From fc35807cf0c7ad96adfe4bd7d02f2ea6380468ff Mon Sep 17 00:00:00 2001 From: ceikry Date: Mon, 2 Aug 2021 07:44:29 -0500 Subject: [PATCH] Fixed a warrior's guild dupe --- Server/data/configs/item_configs.json | 2 +- .../wguild/catapult/CatapultRoom.java | 2 +- .../activity/wguild/WGuildListeners.kt | 42 +++++++++++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 Server/src/main/kotlin/rs09/game/content/activity/wguild/WGuildListeners.kt diff --git a/Server/data/configs/item_configs.json b/Server/data/configs/item_configs.json index b8cd15e3d..62d72fee2 100644 --- a/Server/data/configs/item_configs.json +++ b/Server/data/configs/item_configs.json @@ -80754,7 +80754,7 @@ "name": "Defensive shield", "weight": "3.6", "archery_ticket_price": "0", - "two_handed": "true", + "two_handed": "false", "id": "8856", "bonuses": "0,0,0,-6,-2,8,9,7,0,8,0,0,0,0,0", "equipment_slot": "5" diff --git a/Server/src/main/java/core/game/content/activity/wguild/catapult/CatapultRoom.java b/Server/src/main/java/core/game/content/activity/wguild/catapult/CatapultRoom.java index f2633d42b..47b4ae155 100644 --- a/Server/src/main/java/core/game/content/activity/wguild/catapult/CatapultRoom.java +++ b/Server/src/main/java/core/game/content/activity/wguild/catapult/CatapultRoom.java @@ -44,7 +44,7 @@ public final class CatapultRoom extends MapZone implements Plugin { /** * The target location. */ - private static final Location TARGET = Location.create(2842, 3545, 1); + public static final Location TARGET = Location.create(2842, 3545, 1); /** * The shield item id. diff --git a/Server/src/main/kotlin/rs09/game/content/activity/wguild/WGuildListeners.kt b/Server/src/main/kotlin/rs09/game/content/activity/wguild/WGuildListeners.kt new file mode 100644 index 000000000..fafd7ce09 --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/content/activity/wguild/WGuildListeners.kt @@ -0,0 +1,42 @@ +package rs09.game.content.activity.wguild + +import core.game.component.Component +import core.game.container.impl.EquipmentContainer +import core.game.content.activity.wguild.catapult.CatapultRoom +import core.game.node.item.Item +import org.rs09.consts.Items +import rs09.game.interaction.InteractionListener + +class WGuildListeners : InteractionListener() { + override fun defineListeners() { + onEquip(Items.DEFENSIVE_SHIELD_8856){player, node -> + if (node is Item) { + if (player.location != CatapultRoom.TARGET) { + player.packetDispatch.sendMessage("You may not equip this shield outside the target area in the Warrior's Guild.") + return@onEquip false + } + if (player.equipment[EquipmentContainer.SLOT_WEAPON] != null) { + player.dialogueInterpreter.sendDialogue( + "You will need to make sure your sword hand is free to equip this", + "shield." + ) + return@onEquip false + } + + player.interfaceManager.hideTabs(2, 3, 5, 6, 7, 11, 12) + player.interfaceManager.openTab(4, Component(411)) + player.interfaceManager.setViewedTab(4) + player.interfaceManager.open(Component(410)) + return@onEquip true + } + + return@onEquip false + } + + onUnequip(Items.DEFENSIVE_SHIELD_8856){player, _ -> + player.interfaceManager.restoreTabs() + player.interfaceManager.openTab(4, Component(387)) + return@onUnequip true + } + } +} \ No newline at end of file