From e0387dce00852ff89126d40b481404caba4b331d Mon Sep 17 00:00:00 2001 From: MagicBot Date: Wed, 20 Sep 2023 15:53:41 -0400 Subject: [PATCH] class and table schema now conform to JSON --- src/engine/Enum.java | 2 +- src/engine/InterestManagement/HeightMap.java | 8 +- src/engine/db/handlers/dbZoneHandler.java | 12 +-- src/engine/devcmd/cmds/AddMobCmd.java | 2 +- src/engine/devcmd/cmds/GetHeightCmd.java | 2 +- src/engine/devcmd/cmds/GetZoneCmd.java | 2 +- src/engine/devcmd/cmds/GotoCmd.java | 4 +- src/engine/devcmd/cmds/InfoCmd.java | 4 +- src/engine/devcmd/cmds/MakeBaneCmd.java | 4 +- src/engine/devcmd/cmds/PurgeObjectsCmd.java | 2 +- src/engine/devcmd/cmds/RemoveBaneCmd.java | 4 +- src/engine/devcmd/cmds/RemoveObjectCmd.java | 2 +- src/engine/devcmd/cmds/SetBaneActiveCmd.java | 4 +- .../devcmd/cmds/SetForceRenameCityCmd.java | 4 +- src/engine/devcmd/cmds/ZoneInfoCmd.java | 6 +- src/engine/devcmd/cmds/ZoneSetCmd.java | 2 +- src/engine/gameManager/MovementManager.java | 2 +- src/engine/gameManager/ZoneManager.java | 16 ++-- src/engine/net/client/ClientMessagePump.java | 6 +- .../handlers/AbandonAssetMsgHandler.java | 2 +- .../handlers/AssetSupportMsgHandler.java | 2 +- .../handlers/ChannelMuteMsgHandler.java | 2 +- .../handlers/ClaimGuildTreeMsgHandler.java | 2 +- .../handlers/ManageCityAssetMsgHandler.java | 6 +- .../handlers/ObjectActionMsgHandler.java | 2 +- .../client/handlers/OrderNPCMsgHandler.java | 2 +- .../client/handlers/PlaceAssetMsgHandler.java | 30 +++---- .../handlers/RepairBuildingMsgHandler.java | 4 +- src/engine/net/client/msg/CityAssetMsg.java | 2 +- .../net/client/msg/GuildTreeStatusMsg.java | 4 +- .../net/client/msg/ManageCityAssetsMsg.java | 10 +-- .../net/client/msg/ViewResourcesMessage.java | 2 +- src/engine/objects/Bane.java | 4 +- src/engine/objects/Building.java | 4 +- src/engine/objects/City.java | 4 +- src/engine/objects/ItemFactory.java | 4 +- src/engine/objects/NPC.java | 4 +- src/engine/objects/Warehouse.java | 2 +- src/engine/objects/Zone.java | 81 +++++++++---------- src/engine/server/world/WorldServer.java | 4 +- 40 files changed, 132 insertions(+), 133 deletions(-) diff --git a/src/engine/Enum.java b/src/engine/Enum.java index b7b78c73..8abd1d8a 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -469,7 +469,7 @@ public class Enum { // 14001 does not have a banestone to bind at - if (ruinZone.loadNum == 14001) + if (ruinZone.zoneTemplate == 14001) spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30); else spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc() diff --git a/src/engine/InterestManagement/HeightMap.java b/src/engine/InterestManagement/HeightMap.java index 06957997..a2f7168c 100644 --- a/src/engine/InterestManagement/HeightMap.java +++ b/src/engine/InterestManagement/HeightMap.java @@ -191,7 +191,7 @@ public class HeightMap { HeightMap heightMap = new HeightMap(zone); - HeightMap.heightmapByLoadNum.put(zone.loadNum, heightMap); + HeightMap.heightmapByLoadNum.put(zone.zoneTemplate, heightMap); } @@ -237,7 +237,7 @@ public class HeightMap { // Heightmap blending is based on distance to edge of zone. - if (Bounds.collide(worldLoc, heightMapZone.maxBlend) == true) + if (Bounds.collide(worldLoc, heightMapZone.blendBounds) == true) return interpolatedTerrainHeight; // We will need the parent height if we got this far into the method @@ -264,8 +264,8 @@ public class HeightMap { blendBounds.setBounds(new Vector2f(heightMapZone.absX, heightMapZone.absZ), zoneLoc, 0.0f); - float maxBlendArea = (heightMapZone.maxBlend.getHalfExtents().x) * - (heightMapZone.maxBlend.getHalfExtents().y); + float maxBlendArea = (heightMapZone.blendBounds.getHalfExtents().x) * + (heightMapZone.blendBounds.getHalfExtents().y); float currentArea = (blendBounds.getHalfExtents().x) * (blendBounds.getHalfExtents().y); float zoneArea = (heightMapZone.bounds.getHalfExtents().x) * diff --git a/src/engine/db/handlers/dbZoneHandler.java b/src/engine/db/handlers/dbZoneHandler.java index c367d22e..b782ad38 100644 --- a/src/engine/db/handlers/dbZoneHandler.java +++ b/src/engine/db/handlers/dbZoneHandler.java @@ -33,18 +33,18 @@ public class dbZoneHandler extends dbHandlerBase { ArrayList wsmList = new ArrayList<>(); wsmList.addAll(zone.getNodes()); if (zone.absX == 0.0f) { - zone.absX = zone.xCoord; + zone.absX = zone.xOffset; } if (zone.absY == 0.0f) { - zone.absY = zone.yCoord; + zone.absY = zone.yOffset; } if (zone.absZ == 0.0f) { - zone.absZ = zone.zCoord; + zone.absZ = zone.zOffset; } for (Zone child : zone.getNodes()) { - child.absX = child.xCoord + zone.absX; - child.absY = child.yCoord + zone.absY; - child.absZ = child.zCoord + zone.absZ; + child.absX = child.xOffset + zone.absX; + child.absY = child.yOffset + zone.absY; + child.absZ = child.zOffset + zone.absZ; wsmList.addAll(this.GET_ALL_NODES(child)); } return wsmList; diff --git a/src/engine/devcmd/cmds/AddMobCmd.java b/src/engine/devcmd/cmds/AddMobCmd.java index 30fbac56..57459f67 100644 --- a/src/engine/devcmd/cmds/AddMobCmd.java +++ b/src/engine/devcmd/cmds/AddMobCmd.java @@ -78,7 +78,7 @@ public class AddMobCmd extends AbstractDevCmd { return; } - if (zone.isPlayerCity) { + if (zone.isGuildZone) { throwbackError(pc, "Cannot use ./mob on Player cities. Try ./servermob instead."); return; } diff --git a/src/engine/devcmd/cmds/GetHeightCmd.java b/src/engine/devcmd/cmds/GetHeightCmd.java index 29792691..eb0eb280 100644 --- a/src/engine/devcmd/cmds/GetHeightCmd.java +++ b/src/engine/devcmd/cmds/GetHeightCmd.java @@ -59,7 +59,7 @@ public class GetHeightCmd extends AbstractDevCmd { this.throwbackInfo(playerCharacter, "Min: " + heightmapZone.getHeightMap().zone_minBlend + " Max: " + heightmapZone.getHeightMap().zone_maxBlend); - if (Bounds.collide(playerCharacter.getLoc(), heightmapZone.maxBlend)) { + if (Bounds.collide(playerCharacter.getLoc(), heightmapZone.blendBounds)) { this.throwbackInfo(playerCharacter, "Blend: Max (Child)"); return; } diff --git a/src/engine/devcmd/cmds/GetZoneCmd.java b/src/engine/devcmd/cmds/GetZoneCmd.java index a2deba81..62ffb1df 100644 --- a/src/engine/devcmd/cmds/GetZoneCmd.java +++ b/src/engine/devcmd/cmds/GetZoneCmd.java @@ -51,7 +51,7 @@ public class GetZoneCmd extends AbstractDevCmd { } for (Zone zone : allIn) - throwbackInfo(pcSender, zone.zoneName + "; UUID: " + zone.getObjectUUID() + ", loadNum: " + zone.loadNum); + throwbackInfo(pcSender, zone.zoneName + "; UUID: " + zone.getObjectUUID() + ", loadNum: " + zone.zoneTemplate); } @Override diff --git a/src/engine/devcmd/cmds/GotoCmd.java b/src/engine/devcmd/cmds/GotoCmd.java index e2864d82..3d7550c1 100644 --- a/src/engine/devcmd/cmds/GotoCmd.java +++ b/src/engine/devcmd/cmds/GotoCmd.java @@ -81,7 +81,7 @@ public class GotoCmd extends AbstractDevCmd { continue; Zone zone = city.getParent(); if (zone != null) { - if (zone.isNPCCity || zone.isPlayerCity) + if (zone.isNPCCity || zone.isGuildZone) loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS); else loc = zone.getLoc(); @@ -100,7 +100,7 @@ public class GotoCmd extends AbstractDevCmd { if (!zone.zoneName.equalsIgnoreCase(cityName)) continue; if (zone != null) { - if (zone.isNPCCity || zone.isPlayerCity) + if (zone.isNPCCity || zone.isGuildZone) loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS); else loc = zone.getLoc(); diff --git a/src/engine/devcmd/cmds/InfoCmd.java b/src/engine/devcmd/cmds/InfoCmd.java index 34bb73e2..d0257efb 100644 --- a/src/engine/devcmd/cmds/InfoCmd.java +++ b/src/engine/devcmd/cmds/InfoCmd.java @@ -387,7 +387,7 @@ public class InfoCmd extends AbstractDevCmd { output += newline; output += "EquipSet: " + targetNPC.getEquipmentSetID(); output += newline; - output += "Parent Zone LoadNum : " + targetNPC.getParentZone().loadNum; + output += "Parent Zone LoadNum : " + targetNPC.getParentZone().zoneTemplate; } @@ -473,7 +473,7 @@ public class InfoCmd extends AbstractDevCmd { output += "EquipSet: " + targetMob.equipmentSetID; output += newline; try { - output += "Parent Zone LoadNum : " + targetMob.getParentZone().loadNum; + output += "Parent Zone LoadNum : " + targetMob.getParentZone().zoneTemplate; } catch (Exception ex) { //who cares } diff --git a/src/engine/devcmd/cmds/MakeBaneCmd.java b/src/engine/devcmd/cmds/MakeBaneCmd.java index 17f82685..829ca955 100644 --- a/src/engine/devcmd/cmds/MakeBaneCmd.java +++ b/src/engine/devcmd/cmds/MakeBaneCmd.java @@ -111,12 +111,12 @@ public class MakeBaneCmd extends AbstractDevCmd { return; } - if (!zone.isPlayerCity) { + if (!zone.isGuildZone) { throwbackError(pc, "This is not a player city."); return; } - City city = City.getCity(zone.playerCityID); + City city = City.getCity(zone.playerCityUUID); if (city == null) { throwbackError(pc, "Unable to find the city associated with this zone."); return; diff --git a/src/engine/devcmd/cmds/PurgeObjectsCmd.java b/src/engine/devcmd/cmds/PurgeObjectsCmd.java index deb30cd8..b32e1480 100644 --- a/src/engine/devcmd/cmds/PurgeObjectsCmd.java +++ b/src/engine/devcmd/cmds/PurgeObjectsCmd.java @@ -42,7 +42,7 @@ public class PurgeObjectsCmd extends AbstractDevCmd { private static void PurgeWalls(Zone zone, PlayerCharacter pc) { - if (!zone.isPlayerCity) + if (!zone.isGuildZone) return; for (Building building : zone.zoneBuildingSet) { diff --git a/src/engine/devcmd/cmds/RemoveBaneCmd.java b/src/engine/devcmd/cmds/RemoveBaneCmd.java index 0e760f50..1669265c 100644 --- a/src/engine/devcmd/cmds/RemoveBaneCmd.java +++ b/src/engine/devcmd/cmds/RemoveBaneCmd.java @@ -34,12 +34,12 @@ public class RemoveBaneCmd extends AbstractDevCmd { return; } - if (!zone.isPlayerCity) { + if (!zone.isGuildZone) { throwbackError(pc, "This is not a player city."); return; } - City city = City.getCity(zone.playerCityID); + City city = City.getCity(zone.playerCityUUID); if (city == null) { throwbackError(pc, "Unable to find the city associated with this zone."); return; diff --git a/src/engine/devcmd/cmds/RemoveObjectCmd.java b/src/engine/devcmd/cmds/RemoveObjectCmd.java index 19a9fd2c..944ccfc2 100644 --- a/src/engine/devcmd/cmds/RemoveObjectCmd.java +++ b/src/engine/devcmd/cmds/RemoveObjectCmd.java @@ -130,7 +130,7 @@ public class RemoveObjectCmd extends AbstractDevCmd { building.disableSpire(false); if ((building.getBlueprint() != null) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.WAREHOUSE)) { - City city = City.getCity(building.getParentZone().playerCityID); + City city = City.getCity(building.getParentZone().playerCityUUID); if (city != null) { city.setWarehouseBuildingID(0); } diff --git a/src/engine/devcmd/cmds/SetBaneActiveCmd.java b/src/engine/devcmd/cmds/SetBaneActiveCmd.java index e7c0ba56..b1caccb9 100644 --- a/src/engine/devcmd/cmds/SetBaneActiveCmd.java +++ b/src/engine/devcmd/cmds/SetBaneActiveCmd.java @@ -41,12 +41,12 @@ public class SetBaneActiveCmd extends AbstractDevCmd { return; } - if (!zone.isPlayerCity) { + if (!zone.isGuildZone) { throwbackError(pc, "This is not a player city."); return; } - City city = City.getCity(zone.playerCityID); + City city = City.getCity(zone.playerCityUUID); if (city == null) { throwbackError(pc, "Unable to find the city associated with this zone."); return; diff --git a/src/engine/devcmd/cmds/SetForceRenameCityCmd.java b/src/engine/devcmd/cmds/SetForceRenameCityCmd.java index 5b275697..da2e0ca0 100644 --- a/src/engine/devcmd/cmds/SetForceRenameCityCmd.java +++ b/src/engine/devcmd/cmds/SetForceRenameCityCmd.java @@ -31,9 +31,9 @@ public class SetForceRenameCityCmd extends AbstractDevCmd { if (zone == null) return; boolean rename = words[0].equalsIgnoreCase("true") ? true : false; - if (zone.playerCityID == 0) + if (zone.playerCityUUID == 0) return; - City city = City.getCity(zone.playerCityID); + City city = City.getCity(zone.playerCityUUID); if (city == null) return; city.setForceRename(rename); diff --git a/src/engine/devcmd/cmds/ZoneInfoCmd.java b/src/engine/devcmd/cmds/ZoneInfoCmd.java index 17d1226a..efc069e9 100644 --- a/src/engine/devcmd/cmds/ZoneInfoCmd.java +++ b/src/engine/devcmd/cmds/ZoneInfoCmd.java @@ -75,7 +75,7 @@ public class ZoneInfoCmd extends AbstractDevCmd { output += newline; output += "name: " + zone.zoneName; output += newline; - output += "loadNum: " + zone.loadNum; + output += "loadNum: " + zone.zoneTemplate; if (zone.parent != null) { output += StringUtils.addWS(", parent: " + zone.parent.getObjectUUID(), 30); output += "Parentabs: x: " + zone.parent.absX + ", y: " + zone.parent.absY + ", z: " + zone.parent.absZ; @@ -85,7 +85,7 @@ public class ZoneInfoCmd extends AbstractDevCmd { output += newline; output += "absLoc: x: " + zone.absX + ", y: " + zone.absY + ", z: " + zone.absZ; output += newline; - output += "offset: x: " + zone.xCoord + ", y: " + zone.yCoord + ", z: " + zone.zCoord; + output += "offset: x: " + zone.xOffset + ", y: " + zone.yOffset + ", z: " + zone.zOffset; output += newline; output += "radius: x: " + zone.bounds.getHalfExtents().x + ", z: " + zone.bounds.getHalfExtents().y; output += newline; @@ -130,7 +130,7 @@ public class ZoneInfoCmd extends AbstractDevCmd { for (Zone child : nodes) { output += newline; - output += child.zoneName + " (" + child.loadNum + ')'; + output += child.zoneName + " (" + child.zoneTemplate + ')'; } } throwbackInfo(player, output); diff --git a/src/engine/devcmd/cmds/ZoneSetCmd.java b/src/engine/devcmd/cmds/ZoneSetCmd.java index 9da9cbbd..aedb78ac 100644 --- a/src/engine/devcmd/cmds/ZoneSetCmd.java +++ b/src/engine/devcmd/cmds/ZoneSetCmd.java @@ -40,7 +40,7 @@ public class ZoneSetCmd extends AbstractDevCmd { zone = ZoneManager.findSmallestZone(playerCharacter.getLoc()); - throwbackInfo(playerCharacter, zone.zoneName + " (" + zone.loadNum + ") " + zone.getObjectUUID()); + throwbackInfo(playerCharacter, zone.zoneName + " (" + zone.zoneTemplate + ") " + zone.getObjectUUID()); // NPC diff --git a/src/engine/gameManager/MovementManager.java b/src/engine/gameManager/MovementManager.java index c8f3569e..f24ffaf6 100644 --- a/src/engine/gameManager/MovementManager.java +++ b/src/engine/gameManager/MovementManager.java @@ -267,7 +267,7 @@ public enum MovementManager { Zone serverZone = null; serverZone = ZoneManager.findSmallestZone(player.getLoc()); - cityObject = (City) DbManager.getFromCache(GameObjectType.City, serverZone.playerCityID); + cityObject = (City) DbManager.getFromCache(GameObjectType.City, serverZone.playerCityUUID); // Do not send group messages if player is on grid diff --git a/src/engine/gameManager/ZoneManager.java b/src/engine/gameManager/ZoneManager.java index 77ecd6a7..65ab0177 100644 --- a/src/engine/gameManager/ZoneManager.java +++ b/src/engine/gameManager/ZoneManager.java @@ -182,7 +182,7 @@ public enum ZoneManager { public static final void populateWorldZones(final Zone zone) { - int loadNum = zone.loadNum; + int loadNum = zone.zoneTemplate; // Zones are added to separate // collections for quick access @@ -194,7 +194,7 @@ public enum ZoneManager { } - if (zone.isPlayerCity) { + if (zone.isGuildZone) { addPlayerCityZone(zone); return; } @@ -214,7 +214,7 @@ public enum ZoneManager { } public static final void addPlayerCityZone(final Zone zone) { - zone.isPlayerCity = true; + zone.isGuildZone = true; ZoneManager.playerCityZones.add(zone); } @@ -387,8 +387,8 @@ public enum ZoneManager { currentZone = ZoneManager.findSmallestZone(worldLoc); - if (currentZone.isPlayerCity) - return City.getCity(currentZone.playerCityID); + if (currentZone.isGuildZone) + return City.getCity(currentZone.playerCityUUID); return null; } @@ -440,7 +440,7 @@ public enum ZoneManager { //not player city, must be npc city.. - if (!zone.isPlayerCity) + if (!zone.isGuildZone) zone.isNPCCity = true; if ((ConfigManager.serverType.equals(Enum.ServerType.WORLDSERVER)) && (city.getHash() == null)) { @@ -469,7 +469,7 @@ public enum ZoneManager { // Children of seafloor if (parentZone.parent == null) - return worldAlttitude + zone.yCoord; + return worldAlttitude + zone.yOffset; // return height from heightmap engine at zone location @@ -477,7 +477,7 @@ public enum ZoneManager { // Add zone offset to value - worldAlttitude += zone.yCoord; + worldAlttitude += zone.yOffset; return worldAlttitude; } diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index 8086ef33..2a8334ad 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -1196,7 +1196,7 @@ public class ClientMessagePump implements NetMsgHandler { if (npc.getCharItemManager().getInventoryCount() > 150) { - if (npc.getParentZone() != null && npc.getParentZone().playerCityID == 0) { + if (npc.getParentZone() != null && npc.getParentZone().playerCityUUID == 0) { ArrayList inv = npc.getInventory(); for (int i = 0; i < 20; i++) { try { @@ -1229,7 +1229,7 @@ public class ClientMessagePump implements NetMsgHandler { if (ib == null) return; - if (npc.getParentZone() != null && npc.getParentZone().playerCityID != 0) + if (npc.getParentZone() != null && npc.getParentZone().playerCityUUID != 0) if (!npc.getCharItemManager().hasRoomInventory(ib.getWeight())) { ErrorPopupMsg.sendErrorPopup(player, 21); @@ -1280,7 +1280,7 @@ public class ClientMessagePump implements NetMsgHandler { if (building != null && building.getProtectionState().equals(ProtectionState.NPC)) building = null; - if (npc.getParentZone().playerCityID == 0) + if (npc.getParentZone().playerCityUUID == 0) building = null; //make sure npc can afford item diff --git a/src/engine/net/client/handlers/AbandonAssetMsgHandler.java b/src/engine/net/client/handlers/AbandonAssetMsgHandler.java index 8774242d..aea94ffd 100644 --- a/src/engine/net/client/handlers/AbandonAssetMsgHandler.java +++ b/src/engine/net/client/handlers/AbandonAssetMsgHandler.java @@ -151,7 +151,7 @@ public class AbandonAssetMsgHandler extends AbstractClientMsgHandler { cityZone = ZoneManager.findSmallestZone(targetBuilding.getLoc()); // Can't abandon a tree not within a player city zone - if (cityZone.isPlayerCity == false) + if (cityZone.isGuildZone == false) return; if (targetBuilding.getCity() == null) diff --git a/src/engine/net/client/handlers/AssetSupportMsgHandler.java b/src/engine/net/client/handlers/AssetSupportMsgHandler.java index 0f4439ae..1627b0ac 100644 --- a/src/engine/net/client/handlers/AssetSupportMsgHandler.java +++ b/src/engine/net/client/handlers/AssetSupportMsgHandler.java @@ -45,7 +45,7 @@ public class AssetSupportMsgHandler extends AbstractClientMsgHandler { if (serverZone == null) return; - serverCity = City.GetCityFromCache(serverZone.playerCityID); + serverCity = City.GetCityFromCache(serverZone.playerCityUUID); if (serverCity == null) return; diff --git a/src/engine/net/client/handlers/ChannelMuteMsgHandler.java b/src/engine/net/client/handlers/ChannelMuteMsgHandler.java index 30a003fc..b6d3ddbb 100644 --- a/src/engine/net/client/handlers/ChannelMuteMsgHandler.java +++ b/src/engine/net/client/handlers/ChannelMuteMsgHandler.java @@ -65,7 +65,7 @@ public class ChannelMuteMsgHandler extends AbstractClientMsgHandler { cityZone = ZoneManager.findSmallestZone(targetBuilding.getLoc()); // Can't abandon a tree not within a player city zone - if (cityZone.isPlayerCity == false) + if (cityZone.isGuildZone == false) return; if (targetBuilding.getCity().hasBeenTransfered == true) { diff --git a/src/engine/net/client/handlers/ClaimGuildTreeMsgHandler.java b/src/engine/net/client/handlers/ClaimGuildTreeMsgHandler.java index c942f40c..82aa5d83 100644 --- a/src/engine/net/client/handlers/ClaimGuildTreeMsgHandler.java +++ b/src/engine/net/client/handlers/ClaimGuildTreeMsgHandler.java @@ -69,7 +69,7 @@ public class ClaimGuildTreeMsgHandler extends AbstractClientMsgHandler { playerZone = building.getParentZone(); if (playerZone != null) - playerCity = City.getCity(playerZone.playerCityID); + playerCity = City.getCity(playerZone.playerCityUUID); // Oops! *** Refactor: Log error switch (msg.getMessageType()) { diff --git a/src/engine/net/client/handlers/ManageCityAssetMsgHandler.java b/src/engine/net/client/handlers/ManageCityAssetMsgHandler.java index 0f55d6a0..4672efc0 100644 --- a/src/engine/net/client/handlers/ManageCityAssetMsgHandler.java +++ b/src/engine/net/client/handlers/ManageCityAssetMsgHandler.java @@ -75,12 +75,12 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler { Zone zone = ZoneManager.findSmallestZone(player.getLoc()); - if (!zone.isPlayerCity) { + if (!zone.isGuildZone) { ErrorPopupMsg.sendErrorMsg(player, "Unable to find city to command."); return true; } - City city = City.GetCityFromCache(zone.playerCityID); + City city = City.GetCityFromCache(zone.playerCityUUID); if (city == null) { ErrorPopupMsg.sendErrorMsg(player, "Unable to find city to command."); @@ -254,7 +254,7 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler { if (baneZone == null) return true; - City banedCity = City.getCity(baneZone.playerCityID); + City banedCity = City.getCity(baneZone.playerCityUUID); if (banedCity == null) return true; diff --git a/src/engine/net/client/handlers/ObjectActionMsgHandler.java b/src/engine/net/client/handlers/ObjectActionMsgHandler.java index 1ffba79c..fad51445 100644 --- a/src/engine/net/client/handlers/ObjectActionMsgHandler.java +++ b/src/engine/net/client/handlers/ObjectActionMsgHandler.java @@ -334,7 +334,7 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler { Zone zone = ZoneManager.findSmallestZone(player.getLoc()); if (zone != null) { - if (zone.isPlayerCity) { + if (zone.isGuildZone) { loc = zone.getLoc(); } } diff --git a/src/engine/net/client/handlers/OrderNPCMsgHandler.java b/src/engine/net/client/handlers/OrderNPCMsgHandler.java index 3de83fee..c7414459 100644 --- a/src/engine/net/client/handlers/OrderNPCMsgHandler.java +++ b/src/engine/net/client/handlers/OrderNPCMsgHandler.java @@ -288,7 +288,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler { if (zone == null) return false; - if (zone.playerCityID == 0) + if (zone.playerCityUUID == 0) return false; City city = building.getCity(); diff --git a/src/engine/net/client/handlers/PlaceAssetMsgHandler.java b/src/engine/net/client/handlers/PlaceAssetMsgHandler.java index 773bdc81..4efb7add 100644 --- a/src/engine/net/client/handlers/PlaceAssetMsgHandler.java +++ b/src/engine/net/client/handlers/PlaceAssetMsgHandler.java @@ -137,7 +137,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { private static boolean validateBuildingPlacement(Zone serverZone, PlaceAssetMsg msg, ClientConnection origin, PlayerCharacter player, PlacementInfo placementInfo) { - if (serverZone.isPlayerCity == false) { + if (serverZone.isGuildZone == false) { PlaceAssetMsg.sendPlaceAssetError(origin, 52, player.getName()); return false; } @@ -201,8 +201,8 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { // Cannot place assets on a dead tree - if ((serverZone.isPlayerCity) - && (City.getCity(serverZone.playerCityID).getTOL().getRank() == -1)) { + if ((serverZone.isGuildZone) + && (City.getCity(serverZone.playerCityUUID).getTOL().getRank() == -1)) { PlaceAssetMsg.sendPlaceAssetError(origin, 1, "Cannot place asset on dead tree until world heals"); return false; } @@ -261,14 +261,14 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { // Must be a player city - if (serverZone.isPlayerCity == false) { + if (serverZone.isGuildZone == false) { PlaceAssetMsg.sendPlaceAssetError(origin, 41, player.getName()); // Cannot place outside a guild zone return false; } //Test zone has a city object - City city = City.getCity(serverZone.playerCityID); + City city = City.getCity(serverZone.playerCityUUID); if (city == null) { PlaceAssetMsg.sendPlaceAssetError(origin, 52, ""); //"no city to associate asset with" @@ -512,7 +512,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { if (serverZone == null) return false; - cityObject = City.getCity(serverZone.playerCityID); + cityObject = City.getCity(serverZone.playerCityUUID); // Early exit if something went horribly wrong @@ -571,7 +571,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { // No valid player city found - if (serverCity == null || serverCity.getParent().isPlayerCity == false) { + if (serverCity == null || serverCity.getParent().isGuildZone == false) { PlaceAssetMsg.sendPlaceAssetError(origin, 52, ""); // Cannot place outisde a guild zone return false; } @@ -783,7 +783,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { // Link the zone with the city and then add // to the appropriate hash tables and cache - zoneObject.isPlayerCity = true; + zoneObject.isGuildZone = true; if (zoneObject.parent != null) zoneObject.parent.addNode(zoneObject); //add as child to parent @@ -857,7 +857,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { if (serverZone == null) return false; - cityObject = City.getCity(serverZone.playerCityID); + cityObject = City.getCity(serverZone.playerCityUUID); if (cityObject == null) return false; @@ -931,7 +931,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { int shrineCount = 0; - cityObject = City.getCity(serverZone.playerCityID); + cityObject = City.getCity(serverZone.playerCityUUID); // Cannot place shrine in abandoned city. Shrines must be owned // by the tol owner not the person placing them. @@ -1001,7 +1001,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { int barracksCount = 0; - cityObject = City.getCity(serverZone.playerCityID); + cityObject = City.getCity(serverZone.playerCityUUID); // Cannot place barracks in abandoned city. @@ -1061,7 +1061,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { if (validateCityBuildingPlacement(serverZone, msg, origin, player, msg.getFirstPlacementInfo()) == false) return false; - cityObject = City.getCity(serverZone.playerCityID); + cityObject = City.getCity(serverZone.playerCityUUID); // We need to be able to access how much gold a character is carrying @@ -1229,7 +1229,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { shrineType = Shrine.getShrineTypeByBlueprintUUID(blueprint.getBlueprintUUID()); - city = City.getCity(currentZone.playerCityID); + city = City.getCity(currentZone.playerCityUUID); if (city == null) return false; @@ -1294,7 +1294,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { return false; } - city = City.getCity(currentZone.playerCityID); + city = City.getCity(currentZone.playerCityUUID); if (city == null) return false; @@ -1369,7 +1369,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { newMesh.runAfterLoad(); } else if (ago.getObjectType() == GameObjectType.Warehouse) { Warehouse warehouse = (Warehouse) ago; - City city = City.getCity(currentZone.playerCityID); + City city = City.getCity(currentZone.playerCityUUID); if (city == null) return true; diff --git a/src/engine/net/client/handlers/RepairBuildingMsgHandler.java b/src/engine/net/client/handlers/RepairBuildingMsgHandler.java index 9582b269..615d0045 100644 --- a/src/engine/net/client/handlers/RepairBuildingMsgHandler.java +++ b/src/engine/net/client/handlers/RepairBuildingMsgHandler.java @@ -44,11 +44,11 @@ public class RepairBuildingMsgHandler extends AbstractClientMsgHandler { serverZone = ZoneManager.findSmallestZone(pc.getLoc()); - if (serverZone.playerCityID == 0 && targetBuilding.getBlueprint() != null && targetBuilding.getBlueprint().getBuildingGroup() != BuildingGroup.MINE) + if (serverZone.playerCityUUID == 0 && targetBuilding.getBlueprint() != null && targetBuilding.getBlueprint().getBuildingGroup() != BuildingGroup.MINE) return; - City city = City.GetCityFromCache(serverZone.playerCityID); + City city = City.GetCityFromCache(serverZone.playerCityUUID); if (city != null) { if (city.getBane() != null && city.protectionEnforced == false) diff --git a/src/engine/net/client/msg/CityAssetMsg.java b/src/engine/net/client/msg/CityAssetMsg.java index 0d8490d7..6d3dc207 100644 --- a/src/engine/net/client/msg/CityAssetMsg.java +++ b/src/engine/net/client/msg/CityAssetMsg.java @@ -92,7 +92,7 @@ public class CityAssetMsg extends ClientNetMsg { return; } - city = City.getCity(zone.playerCityID); + city = City.getCity(zone.playerCityUUID); if (city == null) { Logger.debug("Failed to load city data for Tree of life."); diff --git a/src/engine/net/client/msg/GuildTreeStatusMsg.java b/src/engine/net/client/msg/GuildTreeStatusMsg.java index 40538544..19899da3 100644 --- a/src/engine/net/client/msg/GuildTreeStatusMsg.java +++ b/src/engine/net/client/msg/GuildTreeStatusMsg.java @@ -117,8 +117,8 @@ public class GuildTreeStatusMsg extends ClientNetMsg { city = null; if (cityZone != null) - if (cityZone.isPlayerCity) - city = City.GetCityFromCache(cityZone.playerCityID); + if (cityZone.isGuildZone) + city = City.GetCityFromCache(cityZone.playerCityUUID); else if (this.treeOfLife != null && this.treeOfLife.getGuild() != null) city = this.treeOfLife.getGuild().getOwnedCity(); diff --git a/src/engine/net/client/msg/ManageCityAssetsMsg.java b/src/engine/net/client/msg/ManageCityAssetsMsg.java index 94cc837b..9392838e 100644 --- a/src/engine/net/client/msg/ManageCityAssetsMsg.java +++ b/src/engine/net/client/msg/ManageCityAssetsMsg.java @@ -299,8 +299,8 @@ public class ManageCityAssetsMsg extends ClientNetMsg { Set buildings = ZoneManager.findSmallestZone(assetManager.getLoc()).zoneBuildingSet; Building tol = null; - if (playerZone.playerCityID != 0) - city = City.GetCityFromCache(playerZone.playerCityID); + if (playerZone.playerCityUUID != 0) + city = City.GetCityFromCache(playerZone.playerCityUUID); if (city != null) tol = city.getTOL(); @@ -368,7 +368,7 @@ public class ManageCityAssetsMsg extends ClientNetMsg { if (zone == null) return; - City banedCity = City.getCity(zone.playerCityID); + City banedCity = City.getCity(zone.playerCityUUID); if (banedCity == null) return; @@ -621,9 +621,9 @@ public class ManageCityAssetsMsg extends ClientNetMsg { } else { writer.putInt(1); //kos on/off? writer.putInt(3); // was 3 - if (zone.playerCityID != 0 && asset.assetIsProtected()) { + if (zone.playerCityUUID != 0 && asset.assetIsProtected()) { writer.putInt(GameObjectType.Building.ordinal()); - writer.putInt(City.getCity(zone.playerCityID).getTOL().getObjectUUID()); + writer.putInt(City.getCity(zone.playerCityUUID).getTOL().getObjectUUID()); } else { writer.putInt(0); writer.putInt(0); diff --git a/src/engine/net/client/msg/ViewResourcesMessage.java b/src/engine/net/client/msg/ViewResourcesMessage.java index 55a4eab0..0bb3ff74 100644 --- a/src/engine/net/client/msg/ViewResourcesMessage.java +++ b/src/engine/net/client/msg/ViewResourcesMessage.java @@ -73,7 +73,7 @@ public class ViewResourcesMessage extends ClientNetMsg { if (this.warehouseBuilding.getParentZone() == null) return false; - this.city = (City) DbManager.getObject(Enum.GameObjectType.City, this.warehouseBuilding.getParentZone().playerCityID); + this.city = (City) DbManager.getObject(Enum.GameObjectType.City, this.warehouseBuilding.getParentZone().playerCityUUID); if (this.city == null) return false; diff --git a/src/engine/objects/Bane.java b/src/engine/objects/Bane.java index 38f50ff9..4578d653 100644 --- a/src/engine/objects/Bane.java +++ b/src/engine/objects/Bane.java @@ -162,8 +162,8 @@ public final class Bane { // Cannot place assets on a dead tree - if ((cityZone.isPlayerCity) && - (City.getCity(cityZone.playerCityID).getTOL().getRank() == -1)) { + if ((cityZone.isGuildZone) && + (City.getCity(cityZone.playerCityUUID).getTOL().getRank() == -1)) { PlaceAssetMsg.sendPlaceAssetError(origin, 1, "Cannot bane a dead tree!"); return false; } diff --git a/src/engine/objects/Building.java b/src/engine/objects/Building.java index 33cf5b06..d172b0bf 100644 --- a/src/engine/objects/Building.java +++ b/src/engine/objects/Building.java @@ -460,10 +460,10 @@ public class Building extends AbstractWorldObject { } } } - if (this.parentZone.isPlayerCity == false) + if (this.parentZone.isGuildZone == false) return null; - return City.getCity(this.parentZone.playerCityID); + return City.getCity(this.parentZone.playerCityUUID); } diff --git a/src/engine/objects/City.java b/src/engine/objects/City.java index 834b155e..5ab37717 100644 --- a/src/engine/objects/City.java +++ b/src/engine/objects/City.java @@ -334,7 +334,7 @@ public class City extends AbstractWorldObject { if (city.noTeleport) continue; - if (city.parentZone != null && city.parentZone.isPlayerCity) { + if (city.parentZone != null && city.parentZone.isGuildZone) { if (pc.getAccount().status.equals(AccountStatus.ADMIN)) { cities.add(city); @@ -395,7 +395,7 @@ public class City extends AbstractWorldObject { if (city.noRepledge) continue; - if (city.parentZone != null && city.parentZone.isPlayerCity) { + if (city.parentZone != null && city.parentZone.isGuildZone) { //list Player cities //open city, just list diff --git a/src/engine/objects/ItemFactory.java b/src/engine/objects/ItemFactory.java index 20229512..abac878f 100644 --- a/src/engine/objects/ItemFactory.java +++ b/src/engine/objects/ItemFactory.java @@ -104,7 +104,7 @@ public class ItemFactory { if (zone == null) return null; - City city = City.getCity(zone.playerCityID); + City city = City.getCity(zone.playerCityUUID); if (city == null) return null; @@ -796,7 +796,7 @@ public class ItemFactory { if (zone == null) return null; - City city = City.getCity(zone.playerCityID); + City city = City.getCity(zone.playerCityUUID); if (city == null) return null; diff --git a/src/engine/objects/NPC.java b/src/engine/objects/NPC.java index 662c8a46..d3d914ce 100644 --- a/src/engine/objects/NPC.java +++ b/src/engine/objects/NPC.java @@ -894,7 +894,7 @@ public class NPC extends AbstractCharacter { this.stamina.set(this.staminaMax); } - if (this.parentZone.isPlayerCity) + if (this.parentZone.isGuildZone) if (NPC.GetNPCProfits(this) == null) NPCProfits.CreateProfits(this); @@ -1192,7 +1192,7 @@ public class NPC extends AbstractCharacter { if (serverZone == null) return null; - city = City.GetCityFromCache(serverZone.playerCityID); + city = City.GetCityFromCache(serverZone.playerCityUUID); if (city == null) { diff --git a/src/engine/objects/Warehouse.java b/src/engine/objects/Warehouse.java index effb2a83..9b55a1f7 100644 --- a/src/engine/objects/Warehouse.java +++ b/src/engine/objects/Warehouse.java @@ -1272,7 +1272,7 @@ public class Warehouse extends AbstractWorldObject { return; } - City city = City.getCity(cityZone.playerCityID); + City city = City.getCity(cityZone.playerCityUUID); if (city == null) { Logger.error("Failed to load City for Warehouse with UUID " + this.getObjectUUID()); diff --git a/src/engine/objects/Zone.java b/src/engine/objects/Zone.java index 400c7def..ece867c3 100644 --- a/src/engine/objects/Zone.java +++ b/src/engine/objects/Zone.java @@ -33,12 +33,12 @@ public class Zone extends AbstractGameObject { public final Set zoneBuildingSet = Collections.newSetFromMap(new ConcurrentHashMap<>()); public final Set zoneNPCSet = Collections.newSetFromMap(new ConcurrentHashMap<>()); public final Set zoneMobSet = Collections.newSetFromMap(new ConcurrentHashMap<>()); - public final int playerCityID; + public final int playerCityUUID; public final String zoneName; - public final float xCoord; - public final float zCoord; - public final float yCoord; - public final int loadNum; + public final float xOffset; + public final float zOffset; + public final float yOffset; + public final int zoneTemplate; public final byte peaceZone; public final String Icon1; public final String Icon2; @@ -54,13 +54,13 @@ public class Zone extends AbstractGameObject { public Zone parent = null; public Bounds bounds; public boolean isNPCCity = false; - public boolean isPlayerCity = false; + public boolean isGuildZone; public String hash; public float worldAltitude = 0; public float seaLevel = 0f; public static final Set respawnQue = Collections.newSetFromMap(new ConcurrentHashMap<>()); public static long lastRespawn = 0; - public Bounds maxBlend; + public Bounds blendBounds; /** * ResultSet Constructor @@ -68,22 +68,21 @@ public class Zone extends AbstractGameObject { public Zone(ResultSet rs) throws SQLException { super(rs); this.parentZoneID = rs.getInt("parent"); - this.playerCityID = rs.getInt("isPlayerCity"); - this.isPlayerCity = this.playerCityID != 0; + this.playerCityUUID = rs.getInt("playerCityUUID"); + this.isGuildZone = this.playerCityUUID != 0; this.zoneName = rs.getString("Name"); - this.xCoord = rs.getFloat("XCoord"); - this.zCoord = rs.getFloat("ZCoord"); - this.yCoord = rs.getFloat("YOffset"); - this.loadNum = rs.getInt("LoadNum"); - this.peaceZone = rs.getByte("SafeZone"); - this.Icon1 = rs.getString("Icon1"); - this.Icon2 = rs.getString("Icon2"); - this.Icon3 = rs.getString("Icon3"); + this.xOffset = rs.getFloat("xOffset"); + this.zOffset = rs.getFloat("zOffset"); + this.yOffset = rs.getFloat("yOffset"); + this.zoneTemplate = rs.getInt("zoneTemplate"); + this.peaceZone = rs.getByte("paceZone"); + this.Icon1 = rs.getString("icon1"); + this.Icon2 = rs.getString("icon2"); + this.Icon3 = rs.getString("icon3"); + this.minLvl = rs.getInt("min_level"); + this.maxLvl = rs.getInt("max_level"); this.hash = rs.getString("hash"); - this.minLvl = rs.getInt("minLvl"); - this.maxLvl = rs.getInt("maxLvl"); - //this needs to be here specifically for new zones created after server boot (e.g. player city zones) Zone parentZone = ZoneManager.getZoneByUUID(parentZoneID); @@ -107,28 +106,28 @@ public class Zone extends AbstractGameObject { public static void serializeForClientMsg(Zone zone, ByteBufferWriter writer) { - if (zone.loadNum == 0 && zone.playerCityID == 0) + if (zone.zoneTemplate == 0 && zone.playerCityUUID == 0) Logger.warn("Warning! WorldServerMap with ID " + zone.getObjectUUID() + " has a loadnum of 0 (player city) and no city linked. This will probably crash the client!"); // Player City Terraform values serialized here. - if (zone.playerCityID > 0) { + if (zone.playerCityUUID > 0) { writer.put((byte) 1); // Player City - True writer.putFloat(Enum.CityBoundsType.ZONE.halfExtents); writer.putFloat(Enum.CityBoundsType.ZONE.halfExtents); } else writer.put((byte) 0); // Player City - False - writer.putFloat(zone.xCoord); - writer.putFloat(zone.zCoord); - writer.putFloat(zone.yCoord); + writer.putFloat(zone.xOffset); + writer.putFloat(zone.zOffset); + writer.putFloat(zone.yOffset); writer.putInt(0); writer.putInt(0); - writer.putInt(zone.loadNum); + writer.putInt(zone.zoneTemplate); - if (zone.playerCityID > 0) { - City k = City.getCity(zone.playerCityID); + if (zone.playerCityUUID > 0) { + City k = City.getCity(zone.playerCityUUID); if (k != null) { writer.putInt(k.getObjectType().ordinal()); @@ -141,7 +140,7 @@ public class Zone extends AbstractGameObject { } writer.putInt(zone.nodes.size()); - City city = City.getCity(zone.playerCityID); + City city = City.getCity(zone.playerCityUUID); if (city != null) writer.putString(city.getCityName()); @@ -168,7 +167,7 @@ public class Zone extends AbstractGameObject { this.bounds = Bounds.borrow(); - Vector2f zoneSize = ZoneManager._zone_size_data.get(this.loadNum); + Vector2f zoneSize = ZoneManager._zone_size_data.get(this.zoneTemplate); // Default to player zone size on error? Maybe log this @@ -182,10 +181,10 @@ public class Zone extends AbstractGameObject { // Set heightmap blending bounds if (heightMap == null) { - this.maxBlend = bounds; + this.blendBounds = bounds; } else { - this.maxBlend = Bounds.borrow(); - this.maxBlend.setBounds(new Vector2f(this.absX, this.absZ), bounds.getHalfExtents().subtract(heightMap.zone_minBlend, heightMap.zone_minBlend), 0.0f); + this.blendBounds = Bounds.borrow(); + this.blendBounds.setBounds(new Vector2f(this.absX, this.absZ), bounds.getHalfExtents().subtract(heightMap.zone_minBlend, heightMap.zone_minBlend), 0.0f); } } @@ -198,17 +197,17 @@ public class Zone extends AbstractGameObject { // Seafloor if (this.parent == null) { - this.absX = this.xCoord; + this.absX = this.xOffset; this.absY = MBServerStatics.SEA_FLOOR_ALTITUDE; - this.absZ = this.zCoord; + this.absZ = this.zOffset; this.seaLevel = 0; this.setBounds(); return; } - this.absX = this.xCoord + parent.absX; - this.absY = this.yCoord + parent.absY; - this.absZ = this.zCoord + parent.absZ; + this.absX = this.xOffset + parent.absX; + this.absY = this.yOffset + parent.absY; + this.absZ = this.zOffset + parent.absZ; if (this.minLvl == 0 || this.maxLvl == 0) { this.minLvl = this.parent.minLvl; @@ -239,7 +238,7 @@ public class Zone extends AbstractGameObject { // Macro zones have icons. - if (this.isPlayerCity == true) + if (this.isGuildZone == true) return false; if (this.parent == null) @@ -311,10 +310,10 @@ public class Zone extends AbstractGameObject { public HeightMap getHeightMap() { - if (this.isPlayerCity) + if (this.isGuildZone) return HeightMap.PlayerCityHeightMap; - return HeightMap.heightmapByLoadNum.get(this.loadNum); + return HeightMap.heightmapByLoadNum.get(this.zoneTemplate); } } diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index da1437f1..06156bad 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -469,7 +469,7 @@ public class WorldServer { for (Zone zone : ZoneManager.getAllZones()) { if (zone.getHeightMap() != null) { if (zone.getHeightMap().bucketWidthX == 0) { - System.out.println("Zone load num: " + zone.loadNum + " has no bucket width"); + System.out.println("Zone load num: " + zone.zoneTemplate + " has no bucket width"); } } } @@ -565,7 +565,7 @@ public class WorldServer { for (Zone zone : rootParent) { - ZoneManager.addZone(zone.loadNum, zone); + ZoneManager.addZone(zone.zoneTemplate, zone); //Handle Buildings