Skip to content

Subject: Suggested improvements for TagsDatabase.lua#335

Open
adavak wants to merge 2 commits into
DaleHuntGB:masterfrom
adavak:master
Open

Subject: Suggested improvements for TagsDatabase.lua#335
adavak wants to merge 2 commits into
DaleHuntGB:masterfrom
adavak:master

Conversation

@adavak
Copy link
Copy Markdown

@adavak adavak commented May 8, 2026


Subject: Suggested improvements for TagsDatabase.lua

Hi, here are some enhancements I made to Core/Config/TagsDatabase.lua in the health tag methods. Feel free to use or ignore any of them.

Changes made:

1. Localized status text for Dead & Offline
Replaced hardcoded "Dead" and "Offline" with WoW global strings so they auto-localize:

local deadText = DEAD or "Dead"
local offlineText = PLAYER_OFFLINE or "Offline"

2. AFK / DND appended as suffix instead of replacing health
Previously AFK and DND replaced the health value entirely (same as Dead/Ghost/Offline). Changed them to append as a suffix after health text, e.g. 123K (暂离) / 123K (勿扰):

local statusSuffix = UnitIsAFK(unit) and (" ("..(AFK or "AFK")..")") or UnitIsDND(unit) and (" ("..(DND or "DND")..")") or ""

3. Added UNIT_FLAGS to health tag events
So tags refresh when AFK/DND status changes:

["curhp:abbr"] = "UNIT_HEALTH UNIT_MAXHEALTH UNIT_FLAGS",
["curhpperhp"] = "UNIT_HEALTH UNIT_MAXHEALTH UNIT_FLAGS",
["curhpperhp:abbr"] = "UNIT_HEALTH UNIT_MAXHEALTH UNIT_FLAGS",

4. Added PLAYER_FLAGS_CHANGED handler
Since UNIT_FLAGS doesn't fire for the player's own AFK/DND changes, added a standalone handler at the bottom:

local afkDndFrame = CreateFrame("Frame")
afkDndFrame:RegisterEvent("PLAYER_FLAGS_CHANGED")
afkDndFrame:SetScript("OnEvent", function()
    for unit in pairs(UUF.db.profile.Units) do
        local frame = UUF[unit:upper()]
        if frame and frame.UpdateTags then
            frame:UpdateTags()
        end
    end
end)

Things to discuss with you:

  • Feign Death (UnitIsFeignDeath()) – currently left in the code as UnitIsFeignDeath(unit) and "Feign Death". However, this API only returns valid data for friendly units; hostile units always show false.
  • Ghost – there's no WoW global string for ghost status (unlike DEAD/PLAYER_OFFLINE/AFK/DND). Currently using hardcoded "Ghost". Any idea for a localized alternative, or is hardcoded English fine?

Let me know if you'd like a clean diff instead.

@lichie567
Copy link
Copy Markdown

@adavak i think you got your gh creds stolen by a worm 😭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants