Browse Source

Cleanup in bane handling

combat-2
MagicBot 8 months ago
parent
commit
91016dd53c
  1. 26
      src/engine/net/client/handlers/ObjectActionMsgHandler.java

26
src/engine/net/client/handlers/ObjectActionMsgHandler.java

@ -185,42 +185,42 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
case BUCKET: //water bucket case BUCKET: //water bucket
case POTION: //potions, tears of saedron case POTION: //potions, tears of saedron
case SCROLL: //runes, petition, warrant, scrolls case SCROLL: //runes, petition, warrant, scrolls
if (uuid > 680069 && uuid < 680074) //Handle Charter, Deed, Petition, Warrant here if (uuid > 680069 && uuid < 680074) //Handle Charter, Deed, Petition, Warrant here
{
break; 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 // Only one banestone at a time
lock.writeLock().lock(); lock.writeLock().lock();
try { try {
if (Bane.summonBanestone(player, origin, rank) == true) if (Bane.summonBanestone(player, origin, item.template.item_bane_rank) == true)
itemMan.consume(item); itemMan.consume(item);
} finally { } finally {
lock.writeLock().unlock(); lock.writeLock().unlock();
} }
break; break;
} else if (uuid == 910010) { //tears of saedron }
if (uuid == 910010) { //tears of saedron
if (comps.size() > 1) { if (comps.size() > 1) {
AbstractCharacter.removeRune(player, origin, comps.get(1).intValue()); AbstractCharacter.removeRune(player, origin, comps.get(1).intValue());
} }
break; break;
} else if ((byte) item.chargesRemaining > 0) { }
if (item.chargesRemaining > 0) {
ArrayList<Long> tarList = msg.getTargetCompID(); ArrayList<Long> tarList = msg.getTargetCompID();
AbstractWorldObject target = player; AbstractWorldObject target = player;
if (tarList.size() > 1) { if (tarList.size() > 1) {
long tarID = tarList.get(1); long tarID = tarList.get(1);
if (tarID != 0) { if (tarID != 0) {
AbstractGameObject tarAgo = AbstractGameObject.getFromTypeAndID(tarID); AbstractGameObject tarAgo = AbstractGameObject.getFromTypeAndID(tarID);
if (tarAgo != null && tarAgo instanceof AbstractWorldObject) { if (tarAgo instanceof AbstractWorldObject) {
target = (AbstractWorldObject) tarAgo; target = (AbstractWorldObject) tarAgo;
} }
} }
@ -228,8 +228,6 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
// Bypass for waterbuckets // Bypass for waterbuckets
// test character targeted
if (item.template.item_type.equals(mbEnums.ItemType.BUCKET)) { if (item.template.item_type.equals(mbEnums.ItemType.BUCKET)) {
// test for valid target type // test for valid target type

Loading…
Cancel
Save