QuestieNameplate.lua has a small bug relating to nameplate quest progress updates; fails to apply icons to existing mobs
Arcitec opened this issue ยท 3 comments
- There are two ways that Questie applies nameplate icons.
- 1: When nameplates come into view, via
NAME_PLATE_UNIT_ADDED
which callsQuestieNameplate.NameplateCreated
. - 2: When the quest log progress changes, via
_EventHandler:QuestLogUpdate()
which callsQuestieNameplate:UpdateNameplate()
whenever the user adds/removes/progresses a quest.
The properly working situation is as follows:
- User is far away from quest mobs.
- User accepts a quest. The
UpdateNameplate
code runs. There's no work to do, since the user isn't near that mob. - User gets into range of quest mobs, the
NAME_PLATE_UNIT_ADDED
handler runs, adds the mobs to theactiveGUIDs
table, and draws nameplates with the proper Questie icon. That handler also runsframe:Show()
on those icons to ensure that they are visible.
The bug situation is as follows:
- User is standing next to quest mobs that have zero icons. Because there's no icons, the
activeGUIDs
table doesn't contain any data for those mobs. - User accepts a quest which involves the nearby mobs.
- Because the mobs are already visible in range, their nameplates are already visible, so the
NAME_PLATE_UNIT_ADDED
handler never runs. - The only handler that runs is
UpdateNameplate
, which then loops over the contents ofactiveGUIDs
. But that table hasn't registered the mobs when their nameplates came into view, since the player had no quests for those mobs. So Questie doesn't react to the fact that those mobs now need icons. It is blind about the existence of those nameplates. In fact, even if there had been data inactiveGUIDs
, it would still fail to show icons for them, becauseUpdateNameplate
only sets the icon texture, it never calls:Show()
for the icon.
To sum up the two bugs:
- Nameplates are ONLY registered in Questie's
activeGUIDs
if the user has quests for those mobs when the nameplates come into view. If not, then Questie is blind about the existence of those nameplates. UpdateNameplate
doesn't call:Show()
for the icon, so it would still not appear even if activeGUIDs had tracked the nearby nameplates properly.
The only real question is: Is it even worth fixing these bugs, and making Questie track all nearby nameplates at all times, and properly apply quest icons if quests are gained that relate to nearby mobs? Is it a common enough situation to need a fix? Maybe not.
Small sidenote, which should be fixed at the same time:
QuestieNameplate:UpdateNameplate() does the following useless double-check (I've removed all surrounding code):
if icon then
if (not frame.lastIcon) or icon ~= frame.lastIcon then
frame.lastIcon = icon
frame.Icon:SetTexture(nil)
frame.Icon:SetTexture(icon)
end
end
This is pointless because first it checks if icon
which means icon
isn't nil if that check success. Then it checks if (not frame.lastIcon)
which means "if lastIcon is nil". Lastly it checks if icon ~= frame.lastIcon
which means "icon" and "lastIcon" are different.
This should be rewritten as:
if icon then
if frame.lastIcon ~= icon then -- Reacts if lastIcon is nil (since icon is non-nil), or in any other way differs from icon.
frame.lastIcon = icon
--frame.Icon:SetTexture(nil) -- This line should be removed, it's literally pointless. May have been some ancient WoW bug.
frame.Icon:SetTexture(icon)
end
end
I noticed this myself, but didn't have the time to look into it yet. It is also quite easy to fix from a user perspective by simply toggling the nameplates once.
So I agree it might not even be worth the time, but it is a bug and I will leave this open!