From 92015c1a13889712d7061baadf3edbbd5c5f4362 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Mon, 15 May 2023 19:01:43 -0500 Subject: [PATCH 1/5] guards no longer ignore early exit. FSM will not run if no players are online. mobs will use translocate instead of recall power. --- src/engine/ai/MobileFSM.java | 10 ++++------ src/engine/ai/MobileFSMManager.java | 3 ++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java index 7b9ad4e9..69846d01 100644 --- a/src/engine/ai/MobileFSM.java +++ b/src/engine/ai/MobileFSM.java @@ -331,7 +331,7 @@ public class MobileFSM { CheckForRespawn(mob); return; } - if (mob.playerAgroMap.isEmpty() && mob.isPlayerGuard == false) + if (mob.playerAgroMap.isEmpty()) //no players loaded, no need to proceed return; if (mob.isCombat() && mob.getCombatTarget() == null) { @@ -492,21 +492,19 @@ public class MobileFSM { if (mob.isPlayerGuard() && !mob.despawned) { City current = ZoneManager.getCityAtLocation(mob.getLoc()); if (current == null || current.equals(mob.getGuild().getOwnedCity()) == false || mob.playerAgroMap.isEmpty()) { - PowersBase recall = PowersManager.getPowerByToken(-1994153779); - PowersManager.useMobPower(mob, mob, recall, 40); + MovementManager.translocate(mob,mob.getBindLoc(),null); mob.setCombatTarget(null); if(mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal() && mob.isAlive()){ //guard captain pulls his minions home with him for (Entry minion : mob.siegeMinionMap.entrySet()) { - PowersManager.useMobPower(minion.getKey(), minion.getKey(), recall, 40); + MovementManager.translocate(minion.getKey(),mob.getBindLoc(),null); minion.getKey().setCombatTarget(null); } } } } else if(MovementUtilities.inRangeOfBindLocation(mob) == false) { - PowersBase recall = PowersManager.getPowerByToken(-1994153779); - PowersManager.useMobPower(mob, mob, recall, 40); + MovementManager.translocate(mob,mob.getBindLoc(),null); mob.setCombatTarget(null); } } diff --git a/src/engine/ai/MobileFSMManager.java b/src/engine/ai/MobileFSMManager.java index f8b0fd52..3073e877 100644 --- a/src/engine/ai/MobileFSMManager.java +++ b/src/engine/ai/MobileFSMManager.java @@ -8,6 +8,7 @@ package engine.ai; +import engine.gameManager.SessionManager; import engine.gameManager.ZoneManager; import engine.objects.Mob; import engine.objects.Zone; @@ -88,7 +89,7 @@ public class MobileFSMManager { for (Mob mob : zone.zoneMobSet) { try { - if (mob != null) + if (mob != null && SessionManager.getActivePlayerCharacterCount() > 0) MobileFSM.DetermineAction(mob); } catch (Exception e) { Logger.error("Mob: " + mob.getName() + " UUID: " + mob.getObjectUUID() + " ERROR: " + e); From ba0a7d35cb4ef073c4939e4d6f0f810d01a528f9 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 18 May 2023 07:54:04 -0400 Subject: [PATCH 2/5] Error logging added. --- src/engine/db/handlers/dbRunegateHandler.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/engine/db/handlers/dbRunegateHandler.java b/src/engine/db/handlers/dbRunegateHandler.java index 86d1c575..c0cc5b01 100644 --- a/src/engine/db/handlers/dbRunegateHandler.java +++ b/src/engine/db/handlers/dbRunegateHandler.java @@ -13,6 +13,7 @@ import engine.Enum; import engine.gameManager.DbManager; import engine.objects.Building; import engine.objects.Portal; +import org.pmw.tinylog.Logger; import java.sql.ResultSet; import java.sql.SQLException; @@ -62,6 +63,7 @@ public class dbRunegateHandler extends dbHandlerBase { } } catch (SQLException e) { + Logger.error("Exception while loading runegate portals: " + e); } finally { closeCallable(); } From ac42a9cd8fe1ae94c37ea491f47259aa28025296 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 18 May 2023 19:48:37 -0500 Subject: [PATCH 3/5] removed treb override in MobileFSM.DetermineAction --- src/engine/ai/MobileFSM.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java index 69846d01..4b6e99ce 100644 --- a/src/engine/ai/MobileFSM.java +++ b/src/engine/ai/MobileFSM.java @@ -305,11 +305,6 @@ public class MobileFSM { public static void DetermineAction(Mob mob) { if (mob == null) return; - if (mob.despawned && mob.getMobBase().getLoadID() == 13171) { - //trebuchet spawn handler - CheckForRespawn(mob); - return; - } if (mob.despawned && mob.isPlayerGuard) { //override for guards if(mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()){ From 932daa730a7ab3bc0a150dc1d955ee5d6152c365 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 18 May 2023 19:54:54 -0500 Subject: [PATCH 4/5] guards use highbred City._playerMemory.size() and Mob.playerAgroMap to go to sleep --- src/engine/ai/MobileFSM.java | 10 +++++++--- src/engine/objects/City.java | 2 +- src/engine/objects/Mob.java | 2 ++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java index 4b6e99ce..65c1b08c 100644 --- a/src/engine/ai/MobileFSM.java +++ b/src/engine/ai/MobileFSM.java @@ -305,6 +305,13 @@ public class MobileFSM { public static void DetermineAction(Mob mob) { if (mob == null) return; + if (mob.playerAgroMap.isEmpty() && !mob.isPlayerGuard) + //no players loaded, no need to proceed + return; + else{ + if(mob.isPlayerGuard && mob.guardedCity._playerMemory.size() < 1 && mob.playerAgroMap.isEmpty()) + return; + } if (mob.despawned && mob.isPlayerGuard) { //override for guards if(mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()){ @@ -326,9 +333,6 @@ public class MobileFSM { CheckForRespawn(mob); return; } - if (mob.playerAgroMap.isEmpty()) - //no players loaded, no need to proceed - return; if (mob.isCombat() && mob.getCombatTarget() == null) { mob.setCombat(false); UpdateStateMsg rwss = new UpdateStateMsg(); diff --git a/src/engine/objects/City.java b/src/engine/objects/City.java index dbb31856..084ab55d 100644 --- a/src/engine/objects/City.java +++ b/src/engine/objects/City.java @@ -87,7 +87,7 @@ public class City extends AbstractWorldObject { // Players who have entered the city (used for adding and removing affects) - private final HashSet _playerMemory = new HashSet<>(); + public final HashSet _playerMemory = new HashSet<>(); public volatile boolean protectionEnforced = true; private String hash; diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 2106344b..5a62cecd 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -99,6 +99,7 @@ public class Mob extends AbstractIntelligenceAgent { private DeferredPowerJob weaponPower; private DateTime upgradeDateTime = null; private boolean lootSync = false; + public City guardedCity; /** * No Id Constructor @@ -806,6 +807,7 @@ public class Mob extends AbstractIntelligenceAgent { mob.npcOwner = guardCaptain; mob.spawnTime = (int)(-2.500 * guardCaptain.building.getRank() + 22.5) * 60; mob.BehaviourType = Enum.MobBehaviourType.GuardMinion; + mob.guardedCity = guardCaptain.guardedCity; mob.parentZone = parent; parent.zoneMobSet.add(mob); return mob; From 9b5573c2100b08ac39c604215227636e3d2bef02 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 18 May 2023 19:59:39 -0500 Subject: [PATCH 5/5] guards get Mob.guardedCity assigned to --- src/engine/ai/MobileFSM.java | 1 + src/engine/objects/Mob.java | 1 + 2 files changed, 2 insertions(+) diff --git a/src/engine/ai/MobileFSM.java b/src/engine/ai/MobileFSM.java index 65c1b08c..c43cc826 100644 --- a/src/engine/ai/MobileFSM.java +++ b/src/engine/ai/MobileFSM.java @@ -310,6 +310,7 @@ public class MobileFSM { return; else{ if(mob.isPlayerGuard && mob.guardedCity._playerMemory.size() < 1 && mob.playerAgroMap.isEmpty()) + //guards use aggro map and players in their local city zone return; } if (mob.despawned && mob.isPlayerGuard) { diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 5a62cecd..db848361 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -1989,6 +1989,7 @@ public class Mob extends AbstractIntelligenceAgent { else { this.BehaviourType = MobBehaviourType.GuardCaptain; this.spawnTime = 900; + this.guardedCity = ZoneManager.getCityAtLocation(this.bindLoc); } this.deathTime = 0;