diff --git a/src/engine/Enum.java b/src/engine/Enum.java index 68af5572..9206213e 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -2824,6 +2824,7 @@ public class Enum { None(null, false, false, false, false, false), GuardCaptain(null, false, true, true, true, false), GuardMinion(GuardCaptain, false, true, true, false, true), + GuardWallArcher(null, false, true, false, false, false), Wanderer(null, false, false, false, false, false), HamletGuard(null, false, false, false, false, false), AggroWanderer(null, false, false, false, false, false); diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java index 3436d5d9..4a61faa5 100644 --- a/src/engine/ai/MobileFSM.java +++ b/src/engine/ai/MobileFSM.java @@ -502,7 +502,17 @@ public class MobileFSM { } if(mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()){ //this is a player slotted guard minion - if(mob.isAlive() == false || mob.despawned){ + if(mob.despawned){ + if(System.currentTimeMillis() > mob.deathTime + (mob.spawnTime * 1000)){ + if(mob.getEquipmentSetID() != ((Mob)mob.npcOwner).getEquipmentSetID()){ + mob.equipmentSetID = ((Mob)mob.npcOwner).getEquipmentSetID(); + mob.runAfterLoad(); + } + mob.respawn(); + } + return; + } + if(mob.isAlive() == false){ CheckForRespawn(mob); return; } @@ -663,11 +673,16 @@ public class MobileFSM { mobAttack(mob); } private static void CheckToSendMobHome(Mob mob) { - if(mob.isPlayerGuard() && ZoneManager.getCityAtLocation(mob.getLoc()).equals(mob.getGuild().getOwnedCity()) == false){ + + + if(mob.isPlayerGuard()){ + City current = ZoneManager.getCityAtLocation(mob.getLoc()); + if(current == null || current.equals(mob.getGuild().getOwnedCity()) == false) { PowersBase recall = PowersManager.getPowerByToken(-1994153779); PowersManager.useMobPower(mob, mob, recall, 40); mob.setAggroTargetID(0); mob.setCombatTarget(null); + } } if (mob.getLoc().distanceSquared2D(mob.getBindLoc()) > sqr(2000)) { PowersBase recall = PowersManager.getPowerByToken(-1994153779); diff --git a/src/engine/gameManager/BuildingManager.java b/src/engine/gameManager/BuildingManager.java index 9d51282f..25bf31b8 100644 --- a/src/engine/gameManager/BuildingManager.java +++ b/src/engine/gameManager/BuildingManager.java @@ -481,6 +481,19 @@ public enum BuildingManager { mob.setParentZone(zone); return true; } + if (NPC.ISWallArcher(contractID.getContractID())) { + + mob = Mob.createMob( contractID.getMobbaseID(), NpcLoc, contractOwner.getGuild(), true, zone, building, contractID.getContractID()); + + if (mob == null) + return false; + + mob.setRank(rank); + mob.setPlayerGuard(true); + mob.setParentZone(zone); + mob.BehaviourType = Enum.MobBehaviourType.GuardWallArcher; + return true; + } npc = NPC.createNPC( pirateName, contractID.getObjectUUID(), NpcLoc, contractOwner.getGuild(), false, zone, (short) rank, false, building); if (npc == null) diff --git a/src/engine/gameManager/NPCManager.java b/src/engine/gameManager/NPCManager.java index 5810417b..5832d648 100644 --- a/src/engine/gameManager/NPCManager.java +++ b/src/engine/gameManager/NPCManager.java @@ -319,8 +319,11 @@ public enum NPCManager { slot += guardCaptain.siegeMinionMap.size() + 1; guardCaptain.siegeMinionMap.put(mob, slot); - mob.setInBuildingLoc(guardCaptain.building, guardCaptain); - mob.setBindLoc(loc.add(mob.inBuildingLoc)); + //mob.setInBuildingLoc(guardCaptain.building, guardCaptain); + //mob.setBindLoc(loc.add(mob.inBuildingLoc)); + mob.setLoc(guardCaptain.building.getLoc()); + mob.setLastRegion(AbstractWorldObject.GetRegionByWorldObject(mob)); + mob.setBindLoc(guardCaptain.building.getStuckLocation()); mob.deathTime = System.currentTimeMillis(); mob.spawnTime = 900; mob.npcOwner = guardCaptain; diff --git a/src/engine/objects/NPC.java b/src/engine/objects/NPC.java index 46640664..c983bb4e 100644 --- a/src/engine/objects/NPC.java +++ b/src/engine/objects/NPC.java @@ -295,6 +295,25 @@ public class NPC extends AbstractCharacter { } + public static boolean ISWallArcher(int contractID) { + //838, 950, 1051, 1181, 1251, 1351, 1451, 1501, 1526, 1551, 980101, + switch(contractID) { + case 838: + case 950: + case 1051: + case 1181: + case 1251: + case 1351: + case 1451: + case 150: + case 1526: + case 1551: + case 980101: + return true; + } + return false; + } + //This method restarts an upgrade timer when a building is loaded from the database. // Submit upgrade job for this building based upon it's current upgradeDateTime