diff --git a/src/engine/gameManager/StrongholdManager.java b/src/engine/gameManager/StrongholdManager.java index 177536e1..83243f35 100644 --- a/src/engine/gameManager/StrongholdManager.java +++ b/src/engine/gameManager/StrongholdManager.java @@ -119,7 +119,7 @@ public class StrongholdManager { commander.stronghold = mine; } - mine.setActive(true); + mine.isActive = true; tower.setProtectionState(Enum.ProtectionState.PROTECTED); tower.getBounds().setRegions(tower); InterestManager.setObjectDirty(tower); @@ -158,7 +158,7 @@ public class StrongholdManager { //update tower to become Mine Tower again tower.setMeshUUID(1500100); - mine.setActive(false); + mine.isActive = false; tower.setProtectionState(Enum.ProtectionState.NPC); tower.getBounds().setRegions(tower); InterestManager.setObjectDirty(tower); diff --git a/src/engine/loot/ItemTableEntry.java b/src/engine/loot/ItemTableEntry.java index 471e32da..c75fb7d7 100644 --- a/src/engine/loot/ItemTableEntry.java +++ b/src/engine/loot/ItemTableEntry.java @@ -37,11 +37,11 @@ public class ItemTableEntry { List itemTableEntryList; itemTableEntryList = LootManager._itemTables.get(itemTable); - - for (ItemTableEntry iteration : itemTableEntryList) - if (roll >= iteration.minRoll && roll <= iteration.maxRoll) - itemTableEntry = iteration; - + if(itemTableEntryList != null) { + for (ItemTableEntry iteration : itemTableEntryList) + if (roll >= iteration.minRoll && roll <= iteration.maxRoll) + itemTableEntry = iteration; + } return itemTableEntry; } diff --git a/src/engine/loot/ModTableEntry.java b/src/engine/loot/ModTableEntry.java index 86697880..6515e5b4 100644 --- a/src/engine/loot/ModTableEntry.java +++ b/src/engine/loot/ModTableEntry.java @@ -33,11 +33,11 @@ public class ModTableEntry { List itemTableEntryList; itemTableEntryList = LootManager._modTables.get(modTablwe); - - for (ModTableEntry iteration : itemTableEntryList) - if (roll >= iteration.minRoll && roll <= iteration.maxRoll) - modTableEntry = iteration; - + if(itemTableEntryList != null) { + for (ModTableEntry iteration : itemTableEntryList) + if (roll >= iteration.minRoll && roll <= iteration.maxRoll) + modTableEntry = iteration; + } return modTableEntry; } } diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index f64eb7dc..5edba9a2 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -911,12 +911,13 @@ public class MobAI { private static void CheckToSendMobHome(Mob mob) { - if(mob.BehaviourType.equals(Enum.MobBehaviourType.Pet1)){ - if(mob.loc.distanceSquared(mob.getOwner().loc) > 60 * 60) - mob.teleport(mob.getOwner().loc); - return; - } try { + if(mob.BehaviourType.equals(Enum.MobBehaviourType.Pet1)){ + if(mob.loc.distanceSquared(mob.getOwner().loc) > 60 * 60) + mob.teleport(mob.getOwner().loc); + return; + } + if (mob.BehaviourType.isAgressive) { if (mob.isPlayerGuard()) { @@ -1353,21 +1354,24 @@ public class MobAI { return null; } - public static void RecoverHealth(Mob mob){ + public static void RecoverHealth(Mob mob) { //recover health + try { + if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false) + mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis()); - if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false) - mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis()); - - if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000) - if (mob.getHealth() < mob.getHealthMax()) { + if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000) + if (mob.getHealth() < mob.getHealthMax()) { - float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None)) * 0.01f); - mob.setHealth(mob.getHealth() + recoveredHealth); - mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis()); + float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None)) * 0.01f); + mob.setHealth(mob.getHealth() + recoveredHealth); + mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis()); - if (mob.getHealth() > mob.getHealthMax()) - mob.setHealth(mob.getHealthMax()); - } + if (mob.getHealth() > mob.getHealthMax()) + mob.setHealth(mob.getHealthMax()); + } + } catch (Exception e) { + Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: RecoverHealth" + " " + e.getMessage()); + } } } \ No newline at end of file diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index c67038d7..c8a69545 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -1423,8 +1423,9 @@ public class Mob extends AbstractIntelligenceAgent { WorldGrid.RemoveWorldObject(this); this.charItemManager.clearInventory(); - if(this.StrongholdEpic) - StrongholdManager.EndStronghold(this.stronghold); + if(this.StrongholdEpic && this.stronghold != null && this.stronghold.isActive) + this.stronghold.isActive = false; + //StrongholdManager.EndStronghold(this.stronghold); } @Override