|
|
@ -14,6 +14,7 @@ import engine.InterestManagement.WorldGrid; |
|
|
|
import engine.job.JobContainer; |
|
|
|
import engine.job.JobContainer; |
|
|
|
import engine.job.JobScheduler; |
|
|
|
import engine.job.JobScheduler; |
|
|
|
import engine.jobs.UpgradeBuildingJob; |
|
|
|
import engine.jobs.UpgradeBuildingJob; |
|
|
|
|
|
|
|
import engine.loot.WorkOrder; |
|
|
|
import engine.math.Bounds; |
|
|
|
import engine.math.Bounds; |
|
|
|
import engine.math.Vector3fImmutable; |
|
|
|
import engine.math.Vector3fImmutable; |
|
|
|
import engine.mbEnums; |
|
|
|
import engine.mbEnums; |
|
|
@ -49,8 +50,7 @@ public enum BuildingManager { |
|
|
|
|
|
|
|
|
|
|
|
// Some meshes might not have slot locations assigned.
|
|
|
|
// Some meshes might not have slot locations assigned.
|
|
|
|
|
|
|
|
|
|
|
|
if (slotLocations == null || |
|
|
|
if (slotLocations == null || slotLocations.isEmpty()) |
|
|
|
slotLocations.isEmpty()) |
|
|
|
|
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
|
|
int numOfSlots = _slotLocations.get(building.meshUUID).size(); |
|
|
|
int numOfSlots = _slotLocations.get(building.meshUUID).size(); |
|
|
@ -69,8 +69,7 @@ public enum BuildingManager { |
|
|
|
|
|
|
|
|
|
|
|
// Some meshes might not have slot locations assigned.
|
|
|
|
// Some meshes might not have slot locations assigned.
|
|
|
|
|
|
|
|
|
|
|
|
if (slotLocations == null || |
|
|
|
if (slotLocations == null || slotLocations.isEmpty()) |
|
|
|
slotLocations.isEmpty()) |
|
|
|
|
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
|
|
|
|
|
|
|
|
int numOfSlots = _slotLocations.get(building.meshUUID).size(); |
|
|
|
int numOfSlots = _slotLocations.get(building.meshUUID).size(); |
|
|
@ -127,22 +126,16 @@ public enum BuildingManager { |
|
|
|
if (building.getGuild().isGuildLeader(player.getObjectUUID())) |
|
|
|
if (building.getGuild().isGuildLeader(player.getObjectUUID())) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null |
|
|
|
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null && building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 8) |
|
|
|
&& building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 8) |
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null |
|
|
|
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null && building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 9 && GuildStatusController.isInnerCouncil(player.getGuildStatus())) |
|
|
|
&& building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 9 |
|
|
|
|
|
|
|
&& GuildStatusController.isInnerCouncil(player.getGuildStatus())) |
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
if (Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isInnerCouncil(player.getGuildStatus())) |
|
|
|
if (Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isInnerCouncil(player.getGuildStatus())) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
if (Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isGuildLeader(player.getGuildStatus())) |
|
|
|
return Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isGuildLeader(player.getGuildStatus()); |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO test friends list once added
|
|
|
|
//TODO test friends list once added
|
|
|
|
//does not meet above criteria. Cannot access.
|
|
|
|
//does not meet above criteria. Cannot access.
|
|
|
@ -168,7 +161,7 @@ public enum BuildingManager { |
|
|
|
//Somehow guild leader check fails? lets check if Player is true Guild GL.
|
|
|
|
//Somehow guild leader check fails? lets check if Player is true Guild GL.
|
|
|
|
if (building.getGuild() != null && building.getGuild().isGuildLeader(player.getObjectUUID())) |
|
|
|
if (building.getGuild() != null && building.getGuild().isGuildLeader(player.getObjectUUID())) |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
if (GuildStatusController.isGuildLeader(player.getGuildStatus()) == false && GuildStatusController.isInnerCouncil(player.getGuildStatus()) == false) |
|
|
|
if (!GuildStatusController.isGuildLeader(player.getGuildStatus()) && !GuildStatusController.isInnerCouncil(player.getGuildStatus())) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -274,9 +267,7 @@ public enum BuildingManager { |
|
|
|
// Submit upgrade job for future date or current instant
|
|
|
|
// Submit upgrade job for future date or current instant
|
|
|
|
|
|
|
|
|
|
|
|
if (building.getUpgradeDateTime().isAfter(LocalDateTime.now())) { |
|
|
|
if (building.getUpgradeDateTime().isAfter(LocalDateTime.now())) { |
|
|
|
JobContainer jc = JobScheduler.getInstance().scheduleJob(new UpgradeBuildingJob(building), |
|
|
|
JobContainer jc = JobScheduler.getInstance().scheduleJob(new UpgradeBuildingJob(building), building.getUpgradeDateTime().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()); |
|
|
|
building.getUpgradeDateTime().atZone(ZoneId.systemDefault()) |
|
|
|
|
|
|
|
.toInstant().toEpochMilli()); |
|
|
|
|
|
|
|
} else |
|
|
|
} else |
|
|
|
JobScheduler.getInstance().scheduleJob(new UpgradeBuildingJob(building), 0); |
|
|
|
JobScheduler.getInstance().scheduleJob(new UpgradeBuildingJob(building), 0); |
|
|
|
} |
|
|
|
} |
|
|
@ -335,10 +326,16 @@ public enum BuildingManager { |
|
|
|
WorldGrid.RemoveWorldObject(minionMob); |
|
|
|
WorldGrid.RemoveWorldObject(minionMob); |
|
|
|
WorldGrid.unloadObject(minionMob); |
|
|
|
WorldGrid.unloadObject(minionMob); |
|
|
|
|
|
|
|
|
|
|
|
if (minionMob.getParentZone() != null) |
|
|
|
if (minionMob.parentZone != null) |
|
|
|
minionMob.getParentZone().zoneMobSet.remove(minionMob); |
|
|
|
minionMob.parentZone.zoneMobSet.remove(minionMob); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Clear all workorders for this hireling
|
|
|
|
|
|
|
|
if (hireling.getObjectType().equals(GameObjectType.NPC)) |
|
|
|
|
|
|
|
if (ForgeManager.vendorWorkOrderLookup.contains(hireling)) |
|
|
|
|
|
|
|
for (WorkOrder workOrder : ForgeManager.vendorWorkOrderLookup.get(hireling)) |
|
|
|
|
|
|
|
DbManager.WarehouseQueries.DELETE_WORKORDER(workOrder); |
|
|
|
|
|
|
|
|
|
|
|
// Remove hireling from building
|
|
|
|
// Remove hireling from building
|
|
|
|
|
|
|
|
|
|
|
|
building.getHirelings().remove(hireling); |
|
|
|
building.getHirelings().remove(hireling); |
|
|
@ -349,9 +346,11 @@ public enum BuildingManager { |
|
|
|
|
|
|
|
|
|
|
|
Mob hirelingMob = (Mob) hireling; |
|
|
|
Mob hirelingMob = (Mob) hireling; |
|
|
|
|
|
|
|
|
|
|
|
if (hirelingMob.getParentZone() != null) |
|
|
|
if (hirelingMob.parentZone != null) { |
|
|
|
if (hirelingMob.getParentZone().zoneMobSet.contains(hirelingMob)) |
|
|
|
if (hirelingMob.parentZone.zoneMobSet.contains(hirelingMob)) { |
|
|
|
hirelingMob.getParentZone().zoneMobSet.remove(hireling); |
|
|
|
hirelingMob.parentZone.zoneMobSet.remove(hireling); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -451,7 +450,7 @@ public enum BuildingManager { |
|
|
|
if (!Guild.sameGuild(building.getGuild(), player.getGuild())) |
|
|
|
if (!Guild.sameGuild(building.getGuild(), player.getGuild())) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
return GuildStatusController.isGuildLeader(player.getGuildStatus()) != false || GuildStatusController.isInnerCouncil(player.getGuildStatus()) != false; |
|
|
|
return GuildStatusController.isGuildLeader(player.getGuildStatus()) || GuildStatusController.isInnerCouncil(player.getGuildStatus()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//This is mainly used for Rolling and gold sharing between building and warehouse.
|
|
|
|
//This is mainly used for Rolling and gold sharing between building and warehouse.
|
|
|
@ -825,7 +824,7 @@ public enum BuildingManager { |
|
|
|
else |
|
|
|
else |
|
|
|
success = DbManager.BuildingQueries.updateBuildingRank(building, rank); |
|
|
|
success = DbManager.BuildingQueries.updateBuildingRank(building, rank); |
|
|
|
|
|
|
|
|
|
|
|
if (success == false) { |
|
|
|
if (!success) { |
|
|
|
Logger.error("Error writing to database UUID: " + building.getObjectUUID()); |
|
|
|
Logger.error("Error writing to database UUID: " + building.getObjectUUID()); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|