From b2a3eb3e6e9d007912401311b68969833eebafbc Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 10 Mar 2024 16:29:12 -0500 Subject: [PATCH] uniform disc dropper respawns --- src/engine/gameManager/LootManager.java | 3 +++ src/engine/mobileAI/MobAI.java | 4 +++- src/engine/objects/Mob.java | 3 ++- src/engine/server/world/WorldServer.java | 9 +++++++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/engine/gameManager/LootManager.java b/src/engine/gameManager/LootManager.java index 1eb8532f..ce892711 100644 --- a/src/engine/gameManager/LootManager.java +++ b/src/engine/gameManager/LootManager.java @@ -102,6 +102,9 @@ public enum LootManager { DispatchMessage.dispatchMsgToAll(chatMsg); } if (ib.isDiscRune() && mob.level < 60){ + if(Mob.disciplineDroppers.contains(mob) == false){ + Mob.disciplineDroppers.add(mob); + } mob.level = 60; mob.healthMax = 7500; mob.setHealth(7500); diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index 1a26cd0b..f9f2d651 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -846,7 +846,9 @@ public class MobAI { private static void CheckForRespawn(Mob aiAgent) { try { - + if(Mob.disciplineDroppers.contains(aiAgent) == true){ + return; // disc dropper respawns handled elsewhere + } if (aiAgent.deathTime == 0) { aiAgent.setDeathTime(System.currentTimeMillis()); return; diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index f722f7ac..0824f8a1 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -32,6 +32,7 @@ import org.pmw.tinylog.Logger; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.concurrent.ConcurrentHashMap; @@ -42,7 +43,7 @@ import static engine.net.client.msg.ErrorPopupMsg.sendErrorPopup; public class Mob extends AbstractIntelligenceAgent { private static int staticID = 0; - + public static ArrayList disciplineDroppers = new ArrayList<>(); public static HashMap dynamic_pets = new HashMap<>(); //mob specific public final ConcurrentHashMap playerAgroMap = new ConcurrentHashMap<>(); //key = Player value = hate value diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index 0c122b57..1b9990de 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -203,6 +203,7 @@ public class WorldServer { LocalDateTime nextFlashTrashCheckTime = LocalDateTime.now(); LocalDateTime nextHourlyJobTime = LocalDateTime.now().withMinute(0).withSecond(0).plusHours(1); LocalDateTime nextWareHousePushTime = LocalDateTime.now(); + LocalDateTime nextDiscSpawn = LocalDateTime.now().withMinute(0).withSecond(0).plusHours(1); // Begin execution of main game loop @@ -245,6 +246,14 @@ public class WorldServer { nextWareHousePushTime = LocalDateTime.now().plusMinutes(15); } + if (LocalDateTime.now().isAfter(nextDiscSpawn)) { + for(Mob dropper : Mob.disciplineDroppers){ + if(dropper.isAlive() == false){ + dropper.respawn(); + } + } + nextDiscSpawn = LocalDateTime.now().plusHours(3).withMinute(0).withSecond(0); + } ThreadUtils.sleep(50); } }