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
@@ -18,6 +18,7 @@ import engine.net.client.msg.PowerProjectileMsg;
|
||||
import engine.net.client.msg.TargetedActionMsg;
|
||||
import engine.net.client.msg.UpdateStateMsg;
|
||||
import engine.objects.*;
|
||||
import engine.parsers.objects.CObjectTemplate;
|
||||
import engine.parsers.objects.RuneTemplate;
|
||||
import engine.powers.DamageShield;
|
||||
import engine.powers.effectmodifiers.AbstractEffectModifier;
|
||||
@@ -93,25 +94,25 @@ public enum CombatManager {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mainWeapon == null && offWeapon != null && !offWeapon.template.cacheTemplate.getItemSkillUsed().equals("Block")) {
|
||||
if (mainWeapon == null && offWeapon != null && !offWeapon.template.getItemSkillUsed().equals("Block")) {
|
||||
//swing left hand only
|
||||
processAttack(attacker, target, mbEnums.EquipSlotType.LHELD);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mainWeapon == null && offWeapon != null && offWeapon.template.cacheTemplate.getItemSkillUsed().equals("Block")) {
|
||||
if (mainWeapon == null && offWeapon != null && offWeapon.template.getItemSkillUsed().equals("Block")) {
|
||||
//no weapon equipped with a shield, punch with one hand
|
||||
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mainWeapon != null && offWeapon != null && offWeapon.template.cacheTemplate.getItemSkillUsed().equals("Block")) {
|
||||
if (mainWeapon != null && offWeapon != null && offWeapon.template.getItemSkillUsed().equals("Block")) {
|
||||
//one weapon equipped with a shield, swing with one hand
|
||||
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mainWeapon != null && offWeapon != null && !offWeapon.template.cacheTemplate.getItemSkillUsed().equals("Block")) {
|
||||
if (mainWeapon != null && offWeapon != null && !offWeapon.template.getItemSkillUsed().equals("Block")) {
|
||||
//two weapons equipped, swing both hands
|
||||
processAttack(attacker, target, mbEnums.EquipSlotType.RHELD);
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter))
|
||||
@@ -271,13 +272,13 @@ public enum CombatManager {
|
||||
if (weapon != null && !attacker.getObjectType().equals(mbEnums.GameObjectType.Mob)) {
|
||||
//check if Out of Stamina
|
||||
if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) {
|
||||
if (attacker.getStamina() < (weapon.template.cacheTemplate.getItemWt() / 3f)) {
|
||||
if (attacker.getStamina() < (weapon.template.getItemWt() / 3f)) {
|
||||
//set auto attack job
|
||||
setAutoAttackJob(attacker, slot, delay);
|
||||
return;
|
||||
}
|
||||
}
|
||||
float stam = weapon.template.cacheTemplate.getItemWt() / 3f;
|
||||
float stam = weapon.template.getItemWt() / 3f;
|
||||
stam = (stam < 1) ? 1 : stam;
|
||||
attacker.modifyStamina(-(stam), attacker, true);
|
||||
} else
|
||||
@@ -578,14 +579,14 @@ public enum CombatManager {
|
||||
target.setCombatTarget(attacker);
|
||||
}
|
||||
|
||||
public static int getSwingAnimation(ItemTemplate wb, DeferredPowerJob dpj, mbEnums.EquipSlotType slot) {
|
||||
public static int getSwingAnimation(CObjectTemplate wb, DeferredPowerJob dpj, mbEnums.EquipSlotType slot) {
|
||||
|
||||
//No weapon, return default animation
|
||||
if (wb == null)
|
||||
return 75;
|
||||
|
||||
int token;
|
||||
engine.parsers.objects.ItemTemplate.Weapon weapon = engine.parsers.objects.ItemTemplate.getWeapon(wb.template_id);
|
||||
engine.parsers.objects.ItemTemplate.Weapon weapon = engine.parsers.objects.ItemTemplate.getWeapon(wb.getTemplateId());
|
||||
|
||||
if (dpj != null) {
|
||||
|
||||
@@ -596,7 +597,7 @@ public enum CombatManager {
|
||||
}
|
||||
|
||||
//Item has no equipment slots and should not try to return an animation, return default instead
|
||||
if (wb.cacheTemplate.getItemEqSlotsOr().isEmpty()) {
|
||||
if (wb.getItemEqSlotsOr().isEmpty()) {
|
||||
return 75;
|
||||
}
|
||||
|
||||
@@ -605,8 +606,8 @@ public enum CombatManager {
|
||||
int random;
|
||||
|
||||
//Item can only be equipped in one slot, return animation for that slot
|
||||
if (wb.cacheTemplate.getItemEqSlotsOr().size() == 1) {
|
||||
if (wb.cacheTemplate.getItemEqSlotsOr().iterator().next().equals(mbEnums.EquipSlotType.RHELD)) {
|
||||
if (wb.getItemEqSlotsOr().size() == 1) {
|
||||
if (wb.getItemEqSlotsOr().iterator().next().equals(mbEnums.EquipSlotType.RHELD)) {
|
||||
anim = weapon.weapon_attack_anim_right.get(0)[0];
|
||||
if (dpj != null) {
|
||||
random = ThreadLocalRandom.current().nextInt(weapon.weapon_attack_anim_right.size());
|
||||
|
||||
Reference in new issue
Block a user