mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-12 16:40:00 +00:00
nameplates: drop redundant name check from plate-reassignment gate
GUID is the unique identity; the name check was leftover from the name-only era and became dead weight once cachedGuid (NAME_PLATE_UNIT_ ADDED) was added alongside it.
This commit is contained in:
+8
-11
@@ -933,18 +933,15 @@ end
|
|||||||
local name = plate.original.name:GetText()
|
local name = plate.original.name:GetText()
|
||||||
local level = plate.original.level:IsShown() and plate.original.level:GetObjectType() == "FontString" and tonumber(plate.original.level:GetText()) or "??"
|
local level = plate.original.level:IsShown() and plate.original.level:GetObjectType() == "FontString" and tonumber(plate.original.level:GetText()) or "??"
|
||||||
|
|
||||||
-- reset per-unit cache when the plate is reassigned. Gate on GUID *and*
|
-- Reset per-unit cache on plate pool reuse. GUID alone is the identity —
|
||||||
-- name — name alone misses pool reuse between same-named units (e.g. plate
|
-- a unit can't change its name without changing GUID, and NAME_PLATE_UNIT_
|
||||||
-- held a player "Ironforge Guard" and is now reassigned to the NPC by the
|
-- ADDED writes plate.cachedGuid before this fires. Wipe the whole table:
|
||||||
-- same name), which would leak a stale "PLAYER" hint into GetUnitInfo.
|
-- the PERF gates below ("only update X when X changed") would otherwise
|
||||||
-- Wipe the whole cache table: the PERF gates below ("only update X when
|
-- skip bar/color/text updates when the new unit happens to share a
|
||||||
-- X changed") would otherwise skip bar/color/text updates when the new
|
-- cached value with the previous occupant (e.g., both at 60% HP
|
||||||
-- unit happens to share a cached value with the previous occupant
|
-- percentage → bar stays at the old fill until the new mob's HP moves).
|
||||||
-- (e.g., both at 60% HP percentage on plate pool reuse → bar stays at
|
if plate.cache.guid ~= plate.cachedGuid then
|
||||||
-- the old fill until the new mob actually changes HP).
|
|
||||||
if plate.cache.name ~= name or plate.cache.guid ~= plate.cachedGuid then
|
|
||||||
table.wipe(plate.cache)
|
table.wipe(plate.cache)
|
||||||
plate.cache.name = name
|
|
||||||
plate.cache.guid = plate.cachedGuid
|
plate.cache.guid = plate.cachedGuid
|
||||||
plate.cdCache = nil -- new unit, reset spell-keyed timer cache
|
plate.cdCache = nil -- new unit, reset spell-keyed timer cache
|
||||||
plate.name:SetText(GetNameString(name))
|
plate.name:SetText(GetNameString(name))
|
||||||
|
|||||||
Reference in New Issue
Block a user