Read item weight, value and base name through the bridge
Consumers of the legacy ItemTemplate item_wt, item_value and item_base_name now read getItemWt(), getItemValue() and getItemBaseName() on template.cacheTemplate. Parity (offline, scripts/p14.py, 7586 templates): 0 differences in item_wt, item_value and item_base_name. 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
b8ac8cce3e
commit
dc4a9ee08a
29 files changed
+59
-59
No files matched your search
@@ -216,7 +216,7 @@ public class Account extends AbstractGameObject {
|
||||
return;
|
||||
|
||||
if (item.containerType == mbEnums.ItemContainerType.INVENTORY && player.charItemManager.isVaultOpen()) {
|
||||
if (!player.charItemManager.hasRoomVault(item.template.item_wt)) {
|
||||
if (!player.charItemManager.hasRoomVault(item.template.cacheTemplate.getItemWt())) {
|
||||
ItemToVaultMsgHandler.forceTransferFromVaultToInventory(msg, origin, "There is no room in your vault.");
|
||||
return;
|
||||
}
|
||||
@@ -262,7 +262,7 @@ public class Account extends AbstractGameObject {
|
||||
return;
|
||||
|
||||
if (item.containerType == mbEnums.ItemContainerType.VAULT && itemManager.isVaultOpen()) {
|
||||
if (!itemManager.hasRoomInventory(item.template.item_wt)) {
|
||||
if (!itemManager.hasRoomInventory(item.template.cacheTemplate.getItemWt())) {
|
||||
ItemFromVaultMsgHandler.forceTransferFromInventoryToVault(msg, origin, "There is no room in your inventory.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -856,7 +856,7 @@ public class CharacterItemManager {
|
||||
this.itemIDtoType.put(i.getObjectUUID(), i.getObjectType().ordinal());
|
||||
|
||||
if (i.template != null)
|
||||
this.inventoryWeight += i.template.item_wt;
|
||||
this.inventoryWeight += i.template.cacheTemplate.getItemWt();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1092,7 +1092,7 @@ public class CharacterItemManager {
|
||||
|
||||
//test inventory is not full
|
||||
|
||||
if (!hasRoomInventory(template.item_wt))
|
||||
if (!hasRoomInventory(template.cacheTemplate.getItemWt()))
|
||||
return false;
|
||||
|
||||
if (!itemMan.inventory.contains(purchasedItem))
|
||||
@@ -1105,8 +1105,8 @@ public class CharacterItemManager {
|
||||
|
||||
// Reset value
|
||||
|
||||
purchasedItem.value = (int) (purchasedItem.template.item_value * (purchasedItem.combat_health_current / purchasedItem.template.combat_health_full));
|
||||
purchasedItem.magicValue = purchasedItem.template.item_value + purchasedItem.calcMagicValue();
|
||||
purchasedItem.value = (int) (purchasedItem.template.cacheTemplate.getItemValue() * (purchasedItem.combat_health_current / purchasedItem.template.combat_health_full));
|
||||
purchasedItem.magicValue = purchasedItem.template.cacheTemplate.getItemValue() + purchasedItem.calcMagicValue();
|
||||
|
||||
// db transfer successfully, remove from this character
|
||||
// skip this check if this is a mobLoot item (which is not in any inventory)
|
||||
@@ -1194,7 +1194,7 @@ public class CharacterItemManager {
|
||||
if (lootItem.template == null)
|
||||
return null;
|
||||
|
||||
int weight = lootItem.template.item_wt;
|
||||
int weight = lootItem.template.cacheTemplate.getItemWt();
|
||||
|
||||
// make sure lootingPlayer has room for item
|
||||
if (!lootItem.template.cacheTemplate.getItemType().equals(ItemType.GOLD) && !looterItems.hasRoomInventory(weight))
|
||||
@@ -1676,7 +1676,7 @@ public class CharacterItemManager {
|
||||
if (item == null)
|
||||
continue;
|
||||
|
||||
weight += item.template.item_wt;
|
||||
weight += item.template.cacheTemplate.getItemWt();
|
||||
}
|
||||
return weight;
|
||||
}
|
||||
@@ -1696,7 +1696,7 @@ public class CharacterItemManager {
|
||||
this.bankWeight = 0;
|
||||
for (Item item : this.bank) {
|
||||
if (item.template != null)
|
||||
this.bankWeight += item.template.item_wt;
|
||||
this.bankWeight += item.template.cacheTemplate.getItemWt();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1707,7 +1707,7 @@ public class CharacterItemManager {
|
||||
while (it.hasNext()) {
|
||||
Item item = it.next();
|
||||
if (item.template != null)
|
||||
this.equipWeight += item.template.item_wt;
|
||||
this.equipWeight += item.template.cacheTemplate.getItemWt();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1715,7 +1715,7 @@ public class CharacterItemManager {
|
||||
this.inventoryWeight = 0;
|
||||
for (Item item : this.inventory) {
|
||||
if (item.template != null)
|
||||
this.inventoryWeight += item.template.item_wt;
|
||||
this.inventoryWeight += item.template.cacheTemplate.getItemWt();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1723,7 +1723,7 @@ public class CharacterItemManager {
|
||||
this.vaultWeight = 0;
|
||||
for (Item item : this.vault) {
|
||||
if (item.template != null)
|
||||
this.vaultWeight += item.template.item_wt;
|
||||
this.vaultWeight += item.template.cacheTemplate.getItemWt();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -296,7 +296,7 @@ public class Corpse extends AbstractWorldObject {
|
||||
|
||||
//get weight of item
|
||||
|
||||
int weight = item.template.item_wt;
|
||||
int weight = item.template.cacheTemplate.getItemWt();
|
||||
|
||||
//make sure looter has room for item
|
||||
if (item.template.cacheTemplate.getItemType().equals(ItemType.GOLD) == false && !looterItems.hasRoomInventory(weight))
|
||||
|
||||
@@ -75,7 +75,7 @@ public class Item extends AbstractWorldObject {
|
||||
this.containerType = ItemContainerType.NONE;
|
||||
this.numberOfItems = 1;
|
||||
this.flags.addAll(this.template.item_flags);
|
||||
this.value = this.template.item_value;
|
||||
this.value = this.template.cacheTemplate.getItemValue();
|
||||
this.magicValue = this.value + calcMagicValue();
|
||||
loadTemplateEnchantments();
|
||||
}
|
||||
@@ -166,7 +166,7 @@ public class Item extends AbstractWorldObject {
|
||||
this.value = rs.getInt("value");
|
||||
|
||||
if (this.value == 0) {
|
||||
this.value = this.template.item_value;
|
||||
this.value = this.template.cacheTemplate.getItemValue();
|
||||
this.magicValue = this.value + calcMagicValue();
|
||||
} else
|
||||
this.magicValue = this.value; // Value was overridden in vendor inventory
|
||||
@@ -255,7 +255,7 @@ public class Item extends AbstractWorldObject {
|
||||
} else
|
||||
writer.putInt(item.numberOfItems); // Amount of gold
|
||||
} else
|
||||
writer.putInt(item.template.item_value);
|
||||
writer.putInt(item.template.cacheTemplate.getItemValue());
|
||||
|
||||
writer.putInt(item.getValue());
|
||||
|
||||
@@ -955,7 +955,7 @@ public class Item extends AbstractWorldObject {
|
||||
// No enchantments for negative id items in the db. Early exit.
|
||||
|
||||
if (this.objectUUID < 0) {
|
||||
this.magicValue = this.template.item_value + calcMagicValue();
|
||||
this.magicValue = this.template.cacheTemplate.getItemValue() + calcMagicValue();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -971,8 +971,8 @@ public class Item extends AbstractWorldObject {
|
||||
|
||||
// Value is overridden the db
|
||||
|
||||
if (this.value == this.template.item_value)
|
||||
this.magicValue = this.template.item_value + calcMagicValue();
|
||||
if (this.value == this.template.cacheTemplate.getItemValue())
|
||||
this.magicValue = this.template.cacheTemplate.getItemValue() + calcMagicValue();
|
||||
}
|
||||
|
||||
public void addPermanentEnchantment(String enchantID, int rank) {
|
||||
|
||||
@@ -307,7 +307,7 @@ public class Warehouse {
|
||||
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());
|
||||
resourceType = mbEnums.ResourceType.valueOf(ItemTemplate.templates.get(resource.templateID).cacheTemplate.getItemBaseName().toUpperCase());
|
||||
|
||||
if (transaction)
|
||||
AddTransactionToWarehouse(warehouse, playerCharacter.getObjectType(), playerCharacter.getObjectUUID(), mbEnums.TransactionType.DEPOSIT, resourceType, amount);
|
||||
@@ -432,7 +432,7 @@ public class Warehouse {
|
||||
return false;
|
||||
|
||||
if (addToInventory)
|
||||
if (!itemMan.hasRoomInventory(template.item_wt)) {
|
||||
if (!itemMan.hasRoomInventory(template.cacheTemplate.getItemWt())) {
|
||||
ChatManager.chatSystemInfo(playerCharacter, "You can not carry any more of that item.");
|
||||
return false;
|
||||
}
|
||||
@@ -517,7 +517,7 @@ public class Warehouse {
|
||||
if (itemMan == null)
|
||||
return false;
|
||||
|
||||
if (!itemMan.hasRoomInventory(template.item_wt)) {
|
||||
if (!itemMan.hasRoomInventory(template.cacheTemplate.getItemWt())) {
|
||||
ChatManager.chatSystemInfo(playerCharacter, "You can not carry any more of that item.");
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user