Browse Source

class and table schema now conform to JSON

magicbox-1.5.2
MagicBot 1 year ago
parent
commit
be107c0858
  1. 2
      src/engine/devcmd/cmds/AddMobCmd.java
  2. 4
      src/engine/devcmd/cmds/GotoCmd.java
  3. 2
      src/engine/devcmd/cmds/MakeBaneCmd.java
  4. 2
      src/engine/devcmd/cmds/PurgeObjectsCmd.java
  5. 2
      src/engine/devcmd/cmds/RemoveBaneCmd.java
  6. 2
      src/engine/devcmd/cmds/SetBaneActiveCmd.java
  7. 10
      src/engine/gameManager/ZoneManager.java
  8. 2
      src/engine/net/client/handlers/AbandonAssetMsgHandler.java
  9. 2
      src/engine/net/client/handlers/ChannelMuteMsgHandler.java
  10. 2
      src/engine/net/client/handlers/ManageCityAssetMsgHandler.java
  11. 2
      src/engine/net/client/handlers/ObjectActionMsgHandler.java
  12. 10
      src/engine/net/client/handlers/PlaceAssetMsgHandler.java
  13. 2
      src/engine/net/client/msg/GuildTreeStatusMsg.java
  14. 2
      src/engine/objects/AbstractIntelligenceAgent.java
  15. 2
      src/engine/objects/Bane.java
  16. 2
      src/engine/objects/Building.java
  17. 4
      src/engine/objects/City.java
  18. 2
      src/engine/objects/NPC.java
  19. 8
      src/engine/objects/PlayerCharacter.java
  20. 14
      src/engine/objects/Zone.java

2
src/engine/devcmd/cmds/AddMobCmd.java

@ -78,7 +78,7 @@ public class AddMobCmd extends AbstractDevCmd {
return; return;
} }
if (zone.isGuildZone) { if (zone.guild_zone) {
throwbackError(pc, "Cannot use ./mob on Player cities. Try ./servermob instead."); throwbackError(pc, "Cannot use ./mob on Player cities. Try ./servermob instead.");
return; return;
} }

4
src/engine/devcmd/cmds/GotoCmd.java

