collection of players for cities and mines

This commit is contained in:
2024-02-05 20:08:39 -06:00
parent 33bd1a0906
commit 5287b993fa
4 changed files with 111 additions and 10 deletions
@@ -56,6 +56,9 @@ public enum PowersManager {
public static HashMap<Integer, ArrayList<MobPowerEntry>> AllMobPowers;
private static JobScheduler js;
public static String[] siegeBuffs = new String[]{"ART-004A","ARM-112A"};
public static String[] siegeDeBuffs = new String[]{"ACM-003A","WRT-003A"};
private PowersManager() {
}
@@ -2707,7 +2710,12 @@ public enum PowersManager {
}
}
}
public static void applyZergBuff(AbstractGameObject obj){
}
public static void removeZergBuff(HashSet<Integer> playersIDs){
}
}
+34 -4
View File
@@ -10,10 +10,7 @@ package engine.gameManager;
import engine.Enum;
import engine.Enum.GameObjectType;
import engine.objects.AbstractGameObject;
import engine.objects.City;
import engine.objects.PlayerCharacter;
import engine.objects.Runegate;
import engine.objects.*;
import org.pmw.tinylog.Logger;
import java.sql.Connection;
@@ -33,6 +30,7 @@ public enum SimulationManager {
SERVERHEARTBEAT;
private static final long CITY_PULSE = 2000;
private static final long MINE_PULSE = 2000;
private static final long RUNEGATE_PULSE = 3000;
private static final long UPDATE_PULSE = 1000;
private static final long FlIGHT_PULSE = 100;
@@ -40,6 +38,7 @@ public enum SimulationManager {
public static Duration executionMax = Duration.ofNanos(1);
private static SimulationManager instance = null;
private long _cityPulseTime = System.currentTimeMillis() + CITY_PULSE;
private long _minePulseTime = System.currentTimeMillis() + MINE_PULSE;
private long _runegatePulseTime = System.currentTimeMillis()
+ RUNEGATE_PULSE;
private long _updatePulseTime = System.currentTimeMillis() + UPDATE_PULSE;
@@ -126,7 +125,17 @@ public enum SimulationManager {
e.printStackTrace();
}
try {
if ((_minePulseTime != 0)
&& (System.currentTimeMillis() > _minePulseTime))
pulseMines();
} catch (Exception e) {
Logger.error(
"Fatal error in City Pulse: DISABLED. Error Message : "
+ e.getMessage());
e.printStackTrace();
}
SimulationManager.executionTime = Duration.between(startTime, Instant.now());
if (executionTime.compareTo(executionMax) > 0)
@@ -206,7 +215,28 @@ public enum SimulationManager {
_cityPulseTime = System.currentTimeMillis() + CITY_PULSE;
}
private void pulseMines() {
Mine mine;
// *** Refactor: Need a list cached somewhere as it doesn't change very
// often at all. Have a cityListIsDirty boolean that gets set if it
// needs an update. Will speed up this method a great deal.
Collection<AbstractGameObject> mineList = DbManager.getList(Enum.GameObjectType.Mine);
if (mineList == null) {
Logger.info("City List null");
return;
}
for (AbstractGameObject mineObject : mineList) {
mine = (Mine) mineObject;
mine.onEnter();
}
_minePulseTime = System.currentTimeMillis() + MINE_PULSE;
}
/*
* Method runs proximity collision detection for all active portals on the
* game's Runegates