diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java index 63f8d1ab..d5fc4b56 100644 --- a/src/engine/gameManager/CombatManager.java +++ b/src/engine/gameManager/CombatManager.java @@ -187,19 +187,7 @@ public enum CombatManager { } } - DeferredPowerJob dpj = null; - if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) { - - dpj = ((PlayerCharacter) attacker).getWeaponPower(); - - if (dpj != null) { - dpj.attack(target, attackRange); - - if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518)) - ((PlayerCharacter) attacker).setWeaponPower(dpj); - } - } //check if Out of Stamina if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) { @@ -415,6 +403,21 @@ public enum CombatManager { DispatchMessage.sendToAllInRange(target, cmm); } } + + DeferredPowerJob dpj = null; + + if (attacker.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)) { + + dpj = ((PlayerCharacter) attacker).getWeaponPower(); + + if (dpj != null) { + dpj.attack(target, attackRange); + + if (dpj.getPower() != null && (dpj.getPowerToken() == -1851459567 || dpj.getPowerToken() == -1851489518)) + ((PlayerCharacter) attacker).setWeaponPower(dpj); + } + } + //set auto attack job setAutoAttackJob(attacker, slot, delay); @@ -486,11 +489,16 @@ public enum CombatManager { if (token == 563721004) //kick animation return 79; - if (wb != null) - if (mainHand) - return wb.weapon_attack_anim_right.get(ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_right.size()))[0]; - else - return wb.weapon_attack_anim_left.get(ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_left.size()))[0]; + if (wb != null) { + if (mainHand) { + int random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_right.size()); + int anim = wb.weapon_attack_anim_right.get(random)[0]; + return anim; + }else { + int random = ThreadLocalRandom.current().nextInt(wb.weapon_attack_anim_left.size()); + return wb.weapon_attack_anim_left.get(random)[0]; + } + } } if (wb == null) diff --git a/src/engine/net/client/msg/TargetedActionMsg.java b/src/engine/net/client/msg/TargetedActionMsg.java index 6c06c56c..25736d37 100644 --- a/src/engine/net/client/msg/TargetedActionMsg.java +++ b/src/engine/net/client/msg/TargetedActionMsg.java @@ -81,7 +81,7 @@ public class TargetedActionMsg extends ClientNetMsg { private float locX; private float locZ; private int unknown01 = 14; - private int unknown02 = 100; //source animation + private int animationID = 100; //source animation private float unknown03 = 1f; private float sourceStamina = 1f; // attackers stamina after attack private int unknown05 = 6; //signify passive defense @@ -164,7 +164,7 @@ public class TargetedActionMsg extends ClientNetMsg { this.newHealth = 1f; this.damage = damage; } - this.unknown02 = swingAnimation; + this.animationID = swingAnimation; //this.unknown02 = TargetedActionMsg.un2cnt; } @@ -196,7 +196,7 @@ public class TargetedActionMsg extends ClientNetMsg { this.newHealth = 1f; this.damage = damage; } - this.unknown02 = swingAnimation; + this.animationID = swingAnimation; //this.unknown02 = TargetedActionMsg.un2cnt; } @@ -247,7 +247,7 @@ public class TargetedActionMsg extends ClientNetMsg { writer.putFloat(this.locX); writer.putFloat(this.locZ); writer.putInt(this.unknown01); - writer.putInt(this.unknown02); + writer.putInt(this.animationID); writer.putFloat(this.unknown03); writer.putFloat(this.sourceStamina); writer.putInt(this.unknown05); @@ -275,7 +275,7 @@ public class TargetedActionMsg extends ClientNetMsg { this.locX = reader.getFloat(); this.locZ = reader.getFloat(); this.unknown01 = reader.getInt(); - this.unknown02 = reader.getInt(); + this.animationID = reader.getInt(); this.unknown03 = reader.getFloat(); this.sourceStamina = reader.getFloat(); this.unknown05 = reader.getInt();