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:
1 parent
6825f94f1e
commit
b8ac8cce3e
28 files changed
+69
-69
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user