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

Loading…
Cancel
Save