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
@@ -147,7 +147,7 @@ public enum CombatManager {
|
||||
if (bonus != null)
|
||||
rangeMod += bonus.getFloatPercentAll(mbEnums.ModType.WeaponRange, mbEnums.SourceType.None);
|
||||
|
||||
attackRange += weapon.template.item_weapon_max_range * rangeMod;
|
||||
attackRange += engine.parsers.objects.ItemTemplate.getWeapon(weapon.templateID).weapon_max_range * rangeMod;
|
||||
} else if (attacker.getObjectType().equals(mbEnums.GameObjectType.Mob)) {
|
||||
|
||||
//unarmed mob, add the natural attack range from its rune (0 for most melee mobs)
|
||||
@@ -212,7 +212,7 @@ public enum CombatManager {
|
||||
|
||||
if (weapon != null) {
|
||||
|
||||
float wepSpeed = (int) (weapon.template.item_weapon_wepspeed);
|
||||
float wepSpeed = (int) (engine.parsers.objects.ItemTemplate.getWeapon(weapon.templateID).weapon_wepspeed);
|
||||
|
||||
if (weapon.getBonusPercent(mbEnums.ModType.WeaponSpeed, mbEnums.SourceType.None) != 0f) //add weapon speed bonus
|
||||
wepSpeed *= (1 + weapon.getBonus(mbEnums.ModType.WeaponSpeed, mbEnums.SourceType.None));
|
||||
@@ -417,7 +417,7 @@ public enum CombatManager {
|
||||
if (((Mob) attacker).isSiege())
|
||||
damageType = mbEnums.DamageType.SIEGE;
|
||||
} else {
|
||||
damageType = (mbEnums.DamageType) attacker.charItemManager.getEquipped().get(slot).template.item_weapon_damage.keySet().toArray()[0];
|
||||
damageType = engine.parsers.objects.ItemTemplate.getWeapon(attacker.charItemManager.getEquipped().get(slot).templateID).weapon_damage.get(0).damage_type;
|
||||
}
|
||||
|
||||
//get resists
|
||||
@@ -585,6 +585,7 @@ public enum CombatManager {
|
||||
return 75;
|
||||
|
||||
int token;
|
||||
engine.parsers.objects.ItemTemplate.Weapon weapon = engine.parsers.objects.ItemTemplate.getWeapon(wb.template_id);
|
||||
|
||||
if (dpj != null) {
|
||||
|
||||
@@ -606,16 +607,16 @@ public enum CombatManager {
|
||||
//Item can only be equipped in one slot, return animation for that slot
|
||||
if (wb.item_eq_slots_or.size() == 1) {
|
||||
if (wb.item_eq_slots_or.iterator().next().equals(mbEnums.EquipSlotType.RHELD)) {
|
||||
anim = wb.weapon_attack_anim_right.get(0)[0];
|
||||
anim = weapon.weapon_attack_anim_right.get(0)[0];
|
||||
if (dpj != null) {
|
||||
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_right.size());
|
||||
anim = wb.weapon_attack_anim_right.get(random)[0];
|
||||
random = ThreadLocalRandom.current().nextInt(weapon.weapon_attack_anim_right.size());
|
||||
anim = weapon.weapon_attack_anim_right.get(random)[0];
|
||||
}
|
||||
} else {
|
||||
anim = wb.weapon_attack_anim_left.get(0)[0];
|
||||
anim = weapon.weapon_attack_anim_left.get(0)[0];
|
||||
if (dpj != null) {
|
||||
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_left.size());
|
||||
anim = wb.weapon_attack_anim_left.get(random)[0];
|
||||
random = ThreadLocalRandom.current().nextInt(weapon.weapon_attack_anim_left.size());
|
||||
anim = weapon.weapon_attack_anim_left.get(random)[0];
|
||||
}
|
||||
}
|
||||
return anim;
|
||||
@@ -623,16 +624,16 @@ public enum CombatManager {
|
||||
|
||||
//Item can be equipped in either hand, and should have animation sets for each hand
|
||||
if (slot.equals(mbEnums.EquipSlotType.RHELD)) {
|
||||
anim = wb.weapon_attack_anim_right.get(0)[0];
|
||||
anim = weapon.weapon_attack_anim_right.get(0)[0];
|
||||
if (dpj != null) {
|
||||
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_right.size());
|
||||
anim = wb.weapon_attack_anim_right.get(random)[0];
|
||||
random = ThreadLocalRandom.current().nextInt(weapon.weapon_attack_anim_right.size());
|
||||
anim = weapon.weapon_attack_anim_right.get(random)[0];
|
||||
}
|
||||
} else {
|
||||
anim = wb.weapon_attack_anim_left.get(0)[0];
|
||||
anim = weapon.weapon_attack_anim_left.get(0)[0];
|
||||
if (dpj != null) {
|
||||
random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_left.size());
|
||||
anim = wb.weapon_attack_anim_left.get(random)[0];
|
||||
random = ThreadLocalRandom.current().nextInt(weapon.weapon_attack_anim_left.size());
|
||||
anim = weapon.weapon_attack_anim_left.get(random)[0];
|
||||
}
|
||||
}
|
||||
return anim;
|
||||
|
||||
Reference in new issue
Block a user