forked from MagicBane/Server
Auto-leveling camps
This commit is contained in:
@@ -11,6 +11,7 @@ package engine.mobileAI.Threads;
|
|||||||
import engine.gameManager.ZoneManager;
|
import engine.gameManager.ZoneManager;
|
||||||
import engine.objects.Mob;
|
import engine.objects.Mob;
|
||||||
import engine.objects.Zone;
|
import engine.objects.Zone;
|
||||||
|
import engine.util.ZoneLevel;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,6 +40,15 @@ public class MobRespawnThread implements Runnable {
|
|||||||
try {
|
try {
|
||||||
for (Zone zone : ZoneManager.getAllZones()) {
|
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()) {
|
if (zone.respawnQue.isEmpty() == false && zone.lastRespawn + 100 < System.currentTimeMillis()) {
|
||||||
|
|
||||||
Mob respawner = zone.respawnQue.iterator().next();
|
Mob respawner = zone.respawnQue.iterator().next();
|
||||||
|
|||||||
@@ -116,6 +116,10 @@ public class Zone extends AbstractGameObject {
|
|||||||
{
|
{
|
||||||
this.campLvl = ZoneLevel.campMaxLvl;
|
this.campLvl = ZoneLevel.campMaxLvl;
|
||||||
}
|
}
|
||||||
|
else if (this.campLvl < 0)
|
||||||
|
{
|
||||||
|
this.campLvl = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.campLvl > ZoneLevel.campLvlAnnounceThreshold)
|
if (this.campLvl > ZoneLevel.campLvlAnnounceThreshold)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ public class ZoneLevel {
|
|||||||
public static final int campLvlAnnounceThreshold = 5;
|
public static final int campLvlAnnounceThreshold = 5;
|
||||||
public static final int campMaxLvl = 10;
|
public static final int campMaxLvl = 10;
|
||||||
|
|
||||||
|
public static final int queueLengthToLevelUp = 5;
|
||||||
|
public static final int msToLevelDown = 60 * 1000;
|
||||||
|
|
||||||
private static final String[] nameMap =
|
private static final String[] nameMap =
|
||||||
{
|
{
|
||||||
"",
|
"",
|
||||||
|
|||||||
Reference in New Issue
Block a user