From 91d362dcfef8ca63836a23ba9ab1aae0c17912d4 Mon Sep 17 00:00:00 2001 From: Warlockbugs Date: Sun, 8 Dec 2024 05:17:25 +0300 Subject: [PATCH] Tryfixing secure UI frames broken on reconnecting in combat This is an important UI QoL fix mostly aimed at 2.0.0+ clients to ensure secure UI elements created/initialized properly when reconnecting in combat. 1.12.x is not affected as much by this due to less restrictive UI API. --- src/game/Entities/CharacterHandler.cpp | 7 +++++++ src/game/Entities/Object.cpp | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/game/Entities/CharacterHandler.cpp b/src/game/Entities/CharacterHandler.cpp index 7d6f505b8fb..372730941b4 100644 --- a/src/game/Entities/CharacterHandler.cpp +++ b/src/game/Entities/CharacterHandler.cpp @@ -1101,6 +1101,9 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) void WorldSession::HandlePlayerReconnect() { + // Detect if reconnecting in combat + const bool inCombat = _player->IsInCombat(); + // stop logout timer if need LogoutRequest(0); @@ -1240,6 +1243,10 @@ void WorldSession::HandlePlayerReconnect() // Undo flags and states set by logout if present: _player->SetStunnedByLogout(false); + // Mark self for unit flags update to ensure re-application of combat flag at own client + if (inCombat) + _player->ForceValuesUpdateAtIndex(UNIT_FIELD_FLAGS); + m_playerLoading = false; } diff --git a/src/game/Entities/Object.cpp b/src/game/Entities/Object.cpp index 2e7c5e6c5db..3e3915a66c0 100644 --- a/src/game/Entities/Object.cpp +++ b/src/game/Entities/Object.cpp @@ -670,6 +670,13 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u value &= ~UNIT_FLAG_TAXI_FLIGHT; } + // On login/reconnect: delay combat state application at client UI to not interfere with secure frames init + if (target == this && (value & UNIT_FLAG_IN_COMBAT)) + { + if (static_cast(this)->GetSession()->PlayerLoading()) + value &= ~UNIT_FLAG_IN_COMBAT; + } + *data << value; } // Hide special-info for non empathy-casters,