@ -33,20 +33,48 @@ public class MoveToPointHandler extends AbstractClientMsgHandler {
@@ -33,20 +33,48 @@ public class MoveToPointHandler extends AbstractClientMsgHandler {
if ( pc = = null )
return false ;
AbstractWorldObject target = pc . combatTarget ;
AbstractWorldObject target ;
Enum . GameObjectType targetType ;
targetType = Enum . GameObjectType . values ( ) [ msg . getTargetType ( ) ] ;
switch ( targetType ) {
case Mob :
target = Mob . getMob ( msg . getTargetID ( ) ) ;
break ;
case PlayerCharacter :
target = PlayerCharacter . getPlayerCharacter ( msg . getTargetID ( ) ) ;
break ;
case Building :
target = BuildingManager . getBuilding ( msg . getTargetID ( ) ) ;
break ;
default :
target = null ;
break ;
}
if ( target ! = null ) {
switch ( target . getObjectType ( ) ) {
case Building :
target = BuildingManager . getBuilding ( msg . getTargetID ( ) ) ;
if ( target = = null )
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 )
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
}
}