Browse Source

Update to resource type

postwipe-mines
MagicBot 7 months ago
parent
commit
f5cc4a3290
  1. 53
      src/engine/mbEnums.java
  2. 2
      src/engine/objects/Mine.java
  3. 4
      src/engine/objects/Warehouse.java

53
src/engine/mbEnums.java

@ -2715,31 +2715,31 @@ public class mbEnums { @@ -2715,31 +2715,31 @@ public class mbEnums {
public enum ResourceType {
GOLD(7, 2308551, 100000000, 10),
ADAMANT(1580003, -1741189964, 1000, 10),
AGATE(1580009, 75173057, 2000, 10),
ANTIMONY(1580014, 452320058, 1000, 10),
AZOTH(1580012, 78329697, 2000, 10),
BLOODSTONE(1580020, -1569826353, 500, 10),
BRONZEWOOD(1580006, 1334770447, 500, 10),
COAL(1580008, 2559427, 3000, 10),
DIAMOND(1580010, -1730704107, 2000, 10),
GALVOR(1580017, -1596311545, 2000, 10),
IRON(1580002, 2504297, 2000, 10),
LUMBER(1580004, -1603256692, 10000, 10),
MANDRAKE(1580007, 1191391799, 1000, 10),
MITHRIL(1580021, -1761257186, 500, 10),
OAK(1580005, 74767, 3000, 10),
OBSIDIAN(1580019, -697973233, 500, 10),
ONYX(1580011, 2977263, 1000, 10),
ORICHALK(1580013, -2036290524, 3000, 10),
QUICKSILVER(1580016, -472884509, 1000, 10),
STONE(1580000, 74856115, 10000, 10),
SULFUR(1580015, -1586349421, 1000, 10),
TRUESTEEL(1580001, -317484979, 2000, 10),
WORMWOOD(1580018, 1532478436, 500, 10);
public static HashMap<Integer, ResourceType> resourceLookup = new HashMap<>();
GOLD(7, -1670881623, 100000000, 50000),
ADAMANT(1580003, 1557001525, 1000, 10),
AGATE(1580009, -1096157543, 2000, 20),
ANTIMONY(1580014, 1256147265, 1000, 10),
AZOTH(1580012, -1205326951, 2000, 20),
BLOODSTONE(1580020, -1912381716, 500, 5),
BRONZEWOOD(1580006, -519681813, 500, 10),
COAL(1580008, -1672872311, 3000, 30),
DIAMOND(1580010, 1540225085, 2000, 20),
GALVOR(1580017, -1683992404, 2000, 5),
IRON(1580002, -1673518119, 2000, 20),
LUMBER(1580004, 1628412684, 10000, 100),
MANDRAKE(1580007, 1519910613, 1000, 10),
MITHRIL(1580021, 626743397, 500, 5),
OAK(1580005, -1653034775, 3000, 30),
OBSIDIAN(1580019, 778019055, 500, 5),
ONYX(1580011, -1675952151, 1000, 10),
ORICHALK(1580013, -1468730955, 3000, 30),
QUICKSILVER(1580016, -2081208434, 1000, 10),
STONE(1580000, -1094703863, 10000, 100),
SULFUR(1580015, -1763687412, 1000, 10),
TRUESTEEL(1580001, -169012482, 2000, 20),
WORMWOOD(1580018, 1204785075, 500, 5);
public static HashMap<Integer, ResourceType> templateLookup = new HashMap<>();
public static HashMap<Integer, ResourceType> hashLookup = new HashMap<>();
public int templateID;
public ItemTemplate template;
@ -2758,11 +2758,10 @@ public class mbEnums { @@ -2758,11 +2758,10 @@ public class mbEnums {
public static void InitializeResourceTypes() {
for (ResourceType resourceType : ResourceType.values()) {
resourceLookup.put(resourceType.templateID, resourceType);
templateLookup.put(resourceType.templateID, resourceType);
hashLookup.put(resourceType.hash, resourceType);
}
}
}

2
src/engine/objects/Mine.java

@ -482,7 +482,7 @@ public class Mine extends AbstractGameObject { @@ -482,7 +482,7 @@ public class Mine extends AbstractGameObject {
if (this.owningGuild.getOwnedCity().warehouse == null)
return false;
return Warehouse.depositFromMine(this, mbEnums.ResourceType.resourceLookup.get(this.production.templateID), this.getModifiedProductionAmount(), this.owningGuild.getOwnedCity().warehouse);
return Warehouse.depositFromMine(this, mbEnums.ResourceType.templateLookup.get(this.production.templateID), this.getModifiedProductionAmount(), this.owningGuild.getOwnedCity().warehouse);
}
public boolean updateGuildOwner(PlayerCharacter playerCharacter) {

4
src/engine/objects/Warehouse.java

@ -233,7 +233,7 @@ public class Warehouse { @@ -233,7 +233,7 @@ public class Warehouse {
return false;
}
mbEnums.ResourceType resourceType = mbEnums.ResourceType.resourceLookup.get(resource.templateID);
mbEnums.ResourceType resourceType = mbEnums.ResourceType.templateLookup.get(resource.templateID);
if (warehouse.resources.get(resourceType) == null)
return false;
@ -261,7 +261,7 @@ public class Warehouse { @@ -261,7 +261,7 @@ public class Warehouse {
int newAmount = oldAmount + amount;
if (newAmount > mbEnums.ResourceType.resourceLookup.get(resource.templateID).deposit_limit)
if (newAmount > mbEnums.ResourceType.templateLookup.get(resource.templateID).deposit_limit)
return false;
if (removeFromInventory) {

Loading…
Cancel
Save