Read the weapon block from the cache template item_weapon
Range, speed, damage list and swing anims now come from engine.parsers.objects.ItemTemplate.getWeapon(templateID). Non-weapons and missing templates get an empty block, matching the legacy zero defaults. Offline parity (scripts/p15b.py, 811 WEAPON rows vs COBJECTS/ITEM): 0 differences in speed, range, projectile, idle anim, damage list or either anim list. No duplicate damage types exist, so sum vs first is moot; first entry is used as before. 26 weapons (ammo, lutes, no-stats crossbows) have an empty damage list, same as the DB. No value changes. No comparator removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
441a935bd9
commit
6b2f000434
5 files changed
+48
-33
No files matched your search
@@ -33,6 +33,9 @@ public class ItemTemplate implements CObjectTemplate {
|
||||
|
||||
public static HashMap<Integer, ItemTemplate> _items = new HashMap<>();
|
||||
|
||||
// Legacy templates zero-filled the weapon block on non-weapons; held shields and the like rely on it.
|
||||
private static final Weapon NO_WEAPON = new Weapon();
|
||||
|
||||
public int template_id;
|
||||
|
||||
// obj_
|
||||
@@ -463,6 +466,16 @@ public class ItemTemplate implements CObjectTemplate {
|
||||
return item_ignore_saved_actions;
|
||||
}
|
||||
|
||||
public static Weapon getWeapon(int templateID) {
|
||||
|
||||
ItemTemplate template = _items.get(templateID);
|
||||
|
||||
if (template == null || template.item_weapon == null)
|
||||
return NO_WEAPON;
|
||||
|
||||
return template.item_weapon;
|
||||
}
|
||||
|
||||
// item_weapon (ArcAttackInfo_LoadWeapon, sb.exe 0x61FA60).
|
||||
|
||||
public static class Weapon {
|
||||
|
||||
Reference in new issue
Block a user