Initial warehouse refactor

This commit is contained in:
2024-03-15 10:01:22 -04:00
parent 92f53b00b8
commit 97fa583f65
15 changed files with 268 additions and 385 deletions
+6 -27
View File
@@ -33,43 +33,22 @@ public final class MobLoot extends Item {
private String prefix = "";
private String suffix = "";
/**
* Create a new MobLoot.
* Do not use this to create Gold.
*
* @param mob Mob that owns this item
* @param ib ItemBase
*/
public MobLoot(AbstractCharacter mob, ItemBase ib, boolean noSteal) {
this(mob, ib, 0, noSteal);
public MobLoot(AbstractCharacter mob, ItemTemplate template, boolean noSteal) {
this(mob, template, 0, noSteal);
}
/**
* Create a new MobLoot item to hold Gold for the Mob.
*
* @param mob Mob that owns this item
* @param qtyOfGold Quantity of gold
*/
public MobLoot(AbstractCharacter mob, int qtyOfGold) {
this(mob, ItemBase.getGoldItemBase(), qtyOfGold, false);
this(mob, ItemTemplate.itemTemplates.get(Enum.ResourceType.GOLD.templateID), qtyOfGold, false);
}
/**
* Create a new MobLoot.
* Primarily used for stackable items that have a quantity.
*
* @param mob Mob that owns this item
* @param ib ItemBase
* @param quantity Quantity of the item
*/
public MobLoot(AbstractCharacter mob, ItemBase ib, int quantity, boolean noSteal) {
public MobLoot(AbstractCharacter mob, ItemTemplate template, int quantity, boolean noSteal) {
super(ib.getUUID());
super(template.template_id);
this.ownerType = OwnerType.Mob;
this.ownerID = mob.getObjectUUID();
this.objectUUID = generateId();
if (quantity == 0 && ItemTemplate.itemTemplates.get(ib.getUUID()).item_type == ItemType.RESOURCE)
if (quantity == 0 && template.item_type == ItemType.RESOURCE)
quantity = 1;
if (quantity > 0)