forked from MagicBane/Server
Auto-leveling camp modifications
This commit is contained in:
@@ -40,6 +40,7 @@ public class MobRespawnThread implements Runnable {
|
||||
try {
|
||||
for (Zone zone : ZoneManager.getAllZones()) {
|
||||
|
||||
/*
|
||||
if (zone.respawnQue.size() > ZoneLevel.queueLengthToLevelUp) {
|
||||
zone.setCampLvl(zone.getCamplvl() + 1);
|
||||
}
|
||||
@@ -48,6 +49,42 @@ public class MobRespawnThread implements Runnable {
|
||||
zone.getCamplvl() > 0) {
|
||||
zone.setCampLvl(zone.getCamplvl() - 1);
|
||||
}
|
||||
*/
|
||||
|
||||
int deadCount = 0;
|
||||
for (Mob mob : zone.zoneMobSet) {
|
||||
if (!mob.isAlive()) {
|
||||
deadCount = deadCount + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (deadCount > Math.floor(zone.zoneMobSet.size() / 2.0)) {
|
||||
if (zone.levelUpTimer == 0) {
|
||||
zone.levelUpTimer = System.currentTimeMillis();
|
||||
}
|
||||
else if (zone.levelUpTimer + ZoneLevel.msTolevelUp < System.currentTimeMillis()) {
|
||||
zone.setCampLvl(zone.getCampLvl() + 1);
|
||||
|
||||
zone.levelUpTimer = 0;
|
||||
}
|
||||
}
|
||||
else if (deadCount == 0) {
|
||||
|
||||
if (zone.levelDownTimer == 0) {
|
||||
zone.levelDownTimer = System.currentTimeMillis();
|
||||
}
|
||||
else if (zone.levelDownTimer + ZoneLevel.msToLevelDown < System.currentTimeMillis()) {
|
||||
if (zone.getCampLvl() > 0) {
|
||||
zone.setCampLvl(zone.getCampLvl() + 1);
|
||||
|
||||
zone.levelDownTimer = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
zone.levelUpTimer = 0;
|
||||
zone.levelDownTimer = 0;
|
||||
}
|
||||
|
||||
if (zone.respawnQue.isEmpty() == false && zone.lastRespawn + 100 < System.currentTimeMillis()) {
|
||||
|
||||
|
||||
@@ -66,6 +66,8 @@ public class Zone extends AbstractGameObject {
|
||||
public static long lastRespawn = 0;
|
||||
|
||||
private int campLvl = 0;
|
||||
public long levelUpTimer = 0;
|
||||
public long levelDownTimer = 0;
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
@@ -121,7 +123,7 @@ public class Zone extends AbstractGameObject {
|
||||
this.campLvl = 0;
|
||||
}
|
||||
|
||||
if (this.campLvl > ZoneLevel.campLvlAnnounceThreshold)
|
||||
//if (this.campLvl > ZoneLevel.campLvlAnnounceThreshold)
|
||||
{
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, this.getName() + " has reached camp level " + this.campLvl + "! Will anyone contest?!");
|
||||
chatMsg.setMessageType(2);
|
||||
@@ -130,7 +132,7 @@ public class Zone extends AbstractGameObject {
|
||||
}
|
||||
}
|
||||
|
||||
public int getCamplvl()
|
||||
public int getCampLvl()
|
||||
{
|
||||
return this.campLvl;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ public class ZoneLevel {
|
||||
|
||||
public static final int queueLengthToLevelUp = 5;
|
||||
public static final int msToLevelDown = 60 * 1000;
|
||||
public static final int msTolevelUp = 60 * 1000;
|
||||
|
||||
private static final String[] nameMap =
|
||||
{
|
||||
@@ -34,7 +35,7 @@ public class ZoneLevel {
|
||||
public static String getNameSuffix(Zone zone)
|
||||
{
|
||||
try {
|
||||
return nameMap[zone.getCamplvl()];
|
||||
return nameMap[zone.getCampLvl()];
|
||||
}
|
||||
catch (Exception ignored)
|
||||
{
|
||||
@@ -74,7 +75,7 @@ public class ZoneLevel {
|
||||
|
||||
if (zone != null)
|
||||
{
|
||||
modifier += zone.getCamplvl() * modifierPerLevel;
|
||||
modifier += zone.getCampLvl() * modifierPerLevel;
|
||||
}
|
||||
|
||||
return modifier;
|
||||
|
||||
Reference in New Issue
Block a user