From ce0dfdabfb507a1860e5fbaab0e403f04a1b2444 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 22 Oct 2023 11:48:15 -0400 Subject: [PATCH 1/8] Zones with zero blend inherit from parent --- src/engine/InterestManagement/Terrain.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/engine/InterestManagement/Terrain.java b/src/engine/InterestManagement/Terrain.java index 4db671ab..6b962fda 100644 --- a/src/engine/InterestManagement/Terrain.java +++ b/src/engine/InterestManagement/Terrain.java @@ -62,11 +62,22 @@ public class Terrain { // the blending area between child and parent terrains when // they are stitched together. - Vector2f major_blend = new Vector2f(this.zone.template.max_blend / this.zone.major_radius, - this.zone.template.min_blend / this.zone.major_radius); + float max_blend = this.zone.template.max_blend; + float min_blend = this.zone.template.min_blend; - Vector2f minor_blend = new Vector2f(this.zone.template.max_blend / this.zone.minor_radius, - this.zone.template.min_blend / this.zone.minor_radius); + // Zones with a zero blend inherit from their parent terrain + + if (this.zone.template.max_blend == 0) { + Zone parentZone = this.getNextZoneWithTerrain(this.zone); + max_blend = parentZone.template.max_blend; + min_blend = parentZone.template.min_blend; + } + + Vector2f major_blend = new Vector2f(max_blend / this.zone.major_radius, + min_blend / this.zone.major_radius); + + Vector2f minor_blend = new Vector2f(max_blend / this.zone.minor_radius, + min_blend / this.zone.minor_radius); if (major_blend.y > 0.4f) blend_ratio.x = major_blend.y; From cc7d74168104cfaf938d09f04ead3639c1e01e8f Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 22 Oct 2023 12:05:06 -0400 Subject: [PATCH 2/8] Modified sequencing --- src/engine/objects/Zone.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/engine/objects/Zone.java b/src/engine/objects/Zone.java index 32fb9c72..37092cee 100644 --- a/src/engine/objects/Zone.java +++ b/src/engine/objects/Zone.java @@ -165,12 +165,16 @@ public class Zone extends AbstractWorldObject { if (ZoneManager.seaFloor == null) ZoneManager.seaFloor = this; + this.setParent(); + this.setBounds(); + if (this.template.terrain_type.equals("NONE")) this.terrain = null; else this.terrain = new Terrain(this); - this.setParent(); + this.global_height = ZoneManager.calculateGlobalZoneHeight(this); + setSeaLevel(); if (this.min_level == 0 && this.parent != null) { this.min_level = this.parent.min_level; @@ -222,9 +226,6 @@ public class Zone extends AbstractWorldObject { this.max_level = this.parent.max_level; } - this.setBounds(); - this.global_height = ZoneManager.calculateGlobalZoneHeight(this); - setSeaLevel(); } private void setSeaLevel() { From c3586a70fd9a7be3050136082a13e70a095a2083 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 22 Oct 2023 12:15:48 -0400 Subject: [PATCH 3/8] Modified sequencing --- src/engine/InterestManagement/Terrain.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/InterestManagement/Terrain.java b/src/engine/InterestManagement/Terrain.java index 6b962fda..feef47bd 100644 --- a/src/engine/InterestManagement/Terrain.java +++ b/src/engine/InterestManagement/Terrain.java @@ -68,7 +68,7 @@ public class Terrain { // Zones with a zero blend inherit from their parent terrain if (this.zone.template.max_blend == 0) { - Zone parentZone = this.getNextZoneWithTerrain(this.zone); + Zone parentZone = this.getNextZoneWithTerrain(this.zone.parent); max_blend = parentZone.template.max_blend; min_blend = parentZone.template.min_blend; } From 7b70b680f038b83078e5f34af08a334077b71465 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 22 Oct 2023 12:29:52 -0400 Subject: [PATCH 4/8] Modified sequencing --- src/engine/devcmd/cmds/GetHeightCmd.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/engine/devcmd/cmds/GetHeightCmd.java b/src/engine/devcmd/cmds/GetHeightCmd.java index 4c48abf8..2683925a 100644 --- a/src/engine/devcmd/cmds/GetHeightCmd.java +++ b/src/engine/devcmd/cmds/GetHeightCmd.java @@ -60,6 +60,8 @@ public class GetHeightCmd extends AbstractDevCmd { this.throwbackInfo(playerCharacter, "Grid : " + "[" + gridSquare.x + "]" + "[" + gridSquare.y + "]"); this.throwbackInfo(playerCharacter, "offset: " + "[" + childZoneOffset.x + "]" + "[" + childZoneOffset.y + "]"); this.throwbackInfo(playerCharacter, "Normalized offset: " + "[" + normalizedOffset.x + "]" + "[" + normalizedOffset.y + "]"); + this.throwbackInfo(playerCharacter, "Heightmap blend Values: max/min" + heightmapZone.template.min_blend + " /" + heightmapZone.template.max_blend); + this.throwbackInfo(playerCharacter, "Parent blend Values: nax/min" + parentZone.template.min_blend + " /" + parentZone.template.max_blend); this.throwbackInfo(playerCharacter, "Blend coefficient: " + heightmapZone.terrain.getTerrainBlendCoefficient(childZoneOffset)); this.throwbackInfo(playerCharacter, "------------"); From 8bd406bcf44c5bd5970c1f55359789a67aedbbb7 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 23 Oct 2023 00:07:48 -0400 Subject: [PATCH 5/8] Mobile implements Delayed interface --- src/engine/db/handlers/dbMobHandler.java | 2 +- src/engine/mobileAI/MobAI.java | 2 +- .../net/client/msg/ManageCityAssetsMsg.java | 4 +- src/engine/net/client/msg/ManageNPCMsg.java | 12 +++--- src/engine/objects/Mob.java | 40 +++++++++++++------ 5 files changed, 38 insertions(+), 22 deletions(-) diff --git a/src/engine/db/handlers/dbMobHandler.java b/src/engine/db/handlers/dbMobHandler.java index ad9e0a70..ae8cb0da 100644 --- a/src/engine/db/handlers/dbMobHandler.java +++ b/src/engine/db/handlers/dbMobHandler.java @@ -42,7 +42,7 @@ public class dbMobHandler extends dbHandlerBase { preparedStatement.setFloat(6, toAdd.bindLoc.z); preparedStatement.setInt(7, 0); preparedStatement.setFloat(8, toAdd.spawnRadius); - preparedStatement.setInt(9, toAdd.spawnTime); + preparedStatement.setInt(9, toAdd.spawnDelay); preparedStatement.setInt(10, toAdd.contractUUID); preparedStatement.setInt(11, toAdd.buildingUUID); preparedStatement.setInt(12, toAdd.level); diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index 22cd65dd..cc5158cd 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -813,7 +813,7 @@ public class MobAI { } } } - } else if (System.currentTimeMillis() > (aiAgent.deathTime + (aiAgent.spawnTime * 1000))) { + } else if (System.currentTimeMillis() > (aiAgent.deathTime + (aiAgent.spawnDelay * 1000))) { if (Zone.respawnQue.contains(aiAgent) == false) { Zone.respawnQue.add(aiAgent); diff --git a/src/engine/net/client/msg/ManageCityAssetsMsg.java b/src/engine/net/client/msg/ManageCityAssetsMsg.java index 9392838e..1c32d841 100644 --- a/src/engine/net/client/msg/ManageCityAssetsMsg.java +++ b/src/engine/net/client/msg/ManageCityAssetsMsg.java @@ -727,9 +727,9 @@ public class ManageCityAssetsMsg extends ClientNetMsg { if (!npcHire.isAlive()) { writer.put((byte) 1); // 1 SHOWs respawning - int respawnRemaining = (int) (((Mob) npcHire).deathTime + ((Mob) npcHire).spawnTime * 1000 - System.currentTimeMillis()) / 1000; + int respawnRemaining = (int) (((Mob) npcHire).deathTime + ((Mob) npcHire).spawnDelay * 1000 - System.currentTimeMillis()) / 1000; writer.putInt(respawnRemaining); // Seconds in respawn remaining. - writer.putInt(((Mob) npcHire).spawnTime); // max seconds for respawn + writer.putInt(((Mob) npcHire).spawnDelay); // max seconds for respawn } else writer.put((byte) 0); diff --git a/src/engine/net/client/msg/ManageNPCMsg.java b/src/engine/net/client/msg/ManageNPCMsg.java index 53797601..b9255b0a 100644 --- a/src/engine/net/client/msg/ManageNPCMsg.java +++ b/src/engine/net/client/msg/ManageNPCMsg.java @@ -364,14 +364,14 @@ public class ManageNPCMsg extends ClientNetMsg { writer.putInt(1); long curTime = System.currentTimeMillis() / 1000; - long upgradeTime = (mob.deathTime + (mob.spawnTime * 1000)) / 1000; + long upgradeTime = (mob.deathTime + (mob.spawnDelay * 1000)) / 1000; long timeLife = upgradeTime - curTime; if (upgradeTime * 1000 > System.currentTimeMillis()) { if (mob.guardCaptain.isAlive()) { writer.put((byte) 0);//shows respawning timer - writer.putInt(mob.spawnTime); - writer.putInt(mob.spawnTime); + writer.putInt(mob.spawnDelay); + writer.putInt(mob.spawnDelay); writer.putInt((int) timeLife); //time remaining for mob that is dead writer.putInt(0); writer.put((byte) 0); @@ -688,14 +688,14 @@ public class ManageNPCMsg extends ClientNetMsg { writer.putInt(1); long curTime = System.currentTimeMillis() / 1000; - long upgradeTime = (mob.deathTime + (mob.spawnTime * 1000)) / 1000; + long upgradeTime = (mob.deathTime + (mob.spawnDelay * 1000)) / 1000; long timeLife = upgradeTime - curTime; if (upgradeTime * 1000 > System.currentTimeMillis()) { if (mob.guardCaptain.isAlive()) { writer.put((byte) 0);//shows respawning timer - writer.putInt(mob.spawnTime); - writer.putInt(mob.spawnTime); + writer.putInt(mob.spawnDelay); + writer.putInt(mob.spawnDelay); writer.putInt((int) timeLife); //time remaining for mob that is dead writer.putInt(0); writer.put((byte) 0); diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 8f7f2b2d..27f7d641 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -26,6 +26,7 @@ import engine.net.DispatchMessage; import engine.net.client.msg.PetMsg; import engine.net.client.msg.PlaceAssetMsg; import engine.server.MBServerStatics; +import org.jetbrains.annotations.NotNull; import org.joda.time.DateTime; import org.pmw.tinylog.Logger; @@ -34,11 +35,14 @@ import java.sql.SQLException; import java.util.EnumSet; import java.util.HashMap; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.Delayed; +import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.ReentrantReadWriteLock; import static engine.net.client.msg.ErrorPopupMsg.sendErrorPopup; +import static java.lang.Math.toIntExact; -public class Mob extends AbstractIntelligenceAgent { +public class Mob extends AbstractIntelligenceAgent implements Delayed { private static int staticID = 0; //mob specific @@ -51,10 +55,11 @@ public class Mob extends AbstractIntelligenceAgent { public boolean despawned = false; public Vector3fImmutable destination = Vector3fImmutable.ZERO; public MobBase mobBase; - public int spawnTime; + public int spawnDelay; public Zone parentZone; public boolean hasLoot = false; public long deathTime = 0; + public long respawnTime = 0; public int equipmentSetID = 0; public int runeSet = 0; public int bootySet = 0; @@ -104,7 +109,7 @@ public class Mob extends AbstractIntelligenceAgent { this.agentType = AIAgentType.MOBILE; this.spawnRadius = rs.getFloat("mob_spawnRadius"); - this.spawnTime = rs.getInt("mob_spawnTime"); + this.spawnDelay = rs.getInt("mob_spawnTime"); statLat = rs.getFloat("mob_spawnX"); statAlt = rs.getFloat("mob_spawnY"); @@ -135,8 +140,8 @@ public class Mob extends AbstractIntelligenceAgent { if (this.upgradeDateTime != null) Mob.submitUpgradeJob(this); - if (this.mobBase != null && this.spawnTime == 0) - this.spawnTime = this.mobBase.getSpawnTime(); + if (this.mobBase != null && this.spawnDelay == 0) + this.spawnDelay = this.mobBase.getSpawnTime(); this.runeSet = rs.getInt("runeSet"); this.bootySet = rs.getInt("bootySet"); @@ -450,7 +455,7 @@ public class Mob extends AbstractIntelligenceAgent { minionMobile.deathTime = System.currentTimeMillis(); minionMobile.guardCaptain = guardCaptain; - minionMobile.spawnTime = (int) (-2.500 * guardCaptain.building.getRank() + 22.5) * 60; + minionMobile.spawnDelay = (int) (-2.500 * guardCaptain.building.getRank() + 22.5) * 60; minionMobile.behaviourType = Enum.MobBehaviourType.GuardMinion; minionMobile.agentType = AIAgentType.GUARDMINION; minionMobile.guardedCity = guardCaptain.guardedCity; @@ -509,7 +514,7 @@ public class Mob extends AbstractIntelligenceAgent { siegeMinion.behaviourType = MobBehaviourType.SiegeEngine; siegeMinion.agentType = AIAgentType.SIEGEENGINE; siegeMinion.bindLoc = Vector3fImmutable.ZERO; - siegeMinion.spawnTime = (60 * 15); + siegeMinion.spawnDelay = (60 * 15); siegeMinion.runAfterLoad(); @@ -650,10 +655,10 @@ public class Mob extends AbstractIntelligenceAgent { } public String getSpawnTimeAsString() { - if (this.spawnTime == 0) + if (this.spawnDelay == 0) return MBServerStatics.DEFAULT_SPAWN_TIME_MS / 1000 + " seconds (Default)"; else - return this.spawnTime + " seconds"; + return this.spawnDelay + " seconds"; } @@ -875,7 +880,7 @@ public class Mob extends AbstractIntelligenceAgent { this.playerAgroMap.clear(); if (this.behaviourType.ordinal() == Enum.MobBehaviourType.GuardMinion.ordinal()) - this.spawnTime = (int) (-2.500 * this.guardCaptain.building.getRank() + 22.5) * 60; + this.spawnDelay = (int) (-2.500 * this.guardCaptain.building.getRank() + 22.5) * 60; if (this.isPet()) { @@ -1547,12 +1552,12 @@ public class Mob extends AbstractIntelligenceAgent { switch (this.behaviourType) { case GuardCaptain: this.agentType = AIAgentType.GUARDCAPTAIN; - this.spawnTime = 600; + this.spawnDelay = 600; this.guardedCity = ZoneManager.getCityAtLocation(this.building.getLoc()); break; case GuardWallArcher: this.agentType = AIAgentType.GUARDWALLARCHER; - this.spawnTime = 450; + this.spawnDelay = 450; this.guardedCity = ZoneManager.getCityAtLocation(this.building.getLoc()); break; } @@ -1883,4 +1888,15 @@ public class Mob extends AbstractIntelligenceAgent { lock.writeLock().unlock(); } } + + @Override + public long getDelay(@NotNull TimeUnit unit) { + long timeRemaining = this.respawnTime - System.currentTimeMillis(); + return unit.convert(timeRemaining, TimeUnit.MILLISECONDS); + } + + @Override + public int compareTo(@NotNull Delayed o) { + return toIntExact(this.respawnTime - ((Mob) o).respawnTime); + } } From ff219ce696366e9d84427fae4027cd76b6587210 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 23 Oct 2023 00:32:59 -0400 Subject: [PATCH 6/8] Respawn thread configured --- src/engine/mobileAI/MobAI.java | 7 +- .../mobileAI/Threads/MobRespawnThread.java | 66 ------------------- src/engine/mobileAI/Threads/Respawner.java | 44 +++++++++++++ src/engine/objects/Zone.java | 2 - src/engine/server/world/WorldServer.java | 4 +- 5 files changed, 49 insertions(+), 74 deletions(-) delete mode 100644 src/engine/mobileAI/Threads/MobRespawnThread.java create mode 100644 src/engine/mobileAI/Threads/Respawner.java diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index cc5158cd..169a7157 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -15,6 +15,7 @@ import engine.gameManager.*; import engine.math.Vector3f; import engine.math.Vector3fImmutable; import engine.mobileAI.Threads.MobAIThread; +import engine.mobileAI.Threads.Respawner; import engine.mobileAI.utilities.CombatUtilities; import engine.mobileAI.utilities.MovementUtilities; import engine.net.DispatchMessage; @@ -814,10 +815,8 @@ public class MobAI { } } } else if (System.currentTimeMillis() > (aiAgent.deathTime + (aiAgent.spawnDelay * 1000))) { - - if (Zone.respawnQue.contains(aiAgent) == false) { - Zone.respawnQue.add(aiAgent); - } + aiAgent.respawnTime = aiAgent.deathTime + (aiAgent.spawnDelay * 1000); + Respawner.respawnQueue.put(aiAgent); } } catch (Exception e) { Logger.info(aiAgent.getObjectUUID() + " " + aiAgent.getName() + " Failed At: CheckForRespawn" + " " + e.getMessage()); diff --git a/src/engine/mobileAI/Threads/MobRespawnThread.java b/src/engine/mobileAI/Threads/MobRespawnThread.java deleted file mode 100644 index 24e2f281..00000000 --- a/src/engine/mobileAI/Threads/MobRespawnThread.java +++ /dev/null @@ -1,66 +0,0 @@ -// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . -// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· -// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ -// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ -// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ -// Magicbane Emulator Project © 2013 - 2022 -// www.magicbane.com - - -package engine.mobileAI.Threads; -import engine.gameManager.ZoneManager; -import engine.objects.Mob; -import engine.objects.Zone; -import org.pmw.tinylog.Logger; - -/** - * Thread blocks until MagicBane dispatch messages are - * enqueued then processes them in FIFO order. The collection - * is thread safe. - *

- * Any large messages not time sensitive such as load object - * sent to more than a single individual should be spawned - * individually on a DispatchMessageThread. - */ - -public class MobRespawnThread implements Runnable { - - - public MobRespawnThread() { - Logger.info(" MobRespawnThread thread has started!"); - - } - - @Override - public void run() { - - while (true) { - - try { - for (Zone zone : ZoneManager.getAllZones()) { - - if (zone.respawnQue.isEmpty() == false && zone.lastRespawn + 100 < System.currentTimeMillis()) { - - Mob respawner = zone.respawnQue.iterator().next(); - - if (respawner == null) - continue; - - respawner.respawn(); - zone.respawnQue.remove(respawner); - zone.lastRespawn = System.currentTimeMillis(); - } - } - } catch (Exception e) { - Logger.error(e); - } - - } - } - public static void startRespawnThread() { - Thread respawnThread; - respawnThread = new Thread(new MobRespawnThread()); - respawnThread.setName("respawnThread"); - respawnThread.start(); - } -} diff --git a/src/engine/mobileAI/Threads/Respawner.java b/src/engine/mobileAI/Threads/Respawner.java new file mode 100644 index 00000000..1da3778a --- /dev/null +++ b/src/engine/mobileAI/Threads/Respawner.java @@ -0,0 +1,44 @@ +// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . +// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· +// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ +// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ +// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ +// Magicbane Emulator Project © 2013 - 2022 +// www.magicbane.com + + +package engine.mobileAI.Threads; +import engine.objects.Mob; +import org.pmw.tinylog.Logger; + +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.DelayQueue; + +public enum Respawner implements Runnable { + Respawner; + + public static BlockingQueue respawnQueue = new DelayQueue(); + + @Override + public void run() { + + while (true) { + + try { + Mob mobile = respawnQueue.take(); + mobile.respawn(); + } catch (InterruptedException e) { + Logger.error(e.toString()); + } + + } + + } + + public static void startRespawnThread() { + Thread respawnThread; + respawnThread = new Thread(Respawner); + respawnThread.setName("respawnThread"); + respawnThread.start(); + } +} diff --git a/src/engine/objects/Zone.java b/src/engine/objects/Zone.java index 37092cee..229d18ef 100644 --- a/src/engine/objects/Zone.java +++ b/src/engine/objects/Zone.java @@ -29,8 +29,6 @@ import java.util.concurrent.ConcurrentHashMap; public class Zone extends AbstractWorldObject { - public static final Set respawnQue = Collections.newSetFromMap(new ConcurrentHashMap<>()); - public static long lastRespawn = 0; public final Set zoneBuildingSet = Collections.newSetFromMap(new ConcurrentHashMap<>()); public final Set zoneNPCSet = Collections.newSetFromMap(new ConcurrentHashMap<>()); public final Set zoneMobSet = Collections.newSetFromMap(new ConcurrentHashMap<>()); diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index 627d495b..f1cb0d0c 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -23,7 +23,7 @@ import engine.job.JobContainer; import engine.job.JobScheduler; import engine.jobs.LogoutCharacterJob; import engine.mobileAI.Threads.MobAIThread; -import engine.mobileAI.Threads.MobRespawnThread; +import engine.mobileAI.Threads.Respawner; import engine.net.Dispatch; import engine.net.DispatchMessage; import engine.net.ItemProductionManager; @@ -486,7 +486,7 @@ public class WorldServer { //intiate mob respawn thread Logger.info("Starting Mob Respawn Thread"); - MobRespawnThread.startRespawnThread(); + Respawner.startRespawnThread(); // Run maintenance From 065a1c9cebc72f242976357833c0502ab16306b7 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 23 Oct 2023 00:39:12 -0400 Subject: [PATCH 7/8] Cleanup work. --- src/engine/mobileAI/Threads/Respawner.java | 8 +++----- src/engine/server/world/WorldServer.java | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/engine/mobileAI/Threads/Respawner.java b/src/engine/mobileAI/Threads/Respawner.java index 1da3778a..9aaa477f 100644 --- a/src/engine/mobileAI/Threads/Respawner.java +++ b/src/engine/mobileAI/Threads/Respawner.java @@ -15,8 +15,7 @@ import java.util.concurrent.BlockingQueue; import java.util.concurrent.DelayQueue; public enum Respawner implements Runnable { - Respawner; - + RESPAWNER; public static BlockingQueue respawnQueue = new DelayQueue(); @Override @@ -32,12 +31,11 @@ public enum Respawner implements Runnable { } } - } - public static void startRespawnThread() { + public static void start() { Thread respawnThread; - respawnThread = new Thread(Respawner); + respawnThread = new Thread(RESPAWNER); respawnThread.setName("respawnThread"); respawnThread.start(); } diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index f1cb0d0c..39de164a 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -486,7 +486,7 @@ public class WorldServer { //intiate mob respawn thread Logger.info("Starting Mob Respawn Thread"); - Respawner.startRespawnThread(); + Respawner.start(); // Run maintenance From 1aef82f422de802bcd11c5adfb2d36e9b6106627 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 23 Oct 2023 00:43:23 -0400 Subject: [PATCH 8/8] Cleanup work. --- src/engine/gameManager/ZoneManager.java | 8 ++++---- src/engine/objects/Zone.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/engine/gameManager/ZoneManager.java b/src/engine/gameManager/ZoneManager.java index f0bc0a4b..b842b968 100644 --- a/src/engine/gameManager/ZoneManager.java +++ b/src/engine/gameManager/ZoneManager.java @@ -121,8 +121,8 @@ public enum ZoneManager { public static void resetHotZones() { for (Zone zone : ZoneManager.macroZones) - if (zone.hasBeenHotzone) - zone.hasBeenHotzone = false; + if (zone.wasHotzonw) + zone.wasHotzonw = false; } @@ -150,7 +150,7 @@ public enum ZoneManager { ZoneManager.hotZone = zone; ZoneManager.hotZoneCycle = 1; // Used with HOTZONE_DURATION from config. - zone.hasBeenHotzone = true; + zone.wasHotzonw = true; ZoneManager.hotZoneLastUpdate = LocalDateTime.now().withMinute(0).withSecond(0).atZone(ZoneId.systemDefault()).toInstant(); } @@ -242,7 +242,7 @@ public enum ZoneManager { //no duplicate hotZones - if (zone.hasBeenHotzone == true) + if (zone.wasHotzonw == true) return false; // Enforce min level diff --git a/src/engine/objects/Zone.java b/src/engine/objects/Zone.java index 229d18ef..e380a3fd 100644 --- a/src/engine/objects/Zone.java +++ b/src/engine/objects/Zone.java @@ -52,7 +52,7 @@ public class Zone extends AbstractWorldObject { public float absZ = 0.0f; public int min_level; public int max_level; - public boolean hasBeenHotzone = false; + public boolean wasHotzonw = false; public ArrayList nodes = new ArrayList<>(); public int parentZoneID; public Zone parent = null;