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:
1 parent
f39e35ac23
commit
6b4e9815e0
38 files changed
+201
-193
No files matched your search
@@ -15,6 +15,7 @@ import engine.gameManager.PowersManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.ItemType;
|
||||
import engine.mbEnums.OwnerType;
|
||||
import engine.parsers.objects.CObjectTemplate;
|
||||
import engine.powers.poweractions.AbstractPowerAction;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -30,22 +31,22 @@ public final class MobLoot extends Item {
|
||||
private String prefix = "";
|
||||
private String suffix = "";
|
||||
|
||||
public MobLoot(AbstractCharacter mob, ItemTemplate template, boolean noSteal) {
|
||||
public MobLoot(AbstractCharacter mob, CObjectTemplate template, boolean noSteal) {
|
||||
this(mob, template, 0, noSteal);
|
||||
}
|
||||
|
||||
public MobLoot(AbstractCharacter mob, int qtyOfGold) {
|
||||
this(mob, ItemTemplate.templates.get(mbEnums.ResourceType.GOLD.templateID), qtyOfGold, false);
|
||||
this(mob, CObjectTemplate.lookup(mbEnums.ResourceType.GOLD.templateID), qtyOfGold, false);
|
||||
}
|
||||
|
||||
public MobLoot(AbstractCharacter mob, ItemTemplate template, int quantity, boolean noSteal) {
|
||||
public MobLoot(AbstractCharacter mob, CObjectTemplate template, int quantity, boolean noSteal) {
|
||||
|
||||
super(template.template_id);
|
||||
super(template.getTemplateId());
|
||||
this.ownerType = OwnerType.Mob;
|
||||
this.ownerID = mob.getObjectUUID();
|
||||
this.objectUUID = generateId();
|
||||
|
||||
if (quantity == 0 && template.cacheTemplate.getItemType() == ItemType.RESOURCE)
|
||||
if (quantity == 0 && template.getItemType() == ItemType.RESOURCE)
|
||||
quantity = 1;
|
||||
|
||||
if (quantity > 0)
|
||||
@@ -105,7 +106,7 @@ public final class MobLoot extends Item {
|
||||
if (isDeleted)
|
||||
return null;
|
||||
|
||||
if (this.template.cacheTemplate.getItemType().equals(ItemType.GOLD))
|
||||
if (this.template.getItemType().equals(ItemType.GOLD))
|
||||
return null;
|
||||
|
||||
Item item = this;
|
||||
|
||||
Reference in new issue
Block a user