Fix spell cast error messages, action bar drag-drop, and player name display

- Rewrite SpellCastResult enum to match AzerothCore 3.3.5a values (was misaligned, showing wrong error messages like "Not while trading" instead of "Unit not in front")
- Fix spellbook-to-action-bar drag-drop by using ImGuiHoveredFlags_AllowWhenBlockedByActiveItem for cross-window hover detection
- Fix player frame showing wrong character name by looking up activeCharacterGuid instead of always using characters[0]
- Clear playerNameCache on disconnect to prevent stale names across sessions
This commit is contained in:
Kelsi 2026-02-06 21:25:35 -08:00
parent aa8689d521
commit d84d904b65
3 changed files with 153 additions and 114 deletions

View file

@ -720,8 +720,14 @@ void GameScreen::renderPlayerFrame(game::GameHandler& gameHandler) {
uint32_t playerMaxHp = 100;
const auto& characters = gameHandler.getCharacters();
if (!characters.empty()) {
const auto& ch = characters[0];
uint64_t activeGuid = gameHandler.getActiveCharacterGuid();
const game::Character* activeChar = nullptr;
for (const auto& c : characters) {
if (c.guid == activeGuid) { activeChar = &c; break; }
}
if (!activeChar && !characters.empty()) activeChar = &characters[0];
if (activeChar) {
const auto& ch = *activeChar;
playerName = ch.name;
// Use live server level if available, otherwise character struct
playerLevel = gameHandler.getPlayerLevel();
@ -1510,7 +1516,7 @@ void GameScreen::renderActionBar(game::GameHandler& gameHandler) {
}
bool rightClicked = ImGui::IsItemClicked(ImGuiMouseButton_Right);
bool hoveredOnRelease = ImGui::IsItemHovered() &&
bool hoveredOnRelease = ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem) &&
ImGui::IsMouseReleased(ImGuiMouseButton_Left);
// Drop dragged spell from spellbook onto this slot