Browse Source

Static method moved to manager singleton.

master
MagicBot 2 years ago
parent
commit
e203945ea3
  1. 29
      src/engine/gameManager/ZoneManager.java
  2. 27
      src/engine/objects/City.java
  3. 2
      src/engine/server/world/WorldServer.java

29
src/engine/gameManager/ZoneManager.java

@ -9,6 +9,8 @@
package engine.gameManager; package engine.gameManager;
import engine.Enum; import engine.Enum;
import engine.db.archive.CityRecord;
import engine.db.archive.DataWarehouse;
import engine.math.Bounds; import engine.math.Bounds;
import engine.math.Vector2f; import engine.math.Vector2f;
import engine.math.Vector3f; import engine.math.Vector3f;
@ -423,4 +425,31 @@ public enum ZoneManager {
treeBounds.release(); treeBounds.release();
return validLocation; return validLocation;
} }
public static void loadCities(Zone zone) {
ArrayList<City> cities = DbManager.CityQueries.GET_CITIES_BY_ZONE(zone.getObjectUUID());
for (City city : cities) {
city.setParent(zone);
city.setObjectTypeMask(MBServerStatics.MASK_CITY);
city.setLoc(city.getLoc()); // huh?
//not player city, must be npc city..
if (!zone.isPlayerCity())
zone.setNPCCity(true);
if ((ConfigManager.serverType.equals(Enum.ServerType.WORLDSERVER)) && (city.getHash() == null)) {
city.setHash();
if (DataWarehouse.recordExists(Enum.DataRecordType.CITY, city.getObjectUUID()) == false) {
CityRecord cityRecord = CityRecord.borrow(city, Enum.RecordEventType.CREATE);
DataWarehouse.pushToWarehouse(cityRecord);
}
}
}
}
} }

27
src/engine/objects/City.java

@ -746,33 +746,6 @@ public class City extends AbstractWorldObject {
return open; return open;
} }
public static void loadCities(Zone zone) {
ArrayList<City> cities = DbManager.CityQueries.GET_CITIES_BY_ZONE(zone.getObjectUUID());
for (City city : cities) {
city.setParent(zone);
city.setObjectTypeMask(MBServerStatics.MASK_CITY);
city.setLoc(city.location);
//not player city, must be npc city..
if (!zone.isPlayerCity())
zone.setNPCCity(true);
if ((ConfigManager.serverType.equals(ServerType.WORLDSERVER)) && (city.hash == null)) {
city.setHash();
if (DataWarehouse.recordExists(Enum.DataRecordType.CITY, city.getObjectUUID()) == false) {
CityRecord cityRecord = CityRecord.borrow(city, Enum.RecordEventType.CREATE);
DataWarehouse.pushToWarehouse(cityRecord);
}
}
}
}
@Override @Override
public void updateDatabase() { public void updateDatabase() {

2
src/engine/server/world/WorldServer.java

@ -572,7 +572,7 @@ public class WorldServer {
//Handle cities //Handle cities
City.loadCities(zone); ZoneManager.loadCities(zone);
ZoneManager.populateWorldZones(zone); ZoneManager.populateWorldZones(zone);
} catch (Exception e) { } catch (Exception e) {

Loading…
Cancel
Save