Rewrote entire banking system (aside from dialogue), converted to listener system

This commit is contained in:
vddcore
2022-06-23 13:31:17 +00:00
committed by Ryan
parent 40dd58d610
commit b094fe5b0c
32 changed files with 1420 additions and 827 deletions
@@ -0,0 +1,57 @@
package rs09.game.content.dialogue
import api.*
import core.game.content.dialogue.DialoguePlugin
import core.game.node.entity.player.Player
import core.plugin.Initializable
import rs09.tools.START_DIALOGUE
/**
* Represents the dialogue shown when the user presses
* "Deposit Beast of Burden" button on the Bank Interface.
*
* @author vddCore
*/
class BankDepositDialogue : DialogueFile() {
override fun handle(componentID: Int, buttonID: Int) {
when (stage) {
START_DIALOGUE -> options(
"Deposit Inventory",
"Deposit Worn Equipment",
"Deposit Beast of Burden",
"Cancel"
).also { stage++ }
1 -> when (buttonID) {
1 -> player?.let {
end()
if (it.inventory.isEmpty) {
sendMessage(it, "You have nothing in your inventory that you can deposit.")
} else {
dumpContainer(it, it.inventory)
}
}
2 -> player?.let {
end()
if (it.equipment.isEmpty) {
sendMessage(it, "You have no equipment that you can deposit.")
} else {
dumpContainer(it, it.equipment)
}
}
3 -> player?.let {
end()
dumpBeastOfBurden(it)
}
4 -> end()
}
}
}
}