Renamed class to not conflict with the java.lang version.

This commit is contained in:
2024-04-05 07:59:44 -04:00
parent dd84615ca1
commit c1ee6f5b52
388 changed files with 1807 additions and 1779 deletions
+33 -33
View File
@@ -11,7 +11,7 @@ package engine.gameManager;
// Defines static methods which comprise the magicbane
// building maintenance system.
import engine.Enum;
import engine.mbEnums;
import engine.objects.Building;
import engine.objects.City;
import engine.objects.Warehouse;
@@ -44,7 +44,7 @@ public enum MaintenanceManager {
// Build list of buildings to apply maintenance on.
buildingList = new ArrayList(DbManager.getList(Enum.GameObjectType.Building));
buildingList = new ArrayList(DbManager.getList(mbEnums.GameObjectType.Building));
HashMap<String, ArrayList<Building>> maintMap = new HashMap<>();
maintMap = buildMaintList(buildingList);
@@ -119,7 +119,7 @@ public enum MaintenanceManager {
// No maintenance on NPC owned buildings (Cache loaded)
if (building.getProtectionState() == Enum.ProtectionState.NPC)
if (building.getProtectionState() == mbEnums.ProtectionState.NPC)
continue;
// No maintenance on constructing meshes
@@ -141,12 +141,12 @@ public enum MaintenanceManager {
// No maintenance on banestones omfg
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.BANESTONE))
if (building.getBlueprint().getBuildingGroup().equals(mbEnums.BuildingGroup.BANESTONE))
continue;
// no maintenance on Mines omfg
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.MINE))
if (building.getBlueprint().getBuildingGroup().equals(mbEnums.BuildingGroup.MINE))
continue;
// Null Maintenance date?
@@ -169,7 +169,7 @@ public enum MaintenanceManager {
// Add building to maintenance queue
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL))
if (building.getBlueprint().getBuildingGroup().equals(mbEnums.BuildingGroup.TOL))
tolList.add(building);
else
maintList.add(building);
@@ -220,14 +220,14 @@ public enum MaintenanceManager {
// the overdraft for us.
if (hasFunds == false && (building.assetIsProtected() || building.getBlueprint().getBuildingGroup() == Enum.BuildingGroup.WAREHOUSE)) {
if (hasFunds == false && (building.assetIsProtected() || building.getBlueprint().getBuildingGroup() == mbEnums.BuildingGroup.WAREHOUSE)) {
overDraft = maintCost - building.getStrongboxValue();
}
if ((overDraft > 0))
if ((building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.SHRINE) == false) &&
if ((building.getBlueprint().getBuildingGroup().equals(mbEnums.BuildingGroup.SHRINE) == false) &&
(warehouse != null) && building.assetIsProtected() == true &&
(warehouse.resources.get(Enum.ResourceType.GOLD)) >= overDraft) {
(warehouse.resources.get(mbEnums.ResourceType.GOLD)) >= overDraft) {
hasFunds = true;
}
@@ -242,22 +242,22 @@ public enum MaintenanceManager {
hasResources = false;
else {
resourceValue = warehouse.resources.get(Enum.ResourceType.STONE);
resourceValue = warehouse.resources.get(mbEnums.ResourceType.STONE);
if (resourceValue < 1500)
hasResources = false;
resourceValue = warehouse.resources.get(Enum.ResourceType.LUMBER);
resourceValue = warehouse.resources.get(mbEnums.ResourceType.LUMBER);
if (resourceValue < 1500)
hasResources = false;
resourceValue = warehouse.resources.get(Enum.ResourceType.GALVOR);
resourceValue = warehouse.resources.get(mbEnums.ResourceType.GALVOR);
if (resourceValue < 5)
hasResources = false;
resourceValue = warehouse.resources.get(Enum.ResourceType.WORMWOOD);
resourceValue = warehouse.resources.get(mbEnums.ResourceType.WORMWOOD);
if (resourceValue < 5)
hasResources = false;
@@ -290,16 +290,16 @@ public enum MaintenanceManager {
if (overDraft > 0) {
resourceValue = warehouse.resources.get(Enum.ResourceType.GOLD);
warehouse.resources.put(Enum.ResourceType.GOLD, resourceValue - overDraft);
resourceValue = warehouse.resources.get(mbEnums.ResourceType.GOLD);
warehouse.resources.put(mbEnums.ResourceType.GOLD, resourceValue - overDraft);
if (!DbManager.WarehouseQueries.UPDATE_WAREHOUSE(warehouse)) {
warehouse.resources.put(Enum.ResourceType.GOLD, resourceValue);
warehouse.resources.put(mbEnums.ResourceType.GOLD, resourceValue);
Logger.error("gold update failed for warehouse of city:" + warehouse.city.getName());
return true;
}
Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Enum.ResourceType.GOLD, overDraft);
Warehouse.AddTransactionToWarehouse(warehouse, mbEnums.GameObjectType.Building, building.getObjectUUID(), mbEnums.TransactionType.WITHDRAWL, mbEnums.ResourceType.GOLD, overDraft);
}
// Early exit as we're done if we're not an R8 tree
@@ -311,54 +311,54 @@ public enum MaintenanceManager {
// Withdraw Stone
resourceValue = warehouse.resources.get(Enum.ResourceType.STONE);
warehouse.resources.put(Enum.ResourceType.STONE, resourceValue - 1500);
resourceValue = warehouse.resources.get(mbEnums.ResourceType.STONE);
warehouse.resources.put(mbEnums.ResourceType.STONE, resourceValue - 1500);
if (!DbManager.WarehouseQueries.UPDATE_WAREHOUSE(warehouse)) {
warehouse.resources.put(Enum.ResourceType.STONE, resourceValue);
warehouse.resources.put(mbEnums.ResourceType.STONE, resourceValue);
Logger.error("stone update failed for warehouse of city:" + warehouse.city.getName());
return true;
}
Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Enum.ResourceType.STONE, 1500);
Warehouse.AddTransactionToWarehouse(warehouse, mbEnums.GameObjectType.Building, building.getObjectUUID(), mbEnums.TransactionType.WITHDRAWL, mbEnums.ResourceType.STONE, 1500);
// Withdraw Lumber
resourceValue = warehouse.resources.get(Enum.ResourceType.LUMBER);
warehouse.resources.put(Enum.ResourceType.LUMBER, resourceValue - 1500);
resourceValue = warehouse.resources.get(mbEnums.ResourceType.LUMBER);
warehouse.resources.put(mbEnums.ResourceType.LUMBER, resourceValue - 1500);
if (!DbManager.WarehouseQueries.UPDATE_WAREHOUSE(warehouse)) {
warehouse.resources.put(Enum.ResourceType.STONE, resourceValue);
warehouse.resources.put(mbEnums.ResourceType.STONE, resourceValue);
Logger.error("lumber update failed for warehouse of city:" + warehouse.city.getName());
return true;
}
Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Enum.ResourceType.LUMBER, 1500);
Warehouse.AddTransactionToWarehouse(warehouse, mbEnums.GameObjectType.Building, building.getObjectUUID(), mbEnums.TransactionType.WITHDRAWL, mbEnums.ResourceType.LUMBER, 1500);
// Withdraw Galvor
resourceValue = warehouse.resources.get(Enum.ResourceType.GALVOR);
warehouse.resources.put(Enum.ResourceType.GALVOR, resourceValue - 5);
resourceValue = warehouse.resources.get(mbEnums.ResourceType.GALVOR);
warehouse.resources.put(mbEnums.ResourceType.GALVOR, resourceValue - 5);
if (!DbManager.WarehouseQueries.UPDATE_WAREHOUSE(warehouse)) {
warehouse.resources.put(Enum.ResourceType.GALVOR, resourceValue);
warehouse.resources.put(mbEnums.ResourceType.GALVOR, resourceValue);
Logger.error("GALVOR update failed for warehouse of city:" + warehouse.city.getName());
return true;
}
Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Enum.ResourceType.GALVOR, 5);
Warehouse.AddTransactionToWarehouse(warehouse, mbEnums.GameObjectType.Building, building.getObjectUUID(), mbEnums.TransactionType.WITHDRAWL, mbEnums.ResourceType.GALVOR, 5);
// Withdraw GWORMWOOD
resourceValue = warehouse.resources.get(Enum.ResourceType.WORMWOOD);
warehouse.resources.put(Enum.ResourceType.WORMWOOD, resourceValue - 5);
resourceValue = warehouse.resources.get(mbEnums.ResourceType.WORMWOOD);
warehouse.resources.put(mbEnums.ResourceType.WORMWOOD, resourceValue - 5);
if (!DbManager.WarehouseQueries.UPDATE_WAREHOUSE(warehouse)) {
warehouse.resources.put(Enum.ResourceType.GALVOR, resourceValue);
warehouse.resources.put(mbEnums.ResourceType.GALVOR, resourceValue);
Logger.error("wyrmwood update failed for warehouse of city:" + warehouse.city.getName());
return true;
}
Warehouse.AddTransactionToWarehouse(warehouse, Enum.GameObjectType.Building, building.getObjectUUID(), Enum.TransactionType.WITHDRAWL, Enum.ResourceType.WORMWOOD, 5);
Warehouse.AddTransactionToWarehouse(warehouse, mbEnums.GameObjectType.Building, building.getObjectUUID(), mbEnums.TransactionType.WITHDRAWL, mbEnums.ResourceType.WORMWOOD, 5);
return true;
}