Switch Item.template and MobLoot to CObjectTemplate

Item.template is now the cache template from CObjectTemplate.lookup
instead of the legacy DB ItemTemplate, so item.template.cacheTemplate.X
becomes item.template.X. MobLoot, LootManager, ItemManager.isTwoHanded/
isShield and CombatManager.getSwingAnimation take a CObjectTemplate.

No value changes: every getter already read the cache template through
the bridge, and the lookup resolves the same 7586 ids as
static_item_templates with the same item_type (offline parity p17.py,
0 differences).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
MagicBotandClaude Opus 5.5 committed 2026-10-20 07:55:28 -04:00
1 parent f39e35ac23
commit 6b4e9815e0
38 files changed
+201 -193

No files matched your search

+11 -10
View File
@@ -32,6 +32,7 @@ import engine.net.Dispatch;
import engine.net.client.ClientConnection;
import engine.net.client.msg.*;
import engine.net.client.msg.login.CommitNewCharacterMsg;
import engine.parsers.objects.CObjectTemplate;
import engine.powers.EffectsBase;
import engine.server.MBServerStatics;
import engine.server.login.LoginServer;
@@ -1353,7 +1354,7 @@ public class PlayerCharacter extends AbstractCharacter {
public static float getDexPenalty(Item armor) {
if (armor == null)
return 0f;
ItemTemplate ab = armor.template;
CObjectTemplate ab = armor.template;
if (ab == null)
return 0f;
return engine.parsers.objects.ItemTemplate._items.get(armor.templateID).item_bulk_factor;
@@ -2816,15 +2817,15 @@ public class PlayerCharacter extends AbstractCharacter {
if (item == null)
return false;
ItemTemplate ib = item.template;
CObjectTemplate ib = item.template;
if (ib != null) {
if ((item.template.cacheTemplate.getItemType().equals(ItemType.WEAPON))
&& (item.template.cacheTemplate.getItemSkillUsed().equals(type) || ib.cacheTemplate.getItemSkillMasteryUsed().equals(type)))
if ((item.template.getItemType().equals(ItemType.WEAPON))
&& (item.template.getItemSkillUsed().equals(type) || ib.getItemSkillMasteryUsed().equals(type)))
return true;
return (item.template.cacheTemplate.getItemType().equals(ItemType.ARMOR))
&& (item.template.cacheTemplate.getItemSkillUsed().equals(type));
return (item.template.getItemType().equals(ItemType.ARMOR))
&& (item.template.getItemSkillUsed().equals(type));
}
return false;
@@ -3768,8 +3769,8 @@ public class PlayerCharacter extends AbstractCharacter {
ConcurrentHashMap<EquipSlotType, Item> equipped = this.charItemManager.getEquipped();
Item off = equipped.get(EquipSlotType.LHELD);
Item main = equipped.get(EquipSlotType.RHELD);
ItemTemplate wbMain = null;
ItemTemplate wbOff = null;
CObjectTemplate wbMain = null;
CObjectTemplate wbOff = null;
if (main != null)
wbMain = main.template;
if (off != null)
@@ -3791,8 +3792,8 @@ public class PlayerCharacter extends AbstractCharacter {
this.bonuses.setBool(ModType.Parry, SourceType.None, false);
if ((this.baseClass != null && this.baseClass.getObjectUUID() == 2500)
|| (this.promotionClass != null && this.promotionClass.getObjectUUID() == 2520))
if (wbMain == null || engine.parsers.objects.ItemTemplate.getWeapon(wbMain.template_id).weapon_max_range < MBServerStatics.RANGED_WEAPON_RANGE)
if (wbOff == null || engine.parsers.objects.ItemTemplate.getWeapon(wbOff.template_id).weapon_max_range < MBServerStatics.RANGED_WEAPON_RANGE)
if (wbMain == null || engine.parsers.objects.ItemTemplate.getWeapon(wbMain.getTemplateId()).weapon_max_range < MBServerStatics.RANGED_WEAPON_RANGE)
if (wbOff == null || engine.parsers.objects.ItemTemplate.getWeapon(wbOff.getTemplateId()).weapon_max_range < MBServerStatics.RANGED_WEAPON_RANGE)
this.bonuses.setBool(ModType.Parry, SourceType.None, true);
}