Auto-leveling camps

This commit is contained in:
2024-08-18 14:20:49 -04:00
parent 2cdeaa4d66
commit dd4f4bffe9
3 changed files with 17 additions and 0 deletions
@@ -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();
+4
View File
@@ -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)
{
+3
View File
@@ -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 =
{
"",