From 232c381e9693851c59d78efb794e84ba34ad4f45 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 26 May 2024 21:41:59 -0500 Subject: [PATCH] early exit for attack timer --- src/engine/gameManager/CombatManager.java | 15 +++++++++------ .../net/client/handlers/AttackCmdMsgHandler.java | 6 ------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java index 5d6766c7..2d224f25 100644 --- a/src/engine/gameManager/CombatManager.java +++ b/src/engine/gameManager/CombatManager.java @@ -118,12 +118,15 @@ public enum CombatManager { if (!attacker.isCombat()) return; - if (attacker.getTimestamps().get("Attack" + slot.name()) != null && attacker.getTimestamps().get("Attack" + slot.name()) < System.currentTimeMillis()) { - setAutoAttackJob(attacker, slot, 1000); - return; - } + //check if this slot is on attack timer, if timer has passed clear it, else early exit + if(attacker.getTimers().containsKey("Attack"+slot.name())) + if(attacker.getTimers().get("Attack"+slot.name()).timeToExecutionLeft() <= 0) + attacker.getTimers().remove("Attack"+slot.name()); + else + return; } + // check if character is in range to attack target PlayerBonuses bonus = attacker.getBonuses(); @@ -285,8 +288,8 @@ public enum CombatManager { if (target.getObjectType() == mbEnums.GameObjectType.PlayerCharacter) DispatchManager.dispatchMsgToInterestArea(target, msg, mbEnums.DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false); - else - DispatchManager.sendToAllInRange(attacker, msg); + //else + // DispatchManager.sendToAllInRange(attacker, msg); //set auto attack job setAutoAttackJob(attacker, slot, delay); diff --git a/src/engine/net/client/handlers/AttackCmdMsgHandler.java b/src/engine/net/client/handlers/AttackCmdMsgHandler.java index 9aa79684..154804d8 100644 --- a/src/engine/net/client/handlers/AttackCmdMsgHandler.java +++ b/src/engine/net/client/handlers/AttackCmdMsgHandler.java @@ -67,12 +67,6 @@ public class AttackCmdMsgHandler extends AbstractClientMsgHandler { return true; // cannot attack a null target } - // No point in setting combat target to someone you are already fighting - - if (playerCharacter.isCombat() && playerCharacter.getCombatTarget() != null && - playerCharacter.getCombatTarget().equals(target)) - return true; - //set sources target playerCharacter.setCombatTarget(target);