Browse Source

More itembase refactor

combat-2
MagicBot 8 months ago
parent
commit
3dcffa3042
  1. 24
      src/engine/objects/ItemFactory.java

24
src/engine/objects/ItemFactory.java

@ -141,7 +141,7 @@ public class ItemFactory { @@ -141,7 +141,7 @@ public class ItemFactory {
return null;
}
if (overdraft > resources.get(ItemBase.GOLD_ITEM_BASE)) {
if (overdraft > resources.get(Enum.ResourceType.GOLD)) {
if (pc != null)
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse for overdraft." + " " + template.item_base_name);
return null;
@ -154,7 +154,7 @@ public class ItemFactory { @@ -154,7 +154,7 @@ public class ItemFactory {
ErrorPopupMsg.sendErrorMsg(pc, "Building does not have enough gold to produce this item." + template.item_base_name);
return null;
} else {
if (overdraft > resources.get(ItemBase.GOLD_ITEM_BASE)) {
if (overdraft > resources.get(Enum.ResourceType.GOLD)) {
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse to produce this item." + template.item_base_name);
return null;
}
@ -367,7 +367,7 @@ public class ItemFactory { @@ -367,7 +367,7 @@ public class ItemFactory {
return null;
}
if (overdraft > cityWarehouse.resources.get(ItemBase.GOLD_ITEM_BASE)) {
if (overdraft > cityWarehouse.resources.get(Enum.ResourceType.GOLD)) {
if (pc != null)
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse for overdraft." + template.item_base_name);
return null;
@ -422,7 +422,7 @@ public class ItemFactory { @@ -422,7 +422,7 @@ public class ItemFactory {
ErrorPopupMsg.sendErrorMsg(pc, "Building does not have enough gold to produce this item." + template.item_base_name);
return null;
} else {
if (overdraft > cityWarehouse.resources.get(ItemBase.GOLD_ITEM_BASE)) {
if (overdraft > cityWarehouse.resources.get(Enum.ResourceType.GOLD)) {
ErrorPopupMsg.sendErrorMsg(pc, "Not enough Gold in Warehouse to produce this item." + template.item_base_name);
return null;
}
@ -588,7 +588,7 @@ public class ItemFactory { @@ -588,7 +588,7 @@ public class ItemFactory {
time = (20 - rate);
time *= MBServerStatics.ONE_MINUTE;
if (ml.getItemBase().getUUID() > 910010 && ml.getItemBase().getUUID() < 910019) {
if (ml.templateID > 910010 && ml.templateID < 910019) {
rank = ml.getTemplateID() - 910010;
time = rank * 60 * 60 * 3 * 1000;
}
@ -630,7 +630,7 @@ public class ItemFactory { @@ -630,7 +630,7 @@ public class ItemFactory {
}
public static Item randomRoll(NPC vendor, PlayerCharacter playerCharacter, int itemsToRoll, int itemBaseID) {
public static Item randomRoll(NPC vendor, PlayerCharacter playerCharacter, int itemsToRoll, int templateID) {
byte itemModTable;
int prefixMod = 0;
int suffixMod = 0;
@ -640,8 +640,8 @@ public class ItemFactory { @@ -640,8 +640,8 @@ public class ItemFactory {
ModTableEntry prefixEntry = null;
ModTableEntry suffixEntry = null;
ItemBase ib = ItemBase.getItemBase(itemBaseID);
ItemTemplate template = ItemTemplate.templates.get(itemBaseID);
ItemBase ib = ItemBase.getItemBase(templateID);
ItemTemplate template = ItemTemplate.templates.get(templateID);
if (template == null)
return null;
@ -714,7 +714,7 @@ public class ItemFactory { @@ -714,7 +714,7 @@ public class ItemFactory {
suffix = suffixEntry.action;
}
MobLoot toRoll = ItemFactory.produceRandomRoll(vendor, playerCharacter, prefix, suffix, itemBaseID);
MobLoot toRoll = ItemFactory.produceRandomRoll(vendor, playerCharacter, prefix, suffix, templateID);
if (toRoll == null)
return null;
@ -727,8 +727,10 @@ public class ItemFactory { @@ -727,8 +727,10 @@ public class ItemFactory {
time = (20 - rate);
time *= MBServerStatics.ONE_MINUTE;
if (toRoll.getItemBase().getUUID() > 910010 && toRoll.getItemBase().getUUID() < 910019) {
rank = toRoll.getTemplateID() - 910010;
// Bane circles
if (toRoll.templateID > 910010 && toRoll.templateID < 910019) {
rank = toRoll.templateID - 910010;
time = rank * 60 * 60 * 3 * 1000;
}

Loading…
Cancel
Save