class and table schema now conform to JSON

This commit is contained in:
2023-09-20 15:53:41 -04:00
parent 46b3db033b
commit e0387dce00
40 changed files with 132 additions and 133 deletions
+1 -1
View File
@@ -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()
+4 -4
View File
@@ -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) *
+6 -6
View File
@@ -33,18 +33,18 @@ public class dbZoneHandler extends dbHandlerBase {
ArrayList<Zone> 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;
+1 -1
View File
@@ -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;
}
+1 -1
View File
@@ -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;
}
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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();
+2 -2
View File
@@ -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
}
+2 -2
View File
@@ -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;
+1 -1
View File
@@ -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) {
+2 -2
View File
@@ -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;
+1 -1
View File
@@ -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);
}
+2 -2
View File
@@ -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;
@@ -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);
+3 -3
View File
@@ -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);
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+8 -8
View File
@@ -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;
}
+3 -3
View File
@@ -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<Item> 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
@@ -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)
@@ -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;
@@ -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) {
@@ -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()) {
@@ -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;
@@ -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();
}
}
@@ -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();
@@ -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;
@@ -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)
+1 -1
View File
@@ -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.");
@@ -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();
@@ -299,8 +299,8 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
Set<Building> 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);
@@ -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;
+2 -2
View File
@@ -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;
}
+2 -2
View File
@@ -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);
}
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -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) {
+1 -1
View File
@@ -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());
+40 -41
View File
@@ -33,12 +33,12 @@ public class Zone extends AbstractGameObject {
public final Set<Building> zoneBuildingSet = Collections.newSetFromMap(new ConcurrentHashMap<>());
public final Set<NPC> zoneNPCSet = Collections.newSetFromMap(new ConcurrentHashMap<>());
public final Set<Mob> 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<Mob> 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);
}
}
+2 -2
View File
@@ -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