Added configurable limit for GE bot offers, now set by world.botstock_limit config (defaults to 5000)

This commit is contained in:
Ceikry 2023-06-06 00:19:18 +00:00 committed by Ryan
parent 3d8a6c6e5a
commit c3d48ff36e
3 changed files with 9 additions and 2 deletions

View file

@ -290,5 +290,8 @@ class ServerConstants {
@JvmField
var PLAYER_STOCK_RECIRCULATE = true
@JvmField
var BOTSTOCK_LIMIT = 5000
}
}

View file

@ -11,7 +11,9 @@ import core.net.packet.out.ContainerPacket
import core.net.packet.out.GrandExchangePacket
import core.integrations.discord.Discord
import core.game.world.repository.Repository
import kotlin.math.min
import java.sql.ResultSet
import core.ServerConstants
/**
@ -22,7 +24,6 @@ import java.sql.ResultSet
class GrandExchangeOffer() {
var itemID = 0
var amount = 0
var completedAmount = 0
var offeredValue = 0
var index = 0
@ -37,6 +38,8 @@ class GrandExchangeOffer() {
var isLimitation = 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.
* @return The total value.
@ -49,7 +52,7 @@ class GrandExchangeOffer() {
* @return The amount.
*/
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.

View file

@ -154,6 +154,7 @@ object ServerConfigParser {
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_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()
ServerConstants.LOG_LEVEL = parseEnumEntry<LogLevel>(logLevel) ?: LogLevel.VERBOSE