From dd4f4bffe97cf2348edde564b591f444b9852e64 Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 18 Aug 2024 14:20:49 -0400 Subject: [PATCH] Auto-leveling camps --- src/engine/mobileAI/Threads/MobRespawnThread.java | 10 ++++++++++ src/engine/objects/Zone.java | 4 ++++ src/engine/util/ZoneLevel.java | 3 +++ 3 files changed, 17 insertions(+) diff --git a/src/engine/mobileAI/Threads/MobRespawnThread.java b/src/engine/mobileAI/Threads/MobRespawnThread.java index 24e2f281..f9714a56 100644 --- a/src/engine/mobileAI/Threads/MobRespawnThread.java +++ b/src/engine/mobileAI/Threads/MobRespawnThread.java @@ -11,6 +11,7 @@ package engine.mobileAI.Threads; import engine.gameManager.ZoneManager; import engine.objects.Mob; import engine.objects.Zone; +import engine.util.ZoneLevel; import org.pmw.tinylog.Logger; /** @@ -39,6 +40,15 @@ public class MobRespawnThread implements Runnable { try { for (Zone zone : ZoneManager.getAllZones()) { + if (zone.respawnQue.size() > ZoneLevel.queueLengthToLevelUp) { + zone.setCampLvl(zone.getCamplvl() + 1); + } + else if (zone.respawnQue.isEmpty() && + (zone.lastRespawn + ZoneLevel.msToLevelDown < System.currentTimeMillis()) && + zone.getCamplvl() > 0) { + zone.setCampLvl(zone.getCamplvl() - 1); + } + if (zone.respawnQue.isEmpty() == false && zone.lastRespawn + 100 < System.currentTimeMillis()) { Mob respawner = zone.respawnQue.iterator().next(); diff --git a/src/engine/objects/Zone.java b/src/engine/objects/Zone.java index a4c788d1..89986848 100644 --- a/src/engine/objects/Zone.java +++ b/src/engine/objects/Zone.java @@ -116,6 +116,10 @@ public class Zone extends AbstractGameObject { { this.campLvl = ZoneLevel.campMaxLvl; } + else if (this.campLvl < 0) + { + this.campLvl = 0; + } if (this.campLvl > ZoneLevel.campLvlAnnounceThreshold) { diff --git a/src/engine/util/ZoneLevel.java b/src/engine/util/ZoneLevel.java index 3f3d8621..a8e69890 100644 --- a/src/engine/util/ZoneLevel.java +++ b/src/engine/util/ZoneLevel.java @@ -13,6 +13,9 @@ public class ZoneLevel { public static final int campLvlAnnounceThreshold = 5; public static final int campMaxLvl = 10; + public static final int queueLengthToLevelUp = 5; + public static final int msToLevelDown = 60 * 1000; + private static final String[] nameMap = { "",