diff --git a/Server/src/main/kotlin/rs09/game/ai/general/ScriptAPI.kt b/Server/src/main/kotlin/rs09/game/ai/general/ScriptAPI.kt index 9a448795e..c93955d82 100644 --- a/Server/src/main/kotlin/rs09/game/ai/general/ScriptAPI.kt +++ b/Server/src/main/kotlin/rs09/game/ai/general/ScriptAPI.kt @@ -534,7 +534,7 @@ class ScriptAPI(private val bot: Player) { else -> Repository.sendNews(SERVER_GE_NAME + " just offered " + itemAmt + " " + ItemDefinition.forId(actualId).name.toLowerCase() + " on the GE.") } } - bot.bank.remove(item).also { SystemLogger.logAI("$item has been listed on the GE.") } + bot.bank.remove(item) bot.bank.refresh() } return true @@ -739,4 +739,4 @@ class ScriptAPI(private val bot: Player) { player.packetDispatch.sendString(colorize("%B$amount"),195,9) } } -} \ No newline at end of file +} diff --git a/Server/src/main/kotlin/rs09/game/ge/GrandExchange.kt b/Server/src/main/kotlin/rs09/game/ge/GrandExchange.kt index 072395b80..d3d85c4b3 100644 --- a/Server/src/main/kotlin/rs09/game/ge/GrandExchange.kt +++ b/Server/src/main/kotlin/rs09/game/ge/GrandExchange.kt @@ -231,9 +231,9 @@ class GrandExchange : StartupListener, Commands { } if ( player.isArtificial ) - offer.playerUID = PlayerDetails.getDetails("2009scape").usernameHashcode.also { offer.isBot = true } + offer.playerUID = 0.also { offer.isBot = true } else - offer.playerUID = player.details.usernameHashcode + offer.playerUID = player.details.accountInfo.uid offer.offerState = OfferState.REGISTERED //GrandExchangeRecords.getInstance(player).update(offer) @@ -315,10 +315,10 @@ class GrandExchange : StartupListener, Commands { */ seller.update() - val sellerPlayer = Repository.uid_map[seller.playerUID] + val sellerPlayer = Repository.players.firstOrNull { it.details.accountInfo.uid == seller.playerUID } sellerPlayer?.let { GrandExchangeRecords.getInstance(sellerPlayer).visualizeRecords() } buyer.update() - val buyerPlayer = Repository.uid_map[buyer.playerUID] + val buyerPlayer = Repository.players.firstOrNull { it.details.accountInfo.uid == buyer.playerUID } buyerPlayer?.let { GrandExchangeRecords.getInstance(buyerPlayer).visualizeRecords() } } @@ -369,4 +369,4 @@ class GrandExchange : StartupListener, Commands { GEDB.init() boot() } -} \ No newline at end of file +} diff --git a/Server/src/main/kotlin/rs09/game/ge/GrandExchangeOffer.kt b/Server/src/main/kotlin/rs09/game/ge/GrandExchangeOffer.kt index beccb849c..e2740d697 100644 --- a/Server/src/main/kotlin/rs09/game/ge/GrandExchangeOffer.kt +++ b/Server/src/main/kotlin/rs09/game/ge/GrandExchangeOffer.kt @@ -211,9 +211,7 @@ class GrandExchangeOffer() { o.totalCoinExchange = result.getInt("total_coin_xc") o.playerUID = result.getInt("player_uid") o.index = result.getInt("slot_index") - - if(Repository.uid_map[o.playerUID] != null) - o.player = Repository.uid_map[o.playerUID] + o.player = Repository.players.firstOrNull { it.details.accountInfo.uid == o.playerUID } return o } @@ -243,4 +241,4 @@ class GrandExchangeOffer() { return o } } -} \ No newline at end of file +} diff --git a/Server/src/main/kotlin/rs09/game/ge/GrandExchangeRecords.kt b/Server/src/main/kotlin/rs09/game/ge/GrandExchangeRecords.kt index f53f5669b..9046586e8 100644 --- a/Server/src/main/kotlin/rs09/game/ge/GrandExchangeRecords.kt +++ b/Server/src/main/kotlin/rs09/game/ge/GrandExchangeRecords.kt @@ -55,7 +55,7 @@ class GrandExchangeRecords(private val player: Player? = null) : PersistPlayer, GEDB.run { conn -> val stmt = conn.createStatement() - val offer_records = stmt.executeQuery("SELECT * from player_offers where player_uid = ${player.details.usernameHashcode} AND offer_state < 6") + val offer_records = stmt.executeQuery("SELECT * from player_offers where player_uid = ${player.details.accountInfo.uid} AND offer_state < 6") while (offer_records.next()) { val offer = GrandExchangeOffer.fromQuery(offer_records) @@ -101,7 +101,6 @@ class GrandExchangeRecords(private val player: Player? = null) : PersistPlayer, historyEntry["totalCoinExchange"] = it.totalCoinExchange.toString() historyEntry["completedAmount"] = it.completedAmount.toString() history.add(historyEntry) - SystemLogger.logInfo("Adding history entry for ${it.itemID}") } } save["ge-history"] = history @@ -253,4 +252,4 @@ class GrandExchangeRecords(private val player: Player? = null) : PersistPlayer, return player?.getAttribute("ge-records", GrandExchangeRecords()) ?: GrandExchangeRecords() } } -} \ No newline at end of file +} diff --git a/Server/src/test/kotlin/ExchangeTests.kt b/Server/src/test/kotlin/ExchangeTests.kt index bb3e78f75..1930f4d28 100644 --- a/Server/src/test/kotlin/ExchangeTests.kt +++ b/Server/src/test/kotlin/ExchangeTests.kt @@ -25,7 +25,7 @@ import kotlin.random.Random fun generateOffer(itemId: Int, amount: Int, price: Int, sale: Boolean, username: String = "test ${System.currentTimeMillis()}") : GrandExchangeOffer { val offer = GrandExchangeOffer() - val uid = username.hashCode() + val uid = username.hashCode() // normally this would be the account's uid but in the test we don't have an account offer.offerState = OfferState.REGISTERED offer.itemID = itemId offer.offeredValue = price @@ -115,4 +115,4 @@ import kotlin.random.Random Assertions.assertEquals(false, b.isCancelled) } } -} \ No newline at end of file +}