forked from MagicBane/Server
class and table schema now conform to JSON
This commit is contained in:
@@ -469,7 +469,7 @@ public class Enum {
|
|||||||
|
|
||||||
// 14001 does not have a banestone to bind at
|
// 14001 does not have a banestone to bind at
|
||||||
|
|
||||||
if (ruinZone.loadNum == 14001)
|
if (ruinZone.zoneTemplate == 14001)
|
||||||
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30);
|
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc(), 30);
|
||||||
else
|
else
|
||||||
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc()
|
spawnLocation = Vector3fImmutable.getRandomPointOnCircle(ruinZone.getLoc()
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ public class HeightMap {
|
|||||||
|
|
||||||
HeightMap heightMap = new HeightMap(zone);
|
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.
|
// 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;
|
return interpolatedTerrainHeight;
|
||||||
|
|
||||||
// We will need the parent height if we got this far into the method
|
// 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);
|
blendBounds.setBounds(new Vector2f(heightMapZone.absX, heightMapZone.absZ), zoneLoc, 0.0f);
|
||||||
|
|
||||||
float maxBlendArea = (heightMapZone.maxBlend.getHalfExtents().x) *
|
float maxBlendArea = (heightMapZone.blendBounds.getHalfExtents().x) *
|
||||||
(heightMapZone.maxBlend.getHalfExtents().y);
|
(heightMapZone.blendBounds.getHalfExtents().y);
|
||||||
float currentArea = (blendBounds.getHalfExtents().x) *
|
float currentArea = (blendBounds.getHalfExtents().x) *
|
||||||
(blendBounds.getHalfExtents().y);
|
(blendBounds.getHalfExtents().y);
|
||||||
float zoneArea = (heightMapZone.bounds.getHalfExtents().x) *
|
float zoneArea = (heightMapZone.bounds.getHalfExtents().x) *
|
||||||
|
|||||||
@@ -33,18 +33,18 @@ public class dbZoneHandler extends dbHandlerBase {
|
|||||||
ArrayList<Zone> wsmList = new ArrayList<>();
|
ArrayList<Zone> wsmList = new ArrayList<>();
|
||||||
wsmList.addAll(zone.getNodes());
|
wsmList.addAll(zone.getNodes());
|
||||||
if (zone.absX == 0.0f) {
|
if (zone.absX == 0.0f) {
|
||||||
zone.absX = zone.xCoord;
|
zone.absX = zone.xOffset;
|
||||||
}
|
}
|
||||||
if (zone.absY == 0.0f) {
|
if (zone.absY == 0.0f) {
|
||||||
zone.absY = zone.yCoord;
|
zone.absY = zone.yOffset;
|
||||||
}
|
}
|
||||||
if (zone.absZ == 0.0f) {
|
if (zone.absZ == 0.0f) {
|
||||||
zone.absZ = zone.zCoord;
|
zone.absZ = zone.zOffset;
|
||||||
}
|
}
|
||||||
for (Zone child : zone.getNodes()) {
|
for (Zone child : zone.getNodes()) {
|
||||||
child.absX = child.xCoord + zone.absX;
|
child.absX = child.xOffset + zone.absX;
|
||||||
child.absY = child.yCoord + zone.absY;
|
child.absY = child.yOffset + zone.absY;
|
||||||
child.absZ = child.zCoord + zone.absZ;
|
child.absZ = child.zOffset + zone.absZ;
|
||||||
wsmList.addAll(this.GET_ALL_NODES(child));
|
wsmList.addAll(this.GET_ALL_NODES(child));
|
||||||
}
|
}
|
||||||
return wsmList;
|
return wsmList;
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public class AddMobCmd extends AbstractDevCmd {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zone.isPlayerCity) {
|
if (zone.isGuildZone) {
|
||||||
throwbackError(pc, "Cannot use ./mob on Player cities. Try ./servermob instead.");
|
throwbackError(pc, "Cannot use ./mob on Player cities. Try ./servermob instead.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class GetHeightCmd extends AbstractDevCmd {
|
|||||||
this.throwbackInfo(playerCharacter, "Min: " + heightmapZone.getHeightMap().zone_minBlend + " Max: " + heightmapZone.getHeightMap().zone_maxBlend);
|
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)");
|
this.throwbackInfo(playerCharacter, "Blend: Max (Child)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class GetZoneCmd extends AbstractDevCmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Zone zone : allIn)
|
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
|
@Override
|
||||||
|
|||||||
@@ -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.isPlayerCity)
|
if (zone.isNPCCity || zone.isGuildZone)
|
||||||
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.isPlayerCity)
|
if (zone.isNPCCity || zone.isGuildZone)
|
||||||
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();
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ public class InfoCmd extends AbstractDevCmd {
|
|||||||
output += newline;
|
output += newline;
|
||||||
output += "EquipSet: " + targetNPC.getEquipmentSetID();
|
output += "EquipSet: " + targetNPC.getEquipmentSetID();
|
||||||
output += newline;
|
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 += "EquipSet: " + targetMob.equipmentSetID;
|
||||||
output += newline;
|
output += newline;
|
||||||
try {
|
try {
|
||||||
output += "Parent Zone LoadNum : " + targetMob.getParentZone().loadNum;
|
output += "Parent Zone LoadNum : " + targetMob.getParentZone().zoneTemplate;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
//who cares
|
//who cares
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,12 +111,12 @@ public class MakeBaneCmd extends AbstractDevCmd {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!zone.isPlayerCity) {
|
if (!zone.isGuildZone) {
|
||||||
throwbackError(pc, "This is not a player city.");
|
throwbackError(pc, "This is not a player city.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
City city = City.getCity(zone.playerCityID);
|
City city = City.getCity(zone.playerCityUUID);
|
||||||
if (city == null) {
|
if (city == null) {
|
||||||
throwbackError(pc, "Unable to find the city associated with this zone.");
|
throwbackError(pc, "Unable to find the city associated with this zone.");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -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.isPlayerCity)
|
if (!zone.isGuildZone)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Building building : zone.zoneBuildingSet) {
|
for (Building building : zone.zoneBuildingSet) {
|
||||||
|
|||||||
@@ -34,12 +34,12 @@ public class RemoveBaneCmd extends AbstractDevCmd {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!zone.isPlayerCity) {
|
if (!zone.isGuildZone) {
|
||||||
throwbackError(pc, "This is not a player city.");
|
throwbackError(pc, "This is not a player city.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
City city = City.getCity(zone.playerCityID);
|
City city = City.getCity(zone.playerCityUUID);
|
||||||
if (city == null) {
|
if (city == null) {
|
||||||
throwbackError(pc, "Unable to find the city associated with this zone.");
|
throwbackError(pc, "Unable to find the city associated with this zone.");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ public class RemoveObjectCmd extends AbstractDevCmd {
|
|||||||
building.disableSpire(false);
|
building.disableSpire(false);
|
||||||
|
|
||||||
if ((building.getBlueprint() != null) && (building.getBlueprint().getBuildingGroup() == BuildingGroup.WAREHOUSE)) {
|
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) {
|
if (city != null) {
|
||||||
city.setWarehouseBuildingID(0);
|
city.setWarehouseBuildingID(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,12 +41,12 @@ public class SetBaneActiveCmd extends AbstractDevCmd {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!zone.isPlayerCity) {
|
if (!zone.isGuildZone) {
|
||||||
throwbackError(pc, "This is not a player city.");
|
throwbackError(pc, "This is not a player city.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
City city = City.getCity(zone.playerCityID);
|
City city = City.getCity(zone.playerCityUUID);
|
||||||
if (city == null) {
|
if (city == null) {
|
||||||
throwbackError(pc, "Unable to find the city associated with this zone.");
|
throwbackError(pc, "Unable to find the city associated with this zone.");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ public class SetForceRenameCityCmd extends AbstractDevCmd {
|
|||||||
if (zone == null)
|
if (zone == null)
|
||||||
return;
|
return;
|
||||||
boolean rename = words[0].equalsIgnoreCase("true") ? true : false;
|
boolean rename = words[0].equalsIgnoreCase("true") ? true : false;
|
||||||
if (zone.playerCityID == 0)
|
if (zone.playerCityUUID == 0)
|
||||||
return;
|
return;
|
||||||
City city = City.getCity(zone.playerCityID);
|
City city = City.getCity(zone.playerCityUUID);
|
||||||
if (city == null)
|
if (city == null)
|
||||||
return;
|
return;
|
||||||
city.setForceRename(rename);
|
city.setForceRename(rename);
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class ZoneInfoCmd extends AbstractDevCmd {
|
|||||||
output += newline;
|
output += newline;
|
||||||
output += "name: " + zone.zoneName;
|
output += "name: " + zone.zoneName;
|
||||||
output += newline;
|
output += newline;
|
||||||
output += "loadNum: " + zone.loadNum;
|
output += "loadNum: " + zone.zoneTemplate;
|
||||||
if (zone.parent != null) {
|
if (zone.parent != null) {
|
||||||
output += StringUtils.addWS(", parent: " + zone.parent.getObjectUUID(), 30);
|
output += StringUtils.addWS(", parent: " + zone.parent.getObjectUUID(), 30);
|
||||||
output += "Parentabs: x: " + zone.parent.absX + ", y: " + zone.parent.absY + ", z: " + zone.parent.absZ;
|
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 += newline;
|
||||||
output += "absLoc: x: " + zone.absX + ", y: " + zone.absY + ", z: " + zone.absZ;
|
output += "absLoc: x: " + zone.absX + ", y: " + zone.absY + ", z: " + zone.absZ;
|
||||||
output += newline;
|
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 += newline;
|
||||||
output += "radius: x: " + zone.bounds.getHalfExtents().x + ", z: " + zone.bounds.getHalfExtents().y;
|
output += "radius: x: " + zone.bounds.getHalfExtents().x + ", z: " + zone.bounds.getHalfExtents().y;
|
||||||
output += newline;
|
output += newline;
|
||||||
@@ -130,7 +130,7 @@ public class ZoneInfoCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
for (Zone child : nodes) {
|
for (Zone child : nodes) {
|
||||||
output += newline;
|
output += newline;
|
||||||
output += child.zoneName + " (" + child.loadNum + ')';
|
output += child.zoneName + " (" + child.zoneTemplate + ')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throwbackInfo(player, output);
|
throwbackInfo(player, output);
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class ZoneSetCmd extends AbstractDevCmd {
|
|||||||
|
|
||||||
zone = ZoneManager.findSmallestZone(playerCharacter.getLoc());
|
zone = ZoneManager.findSmallestZone(playerCharacter.getLoc());
|
||||||
|
|
||||||
throwbackInfo(playerCharacter, zone.zoneName + " (" + zone.loadNum + ") " + zone.getObjectUUID());
|
throwbackInfo(playerCharacter, zone.zoneName + " (" + zone.zoneTemplate + ") " + zone.getObjectUUID());
|
||||||
|
|
||||||
// NPC
|
// NPC
|
||||||
|
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ public enum MovementManager {
|
|||||||
Zone serverZone = null;
|
Zone serverZone = null;
|
||||||
|
|
||||||
serverZone = ZoneManager.findSmallestZone(player.getLoc());
|
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
|
// Do not send group messages if player is on grid
|
||||||
|
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ public enum ZoneManager {
|
|||||||
|
|
||||||
public static final void populateWorldZones(final Zone zone) {
|
public static final void populateWorldZones(final Zone zone) {
|
||||||
|
|
||||||
int loadNum = zone.loadNum;
|
int loadNum = zone.zoneTemplate;
|
||||||
|
|
||||||
// Zones are added to separate
|
// Zones are added to separate
|
||||||
// collections for quick access
|
// collections for quick access
|
||||||
@@ -194,7 +194,7 @@ public enum ZoneManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (zone.isPlayerCity) {
|
if (zone.isGuildZone) {
|
||||||
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.isPlayerCity = true;
|
zone.isGuildZone = true;
|
||||||
ZoneManager.playerCityZones.add(zone);
|
ZoneManager.playerCityZones.add(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,8 +387,8 @@ public enum ZoneManager {
|
|||||||
|
|
||||||
currentZone = ZoneManager.findSmallestZone(worldLoc);
|
currentZone = ZoneManager.findSmallestZone(worldLoc);
|
||||||
|
|
||||||
if (currentZone.isPlayerCity)
|
if (currentZone.isGuildZone)
|
||||||
return City.getCity(currentZone.playerCityID);
|
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.isPlayerCity)
|
if (!zone.isGuildZone)
|
||||||
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)) {
|
||||||
@@ -469,7 +469,7 @@ public enum ZoneManager {
|
|||||||
// Children of seafloor
|
// Children of seafloor
|
||||||
|
|
||||||
if (parentZone.parent == null)
|
if (parentZone.parent == null)
|
||||||
return worldAlttitude + zone.yCoord;
|
return worldAlttitude + zone.yOffset;
|
||||||
|
|
||||||
// return height from heightmap engine at zone location
|
// return height from heightmap engine at zone location
|
||||||
|
|
||||||
@@ -477,7 +477,7 @@ public enum ZoneManager {
|
|||||||
|
|
||||||
// Add zone offset to value
|
// Add zone offset to value
|
||||||
|
|
||||||
worldAlttitude += zone.yCoord;
|
worldAlttitude += zone.yOffset;
|
||||||
|
|
||||||
return worldAlttitude;
|
return worldAlttitude;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1196,7 +1196,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
|
|
||||||
|
|
||||||
if (npc.getCharItemManager().getInventoryCount() > 150) {
|
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();
|
ArrayList<Item> inv = npc.getInventory();
|
||||||
for (int i = 0; i < 20; i++) {
|
for (int i = 0; i < 20; i++) {
|
||||||
try {
|
try {
|
||||||
@@ -1229,7 +1229,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
if (ib == null)
|
if (ib == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (npc.getParentZone() != null && npc.getParentZone().playerCityID != 0)
|
if (npc.getParentZone() != null && npc.getParentZone().playerCityUUID != 0)
|
||||||
if (!npc.getCharItemManager().hasRoomInventory(ib.getWeight())) {
|
if (!npc.getCharItemManager().hasRoomInventory(ib.getWeight())) {
|
||||||
|
|
||||||
ErrorPopupMsg.sendErrorPopup(player, 21);
|
ErrorPopupMsg.sendErrorPopup(player, 21);
|
||||||
@@ -1280,7 +1280,7 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
|
|
||||||
if (building != null && building.getProtectionState().equals(ProtectionState.NPC))
|
if (building != null && building.getProtectionState().equals(ProtectionState.NPC))
|
||||||
building = null;
|
building = null;
|
||||||
if (npc.getParentZone().playerCityID == 0)
|
if (npc.getParentZone().playerCityUUID == 0)
|
||||||
building = null;
|
building = null;
|
||||||
|
|
||||||
//make sure npc can afford item
|
//make sure npc can afford item
|
||||||
|
|||||||
@@ -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.isPlayerCity == false)
|
if (cityZone.isGuildZone == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (targetBuilding.getCity() == null)
|
if (targetBuilding.getCity() == null)
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class AssetSupportMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (serverZone == null)
|
if (serverZone == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
serverCity = City.GetCityFromCache(serverZone.playerCityID);
|
serverCity = City.GetCityFromCache(serverZone.playerCityUUID);
|
||||||
|
|
||||||
if (serverCity == null)
|
if (serverCity == null)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -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.isPlayerCity == false)
|
if (cityZone.isGuildZone == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (targetBuilding.getCity().hasBeenTransfered == true) {
|
if (targetBuilding.getCity().hasBeenTransfered == true) {
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class ClaimGuildTreeMsgHandler extends AbstractClientMsgHandler {
|
|||||||
playerZone = building.getParentZone();
|
playerZone = building.getParentZone();
|
||||||
|
|
||||||
if (playerZone != null)
|
if (playerZone != null)
|
||||||
playerCity = City.getCity(playerZone.playerCityID);
|
playerCity = City.getCity(playerZone.playerCityUUID);
|
||||||
|
|
||||||
// Oops! *** Refactor: Log error
|
// Oops! *** Refactor: Log error
|
||||||
switch (msg.getMessageType()) {
|
switch (msg.getMessageType()) {
|
||||||
|
|||||||
@@ -75,12 +75,12 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
Zone zone = ZoneManager.findSmallestZone(player.getLoc());
|
Zone zone = ZoneManager.findSmallestZone(player.getLoc());
|
||||||
|
|
||||||
if (!zone.isPlayerCity) {
|
if (!zone.isGuildZone) {
|
||||||
ErrorPopupMsg.sendErrorMsg(player, "Unable to find city to command.");
|
ErrorPopupMsg.sendErrorMsg(player, "Unable to find city to command.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
City city = City.GetCityFromCache(zone.playerCityID);
|
City city = City.GetCityFromCache(zone.playerCityUUID);
|
||||||
|
|
||||||
if (city == null) {
|
if (city == null) {
|
||||||
ErrorPopupMsg.sendErrorMsg(player, "Unable to find city to command.");
|
ErrorPopupMsg.sendErrorMsg(player, "Unable to find city to command.");
|
||||||
@@ -254,7 +254,7 @@ public class ManageCityAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (baneZone == null)
|
if (baneZone == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
City banedCity = City.getCity(baneZone.playerCityID);
|
City banedCity = City.getCity(baneZone.playerCityUUID);
|
||||||
|
|
||||||
if (banedCity == null)
|
if (banedCity == null)
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -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.isPlayerCity) {
|
if (zone.isGuildZone) {
|
||||||
loc = zone.getLoc();
|
loc = zone.getLoc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ public class OrderNPCMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (zone == null)
|
if (zone == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (zone.playerCityID == 0)
|
if (zone.playerCityUUID == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
City city = building.getCity();
|
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) {
|
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());
|
PlaceAssetMsg.sendPlaceAssetError(origin, 52, player.getName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -201,8 +201,8 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
// Cannot place assets on a dead tree
|
// Cannot place assets on a dead tree
|
||||||
|
|
||||||
if ((serverZone.isPlayerCity)
|
if ((serverZone.isGuildZone)
|
||||||
&& (City.getCity(serverZone.playerCityID).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,14 +261,14 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
// Must be a player city
|
// 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
|
PlaceAssetMsg.sendPlaceAssetError(origin, 41, player.getName()); // Cannot place outside a guild zone
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Test zone has a city object
|
//Test zone has a city object
|
||||||
|
|
||||||
City city = City.getCity(serverZone.playerCityID);
|
City city = City.getCity(serverZone.playerCityUUID);
|
||||||
|
|
||||||
if (city == null) {
|
if (city == null) {
|
||||||
PlaceAssetMsg.sendPlaceAssetError(origin, 52, ""); //"no city to associate asset with"
|
PlaceAssetMsg.sendPlaceAssetError(origin, 52, ""); //"no city to associate asset with"
|
||||||
@@ -512,7 +512,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (serverZone == null)
|
if (serverZone == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
cityObject = City.getCity(serverZone.playerCityID);
|
cityObject = City.getCity(serverZone.playerCityUUID);
|
||||||
|
|
||||||
// Early exit if something went horribly wrong
|
// Early exit if something went horribly wrong
|
||||||
|
|
||||||
@@ -571,7 +571,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
// No valid player city found
|
// 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
|
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.isPlayerCity = true;
|
zoneObject.isGuildZone = 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
|
||||||
@@ -857,7 +857,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (serverZone == null)
|
if (serverZone == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
cityObject = City.getCity(serverZone.playerCityID);
|
cityObject = City.getCity(serverZone.playerCityUUID);
|
||||||
|
|
||||||
if (cityObject == null)
|
if (cityObject == null)
|
||||||
return false;
|
return false;
|
||||||
@@ -931,7 +931,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
int shrineCount = 0;
|
int shrineCount = 0;
|
||||||
|
|
||||||
cityObject = City.getCity(serverZone.playerCityID);
|
cityObject = City.getCity(serverZone.playerCityUUID);
|
||||||
|
|
||||||
// Cannot place shrine in abandoned city. Shrines must be owned
|
// Cannot place shrine in abandoned city. Shrines must be owned
|
||||||
// by the tol owner not the person placing them.
|
// by the tol owner not the person placing them.
|
||||||
@@ -1001,7 +1001,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
int barracksCount = 0;
|
int barracksCount = 0;
|
||||||
|
|
||||||
cityObject = City.getCity(serverZone.playerCityID);
|
cityObject = City.getCity(serverZone.playerCityUUID);
|
||||||
|
|
||||||
// Cannot place barracks in abandoned city.
|
// Cannot place barracks in abandoned city.
|
||||||
|
|
||||||
@@ -1061,7 +1061,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
if (validateCityBuildingPlacement(serverZone, msg, origin, player, msg.getFirstPlacementInfo()) == false)
|
if (validateCityBuildingPlacement(serverZone, msg, origin, player, msg.getFirstPlacementInfo()) == false)
|
||||||
return 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
|
// 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());
|
shrineType = Shrine.getShrineTypeByBlueprintUUID(blueprint.getBlueprintUUID());
|
||||||
|
|
||||||
city = City.getCity(currentZone.playerCityID);
|
city = City.getCity(currentZone.playerCityUUID);
|
||||||
|
|
||||||
if (city == null)
|
if (city == null)
|
||||||
return false;
|
return false;
|
||||||
@@ -1294,7 +1294,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
city = City.getCity(currentZone.playerCityID);
|
city = City.getCity(currentZone.playerCityUUID);
|
||||||
|
|
||||||
if (city == null)
|
if (city == null)
|
||||||
return false;
|
return false;
|
||||||
@@ -1369,7 +1369,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
|||||||
newMesh.runAfterLoad();
|
newMesh.runAfterLoad();
|
||||||
} else if (ago.getObjectType() == GameObjectType.Warehouse) {
|
} else if (ago.getObjectType() == GameObjectType.Warehouse) {
|
||||||
Warehouse warehouse = (Warehouse) ago;
|
Warehouse warehouse = (Warehouse) ago;
|
||||||
City city = City.getCity(currentZone.playerCityID);
|
City city = City.getCity(currentZone.playerCityUUID);
|
||||||
|
|
||||||
if (city == null)
|
if (city == null)
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -44,11 +44,11 @@ public class RepairBuildingMsgHandler extends AbstractClientMsgHandler {
|
|||||||
|
|
||||||
serverZone = ZoneManager.findSmallestZone(pc.getLoc());
|
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;
|
return;
|
||||||
|
|
||||||
|
|
||||||
City city = City.GetCityFromCache(serverZone.playerCityID);
|
City city = City.GetCityFromCache(serverZone.playerCityUUID);
|
||||||
|
|
||||||
if (city != null) {
|
if (city != null) {
|
||||||
if (city.getBane() != null && city.protectionEnforced == false)
|
if (city.getBane() != null && city.protectionEnforced == false)
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public class CityAssetMsg extends ClientNetMsg {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
city = City.getCity(zone.playerCityID);
|
city = City.getCity(zone.playerCityUUID);
|
||||||
|
|
||||||
if (city == null) {
|
if (city == null) {
|
||||||
Logger.debug("Failed to load city data for Tree of life.");
|
Logger.debug("Failed to load city data for Tree of life.");
|
||||||
|
|||||||
@@ -117,8 +117,8 @@ public class GuildTreeStatusMsg extends ClientNetMsg {
|
|||||||
city = null;
|
city = null;
|
||||||
|
|
||||||
if (cityZone != null)
|
if (cityZone != null)
|
||||||
if (cityZone.isPlayerCity)
|
if (cityZone.isGuildZone)
|
||||||
city = City.GetCityFromCache(cityZone.playerCityID);
|
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();
|
||||||
|
|
||||||
|
|||||||
@@ -299,8 +299,8 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
|
|||||||
Set<Building> buildings = ZoneManager.findSmallestZone(assetManager.getLoc()).zoneBuildingSet;
|
Set<Building> buildings = ZoneManager.findSmallestZone(assetManager.getLoc()).zoneBuildingSet;
|
||||||
|
|
||||||
Building tol = null;
|
Building tol = null;
|
||||||
if (playerZone.playerCityID != 0)
|
if (playerZone.playerCityUUID != 0)
|
||||||
city = City.GetCityFromCache(playerZone.playerCityID);
|
city = City.GetCityFromCache(playerZone.playerCityUUID);
|
||||||
|
|
||||||
if (city != null)
|
if (city != null)
|
||||||
tol = city.getTOL();
|
tol = city.getTOL();
|
||||||
@@ -368,7 +368,7 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
|
|||||||
if (zone == null)
|
if (zone == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
City banedCity = City.getCity(zone.playerCityID);
|
City banedCity = City.getCity(zone.playerCityUUID);
|
||||||
|
|
||||||
if (banedCity == null)
|
if (banedCity == null)
|
||||||
return;
|
return;
|
||||||
@@ -621,9 +621,9 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
|
|||||||
} else {
|
} else {
|
||||||
writer.putInt(1); //kos on/off?
|
writer.putInt(1); //kos on/off?
|
||||||
writer.putInt(3); // was 3
|
writer.putInt(3); // was 3
|
||||||
if (zone.playerCityID != 0 && asset.assetIsProtected()) {
|
if (zone.playerCityUUID != 0 && asset.assetIsProtected()) {
|
||||||
writer.putInt(GameObjectType.Building.ordinal());
|
writer.putInt(GameObjectType.Building.ordinal());
|
||||||
writer.putInt(City.getCity(zone.playerCityID).getTOL().getObjectUUID());
|
writer.putInt(City.getCity(zone.playerCityUUID).getTOL().getObjectUUID());
|
||||||
} else {
|
} else {
|
||||||
writer.putInt(0);
|
writer.putInt(0);
|
||||||
writer.putInt(0);
|
writer.putInt(0);
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class ViewResourcesMessage extends ClientNetMsg {
|
|||||||
if (this.warehouseBuilding.getParentZone() == null)
|
if (this.warehouseBuilding.getParentZone() == null)
|
||||||
return false;
|
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)
|
if (this.city == null)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -162,8 +162,8 @@ public final class Bane {
|
|||||||
|
|
||||||
// Cannot place assets on a dead tree
|
// Cannot place assets on a dead tree
|
||||||
|
|
||||||
if ((cityZone.isPlayerCity) &&
|
if ((cityZone.isGuildZone) &&
|
||||||
(City.getCity(cityZone.playerCityID).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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -460,10 +460,10 @@ public class Building extends AbstractWorldObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.parentZone.isPlayerCity == false)
|
if (this.parentZone.isGuildZone == false)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return City.getCity(this.parentZone.playerCityID);
|
return City.getCity(this.parentZone.playerCityUUID);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -334,7 +334,7 @@ public class City extends AbstractWorldObject {
|
|||||||
if (city.noTeleport)
|
if (city.noTeleport)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (city.parentZone != null && city.parentZone.isPlayerCity) {
|
if (city.parentZone != null && city.parentZone.isGuildZone) {
|
||||||
|
|
||||||
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.isPlayerCity) {
|
if (city.parentZone != null && city.parentZone.isGuildZone) {
|
||||||
|
|
||||||
//list Player cities
|
//list Player cities
|
||||||
//open city, just list
|
//open city, just list
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public class ItemFactory {
|
|||||||
if (zone == null)
|
if (zone == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
City city = City.getCity(zone.playerCityID);
|
City city = City.getCity(zone.playerCityUUID);
|
||||||
|
|
||||||
if (city == null)
|
if (city == null)
|
||||||
return null;
|
return null;
|
||||||
@@ -796,7 +796,7 @@ public class ItemFactory {
|
|||||||
if (zone == null)
|
if (zone == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
City city = City.getCity(zone.playerCityID);
|
City city = City.getCity(zone.playerCityUUID);
|
||||||
|
|
||||||
if (city == null)
|
if (city == null)
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -894,7 +894,7 @@ public class NPC extends AbstractCharacter {
|
|||||||
this.stamina.set(this.staminaMax);
|
this.stamina.set(this.staminaMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.parentZone.isPlayerCity)
|
if (this.parentZone.isGuildZone)
|
||||||
if (NPC.GetNPCProfits(this) == null)
|
if (NPC.GetNPCProfits(this) == null)
|
||||||
NPCProfits.CreateProfits(this);
|
NPCProfits.CreateProfits(this);
|
||||||
|
|
||||||
@@ -1192,7 +1192,7 @@ public class NPC extends AbstractCharacter {
|
|||||||
if (serverZone == null)
|
if (serverZone == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
city = City.GetCityFromCache(serverZone.playerCityID);
|
city = City.GetCityFromCache(serverZone.playerCityUUID);
|
||||||
|
|
||||||
if (city == null) {
|
if (city == null) {
|
||||||
|
|
||||||
|
|||||||
@@ -1272,7 +1272,7 @@ public class Warehouse extends AbstractWorldObject {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
City city = City.getCity(cityZone.playerCityID);
|
City city = City.getCity(cityZone.playerCityUUID);
|
||||||
|
|
||||||
if (city == null) {
|
if (city == null) {
|
||||||
Logger.error("Failed to load City for Warehouse with UUID " + this.getObjectUUID());
|
Logger.error("Failed to load City for Warehouse with UUID " + this.getObjectUUID());
|
||||||
|
|||||||
@@ -33,12 +33,12 @@ public class Zone extends AbstractGameObject {
|
|||||||
public final Set<Building> zoneBuildingSet = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
public final Set<Building> zoneBuildingSet = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
||||||
public final Set<NPC> zoneNPCSet = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
public final Set<NPC> zoneNPCSet = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
||||||
public final Set<Mob> zoneMobSet = 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 String zoneName;
|
||||||
public final float xCoord;
|
public final float xOffset;
|
||||||
public final float zCoord;
|
public final float zOffset;
|
||||||
public final float yCoord;
|
public final float yOffset;
|
||||||
public final int loadNum;
|
public final int zoneTemplate;
|
||||||
public final byte peaceZone;
|
public final byte peaceZone;
|
||||||
public final String Icon1;
|
public final String Icon1;
|
||||||
public final String Icon2;
|
public final String Icon2;
|
||||||
@@ -54,13 +54,13 @@ 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 isPlayerCity = false;
|
public boolean isGuildZone;
|
||||||
public String hash;
|
public String hash;
|
||||||
public float worldAltitude = 0;
|
public float worldAltitude = 0;
|
||||||
public float seaLevel = 0f;
|
public float seaLevel = 0f;
|
||||||
public static final Set<Mob> respawnQue = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
public static final Set<Mob> respawnQue = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
||||||
public static long lastRespawn = 0;
|
public static long lastRespawn = 0;
|
||||||
public Bounds maxBlend;
|
public Bounds blendBounds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ResultSet Constructor
|
* ResultSet Constructor
|
||||||
@@ -68,22 +68,21 @@ public class Zone extends AbstractGameObject {
|
|||||||
public Zone(ResultSet rs) throws SQLException {
|
public Zone(ResultSet rs) throws SQLException {
|
||||||
super(rs);
|
super(rs);
|
||||||
this.parentZoneID = rs.getInt("parent");
|
this.parentZoneID = rs.getInt("parent");
|
||||||
this.playerCityID = rs.getInt("isPlayerCity");
|
this.playerCityUUID = rs.getInt("playerCityUUID");
|
||||||
this.isPlayerCity = this.playerCityID != 0;
|
this.isGuildZone = this.playerCityUUID != 0;
|
||||||
this.zoneName = rs.getString("Name");
|
this.zoneName = rs.getString("Name");
|
||||||
this.xCoord = rs.getFloat("XCoord");
|
this.xOffset = rs.getFloat("xOffset");
|
||||||
this.zCoord = rs.getFloat("ZCoord");
|
this.zOffset = rs.getFloat("zOffset");
|
||||||
this.yCoord = rs.getFloat("YOffset");
|
this.yOffset = rs.getFloat("yOffset");
|
||||||
this.loadNum = rs.getInt("LoadNum");
|
this.zoneTemplate = rs.getInt("zoneTemplate");
|
||||||
this.peaceZone = rs.getByte("SafeZone");
|
this.peaceZone = rs.getByte("paceZone");
|
||||||
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");
|
||||||
|
this.minLvl = rs.getInt("min_level");
|
||||||
|
this.maxLvl = rs.getInt("max_level");
|
||||||
this.hash = rs.getString("hash");
|
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)
|
//this needs to be here specifically for new zones created after server boot (e.g. player city zones)
|
||||||
|
|
||||||
Zone parentZone = ZoneManager.getZoneByUUID(parentZoneID);
|
Zone parentZone = ZoneManager.getZoneByUUID(parentZoneID);
|
||||||
@@ -107,28 +106,28 @@ public class Zone extends AbstractGameObject {
|
|||||||
|
|
||||||
public static void serializeForClientMsg(Zone zone, ByteBufferWriter writer) {
|
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!");
|
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.
|
// Player City Terraform values serialized here.
|
||||||
|
|
||||||
if (zone.playerCityID > 0) {
|
if (zone.playerCityUUID > 0) {
|
||||||
writer.put((byte) 1); // Player City - True
|
writer.put((byte) 1); // Player City - True
|
||||||
writer.putFloat(Enum.CityBoundsType.ZONE.halfExtents);
|
writer.putFloat(Enum.CityBoundsType.ZONE.halfExtents);
|
||||||
writer.putFloat(Enum.CityBoundsType.ZONE.halfExtents);
|
writer.putFloat(Enum.CityBoundsType.ZONE.halfExtents);
|
||||||
} else
|
} else
|
||||||
writer.put((byte) 0); // Player City - False
|
writer.put((byte) 0); // Player City - False
|
||||||
|
|
||||||
writer.putFloat(zone.xCoord);
|
writer.putFloat(zone.xOffset);
|
||||||
writer.putFloat(zone.zCoord);
|
writer.putFloat(zone.zOffset);
|
||||||
writer.putFloat(zone.yCoord);
|
writer.putFloat(zone.yOffset);
|
||||||
|
|
||||||
writer.putInt(0);
|
writer.putInt(0);
|
||||||
writer.putInt(0);
|
writer.putInt(0);
|
||||||
writer.putInt(zone.loadNum);
|
writer.putInt(zone.zoneTemplate);
|
||||||
|
|
||||||
if (zone.playerCityID > 0) {
|
if (zone.playerCityUUID > 0) {
|
||||||
City k = City.getCity(zone.playerCityID);
|
City k = City.getCity(zone.playerCityUUID);
|
||||||
|
|
||||||
if (k != null) {
|
if (k != null) {
|
||||||
writer.putInt(k.getObjectType().ordinal());
|
writer.putInt(k.getObjectType().ordinal());
|
||||||
@@ -141,7 +140,7 @@ public class Zone extends AbstractGameObject {
|
|||||||
}
|
}
|
||||||
writer.putInt(zone.nodes.size());
|
writer.putInt(zone.nodes.size());
|
||||||
|
|
||||||
City city = City.getCity(zone.playerCityID);
|
City city = City.getCity(zone.playerCityUUID);
|
||||||
|
|
||||||
if (city != null)
|
if (city != null)
|
||||||
writer.putString(city.getCityName());
|
writer.putString(city.getCityName());
|
||||||
@@ -168,7 +167,7 @@ public class Zone extends AbstractGameObject {
|
|||||||
|
|
||||||
this.bounds = Bounds.borrow();
|
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
|
// Default to player zone size on error? Maybe log this
|
||||||
|
|
||||||
@@ -182,10 +181,10 @@ public class Zone extends AbstractGameObject {
|
|||||||
// Set heightmap blending bounds
|
// Set heightmap blending bounds
|
||||||
|
|
||||||
if (heightMap == null) {
|
if (heightMap == null) {
|
||||||
this.maxBlend = bounds;
|
this.blendBounds = bounds;
|
||||||
} else {
|
} else {
|
||||||
this.maxBlend = Bounds.borrow();
|
this.blendBounds = Bounds.borrow();
|
||||||
this.maxBlend.setBounds(new Vector2f(this.absX, this.absZ), bounds.getHalfExtents().subtract(heightMap.zone_minBlend, heightMap.zone_minBlend), 0.0f);
|
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
|
// Seafloor
|
||||||
|
|
||||||
if (this.parent == null) {
|
if (this.parent == null) {
|
||||||
this.absX = this.xCoord;
|
this.absX = this.xOffset;
|
||||||
this.absY = MBServerStatics.SEA_FLOOR_ALTITUDE;
|
this.absY = MBServerStatics.SEA_FLOOR_ALTITUDE;
|
||||||
this.absZ = this.zCoord;
|
this.absZ = this.zOffset;
|
||||||
this.seaLevel = 0;
|
this.seaLevel = 0;
|
||||||
this.setBounds();
|
this.setBounds();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.absX = this.xCoord + parent.absX;
|
this.absX = this.xOffset + parent.absX;
|
||||||
this.absY = this.yCoord + parent.absY;
|
this.absY = this.yOffset + parent.absY;
|
||||||
this.absZ = this.zCoord + parent.absZ;
|
this.absZ = this.zOffset + parent.absZ;
|
||||||
|
|
||||||
if (this.minLvl == 0 || this.maxLvl == 0) {
|
if (this.minLvl == 0 || this.maxLvl == 0) {
|
||||||
this.minLvl = this.parent.minLvl;
|
this.minLvl = this.parent.minLvl;
|
||||||
@@ -239,7 +238,7 @@ public class Zone extends AbstractGameObject {
|
|||||||
|
|
||||||
// Macro zones have icons.
|
// Macro zones have icons.
|
||||||
|
|
||||||
if (this.isPlayerCity == true)
|
if (this.isGuildZone == true)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (this.parent == null)
|
if (this.parent == null)
|
||||||
@@ -311,10 +310,10 @@ public class Zone extends AbstractGameObject {
|
|||||||
|
|
||||||
public HeightMap getHeightMap() {
|
public HeightMap getHeightMap() {
|
||||||
|
|
||||||
if (this.isPlayerCity)
|
if (this.isGuildZone)
|
||||||
return HeightMap.PlayerCityHeightMap;
|
return HeightMap.PlayerCityHeightMap;
|
||||||
|
|
||||||
return HeightMap.heightmapByLoadNum.get(this.loadNum);
|
return HeightMap.heightmapByLoadNum.get(this.zoneTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -469,7 +469,7 @@ public class WorldServer {
|
|||||||
for (Zone zone : ZoneManager.getAllZones()) {
|
for (Zone zone : ZoneManager.getAllZones()) {
|
||||||
if (zone.getHeightMap() != null) {
|
if (zone.getHeightMap() != null) {
|
||||||
if (zone.getHeightMap().bucketWidthX == 0) {
|
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) {
|
for (Zone zone : rootParent) {
|
||||||
|
|
||||||
ZoneManager.addZone(zone.loadNum, zone);
|
ZoneManager.addZone(zone.zoneTemplate, zone);
|
||||||
|
|
||||||
//Handle Buildings
|
//Handle Buildings
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user