mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-10 10:20:41 -07:00
Changed GE database uids to account database format
This commit is contained in:
parent
2de2f9607d
commit
0ea1438a33
5 changed files with 13 additions and 16 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue