|  |  | @ -16,13 +16,13 @@ import java.util.concurrent.ThreadLocalRandom; | 
			
		
	
		
		
			
				
					
					|  |  |  | public class PlayerGuardHandler { |  |  |  | public class PlayerGuardHandler { | 
			
		
	
		
		
			
				
					
					|  |  |  |     public static void run(Mob guard) { |  |  |  |     public static void run(Mob guard) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         try { |  |  |  |         try { | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (guard.combatTarget != null) { |  |  |  |             if (guard.combatTarget != null) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 checkToDropGuardAggro(guard); |  |  |  |                 checkToDropGuardAggro(guard); | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (guard.combatTarget == null) |  |  |  |             if (guard.combatTarget == null) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 CheckForPlayerGuardAggro(guard); |  |  |  |                 CheckForPlayerGuardAggro(guard); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if(MovementUtilities.canMove(guard)) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 CheckGuardMovement(guard); |  |  |  |                 CheckGuardMovement(guard); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (guard.combatTarget != null && CombatUtilities.inRangeToAttack(guard, guard.combatTarget)) |  |  |  |             if (guard.combatTarget != null && CombatUtilities.inRangeToAttack(guard, guard.combatTarget)) | 
			
		
	
	
		
		
			
				
					|  |  | @ -47,14 +47,14 @@ public class PlayerGuardHandler { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 continue; |  |  |  |                 continue; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             if(tar == null || guard.loc.distanceSquared(tar.loc) < guard.loc.distanceSquared(target.loc)) |  |  |  |             if(tar == null || guard.loc.distanceSquared(tar.loc) < guard.loc.distanceSquared(target.loc)) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if(MobCanAggro(guard,target)) |  |  |  |                 if(GuardCanAggro(guard,target)) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     tar = target; |  |  |  |                     tar = target; | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         if(tar != null) |  |  |  |         if(tar != null) | 
			
		
	
		
		
			
				
					
					|  |  |  |             guard.setCombatTarget(tar); |  |  |  |             guard.setCombatTarget(tar); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public static Boolean MobCanAggro(Mob mob, PlayerCharacter loadedPlayer){ |  |  |  |     public static Boolean GuardCanAggro(Mob guard, PlayerCharacter loadedPlayer){ | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         if (loadedPlayer == null) |  |  |  |         if (loadedPlayer == null) | 
			
		
	
		
		
			
				
					
					|  |  |  |             return false; |  |  |  |             return false; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -63,16 +63,16 @@ public class PlayerGuardHandler { | 
			
		
	
		
		
			
				
					
					|  |  |  |             return false; |  |  |  |             return false; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         //Can't see target, skip aggro.
 |  |  |  |         //Can't see target, skip aggro.
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (!mob.canSee(loadedPlayer)) |  |  |  |         if (!guard.canSee(loadedPlayer)) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             return false; |  |  |  |             return false; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         if(mob.guardedCity != null && mob.guardedCity.cityOutlaws.contains(loadedPlayer.getObjectUUID())) |  |  |  |         if(guard.guardedCity != null && guard.guardedCity.cityOutlaws.contains(loadedPlayer.getObjectUUID())) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             return true; |  |  |  |             return true; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         if(loadedPlayer.guild.getNation().equals(mob.guardedCity.getGuild().getNation())) |  |  |  |         if(loadedPlayer.guild.getNation().equals(guard.guardedCity.getGuild().getNation())) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             return false; |  |  |  |             return false; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         return !mob.guardedCity.isOpen(); |  |  |  |         return !guard.guardedCity.isOpen(); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public static boolean GuardCast(Mob mob) { |  |  |  |     public static boolean GuardCast(Mob mob) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -192,60 +192,60 @@ public class PlayerGuardHandler { | 
			
		
	
		
		
			
				
					
					|  |  |  |         return false; |  |  |  |         return false; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public static void CheckToAttack(Mob mob){ |  |  |  |     public static void CheckToAttack(Mob guard){ | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         try { |  |  |  |         try { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             if(mob.getLastAttackTime() > System.currentTimeMillis()) |  |  |  |             if(guard.getLastAttackTime() > System.currentTimeMillis()) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 return; |  |  |  |                 return; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             PlayerCharacter target = (PlayerCharacter) mob.combatTarget; |  |  |  |             PlayerCharacter target = (PlayerCharacter) guard.combatTarget; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (!mob.canSee(target)) { |  |  |  |             if (!guard.canSee(target)) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 mob.setCombatTarget(null); |  |  |  |                 guard.setCombatTarget(null); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 return; |  |  |  |                 return; | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (mob.isMoving() && mob.getRange() > 20) |  |  |  |             if (guard.isMoving() && guard.getRange() > 20) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 return; |  |  |  |                 return; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             if(target.combatStats == null) |  |  |  |             if(target.combatStats == null) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 target.combatStats = new PlayerCombatStats(target); |  |  |  |                 target.combatStats = new PlayerCombatStats(target); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             ItemBase mainHand = mob.getWeaponItemBase(true); |  |  |  |             ItemBase mainHand = guard.getWeaponItemBase(true); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             ItemBase offHand = mob.getWeaponItemBase(false); |  |  |  |             ItemBase offHand = guard.getWeaponItemBase(false); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (mainHand == null && offHand == null) { |  |  |  |             if (mainHand == null && offHand == null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 CombatUtilities.combatCycle(mob, target, true, null); |  |  |  |                 CombatUtilities.combatCycle(guard, target, true, null); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 int delay = 3000; |  |  |  |                 int delay = 3000; | 
			
		
	
		
		
			
				
					
					|  |  |  |                 mob.setLastAttackTime(System.currentTimeMillis() + delay); |  |  |  |                 guard.setLastAttackTime(System.currentTimeMillis() + delay); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             } else if (mob.getWeaponItemBase(true) != null) { |  |  |  |             } else if (guard.getWeaponItemBase(true) != null) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 int delay = 3000; |  |  |  |                 int delay = 3000; | 
			
		
	
		
		
			
				
					
					|  |  |  |                 CombatUtilities.combatCycle(mob, target, true, mob.getWeaponItemBase(true)); |  |  |  |                 CombatUtilities.combatCycle(guard, target, true, guard.getWeaponItemBase(true)); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 mob.setLastAttackTime(System.currentTimeMillis() + delay); |  |  |  |                 guard.setLastAttackTime(System.currentTimeMillis() + delay); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             } else if (mob.getWeaponItemBase(false) != null) { |  |  |  |             } else if (guard.getWeaponItemBase(false) != null) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 int attackDelay = 3000; |  |  |  |                 int attackDelay = 3000; | 
			
		
	
		
		
			
				
					
					|  |  |  |                 CombatUtilities.combatCycle(mob, target, false, mob.getWeaponItemBase(false)); |  |  |  |                 CombatUtilities.combatCycle(guard, target, false, guard.getWeaponItemBase(false)); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 mob.setLastAttackTime(System.currentTimeMillis() + attackDelay); |  |  |  |                 guard.setLastAttackTime(System.currentTimeMillis() + attackDelay); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (target.getPet() != null) |  |  |  |             if (target.getPet() != null) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (target.getPet().getCombatTarget() == null && target.getPet().assist) |  |  |  |                 if (target.getPet().getCombatTarget() == null && target.getPet().assist) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     target.getPet().setCombatTarget(mob); |  |  |  |                     target.getPet().setCombatTarget(guard); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         } catch (Exception e) { |  |  |  |         } catch (Exception e) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             ////(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackPlayer" + " " + e.getMessage());
 |  |  |  |             ////(guard.getObjectUUID() + " " + guard.getName() + " Failed At: AttackPlayer" + " " + e.getMessage());
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public static void CheckGuardMovement(Mob mob){ |  |  |  |     public static void CheckGuardMovement(Mob guard){ | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         if (mob.getCombatTarget() == null) { |  |  |  |         if (guard.getCombatTarget() == null) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             if (!mob.isMoving()) |  |  |  |             if (!guard.isMoving()) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 Patrol(mob); |  |  |  |                 Patrol(guard); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             else { |  |  |  |             else { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 mob.stopPatrolTime = System.currentTimeMillis(); |  |  |  |                 guard.stopPatrolTime = System.currentTimeMillis(); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else { |  |  |  |         } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |             MovementUtilities.moveToLocation(mob, mob.combatTarget.loc, mob.getRange()); |  |  |  |             MovementUtilities.moveToLocation(guard, guard.combatTarget.loc, guard.getRange()); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | 
 |