From 91016dd53c2b478e0846829a5efdd6491c96a8a8 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 27 Apr 2024 07:06:39 -0400 Subject: [PATCH] Cleanup in bane handling --- .../handlers/ObjectActionMsgHandler.java | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/engine/net/client/handlers/ObjectActionMsgHandler.java b/src/engine/net/client/handlers/ObjectActionMsgHandler.java index 21c5ff0d..de82fb79 100644 --- a/src/engine/net/client/handlers/ObjectActionMsgHandler.java +++ b/src/engine/net/client/handlers/ObjectActionMsgHandler.java @@ -185,42 +185,42 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler { case BUCKET: //water bucket case POTION: //potions, tears of saedron - case SCROLL: //runes, petition, warrant, scrolls if (uuid > 680069 && uuid < 680074) //Handle Charter, Deed, Petition, Warrant here - { break; - } else if (uuid > 910010 && uuid < 910019) { - int rank = uuid - 910010; + if (item.template.item_bane_rank > 0) { - if (rank < 1 || rank > 8) { - ChatManager.chatSystemError(player, "Invalid Rank for bane scroll!"); - return true; - } // Only one banestone at a time + lock.writeLock().lock(); try { - if (Bane.summonBanestone(player, origin, rank) == true) + if (Bane.summonBanestone(player, origin, item.template.item_bane_rank) == true) itemMan.consume(item); } finally { lock.writeLock().unlock(); } break; - } else if (uuid == 910010) { //tears of saedron + } + + if (uuid == 910010) { //tears of saedron if (comps.size() > 1) { AbstractCharacter.removeRune(player, origin, comps.get(1).intValue()); } break; - } else if ((byte) item.chargesRemaining > 0) { + } + + if (item.chargesRemaining > 0) { ArrayList tarList = msg.getTargetCompID(); AbstractWorldObject target = player; + if (tarList.size() > 1) { long tarID = tarList.get(1); + if (tarID != 0) { AbstractGameObject tarAgo = AbstractGameObject.getFromTypeAndID(tarID); - if (tarAgo != null && tarAgo instanceof AbstractWorldObject) { + if (tarAgo instanceof AbstractWorldObject) { target = (AbstractWorldObject) tarAgo; } } @@ -228,8 +228,6 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler { // Bypass for waterbuckets - // test character targeted - if (item.template.item_type.equals(mbEnums.ItemType.BUCKET)) { // test for valid target type