|
|
|
@ -75,11 +75,14 @@ public class Building extends AbstractWorldObject {
@@ -75,11 +75,14 @@ public class Building extends AbstractWorldObject {
|
|
|
|
|
public int level; |
|
|
|
|
public AtomicBoolean isDeranking = new AtomicBoolean(false); |
|
|
|
|
public LocalDateTime maintDateTime; |
|
|
|
|
protected Resists resists; |
|
|
|
|
/* The Blueprint class has methods able to derive |
|
|
|
|
* all defining characteristics of this building, |
|
|
|
|
*/ |
|
|
|
|
public int blueprintUUID = 0; |
|
|
|
|
public int rank; |
|
|
|
|
public ArrayList<Vector3fImmutable> patrolPoints; |
|
|
|
|
public ProtectionState protectionState = ProtectionState.NONE; |
|
|
|
|
protected Resists resists; |
|
|
|
|
private float w = 1.0f; |
|
|
|
|
private Vector3f meshScale = new Vector3f(1.0f, 1.0f, 1.0f); |
|
|
|
|
private int doorState = 0; |
|
|
|
@ -88,15 +91,12 @@ public class Building extends AbstractWorldObject {
@@ -88,15 +91,12 @@ public class Building extends AbstractWorldObject {
|
|
|
|
|
private int maxGold; |
|
|
|
|
private int effectFlags = 0; |
|
|
|
|
private String name = ""; |
|
|
|
|
public int rank; |
|
|
|
|
private boolean ownerIsNPC = true; |
|
|
|
|
private boolean spireIsActive = false; |
|
|
|
|
private ConcurrentHashMap<String, JobContainer> timers = null; |
|
|
|
|
private ConcurrentHashMap<String, Long> timestamps = null; |
|
|
|
|
private ConcurrentHashMap<Integer, BuildingFriends> friends; |
|
|
|
|
private ConcurrentHashMap<Integer, Condemned> condemned; |
|
|
|
|
public ArrayList<Vector3fImmutable> patrolPoints; |
|
|
|
|
public ProtectionState protectionState = ProtectionState.NONE; |
|
|
|
|
private ArrayList<Building> children = null; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -164,7 +164,7 @@ public class Building extends AbstractWorldObject {
@@ -164,7 +164,7 @@ public class Building extends AbstractWorldObject {
|
|
|
|
|
this.upgradeDateTime = LocalDateTime.ofInstant(upgradeTimeStamp.toInstant(), ZoneId.systemDefault()); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
Logger.error("Failed for object " + this.blueprintUUID + ' ' + this.getObjectUUID() + e.toString()); |
|
|
|
|
Logger.error("Failed for object " + this.blueprintUUID + ' ' + this.getObjectUUID() + e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -385,13 +385,13 @@ public class Building extends AbstractWorldObject {
@@ -385,13 +385,13 @@ public class Building extends AbstractWorldObject {
|
|
|
|
|
Mine.SendMineAttackMessage(this); |
|
|
|
|
|
|
|
|
|
City playerCity = ZoneManager.getCityAtLocation(this.loc); |
|
|
|
|
if(playerCity != null){ |
|
|
|
|
if(this.getGuild().getNation().equals(playerCity.getTOL().getGuild().getNation())){ |
|
|
|
|
if (playerCity != null) { |
|
|
|
|
if (this.getGuild().getNation().equals(playerCity.getTOL().getGuild().getNation())) { |
|
|
|
|
//friendly building has been attacked, add attacker to city outlaw list
|
|
|
|
|
if(!playerCity.cityOutlaws.contains(attacker.getObjectUUID()) && attacker.getObjectType().equals(GameObjectType.PlayerCharacter)) |
|
|
|
|
if (!playerCity.cityOutlaws.contains(attacker.getObjectUUID()) && attacker.getObjectType().equals(GameObjectType.PlayerCharacter)) |
|
|
|
|
playerCity.cityOutlaws.add(attacker.getObjectUUID()); |
|
|
|
|
for(Mob guard : playerCity.getParent().zoneMobSet) |
|
|
|
|
if(guard.combatTarget == null) |
|
|
|
|
for (Mob guard : playerCity.getParent().zoneMobSet) |
|
|
|
|
if (guard.combatTarget == null) |
|
|
|
|
guard.setCombatTarget(attacker); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -954,7 +954,6 @@ public class Building extends AbstractWorldObject {
@@ -954,7 +954,6 @@ public class Building extends AbstractWorldObject {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Submit upgrade job if building is currently set to rank.
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
@ -970,18 +969,6 @@ public class Building extends AbstractWorldObject {
@@ -970,18 +969,6 @@ public class Building extends AbstractWorldObject {
|
|
|
|
|
this.friends = BuildingManager._buildingFriends.computeIfAbsent(this.getObjectUUID(), k -> new ConcurrentHashMap<>()); |
|
|
|
|
this.condemned = BuildingManager._buildingCondemned.computeIfAbsent(this.getObjectUUID(), k -> new ConcurrentHashMap<>()); |
|
|
|
|
|
|
|
|
|
//LOad Owners in Cache so we do not have to continuely look in the db for owner.
|
|
|
|
|
|
|
|
|
|
if (this.ownerIsNPC) { |
|
|
|
|
if (NPC.getNPC(this.ownerUUID) == null) |
|
|
|
|
Logger.info("Building UID " + this.getObjectUUID() + " Failed to Load NPC Owner with ID " + this.ownerUUID + " Location " + this.getLoc().toString()); |
|
|
|
|
|
|
|
|
|
} else if (this.ownerUUID != 0) { |
|
|
|
|
if (PlayerCharacter.getPlayerCharacter(this.ownerUUID) == null) { |
|
|
|
|
Logger.info("Building UID " + this.getObjectUUID() + " Failed to Load Player Owner with ID " + this.ownerUUID + " Location " + this.getLoc().toString()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Set bounds for this building
|
|
|
|
|
|
|
|
|
|
Bounds buildingBounds = Bounds.borrow(); |
|
|
|
@ -995,7 +982,7 @@ public class Building extends AbstractWorldObject {
@@ -995,7 +982,7 @@ public class Building extends AbstractWorldObject {
|
|
|
|
|
this.children = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
if (this.parentBuildingID != 0) { |
|
|
|
|
Building parent = BuildingManager.getBuildingFromCache(this.parentBuildingID); |
|
|
|
|
Building parent = BuildingManager.getBuilding(this.parentBuildingID); |
|
|
|
|
|
|
|
|
|
if (parent != null) { |
|
|
|
|
parent.children.add(this); |
|
|
|
@ -1400,10 +1387,7 @@ public class Building extends AbstractWorldObject {
@@ -1400,10 +1387,7 @@ public class Building extends AbstractWorldObject {
|
|
|
|
|
|
|
|
|
|
public boolean assetIsProtected() { |
|
|
|
|
|
|
|
|
|
boolean outValue = false; |
|
|
|
|
|
|
|
|
|
if (protectionState.equals(ProtectionState.PROTECTED)) |
|
|
|
|
outValue = true; |
|
|
|
|
boolean outValue = protectionState.equals(ProtectionState.PROTECTED); |
|
|
|
|
|
|
|
|
|
if (protectionState.equals(ProtectionState.CONTRACT)) |
|
|
|
|
outValue = true; |
|
|
|
|