forked from MagicBane/Server
class and table schema now conform to JSON
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user