Implemented Falador cannonball bot that contributes stock to the GE

This commit is contained in:
Avi Weinstock
2023-06-02 02:15:13 +00:00
committed by Ryan
parent 9a25c2a87d
commit a313c227d5
6 changed files with 367 additions and 17 deletions
+15 -1
View File
@@ -359,10 +359,24 @@ class GrandExchange : StartupListener, Commands {
return offers
}
fun getBotstockForId(itemId: Int): Int {
var total = 0
GEDB.run { conn ->
val stmt = conn.prepareStatement("SELECT sum(amount) FROM bot_offers WHERE amount > 0 AND item_id = ?")
stmt.setInt(1, itemId)
val results = stmt.executeQuery()
while (results.next()) {
total += results.getInt(1)
}
}
return total
}
}
override fun startup(){
GEDB.init()
boot()
}
}
}