Browse Source

Bane rank loaded from template

combat-2
MagicBot 9 months ago
parent
commit
7f579e5268
  1. 21
      src/engine/gameManager/ForgeManager.java
  2. 7
      src/engine/objects/ItemTemplate.java

21
src/engine/gameManager/ForgeManager.java

@ -131,16 +131,14 @@ public enum ForgeManager implements Runnable { @@ -131,16 +131,14 @@ public enum ForgeManager implements Runnable {
public static long calcRollingDuration(WorkOrder workOrder) {
long rollingDuration;
float rank = workOrder.vendor.getBuilding().getRank() - 1;
float rate = (float) (2.5 * rank);
float rate = (float) (2.5 * (workOrder.vendor.getBuilding().getRank() - 1));
float baseTime = (20 - rate) * 60000;
ItemTemplate template = ItemTemplate.templates.get(workOrder.templateID);
// Bane circles
if (workOrder.templateID > 910010 && workOrder.templateID < 910019) {
rank = workOrder.templateID - 910010;
baseTime = rank * 60 * 60 * 3 * 1000;
}
if (template.item_bane_rank > 0)
baseTime = template.item_bane_rank * 60 * 60 * 3 * 1000;
rollingDuration = (long) (baseTime * Float.parseFloat(ConfigManager.MB_PRODUCTION_RATE.getValue()));
return rollingDuration;
@ -148,16 +146,27 @@ public enum ForgeManager implements Runnable { @@ -148,16 +146,27 @@ public enum ForgeManager implements Runnable {
public static int calcAvailableSlots(WorkOrder workOrder) {
// Slots available in a forge are based on the npc rank
int availableSlots = workOrder.vendor.getRank();
// Slots currently used up by the npc workOrders
for (WorkOrder npcWorkOrder : workOrder.vendor.workOrders)
availableSlots = availableSlots - npcWorkOrder.slotCount;
// Slot count override for single item production
if (workOrder.total_to_produce == 0 && availableSlots > 1)
availableSlots = 1;
return availableSlots;
}
public static HashMap<mbEnums.ResourceType, Integer> calcProductionCost(WorkOrder workOrder) {
// Calculate the production cost for a single run of this workOrder
HashMap<mbEnums.ResourceType, Integer> production_cost = new HashMap<>();
ItemTemplate template = ItemTemplate.templates.get(workOrder.templateID);

7
src/engine/objects/ItemTemplate.java

@ -133,6 +133,7 @@ public class ItemTemplate { @@ -133,6 +133,7 @@ public class ItemTemplate {
public final EnumSet<mbEnums.MonsterType> rune_not_enemy_monster_types = EnumSet.noneOf(mbEnums.MonsterType.class);
public final ArrayList<Integer> rune_groupee_monster_types = new ArrayList<>();
public final ArrayList<Integer> rune_helper_monster_types = new ArrayList<>();
public int item_bane_rank;
public ItemTemplate(JSONObject jsonObject) {
@ -178,6 +179,12 @@ public class ItemTemplate { @@ -178,6 +179,12 @@ public class ItemTemplate {
obj_sparse_data.put(sparseType, sparseValue.toString());
}
// Banes are defined by their sparse data field
if (obj_sparse_data.entrySet().contains("ACTIONRESPONSE"))
if (obj_sparse_data.get("ACTIONRESPONSE").equals("4250517122"))
item_bane_rank = ((Long) jsonObject.get("item_bane_rank")).intValue();
// Reading float values
combat_health_current = ((Double) jsonObject.get("combat_health_current")).floatValue();

Loading…
Cancel
Save