Browse Source

Auto-leveling camp modifications

NovaTest
kevin 4 months ago
parent
commit
785a5eb736
  1. 37
      src/engine/mobileAI/Threads/MobRespawnThread.java
  2. 6
      src/engine/objects/Zone.java
  3. 5
      src/engine/util/ZoneLevel.java

37
src/engine/mobileAI/Threads/MobRespawnThread.java

@ -40,6 +40,7 @@ public class MobRespawnThread implements Runnable { @@ -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 { @@ -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()) {

6
src/engine/objects/Zone.java

@ -66,6 +66,8 @@ public class Zone extends AbstractGameObject { @@ -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 { @@ -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 { @@ -130,7 +132,7 @@ public class Zone extends AbstractGameObject {
}
}
public int getCamplvl()
public int getCampLvl()
{
return this.campLvl;
}

5
src/engine/util/ZoneLevel.java

@ -15,6 +15,7 @@ public class ZoneLevel { @@ -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 { @@ -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 { @@ -74,7 +75,7 @@ public class ZoneLevel {
if (zone != null)
{
modifier += zone.getCamplvl() * modifierPerLevel;
modifier += zone.getCampLvl() * modifierPerLevel;
}
return modifier;

Loading…
Cancel
Save