diff --git a/Server/libs/ConstLib-1.0.jar b/Server/libs/ConstLib-1.0.jar index 7d06b3eac..ae01341e3 100644 Binary files a/Server/libs/ConstLib-1.0.jar and b/Server/libs/ConstLib-1.0.jar differ diff --git a/Server/src/main/kotlin/rs09/game/content/ame/events/drilldemon/SeargentDamienDialogue.kt b/Server/src/main/kotlin/rs09/game/content/ame/events/drilldemon/SeargentDamienDialogue.kt index 89f5dceda..39b933669 100644 --- a/Server/src/main/kotlin/rs09/game/content/ame/events/drilldemon/SeargentDamienDialogue.kt +++ b/Server/src/main/kotlin/rs09/game/content/ame/events/drilldemon/SeargentDamienDialogue.kt @@ -14,6 +14,7 @@ class SeargentDamienDialogue(val isCorrect: Boolean = false) : DialogueFile() { 0 -> npc(FacialExpression.OLD_NORMAL,"My god you actually did it, you limp","wristed worm-bodied MAGGOT! Take this","and get out of my sight.").also { stage++ } 1 -> { end() + player!!.unlock() DrillDemonUtils.cleanup(player!!) player!!.pulseManager.run(object : Pulse(){ override fun pulse(): Boolean { diff --git a/Server/src/main/kotlin/rs09/game/content/ame/events/supriseexam/SupriseExamListeners.kt b/Server/src/main/kotlin/rs09/game/content/ame/events/supriseexam/SupriseExamListeners.kt index 94e621d0c..5faec7dfe 100644 --- a/Server/src/main/kotlin/rs09/game/content/ame/events/supriseexam/SupriseExamListeners.kt +++ b/Server/src/main/kotlin/rs09/game/content/ame/events/supriseexam/SupriseExamListeners.kt @@ -38,7 +38,7 @@ class SupriseExamListeners : InteractionListener() { return@on true } - on(BOOK_OF_KNOWLEDGE,ITEM,"read"){player, node -> + on(BOOK_OF_KNOWLEDGE,ITEM,"read"){player, _ -> player.setAttribute("caller"){skill: Int,p: Player -> if(p.inventory.remove(Item(BOOK_OF_KNOWLEDGE))) { val level = p.skills.getStaticLevel(skill) diff --git a/Server/src/main/kotlin/rs09/game/interaction/inter/CreditShopInterface.kt b/Server/src/main/kotlin/rs09/game/interaction/inter/CreditShopInterface.kt new file mode 100644 index 000000000..a089eba16 --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/interaction/inter/CreditShopInterface.kt @@ -0,0 +1,79 @@ +package rs09.game.interaction.inter + +import core.game.node.entity.player.Player +import core.game.node.item.Item +import org.rs09.consts.Components +import org.rs09.consts.Items +import rs09.game.interaction.InterfaceListener + +class CreditShopInterface : InterfaceListener() { + + val CREDIT_SHOP = Components.CREDIT_SHOP + val TEXT_CHILD = 39 + + override fun defineListeners() { + on(CREDIT_SHOP){player, component, opcode, buttonID, slot, itemID -> + val item = getItem(buttonID) + + if(opcode == 155){ + player.dialogueInterpreter.sendDialogue("This item costs ${item.price} credits.") + return@on true + } + + if(buttonID == 14 || buttonID == 21){ + val specific = when(opcode){ + 196 -> if(buttonID == 14) Items.RED_PARTYHAT_1038 else Items.RED_HWEEN_MASK_1057 + 124 -> if(buttonID == 14) Items.GREEN_PARTYHAT_1044 else Items.GREEN_HWEEN_MASK_1053 + 199 -> if(buttonID == 14) Items.BLUE_PARTYHAT_2422 else Items.BLUE_HWEEN_MASK_1055 + 234 -> Items.YELLOW_PARTYHAT_1040 + 168 -> Items.PURPLE_PARTYHAT_1046 + 166 -> Items.WHITE_PARTYHAT_1048 + else -> Items.DWARF_WEED_SEED_5303 + } + attemptPurchase(player,specific,item.price) + } else { + attemptPurchase(player,item.id,item.price) + } + return@on true + } + + onOpen(CREDIT_SHOP){player, component -> + sendCredits(player) + return@onOpen true + } + } + + private fun getItem(buttonID: Int): ShopItem{ + return when(buttonID){ + 14 -> ShopItem(Items.BLUE_PARTYHAT_2422,75) + 18 -> ShopItem(Items.SCYTHE_1419,100) + 20 -> ShopItem(Items.JANGLES_THE_MONKEY_14648,200) + 17 -> ShopItem(Items.CHRISTMAS_CRACKER_962,65) + 21 -> ShopItem(Items.BLUE_HWEEN_MASK_1055,65) + 16 -> ShopItem(Items.SANTA_HAT_1050,65) + 19 -> ShopItem(Items.BUNNY_EARS_1037,150) + 15 -> ShopItem(Items.EASTER_RING_7927,100) + else -> ShopItem(0,0) + } + } + + fun sendCredits(player: Player){ + player.packetDispatch.sendString("You have ${player.details.credits} credits to spend.",CREDIT_SHOP,TEXT_CHILD) + } + + fun attemptPurchase(player: Player, item: Int, price: Int){ + if(player.details.credits < price){ + player.dialogueInterpreter.sendDialogue("You don't have enough credits for that.") + return + } + + if(player.inventory.add(Item(item))){ + player.details.credits -= price + } else { + player.dialogueInterpreter.sendDialogue("You don't have enough inventory space for that.") + } + sendCredits(player) + } + + internal class ShopItem(val id: Int, val price: Int) +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/system/command/sets/MiscCommandSet.kt b/Server/src/main/kotlin/rs09/game/system/command/sets/MiscCommandSet.kt index 224ca8a63..b9b1238f7 100644 --- a/Server/src/main/kotlin/rs09/game/system/command/sets/MiscCommandSet.kt +++ b/Server/src/main/kotlin/rs09/game/system/command/sets/MiscCommandSet.kt @@ -132,9 +132,9 @@ class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){ /** * Opens the credit/voting shop */ - /*define("shop", Command.Privilege.STANDARD){ player, _ -> - CreditShop().open(player) - }*/ + define("shop", Command.Privilege.STANDARD){ player, _ -> + player.interfaceManager.open(Component(Components.CREDIT_SHOP)) + } /** * Shows the player a list of currently active GE sell offers @@ -460,5 +460,9 @@ class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){ player.antiMacroHandler.event = RandomEvents.SURPRISE_EXAM.npc.create(player,null,"sexam") player.antiMacroHandler.event!!.init() } + + define("addcredits",Command.Privilege.ADMIN){player,_ -> + player.details.credits += 100 + } } } \ No newline at end of file