From 760c6a2790bc47300d41a5d88d5673953d518d34 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Sat, 21 Mar 2026 02:31:59 -0700 Subject: [PATCH] feat: fire PLAYER_ENTER_COMBAT and PLAYER_LEAVE_COMBAT events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fire PLAYER_ENTER_COMBAT when the player's auto-attack starts (SMSG_ATTACKSTART) and PLAYER_LEAVE_COMBAT when auto-attack stops. These events are distinct from PLAYER_REGEN_DISABLED/ENABLED — they specifically track physical melee combat state and are used by combat-aware addons for weapon swing timers and attack state tracking. --- src/game/game_handler.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index 74f027ef..f8c71576 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -16043,6 +16043,8 @@ void GameHandler::stopAutoAttack() { socket->send(packet); } LOG_INFO("Stopping auto-attack"); + if (addonEventCallback_) + addonEventCallback_("PLAYER_LEAVE_COMBAT", {}); } void GameHandler::addCombatText(CombatTextEntry::Type type, int32_t amount, uint32_t spellId, bool isPlayerSource, uint8_t powerType, @@ -16164,6 +16166,8 @@ void GameHandler::handleAttackStart(network::Packet& packet) { autoAttacking = true; autoAttackRetryPending_ = false; autoAttackTarget = data.victimGuid; + if (addonEventCallback_) + addonEventCallback_("PLAYER_ENTER_COMBAT", {}); } else if (data.victimGuid == playerGuid && data.attackerGuid != 0) { hostileAttackers_.insert(data.attackerGuid); autoTargetAttacker(data.attackerGuid);