Fixed a warrior's guild dupe

This commit is contained in:
ceikry 2021-08-02 07:44:29 -05:00
parent c7acb9c0e7
commit fc35807cf0
3 changed files with 44 additions and 2 deletions

View file

@ -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"

View file

@ -44,7 +44,7 @@ public final class CatapultRoom extends MapZone implements Plugin<Object> {
/**
* 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.

View file

@ -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
}
}
}