From be107c08588b73c022a4c70913251bb8947925d8 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Wed, 20 Sep 2023 16:05:57 -0400 Subject: [PATCH] class and table schema now conform to JSON --- src/engine/devcmd/cmds/AddMobCmd.java | 2 +- src/engine/devcmd/cmds/GotoCmd.java | 4 ++-- src/engine/devcmd/cmds/MakeBaneCmd.java | 2 +- src/engine/devcmd/cmds/PurgeObjectsCmd.java | 2 +- src/engine/devcmd/cmds/RemoveBaneCmd.java | 2 +- src/engine/devcmd/cmds/SetBaneActiveCmd.java | 2 +- src/engine/gameManager/ZoneManager.java | 10 +++++----- .../client/handlers/AbandonAssetMsgHandler.java | 2 +- .../net/client/handlers/ChannelMuteMsgHandler.java | 2 +- .../client/handlers/ManageCityAssetMsgHandler.java | 2 +- .../client/handlers/ObjectActionMsgHandler.java | 2 +- .../net/client/handlers/PlaceAssetMsgHandler.java | 10 +++++----- src/engine/net/client/msg/GuildTreeStatusMsg.java | 2 +- src/engine/objects/AbstractIntelligenceAgent.java | 2 +- src/engine/objects/Bane.java | 2 +- src/engine/objects/Building.java | 2 +- src/engine/objects/City.java | 4 ++-- src/engine/objects/NPC.java | 2 +- src/engine/objects/PlayerCharacter.java | 8 ++++---- src/engine/objects/Zone.java | 14 +++++++------- 20 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/engine/devcmd/cmds/AddMobCmd.java b/src/engine/devcmd/cmds/AddMobCmd.java index 57459f67..1bb09c47 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.isGuildZone) { + if (zone.guild_zone) { throwbackError(pc, "Cannot use ./mob on Player cities. Try ./servermob instead."); return; } diff --git a/src/engine/devcmd/cmds/GotoCmd.java b/src/engine/devcmd/cmds/GotoCmd.java index 3d7550c1..93ae4e5f 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.isGuildZone) + if (zone.isNPCCity || zone.guild_zone) 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.isGuildZone) + if (zone.isNPCCity || zone.guild_zone) loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS); else loc = zone.getLoc(); diff --git a/src/engine/devcmd/cmds/MakeBaneCmd.java b/src/engine/devcmd/cmds/MakeBaneCmd.java index 829ca955..4b4b379d 100644 --- a/src/engine/devcmd/cmds/MakeBaneCmd.java +++ b/src/engine/devcmd/cmds/MakeBaneCmd.java @@ -111,7 +111,7 @@ public class MakeBaneCmd extends AbstractDevCmd { return; } - if (!zone.isGuildZone) { + if (!zone.guild_zone) { throwbackError(pc, "This is not a player city."); return; } diff --git a/src/engine/devcmd/cmds/PurgeObjectsCmd.java b/src/engine/devcmd/cmds/PurgeObjectsCmd.java index b32e1480..23c5a1c8 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.isGuildZone) + if (!zone.guild_zone) return; for (Building building : zone.zoneBuildingSet) { diff --git a/src/engine/devcmd/cmds/RemoveBaneCmd.java b/src/engine/devcmd/cmds/RemoveBaneCmd.java index 1669265c..cb720307 100644 --- a/src/engine/devcmd/cmds/RemoveBaneCmd.java +++ b/src/engine/devcmd/cmds/RemoveBaneCmd.java @@ -34,7 +34,7 @@ public class RemoveBaneCmd extends AbstractDevCmd { return; } - if (!zone.isGuildZone) { + if (!zone.guild_zone) { throwbackError(pc, "This is not a player city."); return; } diff --git a/src/engine/devcmd/cmds/SetBaneActiveCmd.java b/src/engine/devcmd/cmds/SetBaneActiveCmd.java index b1caccb9..caf1615f 100644 --- a/src/engine/devcmd/cmds/SetBaneActiveCmd.java +++ b/src/engine/devcmd/cmds/SetBaneActiveCmd.java @@ -41,7 +41,7 @@ public class SetBaneActiveCmd extends AbstractDevCmd { return; } - if (!zone.isGuildZone) { + if (!zone.guild_zone) { throwbackError(pc, "This is not a player city."); return; } diff --git a/src/engine/gameManager/ZoneManager.java b/src/engine/gameManager/ZoneManager.java index 65ab0177..13749067 100644 --- a/src/engine/gameManager/ZoneManager.java +++ b/src/engine/gameManager/ZoneManager.java @@ -194,7 +194,7 @@ public enum ZoneManager { } - if (zone.isGuildZone) { + if (zone.guild_zone) { addPlayerCityZone(zone); return; } @@ -214,7 +214,7 @@ public enum ZoneManager { } public static final void addPlayerCityZone(final Zone zone) { - zone.isGuildZone = true; + zone.guild_zone = true; ZoneManager.playerCityZones.add(zone); } @@ -250,7 +250,7 @@ public enum ZoneManager { public static final boolean validHotZone(Zone zone) { - if (zone.peaceZone == (byte) 1) + if (zone.peace_zone == (byte) 1) return false; // no safe zone hotzones// if (this.hotzone == null) if (zone.getNodes().isEmpty()) @@ -387,7 +387,7 @@ public enum ZoneManager { currentZone = ZoneManager.findSmallestZone(worldLoc); - if (currentZone.isGuildZone) + if (currentZone.guild_zone) return City.getCity(currentZone.playerCityUUID); return null; @@ -440,7 +440,7 @@ public enum ZoneManager { //not player city, must be npc city.. - if (!zone.isGuildZone) + if (!zone.guild_zone) zone.isNPCCity = true; if ((ConfigManager.serverType.equals(Enum.ServerType.WORLDSERVER)) && (city.getHash() == null)) { diff --git a/src/engine/net/client/handlers/AbandonAssetMsgHandler.java b/src/engine/net/client/handlers/AbandonAssetMsgHandler.java index aea94ffd..fbbcea93 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.isGuildZone == false) + if (cityZone.guild_zone == false) return; if (targetBuilding.getCity() == null) diff --git a/src/engine/net/client/handlers/ChannelMuteMsgHandler.java b/src/engine/net/client/handlers/ChannelMuteMsgHandler.java index b6d3ddbb..1e71fe89 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.isGuildZone == false) + if (cityZone.guild_zone == false) return; if (targetBuilding.getCity().hasBeenTransfered == true) { diff --git a/src/engine/net/client/handlers/ManageCityAssetMsgHandler.java b/src/engine/net/client/handlers/ManageCityAssetMsgHandler.java index 4672efc0..a2e7726b 100644 --- a/src/engine/net/client/handlers/ManageCityAssetMsgHandler.java +++ b/src/engine/net/client/handlers/ManageCityAssetMsgHandler.java @@ -75,7 +75,7 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler { Zone zone = ZoneManager.findSmallestZone(player.getLoc()); - if (!zone.isGuildZone) { + if (!zone.guild_zone) { ErrorPopupMsg.sendErrorMsg(player, "Unable to find city to command."); return true; } diff --git a/src/engine/net/client/handlers/ObjectActionMsgHandler.java b/src/engine/net/client/handlers/ObjectActionMsgHandler.java index fad51445..5f4c4451 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.isGuildZone) { + if (zone.guild_zone) { loc = zone.getLoc(); } } diff --git a/src/engine/net/client/handlers/PlaceAssetMsgHandler.java b/src/engine/net/client/handlers/PlaceAssetMsgHandler.java index 4efb7add..6ef021a3 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.isGuildZone == false) { + if (serverZone.guild_zone == false) { PlaceAssetMsg.sendPlaceAssetError(origin, 52, player.getName()); return false; } @@ -201,7 +201,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { // Cannot place assets on a dead tree - if ((serverZone.isGuildZone) + if ((serverZone.guild_zone) && (City.getCity(serverZone.playerCityUUID).getTOL().getRank() == -1)) { PlaceAssetMsg.sendPlaceAssetError(origin, 1, "Cannot place asset on dead tree until world heals"); return false; @@ -261,7 +261,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { // Must be a player city - if (serverZone.isGuildZone == false) { + if (serverZone.guild_zone == false) { PlaceAssetMsg.sendPlaceAssetError(origin, 41, player.getName()); // Cannot place outside a guild zone return false; } @@ -571,7 +571,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { // No valid player city found - if (serverCity == null || serverCity.getParent().isGuildZone == false) { + if (serverCity == null || serverCity.getParent().guild_zone == 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.isGuildZone = true; + zoneObject.guild_zone = true; if (zoneObject.parent != null) zoneObject.parent.addNode(zoneObject); //add as child to parent diff --git a/src/engine/net/client/msg/GuildTreeStatusMsg.java b/src/engine/net/client/msg/GuildTreeStatusMsg.java index 19899da3..8b108589 100644 --- a/src/engine/net/client/msg/GuildTreeStatusMsg.java +++ b/src/engine/net/client/msg/GuildTreeStatusMsg.java @@ -117,7 +117,7 @@ public class GuildTreeStatusMsg extends ClientNetMsg { city = null; if (cityZone != null) - if (cityZone.isGuildZone) + if (cityZone.guild_zone) city = City.GetCityFromCache(cityZone.playerCityUUID); else if (this.treeOfLife != null && this.treeOfLife.getGuild() != null) city = this.treeOfLife.getGuild().getOwnedCity(); diff --git a/src/engine/objects/AbstractIntelligenceAgent.java b/src/engine/objects/AbstractIntelligenceAgent.java index 2c9313a3..783029cc 100644 --- a/src/engine/objects/AbstractIntelligenceAgent.java +++ b/src/engine/objects/AbstractIntelligenceAgent.java @@ -130,7 +130,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter { ArrayList allIn = ZoneManager.getAllZonesIn(this.getLoc()); for (Zone zone : allIn) - if (zone.peaceZone == (byte) 1) + if (zone.peace_zone == (byte) 1) return true; return false; diff --git a/src/engine/objects/Bane.java b/src/engine/objects/Bane.java index 4578d653..61c9cfb7 100644 --- a/src/engine/objects/Bane.java +++ b/src/engine/objects/Bane.java @@ -162,7 +162,7 @@ public final class Bane { // Cannot place assets on a dead tree - if ((cityZone.isGuildZone) && + if ((cityZone.guild_zone) && (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 d172b0bf..442d3513 100644 --- a/src/engine/objects/Building.java +++ b/src/engine/objects/Building.java @@ -460,7 +460,7 @@ public class Building extends AbstractWorldObject { } } } - if (this.parentZone.isGuildZone == false) + if (this.parentZone.guild_zone == false) return null; return City.getCity(this.parentZone.playerCityUUID); diff --git a/src/engine/objects/City.java b/src/engine/objects/City.java index 5ab37717..d1820480 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.isGuildZone) { + if (city.parentZone != null && city.parentZone.guild_zone) { 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.isGuildZone) { + if (city.parentZone != null && city.parentZone.guild_zone) { //list Player cities //open city, just list diff --git a/src/engine/objects/NPC.java b/src/engine/objects/NPC.java index d3d914ce..bfb64654 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.isGuildZone) + if (this.parentZone.guild_zone) if (NPC.GetNPCProfits(this) == null) NPCProfits.CreateProfits(this); diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 170d0cec..a1381bb8 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -1703,7 +1703,7 @@ public class PlayerCharacter extends AbstractCharacter { Zone zone = ZoneManager.findSmallestZone(this.getLoc()); if (zone != null) { - return zone.peaceZone == (byte) 1; + return zone.peace_zone == (byte) 1; } return false; @@ -1797,7 +1797,7 @@ public class PlayerCharacter extends AbstractCharacter { //DeathShroud - if (zone.peaceZone == 0) + if (zone.peace_zone == 0) PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false); //enable this to give players deathshroud if mobs kill player. @@ -1843,7 +1843,7 @@ public class PlayerCharacter extends AbstractCharacter { //DeathShroud - if (zone.peaceZone == 0) + if (zone.peace_zone == 0) PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false); if (doPVPEXP) { @@ -1898,7 +1898,7 @@ public class PlayerCharacter extends AbstractCharacter { killCleanup(); Zone zone = ZoneManager.findSmallestZone(this.getLoc()); - if (zone.peaceZone == 0) + if (zone.peace_zone == 0) PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false); // Send death message if needed diff --git a/src/engine/objects/Zone.java b/src/engine/objects/Zone.java index f9a715cd..7d8a484c 100644 --- a/src/engine/objects/Zone.java +++ b/src/engine/objects/Zone.java @@ -39,7 +39,7 @@ public class Zone extends AbstractGameObject { public final float zOffset; public final float yOffset; public final int zoneTemplate; - public final byte peaceZone; + public final byte peace_zone; public final String Icon1; public final String Icon2; public final String Icon3; @@ -54,7 +54,7 @@ public class Zone extends AbstractGameObject { public Zone parent = null; public Bounds bounds; public boolean isNPCCity = false; - public boolean isGuildZone; + public boolean guild_zone; public String hash; public float worldAltitude = 0; public float seaLevel = 0f; @@ -69,13 +69,13 @@ public class Zone extends AbstractGameObject { super(rs); this.parentZoneID = rs.getInt("parent"); this.playerCityUUID = rs.getInt("playerCityUUID"); - this.isGuildZone = this.playerCityUUID != 0; + this.guild_zone = this.playerCityUUID != 0; this.zoneName = rs.getString("zoneName"); this.xOffset = rs.getFloat("xOffset"); this.zOffset = rs.getFloat("zOffset"); this.yOffset = rs.getFloat("yOffset"); this.zoneTemplate = rs.getInt("template"); - this.peaceZone = rs.getByte("peaceZone"); + this.peace_zone = rs.getByte("peace_zone"); this.Icon1 = rs.getString("icon1"); this.Icon2 = rs.getString("icon2"); this.Icon3 = rs.getString("icon3"); @@ -146,7 +146,7 @@ public class Zone extends AbstractGameObject { writer.putString(city.getCityName()); else writer.putString(zone.zoneName); - writer.put(zone.peaceZone); + writer.put(zone.peace_zone); writer.putString(zone.Icon1); writer.putString(zone.Icon2); writer.putString(zone.Icon3); @@ -238,7 +238,7 @@ public class Zone extends AbstractGameObject { // Macro zones have icons. - if (this.isGuildZone == true) + if (this.guild_zone == true) return false; if (this.parent == null) @@ -310,7 +310,7 @@ public class Zone extends AbstractGameObject { public HeightMap getHeightMap() { - if (this.isGuildZone) + if (this.guild_zone) return HeightMap.PlayerCityHeightMap; return HeightMap.heightmapByLoadNum.get(this.zoneTemplate);