@ -81,7 +81,7 @@ public class GotoCmd extends AbstractDevCmd {
continue; continue;
Zone zone = city.getParent(); Zone zone = city.getParent();
if (zone != null) { if (zone != null) {
if (zone.isNPCCity || zone.isGuildZone) if (zone.isNPCCity || zone.guild_zone)
loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS); loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
else else
loc = zone.getLoc(); loc = zone.getLoc();
@ -100,7 +100,7 @@ public class GotoCmd extends AbstractDevCmd {
if (!zone.zoneName.equalsIgnoreCase(cityName)) if (!zone.zoneName.equalsIgnoreCase(cityName))
continue; continue;
if (zone != null) { if (zone != null) {
if (zone.isNPCCity || zone.isGuildZone) if (zone.isNPCCity || zone.guild_zone)
loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS); loc = Vector3fImmutable.getRandomPointOnCircle(zone.getLoc(), MBServerStatics.TREE_TELEPORT_RADIUS);
else else
loc = zone.getLoc(); loc = zone.getLoc();

2
src/engine/devcmd/cmds/MakeBaneCmd.java

@ -111,7 +111,7 @@ public class MakeBaneCmd extends AbstractDevCmd {
return; return;
} }
if (!zone.isGuildZone) { if (!zone.guild_zone) {
throwbackError(pc, "This is not a player city."); throwbackError(pc, "This is not a player city.");
return; return;
} }

2
src/engine/devcmd/cmds/PurgeObjectsCmd.java

@ -42,7 +42,7 @@ public class PurgeObjectsCmd extends AbstractDevCmd {
private static void PurgeWalls(Zone zone, PlayerCharacter pc) { private static void PurgeWalls(Zone zone, PlayerCharacter pc) {
if (!zone.isGuildZone) if (!zone.guild_zone)
return; return;
for (Building building : zone.zoneBuildingSet) { for (Building building : zone.zoneBuildingSet) {

2
src/engine/devcmd/cmds/RemoveBaneCmd.java

@ -34,7 +34,7 @@ public class RemoveBaneCmd extends AbstractDevCmd {
return; return;
} }
if (!zone.isGuildZone) { if (!zone.guild_zone) {
throwbackError(pc, "This is not a player city."); throwbackError(pc, "This is not a player city.");
return; return;
} }

2
src/engine/devcmd/cmds/SetBaneActiveCmd.java

@ -41,7 +41,7 @@ public class SetBaneActiveCmd extends AbstractDevCmd {
return; return;
} }
if (!zone.isGuildZone) { if (!zone.guild_zone) {
throwbackError(pc, "This is not a player city."); throwbackError(pc, "This is not a player city.");
return; return;
} }

10
src/engine/gameManager/ZoneManager.java

@ -194,7 +194,7 @@ public enum ZoneManager {
} }
if (zone.isGuildZone) { if (zone.guild_zone) {
addPlayerCityZone(zone); addPlayerCityZone(zone);
return; return;
} }
@ -214,7 +214,7 @@ public enum ZoneManager {
} }
public static final void addPlayerCityZone(final Zone zone) { public static final void addPlayerCityZone(final Zone zone) {
zone.isGuildZone = true; zone.guild_zone = true;
ZoneManager.playerCityZones.add(zone); ZoneManager.playerCityZones.add(zone);
} }
@ -250,7 +250,7 @@ public enum ZoneManager {
public static final boolean validHotZone(Zone zone) { 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) return false; // no safe zone hotzones// if (this.hotzone == null)
if (zone.getNodes().isEmpty()) if (zone.getNodes().isEmpty())
@ -387,7 +387,7 @@ public enum ZoneManager {
currentZone = ZoneManager.findSmallestZone(worldLoc); currentZone = ZoneManager.findSmallestZone(worldLoc);
if (currentZone.isGuildZone) if (currentZone.guild_zone)
return City.getCity(currentZone.playerCityUUID); return City.getCity(currentZone.playerCityUUID);
return null; return null;
@ -440,7 +440,7 @@ public enum ZoneManager {
//not player city, must be npc city.. //not player city, must be npc city..
if (!zone.isGuildZone) if (!zone.guild_zone)
zone.isNPCCity = true; zone.isNPCCity = true;
if ((ConfigManager.serverType.equals(Enum.ServerType.WORLDSERVER)) && (city.getHash() == null)) { if ((ConfigManager.serverType.equals(Enum.ServerType.WORLDSERVER)) && (city.getHash() == null)) {

2
src/engine/net/client/handlers/AbandonAssetMsgHandler.java

@ -151,7 +151,7 @@ public class AbandonAssetMsgHandler extends AbstractClientMsgHandler {
cityZone = ZoneManager.findSmallestZone(targetBuilding.getLoc()); cityZone = ZoneManager.findSmallestZone(targetBuilding.getLoc());
// Can't abandon a tree not within a player city zone // Can't abandon a tree not within a player city zone
if (cityZone.isGuildZone == false) if (cityZone.guild_zone == false)
return; return;
if (targetBuilding.getCity() == null) if (targetBuilding.getCity() == null)

2
src/engine/net/client/handlers/ChannelMuteMsgHandler.java

@ -65,7 +65,7 @@ public class ChannelMuteMsgHandler extends AbstractClientMsgHandler {
cityZone = ZoneManager.findSmallestZone(targetBuilding.getLoc()); cityZone = ZoneManager.findSmallestZone(targetBuilding.getLoc());
// Can't abandon a tree not within a player city zone // Can't abandon a tree not within a player city zone
if (cityZone.isGuildZone == false) if (cityZone.guild_zone == false)
return; return;
if (targetBuilding.getCity().hasBeenTransfered == true) { if (targetBuilding.getCity().hasBeenTransfered == true) {

2
src/engine/net/client/handlers/ManageCityAssetMsgHandler.java

@ -75,7 +75,7 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
Zone zone = ZoneManager.findSmallestZone(player.getLoc()); Zone zone = ZoneManager.findSmallestZone(player.getLoc());
if (!zone.isGuildZone) { if (!zone.guild_zone) {
ErrorPopupMsg.sendErrorMsg(player, "Unable to find city to command."); ErrorPopupMsg.sendErrorMsg(player, "Unable to find city to command.");
return true; return true;
} }

2
src/engine/net/client/handlers/ObjectActionMsgHandler.java

@ -334,7 +334,7 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
Zone zone = ZoneManager.findSmallestZone(player.getLoc()); Zone zone = ZoneManager.findSmallestZone(player.getLoc());
if (zone != null) { if (zone != null) {
if (zone.isGuildZone) { if (zone.guild_zone) {
loc = zone.getLoc(); loc = zone.getLoc();
} }
} }

10
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) { 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()); PlaceAssetMsg.sendPlaceAssetError(origin, 52, player.getName());
return false; return false;
} }
@ -201,7 +201,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
// Cannot place assets on a dead tree // Cannot place assets on a dead tree
if ((serverZone.isGuildZone) if ((serverZone.guild_zone)
&& (City.getCity(serverZone.playerCityUUID).getTOL().getRank() == -1)) { && (City.getCity(serverZone.playerCityUUID).getTOL().getRank() == -1)) {
PlaceAssetMsg.sendPlaceAssetError(origin, 1, "Cannot place asset on dead tree until world heals"); PlaceAssetMsg.sendPlaceAssetError(origin, 1, "Cannot place asset on dead tree until world heals");
return false; return false;
@ -261,7 +261,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
// Must be a player city // 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 PlaceAssetMsg.sendPlaceAssetError(origin, 41, player.getName()); // Cannot place outside a guild zone
return false; return false;
} }
@ -571,7 +571,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
// No valid player city found // 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 PlaceAssetMsg.sendPlaceAssetError(origin, 52, ""); // Cannot place outisde a guild zone
return false; return false;
} }
@ -783,7 +783,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
// Link the zone with the city and then add // Link the zone with the city and then add
// to the appropriate hash tables and cache // to the appropriate hash tables and cache
zoneObject.isGuildZone = true; zoneObject.guild_zone = true;
if (zoneObject.parent != null) if (zoneObject.parent != null)
zoneObject.parent.addNode(zoneObject); //add as child to parent zoneObject.parent.addNode(zoneObject); //add as child to parent

2
src/engine/net/client/msg/GuildTreeStatusMsg.java

@ -117,7 +117,7 @@ public class GuildTreeStatusMsg extends ClientNetMsg {
city = null; city = null;
if (cityZone != null) if (cityZone != null)
if (cityZone.isGuildZone) if (cityZone.guild_zone)
city = City.GetCityFromCache(cityZone.playerCityUUID); city = City.GetCityFromCache(cityZone.playerCityUUID);
else if (this.treeOfLife != null && this.treeOfLife.getGuild() != null) else if (this.treeOfLife != null && this.treeOfLife.getGuild() != null)
city = this.treeOfLife.getGuild().getOwnedCity(); city = this.treeOfLife.getGuild().getOwnedCity();

2
src/engine/objects/AbstractIntelligenceAgent.java

@ -130,7 +130,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
ArrayList<Zone> allIn = ZoneManager.getAllZonesIn(this.getLoc()); ArrayList<Zone> allIn = ZoneManager.getAllZonesIn(this.getLoc());
for (Zone zone : allIn) for (Zone zone : allIn)
if (zone.peaceZone == (byte) 1) if (zone.peace_zone == (byte) 1)
return true; return true;
return false; return false;

2
src/engine/objects/Bane.java

@ -162,7 +162,7 @@ public final class Bane {
// Cannot place assets on a dead tree // Cannot place assets on a dead tree
if ((cityZone.isGuildZone) && if ((cityZone.guild_zone) &&
(City.getCity(cityZone.playerCityUUID).getTOL().getRank() == -1)) { (City.getCity(cityZone.playerCityUUID).getTOL().getRank() == -1)) {
PlaceAssetMsg.sendPlaceAssetError(origin, 1, "Cannot bane a dead tree!"); PlaceAssetMsg.sendPlaceAssetError(origin, 1, "Cannot bane a dead tree!");
return false; return false;

2
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 null;
return City.getCity(this.parentZone.playerCityUUID); return City.getCity(this.parentZone.playerCityUUID);

4
src/engine/objects/City.java

@ -334,7 +334,7 @@ public class City extends AbstractWorldObject {
if (city.noTeleport) if (city.noTeleport)
continue; continue;
if (city.parentZone != null && city.parentZone.isGuildZone) { if (city.parentZone != null && city.parentZone.guild_zone) {
if (pc.getAccount().status.equals(AccountStatus.ADMIN)) { if (pc.getAccount().status.equals(AccountStatus.ADMIN)) {
cities.add(city); cities.add(city);
@ -395,7 +395,7 @@ public class City extends AbstractWorldObject {
if (city.noRepledge) if (city.noRepledge)
continue; continue;
if (city.parentZone != null && city.parentZone.isGuildZone) { if (city.parentZone != null && city.parentZone.guild_zone) {
//list Player cities //list Player cities
//open city, just list //open city, just list

2
src/engine/objects/NPC.java

@ -894,7 +894,7 @@ public class NPC extends AbstractCharacter {
this.stamina.set(this.staminaMax); this.stamina.set(this.staminaMax);
} }
if (this.parentZone.isGuildZone) if (this.parentZone.guild_zone)
if (NPC.GetNPCProfits(this) == null) if (NPC.GetNPCProfits(this) == null)
NPCProfits.CreateProfits(this); NPCProfits.CreateProfits(this);

8
src/engine/objects/PlayerCharacter.java

@ -1703,7 +1703,7 @@ public class PlayerCharacter extends AbstractCharacter {
Zone zone = ZoneManager.findSmallestZone(this.getLoc()); Zone zone = ZoneManager.findSmallestZone(this.getLoc());
if (zone != null) { if (zone != null) {
return zone.peaceZone == (byte) 1; return zone.peace_zone == (byte) 1;
} }
return false; return false;
@ -1797,7 +1797,7 @@ public class PlayerCharacter extends AbstractCharacter {
//DeathShroud //DeathShroud
if (zone.peaceZone == 0) if (zone.peace_zone == 0)
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false); PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false);
//enable this to give players deathshroud if mobs kill player. //enable this to give players deathshroud if mobs kill player.
@ -1843,7 +1843,7 @@ public class PlayerCharacter extends AbstractCharacter {
//DeathShroud //DeathShroud
if (zone.peaceZone == 0) if (zone.peace_zone == 0)
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false); PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false);
if (doPVPEXP) { if (doPVPEXP) {
@ -1898,7 +1898,7 @@ public class PlayerCharacter extends AbstractCharacter {
killCleanup(); killCleanup();
Zone zone = ZoneManager.findSmallestZone(this.getLoc()); Zone zone = ZoneManager.findSmallestZone(this.getLoc());
if (zone.peaceZone == 0) if (zone.peace_zone == 0)
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false); PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false);
// Send death message if needed // Send death message if needed

14
src/engine/objects/Zone.java

@ -39,7 +39,7 @@ public class Zone extends AbstractGameObject {
public final float zOffset; public final float zOffset;
public final float yOffset; public final float yOffset;
public final int zoneTemplate; public final int zoneTemplate;
public final byte peaceZone; public final byte peace_zone;
public final String Icon1; public final String Icon1;
public final String Icon2; public final String Icon2;
public final String Icon3; public final String Icon3;
@ -54,7 +54,7 @@ public class Zone extends AbstractGameObject {
public Zone parent = null; public Zone parent = null;
public Bounds bounds; public Bounds bounds;
public boolean isNPCCity = false; public boolean isNPCCity = false;
public boolean isGuildZone; public boolean guild_zone;
public String hash; public String hash;
public float worldAltitude = 0; public float worldAltitude = 0;
public float seaLevel = 0f; public float seaLevel = 0f;
@ -69,13 +69,13 @@ public class Zone extends AbstractGameObject {
super(rs); super(rs);
this.parentZoneID = rs.getInt("parent"); this.parentZoneID = rs.getInt("parent");
this.playerCityUUID = rs.getInt("playerCityUUID"); this.playerCityUUID = rs.getInt("playerCityUUID");
this.isGuildZone = this.playerCityUUID != 0; this.guild_zone = this.playerCityUUID != 0;
this.zoneName = rs.getString("zoneName"); this.zoneName = rs.getString("zoneName");
this.xOffset = rs.getFloat("xOffset"); this.xOffset = rs.getFloat("xOffset");
this.zOffset = rs.getFloat("zOffset"); this.zOffset = rs.getFloat("zOffset");
this.yOffset = rs.getFloat("yOffset"); this.yOffset = rs.getFloat("yOffset");
this.zoneTemplate = rs.getInt("template"); this.zoneTemplate = rs.getInt("template");
this.peaceZone = rs.getByte("peaceZone"); this.peace_zone = rs.getByte("peace_zone");
this.Icon1 = rs.getString("icon1"); this.Icon1 = rs.getString("icon1");
this.Icon2 = rs.getString("icon2"); this.Icon2 = rs.getString("icon2");
this.Icon3 = rs.getString("icon3"); this.Icon3 = rs.getString("icon3");
@ -146,7 +146,7 @@ public class Zone extends AbstractGameObject {
writer.putString(city.getCityName()); writer.putString(city.getCityName());
else else
writer.putString(zone.zoneName); writer.putString(zone.zoneName);
writer.put(zone.peaceZone); writer.put(zone.peace_zone);
writer.putString(zone.Icon1); writer.putString(zone.Icon1);
writer.putString(zone.Icon2); writer.putString(zone.Icon2);
writer.putString(zone.Icon3); writer.putString(zone.Icon3);
@ -238,7 +238,7 @@ public class Zone extends AbstractGameObject {
// Macro zones have icons. // Macro zones have icons.
if (this.isGuildZone == true) if (this.guild_zone == true)
return false; return false;
if (this.parent == null) if (this.parent == null)
@ -310,7 +310,7 @@ public class Zone extends AbstractGameObject {
public HeightMap getHeightMap() { public HeightMap getHeightMap() {
if (this.isGuildZone) if (this.guild_zone)
return HeightMap.PlayerCityHeightMap; return HeightMap.PlayerCityHeightMap;
return HeightMap.heightmapByLoadNum.get(this.zoneTemplate); return HeightMap.heightmapByLoadNum.get(this.zoneTemplate);

Loading…
Cancel
Save