|
|
@ -39,7 +39,7 @@ public enum MaintenanceManager { |
|
|
|
|
|
|
|
|
|
|
|
// Build list of buildings to apply maintenance on.
|
|
|
|
// Build list of buildings to apply maintenance on.
|
|
|
|
|
|
|
|
|
|
|
|
buildingList = new ArrayList(DbManager.getList(Enum.GameObjectType.Building)); |
|
|
|
buildingList = new ArrayList(DbManager.getList(Enum.GameObjectType.City)); |
|
|
|
maintList = buildMaintList(buildingList); |
|
|
|
maintList = buildMaintList(buildingList); |
|
|
|
|
|
|
|
|
|
|
|
// Deduct upkeep and build list of buildings
|
|
|
|
// Deduct upkeep and build list of buildings
|
|
|
@ -53,7 +53,10 @@ public enum MaintenanceManager { |
|
|
|
// Reset maintenance dates for these buildings
|
|
|
|
// Reset maintenance dates for these buildings
|
|
|
|
|
|
|
|
|
|
|
|
for (Building building : maintList) { |
|
|
|
for (Building building : maintList) { |
|
|
|
setMaintDateTime(building, LocalDateTime.now().plusDays(7)); |
|
|
|
if(derankList.contains(building) == false) |
|
|
|
|
|
|
|
setMaintDateTime(building, LocalDateTime.now().plusDays(7)); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
setMaintDateTime(building, LocalDateTime.now().plusDays(1)); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
// Derak or destroy buildings that did not
|
|
|
|
// Derak or destroy buildings that did not
|
|
|
@ -74,7 +77,10 @@ public enum MaintenanceManager { |
|
|
|
|
|
|
|
|
|
|
|
for (AbstractGameObject gameObject : buildingList) { |
|
|
|
for (AbstractGameObject gameObject : buildingList) { |
|
|
|
|
|
|
|
|
|
|
|
Building building = (Building) gameObject; |
|
|
|
Building building = ((City)gameObject).getTOL();//(Building) gameObject;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(building == null) |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
// No maintenance on NPC owned buildings (Cache loaded)
|
|
|
|
// No maintenance on NPC owned buildings (Cache loaded)
|
|
|
|
|
|
|
|
|
|
|
@ -154,7 +160,8 @@ public enum MaintenanceManager { |
|
|
|
|
|
|
|
|
|
|
|
// Cache maintenance cost value
|
|
|
|
// Cache maintenance cost value
|
|
|
|
|
|
|
|
|
|
|
|
maintCost = building.getMaintCost(); |
|
|
|
//maintCost = building.getMaintCost();
|
|
|
|
|
|
|
|
maintCost = 3000000; |
|
|
|
|
|
|
|
|
|
|
|
// Something went wrong. Missing buildinggroup from switch?
|
|
|
|
// Something went wrong. Missing buildinggroup from switch?
|
|
|
|
|
|
|
|
|
|
|
@ -225,9 +232,9 @@ public enum MaintenanceManager { |
|
|
|
// Add cash back to strongbox for lost rank if the building isn't being destroyed
|
|
|
|
// Add cash back to strongbox for lost rank if the building isn't being destroyed
|
|
|
|
// and it's not an R8 deranking
|
|
|
|
// and it's not an R8 deranking
|
|
|
|
|
|
|
|
|
|
|
|
if ((building.getRank() > 1) && (building.getRank() < 8)) { |
|
|
|
//if ((building.getRank() > 1) && (building.getRank() < 8)) {
|
|
|
|
building.setStrongboxValue(building.getStrongboxValue() + building.getBlueprint().getRankCost(Math.min(building.getRank(), 7))); |
|
|
|
// building.setStrongboxValue(building.getStrongboxValue() + building.getBlueprint().getRankCost(Math.min(building.getRank(), 7)));
|
|
|
|
} |
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
return false; // Early exit for having failed to meet maintenance
|
|
|
|
return false; // Early exit for having failed to meet maintenance
|
|
|
|
} |
|
|
|
} |
|
|
|