|
|
@ -37,41 +37,15 @@ public class MoveToPointHandler extends AbstractClientMsgHandler { |
|
|
|
Enum.GameObjectType targetType; |
|
|
|
Enum.GameObjectType targetType; |
|
|
|
|
|
|
|
|
|
|
|
targetType = Enum.GameObjectType.values()[msg.getTargetType()]; |
|
|
|
targetType = Enum.GameObjectType.values()[msg.getTargetType()]; |
|
|
|
|
|
|
|
|
|
|
|
switch(targetType){ |
|
|
|
switch(targetType){ |
|
|
|
case Building: |
|
|
|
case Building: |
|
|
|
target = BuildingManager.getBuilding(msg.getTargetID()); |
|
|
|
int i = 1; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case NPC: |
|
|
|
case NPC: |
|
|
|
target = NPC.getNPC(msg.getTargetID()); |
|
|
|
int j = 1; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(target != null) { |
|
|
|
|
|
|
|
switch (target.getObjectType()) { |
|
|
|
|
|
|
|
case Building: |
|
|
|
|
|
|
|
target = BuildingManager.getBuilding(msg.getTargetID()); |
|
|
|
|
|
|
|
if (target == null) { |
|
|
|
|
|
|
|
pc.teleport(pc.loc); |
|
|
|
|
|
|
|
msg.setEndCoord(pc.loc); |
|
|
|
|
|
|
|
origin.sendMsg(msg); |
|
|
|
|
|
|
|
return true;// early exit for no building pulled
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Building targetBuilding = (Building) target; |
|
|
|
|
|
|
|
if (!targetBuilding.isVulnerable() || targetBuilding.getRank() < 0) { |
|
|
|
|
|
|
|
pc.teleport(pc.loc); |
|
|
|
|
|
|
|
msg.setEndCoord(pc.loc); |
|
|
|
|
|
|
|
origin.sendMsg(msg); |
|
|
|
|
|
|
|
return true;// cannot attack destroyed building or protected building
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case NPC: |
|
|
|
|
|
|
|
pc.teleport(pc.loc); |
|
|
|
|
|
|
|
msg.setEndCoord(pc.loc); |
|
|
|
|
|
|
|
origin.sendMsg(msg); |
|
|
|
|
|
|
|
return true;//cannot attack anything other than the 3 above
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
MovementManager.movement(msg, pc); |
|
|
|
MovementManager.movement(msg, pc); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|