nameplates: cachedGuid + percent-mode guard + name text position

- Switch the four GUID reads in OnDataChanged from plate.parent:GetName(1)
  (SuperWoW idiom) to plate.cachedGuid (set by NAME_PLATE_UNIT_ADDED via
  UnitGUID(token)). Move the initial OnDataChanged call out of
  OnConfigChange's CREATE path so it runs after UNIT_ADDED has populated
  cachedGuid; re-add it explicitly in the user-config-change loop.

- Reject GetUnitField's health/maxHealth when maxHealth == 100 — the
  engine writes (hp_percent, 100) into UnitFields for non-detailed units
  (UPDATE_PARTIAL packets carry percent only). Without this guard,
  Nampower's raw field read returns the percent and the nameplate displays
  "5 / 100" as if it were real HP. Mirrors libhealth's heuristic so we
  fall through to its estimator instead.

- New config: nametextpos (LEFT/CENTER/RIGHT, defaults to CENTER).
  Decouple the bar's anchor from the name so the name's JustifyH can
  shift left/right without dragging the bar with it.
This commit is contained in:
Brues
2026-06-16 19:53:52 -05:00
parent b3f8745b91
commit 50d06f2e7a
3 changed files with 21 additions and 12 deletions
+1
View File
@@ -2922,6 +2922,7 @@ pfUI:RegisterModule("gui", function ()
CreateConfig(U["nameplates"], T["Healthbar Texture"], C.nameplates, "healthtexture", "dropdown", pfUI.gui.dropdowns.uf_bartexture)
CreateConfig(U["nameplates"], T["Show Health Points"], C.nameplates, "showhp", "checkbox")
CreateConfig(U["nameplates"], T["Health Text Position"], C.nameplates, "hptextpos", "dropdown", pfUI.gui.dropdowns.textalign)
CreateConfig(U["nameplates"], T["Name Text Position"], C.nameplates, "nametextpos", "dropdown", pfUI.gui.dropdowns.textalign)
CreateConfig(U["nameplates"], T["Health Text Format"], C.nameplates, "hptextformat", "dropdown", pfUI.gui.dropdowns.hpformat)
CreateConfig(U["nameplates"], T["Hide Healthbar On Enemy NPCs"], C.nameplates, "enemynpc", "checkbox")
CreateConfig(U["nameplates"], T["Hide Healthbar On Enemy Players"], C.nameplates, "enemyplayer", "checkbox")