forked from MagicBane/Server
Workorders cleared with hireling removal.
This commit is contained in:
@@ -14,6 +14,7 @@ import engine.InterestManagement.WorldGrid;
|
||||
import engine.job.JobContainer;
|
||||
import engine.job.JobScheduler;
|
||||
import engine.jobs.UpgradeBuildingJob;
|
||||
import engine.loot.WorkOrder;
|
||||
import engine.math.Bounds;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.mbEnums;
|
||||
@@ -49,8 +50,7 @@ public enum BuildingManager {
|
||||
|
||||
// Some meshes might not have slot locations assigned.
|
||||
|
||||
if (slotLocations == null ||
|
||||
slotLocations.isEmpty())
|
||||
if (slotLocations == null || slotLocations.isEmpty())
|
||||
return -1;
|
||||
|
||||
int numOfSlots = _slotLocations.get(building.meshUUID).size();
|
||||
@@ -69,8 +69,7 @@ public enum BuildingManager {
|
||||
|
||||
// Some meshes might not have slot locations assigned.
|
||||
|
||||
if (slotLocations == null ||
|
||||
slotLocations.isEmpty())
|
||||
if (slotLocations == null || slotLocations.isEmpty())
|
||||
return -1;
|
||||
|
||||
int numOfSlots = _slotLocations.get(building.meshUUID).size();
|
||||
@@ -127,22 +126,16 @@ public enum BuildingManager {
|
||||
if (building.getGuild().isGuildLeader(player.getObjectUUID()))
|
||||
return true;
|
||||
|
||||
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null
|
||||
&& building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 8)
|
||||
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null && building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 8)
|
||||
return true;
|
||||
|
||||
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null
|
||||
&& building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 9
|
||||
&& GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||
if (building.getFriends().get(player.getGuild().getObjectUUID()) != null && building.getFriends().get(player.getGuild().getObjectUUID()).friendType == 9 && GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||
return true;
|
||||
|
||||
if (Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||
return true;
|
||||
|
||||
if (Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isGuildLeader(player.getGuildStatus()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return Guild.sameGuild(building.getGuild(), player.getGuild()) && GuildStatusController.isGuildLeader(player.getGuildStatus());
|
||||
|
||||
//TODO test friends list once added
|
||||
//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.
|
||||
if (building.getGuild() != null && building.getGuild().isGuildLeader(player.getObjectUUID()))
|
||||
return true;
|
||||
if (GuildStatusController.isGuildLeader(player.getGuildStatus()) == false && GuildStatusController.isInnerCouncil(player.getGuildStatus()) == false)
|
||||
if (!GuildStatusController.isGuildLeader(player.getGuildStatus()) && !GuildStatusController.isInnerCouncil(player.getGuildStatus()))
|
||||
return false;
|
||||
|
||||
|
||||
@@ -274,9 +267,7 @@ public enum BuildingManager {
|
||||
// Submit upgrade job for future date or current instant
|
||||
|
||||
if (building.getUpgradeDateTime().isAfter(LocalDateTime.now())) {
|
||||
JobContainer jc = JobScheduler.getInstance().scheduleJob(new UpgradeBuildingJob(building),
|
||||
building.getUpgradeDateTime().atZone(ZoneId.systemDefault())
|
||||
.toInstant().toEpochMilli());
|
||||
JobContainer jc = JobScheduler.getInstance().scheduleJob(new UpgradeBuildingJob(building), building.getUpgradeDateTime().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
|
||||
} else
|
||||
JobScheduler.getInstance().scheduleJob(new UpgradeBuildingJob(building), 0);
|
||||
}
|
||||
@@ -335,10 +326,16 @@ public enum BuildingManager {
|
||||
WorldGrid.RemoveWorldObject(minionMob);
|
||||
WorldGrid.unloadObject(minionMob);
|
||||
|
||||
if (minionMob.getParentZone() != null)
|
||||
minionMob.getParentZone().zoneMobSet.remove(minionMob);
|
||||
if (minionMob.parentZone != null)
|
||||
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
|
||||
|
||||
building.getHirelings().remove(hireling);
|
||||
@@ -349,9 +346,11 @@ public enum BuildingManager {
|
||||
|
||||
Mob hirelingMob = (Mob) hireling;
|
||||
|
||||
if (hirelingMob.getParentZone() != null)
|
||||
if (hirelingMob.getParentZone().zoneMobSet.contains(hirelingMob))
|
||||
hirelingMob.getParentZone().zoneMobSet.remove(hireling);
|
||||
if (hirelingMob.parentZone != null) {
|
||||
if (hirelingMob.parentZone.zoneMobSet.contains(hirelingMob)) {
|
||||
hirelingMob.parentZone.zoneMobSet.remove(hireling);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -451,7 +450,7 @@ public enum BuildingManager {
|
||||
if (!Guild.sameGuild(building.getGuild(), player.getGuild()))
|
||||
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.
|
||||
@@ -825,7 +824,7 @@ public enum BuildingManager {
|
||||
else
|
||||
success = DbManager.BuildingQueries.updateBuildingRank(building, rank);
|
||||
|
||||
if (success == false) {
|
||||
if (!success) {
|
||||
Logger.error("Error writing to database UUID: " + building.getObjectUUID());
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user