mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-12 17:40:17 -07:00
Added configurable limit for GE bot offers, now set by world.botstock_limit config (defaults to 5000)
This commit is contained in:
parent
3d8a6c6e5a
commit
c3d48ff36e
3 changed files with 9 additions and 2 deletions
|
|
@ -290,5 +290,8 @@ class ServerConstants {
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
var PLAYER_STOCK_RECIRCULATE = true
|
var PLAYER_STOCK_RECIRCULATE = true
|
||||||
|
|
||||||
|
@JvmField
|
||||||
|
var BOTSTOCK_LIMIT = 5000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,9 @@ import core.net.packet.out.ContainerPacket
|
||||||
import core.net.packet.out.GrandExchangePacket
|
import core.net.packet.out.GrandExchangePacket
|
||||||
import core.integrations.discord.Discord
|
import core.integrations.discord.Discord
|
||||||
import core.game.world.repository.Repository
|
import core.game.world.repository.Repository
|
||||||
|
import kotlin.math.min
|
||||||
import java.sql.ResultSet
|
import java.sql.ResultSet
|
||||||
|
import core.ServerConstants
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -22,7 +24,6 @@ import java.sql.ResultSet
|
||||||
|
|
||||||
class GrandExchangeOffer() {
|
class GrandExchangeOffer() {
|
||||||
var itemID = 0
|
var itemID = 0
|
||||||
var amount = 0
|
|
||||||
var completedAmount = 0
|
var completedAmount = 0
|
||||||
var offeredValue = 0
|
var offeredValue = 0
|
||||||
var index = 0
|
var index = 0
|
||||||
|
|
@ -37,6 +38,8 @@ class GrandExchangeOffer() {
|
||||||
var isLimitation = false
|
var isLimitation = false
|
||||||
var isBot = false
|
var isBot = false
|
||||||
|
|
||||||
|
var amount: Int = 0
|
||||||
|
get() = if (isBot) min(field, ServerConstants.BOTSTOCK_LIMIT) else field
|
||||||
/**
|
/**
|
||||||
* Gets the total amount of money entered.
|
* Gets the total amount of money entered.
|
||||||
* @return The total value.
|
* @return The total value.
|
||||||
|
|
@ -49,7 +52,7 @@ class GrandExchangeOffer() {
|
||||||
* @return The amount.
|
* @return The amount.
|
||||||
*/
|
*/
|
||||||
val amountLeft: Int
|
val amountLeft: Int
|
||||||
get() = amount - completedAmount
|
get() = if (isBot) min(ServerConstants.BOTSTOCK_LIMIT, amount - completedAmount) else amount - completedAmount
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if this offer is still active for dispatching.
|
* Checks if this offer is still active for dispatching.
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,7 @@ object ServerConfigParser {
|
||||||
ServerConstants.IRONMAN_ICONS = data.getBoolean("world.ironman_icons", false)
|
ServerConstants.IRONMAN_ICONS = data.getBoolean("world.ironman_icons", false)
|
||||||
ServerConstants.PLAYER_STOCK_CLEAR_INTERVAL = data.getLong("world.playerstock_clear_mins", 180L).toInt()
|
ServerConstants.PLAYER_STOCK_CLEAR_INTERVAL = data.getLong("world.playerstock_clear_mins", 180L).toInt()
|
||||||
ServerConstants.PLAYER_STOCK_RECIRCULATE = data.getBoolean("world.playerstock_bot_offers", true)
|
ServerConstants.PLAYER_STOCK_RECIRCULATE = data.getBoolean("world.playerstock_bot_offers", true)
|
||||||
|
ServerConstants.BOTSTOCK_LIMIT = data.getLong("world.botstock_limit", 5000L).toInt()
|
||||||
|
|
||||||
val logLevel = data.getString("server.log_level", "VERBOSE").uppercase()
|
val logLevel = data.getString("server.log_level", "VERBOSE").uppercase()
|
||||||
ServerConstants.LOG_LEVEL = parseEnumEntry<LogLevel>(logLevel) ?: LogLevel.VERBOSE
|
ServerConstants.LOG_LEVEL = parseEnumEntry<LogLevel>(logLevel) ?: LogLevel.VERBOSE
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue