diff --git a/src/engine/gameManager/StrongholdManager.java b/src/engine/gameManager/StrongholdManager.java index a3161ae6..40a21cbe 100644 --- a/src/engine/gameManager/StrongholdManager.java +++ b/src/engine/gameManager/StrongholdManager.java @@ -344,4 +344,11 @@ public class StrongholdManager { } } } + + //=====================================NEW STUFF + + public static void initStrongholdIslands(){ + Zone island1 = new Zone(501,new Vector3fImmutable(-60032,615,45055),"Stronghold 1"); + ZoneManager.addZone(island1.getObjectUUID(),island1); + } } diff --git a/src/engine/objects/Zone.java b/src/engine/objects/Zone.java index 838712b5..1d980268 100644 --- a/src/engine/objects/Zone.java +++ b/src/engine/objects/Zone.java @@ -27,6 +27,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ThreadLocalRandom; public class Zone extends AbstractGameObject { @@ -103,6 +104,46 @@ public class Zone extends AbstractGameObject { } + //custom constructor + + public Zone(int template, Vector3fImmutable loc, String name){ + this.parentZoneID = 100;//seafloor + this.playerCityID = 0; + this.isPlayerCity = false; + this.zoneName = name; + this.xCoord = loc.x; + this.zCoord = loc.z; + this.yCoord = loc.y; + this.loadNum = template; + this.safeZone = (byte)0; + this.Icon1 = "T_Bandits"; + this.Icon2 = "B_Standard"; + this.Icon3 = "H_T_Bandits"; + this.hash = null; + + this.minLvl = 10; + this.maxLvl = 75; + + //this needs to be here specifically for new zones created after server boot (e.g. player city zones) + Zone parentZone = ZoneManager.getZoneByUUID(parentZoneID); + + this.setParent(parentZone); + + if (this.minLvl == 0 && parentZone != null) { + this.minLvl = parentZone.minLvl; + this.maxLvl = parentZone.maxLvl; + } + + if (parentZone != null) + parentZone.addNode(this); + + // If zone doesn't yet hava a hash then write it back to the zone table + + if (hash == null) + setHash(); + + } + public static void serializeForClientMsg(Zone zone, ByteBufferWriter writer) { if (zone.loadNum == 0 && zone.playerCityID == 0) diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index 62ac5654..f068e3d1 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -524,6 +524,7 @@ public class WorldServer { printThreads(); Logger.info("Threads Running:"); + StrongholdManager.initStrongholdIslands(); return true; }