Read item_type through the cache template bridge

Every consumer of the legacy ItemTemplate item_type now reads
template.cacheTemplate.getItemType(). Left on the legacy field: the
type count in dbItemHandler.LOAD_ITEM_TEMPLATES, which runs before the
bridge is linked. The charter checks already read DeedTemplate.

Parity (offline, static_item_templates vs the template
CObjectIndex.lookup picks, scripts/p14.py, 7586 templates: ITEM 4011,
DEED 880, RUNE 2695): 0 differences in item_type. No value changes
expected.

JSON-Refactor-Plan Task 1.4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
MagicBotandClaude Opus 5.5 committed 2026-10-19 12:43:57 -04:00
1 parent 6825f94f1e
commit b8ac8cce3e
28 files changed
+69 -69

No files matched your search

+2 -2
View File
@@ -325,7 +325,7 @@ public class dbItemHandler extends dbHandlerBase {
for (Item item : inventory) {
if (item.template.item_type.equals(ItemType.GOLD))
if (item.template.cacheTemplate.getItemType().equals(ItemType.GOLD))
continue;
try (Connection connection = DbManager.getConnection();
@@ -474,7 +474,7 @@ public class dbItemHandler extends dbHandlerBase {
*/
public boolean UPDATE_GOLD(final Item item, int newValue, int oldValue) {
if (!item.template.item_type.equals(ItemType.GOLD))
if (!item.template.cacheTemplate.getItemType().equals(ItemType.GOLD))
return false;
try (Connection connection = DbManager.getConnection();
+3 -3
View File
@@ -69,7 +69,7 @@ public class MakeItemCmd extends AbstractDevCmd {
return;
}
if (template.item_type == ItemType.GOLD) {
if (template.cacheTemplate.getItemType() == ItemType.GOLD) {
this.throwbackInfo(pc, "use /addgold to add gold.");
return;
}
@@ -139,8 +139,8 @@ public class MakeItemCmd extends AbstractDevCmd {
}
if ((numItems > 1)
&& (template.item_type.equals(ItemType.RESOURCE) == false)
&& (template.item_type.equals(ItemType.OFFERING)) == false)
&& (template.cacheTemplate.getItemType().equals(ItemType.RESOURCE) == false)
&& (template.cacheTemplate.getItemType().equals(ItemType.OFFERING)) == false)
numItems = 1;
CharacterItemManager cim = pc.charItemManager;
@@ -77,7 +77,7 @@ public class PrintInventoryCmd extends AbstractDevCmd {
for (Item item : inventory) {
ItemTemplate template = ItemTemplate.templates.get(item.templateID);
if (item.template.item_type.equals(ItemType.GOLD) == false) {
if (item.template.cacheTemplate.getItemType().equals(ItemType.GOLD) == false) {
String chargeInfo = "";
int chargeMax = template.item_initial_charges;
+1 -1
View File
@@ -57,7 +57,7 @@ public class SimulateBootyCmd extends AbstractDevCmd {
try {
mob.loadInventory();
for (Item lootItem : mob.charItemManager.getInventory()) {
switch (lootItem.template.item_type) {
switch (lootItem.template.cacheTemplate.getItemType()) {
case EMPLOYMENTCONTRACT: //CONTRACT
Contracts.add(lootItem);
break;
+1 -1
View File
@@ -535,7 +535,7 @@ public enum ChatManager {
if (item != null) //Steal
if (success) {
String name = "";
if (item.template.item_type.equals(mbEnums.ItemType.GOLD))
if (item.template.cacheTemplate.getItemType().equals(mbEnums.ItemType.GOLD))
name = amount + " gold ";
else {
String vowels = "aeiou";
+1 -1
View File
@@ -307,7 +307,7 @@ public enum GroupManager {
return false;
}
if (!item.template.item_type.equals(mbEnums.ItemType.GOLD)) //only split goldItem
if (!item.template.cacheTemplate.getItemType().equals(mbEnums.ItemType.GOLD)) //only split goldItem
return false;
Group group = getGroup(pc);
+3 -3
View File
@@ -112,7 +112,7 @@ public enum ItemManager {
public static boolean isTwoHanded(Item item) {
if (!item.template.item_type.equals(mbEnums.ItemType.WEAPON))
if (!item.template.cacheTemplate.getItemType().equals(mbEnums.ItemType.WEAPON))
return false;
return item.template.item_eq_slots_and.contains(EnumSet.of(mbEnums.EquipSlotType.LHELD, mbEnums.EquipSlotType.RHELD));
@@ -120,7 +120,7 @@ public enum ItemManager {
public static boolean isTwoHanded(ItemTemplate template) {
if (!template.item_type.equals(mbEnums.ItemType.WEAPON))
if (!template.cacheTemplate.getItemType().equals(mbEnums.ItemType.WEAPON))
return false;
return template.item_eq_slots_and.contains(EnumSet.of(mbEnums.EquipSlotType.LHELD, mbEnums.EquipSlotType.RHELD));
@@ -165,7 +165,7 @@ public enum ItemManager {
(slot == mbEnums.EquipSlotType.RHELD && equipped.get(mbEnums.EquipSlotType.LHELD) != null)))
return false;
if (item.template.item_type.equals(mbEnums.ItemType.WEAPON))
if (item.template.cacheTemplate.getItemType().equals(mbEnums.ItemType.WEAPON))
if (equipped.get(slot) != null && equipped.get(slot).equals(item) == false)
return false;
+1 -1
View File
@@ -179,7 +179,7 @@ public enum LootManager {
if (itemUUID == 0)
return null;
if (ItemTemplate.templates.get(itemUUID).item_type.equals(mbEnums.ItemType.RESOURCE)) {
if (ItemTemplate.templates.get(itemUUID).cacheTemplate.getItemType().equals(mbEnums.ItemType.RESOURCE)) {
int amount = ThreadLocalRandom.current().nextInt(tableRow.minSpawn, tableRow.maxSpawn + 1);
return new MobLoot(mob, ItemTemplate.templates.get(itemUUID), amount, false);
}
+2 -2
View File
@@ -352,7 +352,7 @@ public enum NPCManager {
int baseDef = guard.mobBase.getDefenseRating();
int armorDefense = 0;
for (Item equipped : guard.charItemManager.equipped.values())
if (equipped.template.item_type.equals(mbEnums.ItemType.ARMOR) || ItemManager.isShield(equipped.template))
if (equipped.template.cacheTemplate.getItemType().equals(mbEnums.ItemType.ARMOR) || ItemManager.isShield(equipped.template))
armorDefense += equipped.template.item_defense_rating;
guard.defenseRating = dexterity + baseDef + armorDefense;
}
@@ -442,7 +442,7 @@ public enum NPCManager {
return;
for (Item equipped : mob.charItemManager.equipped.values()) {
if (equipped.template.item_type.equals(mbEnums.ItemType.ARMOR)) {
if (equipped.template.cacheTemplate.getItemType().equals(mbEnums.ItemType.ARMOR)) {
mob.resists.setResist(mbEnums.DamageType.SLASHING, mob.resists.getResist(mbEnums.DamageType.SLASHING, 0) + equipped.template.combat_attack_resist.get("SLASHING"));
mob.resists.setResist(mbEnums.DamageType.CRUSHING, mob.resists.getResist(mbEnums.DamageType.CRUSHING, 0) + equipped.template.combat_attack_resist.get("CRUSHING"));
mob.resists.setResist(mbEnums.DamageType.PIERCING, mob.resists.getResist(mbEnums.DamageType.PIERCING, 0) + equipped.template.combat_attack_resist.get("PIERCING"));
+3 -3
View File
@@ -2255,12 +2255,12 @@ public enum PowersManager {
if (pb.targetItem())
return true;
// TODO add these checks later
else if (pb.targetArmor() && item.template.item_type.equals(ItemType.ARMOR))
else if (pb.targetArmor() && item.template.cacheTemplate.getItemType().equals(ItemType.ARMOR))
return true;
else if (pb.targetJewelry() && item.template.item_type.equals(ItemType.JEWELRY))
else if (pb.targetJewelry() && item.template.cacheTemplate.getItemType().equals(ItemType.JEWELRY))
return true;
else
return pb.targetWeapon() && item.template.item_type.equals(ItemType.WEAPON);
return pb.targetWeapon() && item.template.cacheTemplate.getItemType().equals(ItemType.WEAPON);
} // How did we get here? all valid targets have been covered
else
return false;
@@ -238,7 +238,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
if (targetItem == null)
return;
if (targetItem.template.item_type.equals(ItemType.GOLD))
if (targetItem.template.cacheTemplate.getItemType().equals(ItemType.GOLD))
return;
if (!vendor.charItemManager.hasRoomInventory(targetItem.template.item_wt)) {
@@ -319,7 +319,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
if (targetItem == null)
continue;
if (targetItem.template.item_type.equals(ItemType.GOLD))
if (targetItem.template.cacheTemplate.getItemType().equals(ItemType.GOLD))
return;
if (!vendor.charItemManager.doesCharOwnThisItem(targetItem.getObjectUUID()))
@@ -335,7 +335,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
break;
}
switch (targetItem.template.item_type) {
switch (targetItem.template.cacheTemplate.getItemType()) {
case EMPLOYMENTCONTRACT:
case CHARTER:
case DEED:
@@ -465,7 +465,7 @@ public class ItemProductionMsgHandler extends AbstractClientMsgHandler {
if (targetItem == null)
return;
if (targetItem.template.item_type.equals(ItemType.GOLD))
if (targetItem.template.cacheTemplate.getItemType().equals(ItemType.GOLD))
return;
if (!vendor.charItemManager.inventoryContains(targetItem))
@@ -161,7 +161,7 @@ public class LootMsgHandler extends AbstractClientMsgHandler {
if (itemRet == null)
return true;
if (item.template.item_type.equals(mbEnums.ItemType.GOLD)) {
if (item.template.cacheTemplate.getItemType().equals(mbEnums.ItemType.GOLD)) {
// this is done to prevent the temporary goldItem item
// (from the mob) from appearing in player's inventory.
// It also updates the goldItem quantity display
@@ -187,7 +187,7 @@ public class LootMsgHandler extends AbstractClientMsgHandler {
//TODO send group loot message if player is grouped and visible
Group group = GroupManager.getGroup(player);
if (group != null && group.getSplitGold() && (item.template.item_type.equals(mbEnums.ItemType.GOLD) == false)) {
if (group != null && group.getSplitGold() && (item.template.cacheTemplate.getItemType().equals(mbEnums.ItemType.GOLD) == false)) {
String name = item.getName();
String text = player.getFirstName() + " has looted " + name + '.';
ChatManager.chatGroupInfoCanSee(player, text);
@@ -202,7 +202,7 @@ public class LootMsgHandler extends AbstractClientMsgHandler {
if (itemRet == null)
return true;
if (item.template.item_type.equals(mbEnums.ItemType.GOLD)) {
if (item.template.cacheTemplate.getItemType().equals(mbEnums.ItemType.GOLD)) {
// this is done to prevent the temporary goldItem item
// (from the mob) from appearing in player's inventory.
// It also updates the goldItem quantity display
@@ -241,7 +241,7 @@ public class LootMsgHandler extends AbstractClientMsgHandler {
//TODO send group loot message if player is grouped and visible
Group group = GroupManager.getGroup(player);
if (group != null && group.getSplitGold() && (item.template.item_type.equals(mbEnums.ItemType.GOLD) == false)) {
if (group != null && group.getSplitGold() && (item.template.cacheTemplate.getItemType().equals(mbEnums.ItemType.GOLD) == false)) {
String name = item.getName();
String text = player.getFirstName() + " has looted " + name + '.';
ChatManager.chatGroupInfoCanSee(player, text);
@@ -79,7 +79,7 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
int uuid = item.templateID;
switch (item.template.item_type) {
switch (item.template.cacheTemplate.getItemType()) {
case DEED: //buildings
//Call add building screen here, ib.getUseID() get's building ID
@@ -226,7 +226,7 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
// Bypass for waterbuckets
if (item.template.item_type.equals(mbEnums.ItemType.BUCKET)) {
if (item.template.cacheTemplate.getItemType().equals(mbEnums.ItemType.BUCKET)) {
// test for valid target type
if (target.getObjectType() == mbEnums.GameObjectType.PlayerCharacter)
@@ -68,7 +68,7 @@ public class TransferItemFromBankMsgHandler extends AbstractClientMsgHandler {
return true;
;
if (item.template.item_type.equals(mbEnums.ItemType.GOLD)) {
if (item.template.cacheTemplate.getItemType().equals(mbEnums.ItemType.GOLD)) {
if (!itemManager.moveGoldToInventory(item, msg.getNumItems()))
return true;
@@ -65,7 +65,7 @@ public class TransferItemToBankMsgHandler extends AbstractClientMsgHandler {
return true;
if (item.containerType == mbEnums.ItemContainerType.INVENTORY && itemManager.isBankOpen())
if (item.template.item_type.equals(mbEnums.ItemType.GOLD)) {
if (item.template.cacheTemplate.getItemType().equals(mbEnums.ItemType.GOLD)) {
if (!itemManager.moveGoldToBank(item, msg.getNumItems()))
return true;
UpdateGoldMsg goldMes = new UpdateGoldMsg(player);
@@ -54,7 +54,7 @@ public class UpdateInventoryMsg extends ClientNetMsg {
for (Item item : list) {
if (item.template.item_type.equals(ItemType.GOLD)) {
if (item.template.cacheTemplate.getItemType().equals(ItemType.GOLD)) {
if (item.getNumOfItems() == 0)
continue;
}
@@ -156,7 +156,7 @@ public class VendorBuyWindowMsg extends ClientNetMsg {
for (Item item : inventory) {
if (item.getOwnerID() != ownerID)
continue;
if (item.template.item_type.equals(ItemType.GOLD)) {
if (item.template.cacheTemplate.getItemType().equals(ItemType.GOLD)) {
if (item.getNumOfItems() == 0)
continue;
}
+3 -3
View File
@@ -701,7 +701,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
if (itemTemplate == null)
noWeapon = true;
else if (!weapon.template.item_type.equals(ItemType.WEAPON)) {
else if (!weapon.template.cacheTemplate.getItemType().equals(ItemType.WEAPON)) {
defaultAtrAndDamage(abstractCharacter, mainHand);
return;
} else
@@ -718,7 +718,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
if (noWeapon) {
if (mainHand) {
Item off = abstractCharacter.charItemManager.getEquipped().get(EquipSlotType.LHELD);
if (off != null && off.template != null && off.template.item_type.equals(ItemType.WEAPON))
if (off != null && off.template != null && off.template.cacheTemplate.getItemType().equals(ItemType.WEAPON))
abstractCharacter.rangeHandOne = 10 * (1 + (abstractCharacter.statStrBase / 600)); // Set
// to
// no
@@ -997,7 +997,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
if (template == null)
return 0;
if (!armor.template.item_type.equals(ItemType.ARMOR))
if (!armor.template.cacheTemplate.getItemType().equals(ItemType.ARMOR))
return 0;
if (armor.template.item_skill_used.isEmpty())
+1 -1
View File
@@ -172,7 +172,7 @@ public class Account extends AbstractGameObject {
this.vault = DbManager.ItemQueries.GET_ITEMS_FOR_ACCOUNT(this.getObjectUUID());
for (Item item : this.vault) {
if (item.template.item_type.equals(mbEnums.ItemType.GOLD)) {
if (item.template.cacheTemplate.getItemType().equals(mbEnums.ItemType.GOLD)) {
this.vaultGold = item;
}
}
+20 -20
View File
@@ -130,19 +130,19 @@ public class CharacterItemManager {
this.equipped.put(i.equipSlot, i);
break;
case BANK:
if (i.template.item_type.equals(ItemType.GOLD))
if (i.template.cacheTemplate.getItemType().equals(ItemType.GOLD))
this.goldBank = i;
else if (this.bank.contains(i) == false)
this.bank.add(i);
break;
case INVENTORY:
if (i.template.item_type.equals(ItemType.GOLD))
if (i.template.cacheTemplate.getItemType().equals(ItemType.GOLD))
this.goldInventory = i;
else if (this.inventory.contains(i) == false)
this.inventory.add(i);
break;
case VAULT:
if (i.template.item_type.equals(ItemType.GOLD))
if (i.template.cacheTemplate.getItemType().equals(ItemType.GOLD))
this.goldVault = i;
else if (this.vault.contains(i) == false)
this.vault.add(i);
@@ -175,13 +175,13 @@ public class CharacterItemManager {
this.equipped.put(i.equipSlot, i);
break;
case BANK:
if (i.template.item_type.equals(ItemType.GOLD))
if (i.template.cacheTemplate.getItemType().equals(ItemType.GOLD))
this.goldBank = i;
else if (this.bank.contains(i) == false)
this.bank.add(i);
break;
case INVENTORY:
if (i.template.item_type.equals(ItemType.GOLD))
if (i.template.cacheTemplate.getItemType().equals(ItemType.GOLD))
this.goldInventory = i;
else if (this.inventory.contains(i) == false)
this.inventory.add(i);
@@ -511,7 +511,7 @@ public class CharacterItemManager {
if (i == null)
return false;
if (i.template.item_type.equals(ItemType.GOLD)) {
if (i.template.cacheTemplate.getItemType().equals(ItemType.GOLD)) {
if (this.getGoldInventory() != null) {
if (i.getObjectUUID() == this.getGoldInventory().getObjectUUID())
this.goldInventory = null;
@@ -541,7 +541,7 @@ public class CharacterItemManager {
}
private synchronized boolean junk(Item i, boolean updateInventory) {
if (i.template.item_type.equals(ItemType.GOLD)) {
if (i.template.cacheTemplate.getItemType().equals(ItemType.GOLD)) {
if (this.getGoldInventory().getObjectUUID() == i.getObjectUUID())
if (DbManager.ItemQueries.UPDATE_GOLD(i, 0)) {
this.getGoldInventory().setNumOfItems(0);
@@ -596,7 +596,7 @@ public class CharacterItemManager {
if (equippedContains(item)) {
fromEquip = true;
if (item.template.item_type.equals(ItemType.GOLD))
if (item.template.cacheTemplate.getItemType().equals(ItemType.GOLD))
this.absCharacter.cancelOnUnEquip();
}
@@ -814,7 +814,7 @@ public class CharacterItemManager {
// This removes ingame item from inventory for loot.
private synchronized boolean removeItemFromInventory(Item i) {
if (i.template.item_type.equals(ItemType.GOLD)) {
if (i.template.cacheTemplate.getItemType().equals(ItemType.GOLD)) {
if (i.getObjectUUID() != this.getGoldInventory().getObjectUUID())
return false;
if (!DbManager.ItemQueries.UPDATE_GOLD(this.goldInventory, 0)) {
@@ -837,7 +837,7 @@ public class CharacterItemManager {
// This adds item to inventory for loot. Validity checks already handled
public synchronized boolean addItemToInventory(Item i) {
if (i.template.item_type.equals(ItemType.GOLD))
if (i.template.cacheTemplate.getItemType().equals(ItemType.GOLD))
if (this.absCharacter.getObjectType() == GameObjectType.Mob) {
if (this.goldInventory == null)
loadGoldItems();
@@ -1041,7 +1041,7 @@ public class CharacterItemManager {
if (npc.getContractID() >= 1900 && npc.getContractID() <= 1906)
eatItem = true;
if (itemToSell.template.item_type.equals(ItemType.POTION))
if (itemToSell.template.cacheTemplate.getItemType().equals(ItemType.POTION))
eatItem = true;
if (eatItem) {
@@ -1184,9 +1184,9 @@ public class CharacterItemManager {
synchronized (lockFirst) {
synchronized (lockSecond) {
// make sure current player has item in inventory
if (lootItem.template.item_type.equals(ItemType.GOLD) && lootItem.getObjectUUID() != this.getGoldInventory().getObjectUUID() && !(this.absCharacter.getObjectType().equals(GameObjectType.Mob)))
if (lootItem.template.cacheTemplate.getItemType().equals(ItemType.GOLD) && lootItem.getObjectUUID() != this.getGoldInventory().getObjectUUID() && !(this.absCharacter.getObjectType().equals(GameObjectType.Mob)))
return null;
else if (!this.inventory.contains(lootItem) && !this.equipped.containsValue(lootItem) && !lootItem.template.item_type.equals(ItemType.GOLD))
else if (!this.inventory.contains(lootItem) && !this.equipped.containsValue(lootItem) && !lootItem.template.cacheTemplate.getItemType().equals(ItemType.GOLD))
return null;
// get weight of item
@@ -1197,10 +1197,10 @@ public class CharacterItemManager {
int weight = lootItem.template.item_wt;
// make sure lootingPlayer has room for item
if (!lootItem.template.item_type.equals(ItemType.GOLD) && !looterItems.hasRoomInventory(weight))
if (!lootItem.template.cacheTemplate.getItemType().equals(ItemType.GOLD) && !looterItems.hasRoomInventory(weight))
return null;
if (lootItem.template.item_type.equals(ItemType.GOLD))
if (lootItem.template.cacheTemplate.getItemType().equals(ItemType.GOLD))
if (amount != -1) { //from steal
int total = lootItem.getNumOfItems();
amount = (amount > total) ? total : amount;
@@ -1263,19 +1263,19 @@ public class CharacterItemManager {
* Delegates
*/
public synchronized boolean bankContains(Item item) {
if (item.template.item_type.equals(ItemType.GOLD))
if (item.template.cacheTemplate.getItemType().equals(ItemType.GOLD))
return (this.getGoldBank() != null && this.goldBank.getObjectUUID() == item.getObjectUUID());
return bank.contains(item);
}
public synchronized boolean inventoryContains(Item item) {
if (item.template.item_type.equals(ItemType.GOLD))
if (item.template.cacheTemplate.getItemType().equals(ItemType.GOLD))
return (this.getGoldInventory() != null && this.goldInventory.getObjectUUID() == item.getObjectUUID());
return inventory.contains(item);
}
public synchronized boolean vaultContains(Item item) {
if (item.template.item_type.equals(ItemType.GOLD))
if (item.template.cacheTemplate.getItemType().equals(ItemType.GOLD))
return (this.getGoldVault() != null && this.goldVault.getObjectUUID() == item.getObjectUUID());
return this.account.getVault().contains(item);
}
@@ -1518,13 +1518,13 @@ public class CharacterItemManager {
item.zeroItem();
item.containerType = mbEnums.ItemContainerType.INVENTORY;
if (item.template.item_type.equals(ItemType.GOLD))
if (item.template.cacheTemplate.getItemType().equals(ItemType.GOLD))
//only add gold item once
if (!corpse.hasGold())
corpse.setHasGold(true);
newInventory.add(item);
} else //item
if (item.template.item_type.equals(ItemType.GOLD)) {
if (item.template.cacheTemplate.getItemType().equals(ItemType.GOLD)) {
int amt = item.getNumOfItems();
item.setNumOfItems(0);
MobLoot ml = new MobLoot(this.absCharacter, amt);
+2 -2
View File
@@ -299,11 +299,11 @@ public class Corpse extends AbstractWorldObject {
int weight = item.template.item_wt;
//make sure looter has room for item
if (item.template.item_type.equals(ItemType.GOLD) == false && !looterItems.hasRoomInventory(weight))
if (item.template.cacheTemplate.getItemType().equals(ItemType.GOLD) == false && !looterItems.hasRoomInventory(weight))
return null;
//attempt to transfer item in db
if (item.template.item_type.equals(ItemType.GOLD)) {
if (item.template.cacheTemplate.getItemType().equals(ItemType.GOLD)) {
if (!looterItems.moveGoldToInventory(item, item.getNumOfItems()))
return null;
} else if (!item.moveItemToInventory(looter))
+2 -2
View File
@@ -463,7 +463,7 @@ public class Item extends AbstractWorldObject {
int serialized = 0;
for (Item item : list) {
if (item.template.item_type.equals(ItemType.GOLD))
if (item.template.cacheTemplate.getItemType().equals(ItemType.GOLD))
if (item.numberOfItems == 0)
continue;
try {
@@ -497,7 +497,7 @@ public class Item extends AbstractWorldObject {
int serialized = 0;
for (Item item : list) {
if (item.template.item_type.equals(ItemType.GOLD))
if (item.template.cacheTemplate.getItemType().equals(ItemType.GOLD))
if (item.numberOfItems == 0)
continue;
try {
+2 -2
View File
@@ -45,7 +45,7 @@ public final class MobLoot extends Item {
this.ownerID = mob.getObjectUUID();
this.objectUUID = generateId();
if (quantity == 0 && template.item_type == ItemType.RESOURCE)
if (quantity == 0 && template.cacheTemplate.getItemType() == ItemType.RESOURCE)
quantity = 1;
if (quantity > 0)
@@ -105,7 +105,7 @@ public final class MobLoot extends Item {
if (isDeleted)
return null;
if (this.template.item_type.equals(ItemType.GOLD))
if (this.template.cacheTemplate.getItemType().equals(ItemType.GOLD))
return null;
Item item = this;
+1 -1
View File
@@ -969,7 +969,7 @@ public class NPC extends AbstractCharacter {
if (itemTemplate.item_skill_required.values().iterator().hasNext())
skillRequired = itemTemplate.item_skill_required.values().iterator().next();
boolean exclude = skillRequired == 0 && ItemTemplate.templates.get(itemID).item_type.equals(ItemType.WEAPON);
boolean exclude = skillRequired == 0 && ItemTemplate.templates.get(itemID).cacheTemplate.getItemType().equals(ItemType.WEAPON);
if (skillRequired <= maxSkill && !exclude)
filteredItemList.add(itemID);
}
+2 -2
View File
@@ -2819,11 +2819,11 @@ public class PlayerCharacter extends AbstractCharacter {
ItemTemplate ib = item.template;
if (ib != null) {
if ((item.template.item_type.equals(ItemType.WEAPON))
if ((item.template.cacheTemplate.getItemType().equals(ItemType.WEAPON))
&& (item.template.item_skill_used.equals(type) || ib.item_skill_mastery_used.equals(type)))
return true;
return (item.template.item_type.equals(ItemType.ARMOR))
return (item.template.cacheTemplate.getItemType().equals(ItemType.ARMOR))
&& (item.template.item_skill_used.equals(type));
}
+1 -1
View File
@@ -162,7 +162,7 @@ public class Resists {
if (armor == null)
return phys;
if (armor.template.item_type.equals(mbEnums.ItemType.ARMOR)) {
if (armor.template.cacheTemplate.getItemType().equals(mbEnums.ItemType.ARMOR)) {
phys[0] += armor.template.combat_attack_resist.get("SLASHING");
phys[1] += armor.template.combat_attack_resist.get("CRUSHING");
phys[2] += armor.template.combat_attack_resist.get("PIERCING");
+1 -1
View File
@@ -304,7 +304,7 @@ public class Warehouse {
return false;
}
if (resource.template.item_type.equals(mbEnums.ItemType.GOLD))
if (resource.template.cacheTemplate.getItemType().equals(mbEnums.ItemType.GOLD))
resourceType = mbEnums.ResourceType.GOLD;
else
resourceType = mbEnums.ResourceType.valueOf(ItemTemplate.templates.get(resource.templateID).item_base_name.toUpperCase());
@@ -63,7 +63,7 @@ public class StealPowerAction extends AbstractPowerAction {
//called to get amount of gold to steal between 0 and max gold
protected static int getAmountToSteal(Item item) {
if (item.template.item_type.equals(ItemType.GOLD)) {
if (item.template.cacheTemplate.getItemType().equals(ItemType.GOLD)) {
int amount = item.getNumOfItems();
@@ -159,7 +159,7 @@ public class StealPowerAction extends AbstractPowerAction {
if (myCIM == null || ownerCIM == null)
return;
if (tar.template.item_type.equals(ItemType.GOLD)) {
if (tar.template.cacheTemplate.getItemType().equals(ItemType.GOLD)) {
//stealing gold
if (!myCIM.transferGoldToMyInventory((AbstractCharacter) owner, amount))
return;