Skip to content

Commit

Permalink
Tryfixing secure UI frames broken on reconnecting in combat
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Warlockbugs committed Dec 8, 2024
1 parent 585d854 commit 91d362d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/game/Entities/CharacterHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}

Expand Down
7 changes: 7 additions & 0 deletions src/game/Entities/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Player const*>(this)->GetSession()->PlayerLoading())
value &= ~UNIT_FLAG_IN_COMBAT;
}

*data << value;
}
// Hide special-info for non empathy-casters,
Expand Down

0 comments on commit 91d362d

Please sign in to comment.