mirror of
https://gitlab.com/2009scape/tools/rs09-thanos-tool.git
synced 2026-08-01 14:39:20 -06:00
Thanos can now modify shop item restock times
This commit is contained in:
parent
341059da8b
commit
3d76b929fa
3 changed files with 8 additions and 6 deletions
|
|
@ -202,7 +202,7 @@ enum class Editors(val data: EditorData) {
|
|||
sh.put("title",shop.title)
|
||||
val stockBuilder = StringBuilder()
|
||||
for(item in shop.stock){
|
||||
stockBuilder.append("{${item.id},${if(item.infinite) "inf" else item.amount}}${if(shop.stock.isLast(item)) "" else "-"}")
|
||||
stockBuilder.append("{${item.id},${if(item.infinite) "inf" else item.amount},${item.restockTime}}${if(shop.stock.isLast(item)) "" else "-"}")
|
||||
}
|
||||
sh.put("stock",stockBuilder.toString())
|
||||
sh.put("npcs",shop.npcs)
|
||||
|
|
@ -240,7 +240,7 @@ fun parseStock(stock: String): ArrayList<Item>{
|
|||
stock.split('-').map {
|
||||
val tokens = it.replace("{", "").replace("}", "").split(",".toRegex()).toTypedArray()
|
||||
var amount = tokens[1].trim()
|
||||
items.add(Item(tokens[0].trim().toInt(),amount,amount == "inf"))
|
||||
items.add(Item(tokens[0].trim().toInt(),amount,amount == "inf", tokens.getOrNull(2)?.toIntOrNull() ?: 100))
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ object FileLoader{
|
|||
}
|
||||
}
|
||||
|
||||
class Item(var id: Int,var amount: String,var infinite: Boolean)
|
||||
class Item(var id: Int, var amount: String, var infinite: Boolean, var restockTime: Int = 100)
|
||||
class WeightedItem(var id: Int, var minAmt: String, var maxAmt: String, var weight: Double, var isAlways: Boolean)
|
||||
|
||||
private val CHARMS = intArrayOf(12160,12163,12159,12158)
|
||||
|
|
|
|||
|
|
@ -90,8 +90,8 @@ class ShopEdit(val shopID: Int) : JFrame("Edit Shop") {
|
|||
val addButton = JButton("Add Item")
|
||||
addButton.addActionListener {
|
||||
ItemMenu.caller = {id,name ->
|
||||
model.addRow(arrayOf(name,id,0,false))
|
||||
shop!!.stock.add(Item(id,"0",false))
|
||||
model.addRow(arrayOf(name,id,0,false,100))
|
||||
shop!!.stock.add(Item(id,"0",false, 100))
|
||||
}
|
||||
ItemMenu.open()
|
||||
}
|
||||
|
|
@ -131,6 +131,7 @@ class ShopEdit(val shopID: Int) : JFrame("Edit Shop") {
|
|||
1 -> TableData.shops[shopID]!!.stock[editingRow].id = newValue.toInt()
|
||||
2 -> TableData.shops[shopID]!!.stock[editingRow].amount = newValue
|
||||
3 -> TableData.shops[shopID]!!.stock[editingRow].infinite = newValue.toBoolean()
|
||||
4 -> TableData.shops[shopID]!!.stock[editingRow].restockTime = newValue.toInt()
|
||||
}
|
||||
super.editingStopped(e)
|
||||
}
|
||||
|
|
@ -153,6 +154,7 @@ class ShopEdit(val shopID: Int) : JFrame("Edit Shop") {
|
|||
model.addColumn("ID")
|
||||
model.addColumn("Amount")
|
||||
model.addColumn("Infinite?")
|
||||
model.addColumn("Restock Ticks")
|
||||
|
||||
val scrollPane = JScrollPane(itemTable)
|
||||
add(scrollPane,BorderLayout.SOUTH)
|
||||
|
|
@ -163,7 +165,7 @@ class ShopEdit(val shopID: Int) : JFrame("Edit Shop") {
|
|||
|
||||
fun open(){
|
||||
for(item in shop?.stock ?: ArrayList()){
|
||||
model.addRow(arrayOf(TableData.itemNames[item.id] ?: "unknown",item.id,item.amount,item.infinite))
|
||||
model.addRow(arrayOf(TableData.itemNames[item.id] ?: "unknown",item.id,item.amount,item.infinite, item.restockTime))
|
||||
}
|
||||
isVisible = true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue