NameplateCooldowns

NameplateCooldowns

8M Downloads

Potential new isHealer check

rbgdevx opened this issue ยท 6 comments

commented

WoW version
Retail

Describe the feature you'd like to be implemented
Hey ๐Ÿ‘‹๐Ÿผ I think i have a new way to check if someone is a healer.

In 10.1.5 if you remember they added the spec to the tooltip on hover of characters. This code i have working in my project right now and haven't had an issue yet, lmk what you think but if it works for you it could replace the dependency on LibHealerCheck. Worth noting i could not find the source of LibHealerCheck or how that lib came to be.

local HEALER_SPECS = {
  ["Restoration Druid"] = true,
  ["Restoration Shaman"] = true,
  ["Mistweaver Monk"] = true,
  ["Holy Priest"] = true,
  ["Holy Paladin"] = true,
  ["Discipline Priest"] = true,
  ["Preservation Evoker"] = true,
}
local isHealer = false
local data = GetUnitTooltip(unit)
if data then
  if data.lines then
    for _, line in pairs(data.lines) do
      if line.type == Enum.TooltipDataLineType.None then
        if HEALER_SPECS[line.leftText] then
          local unitGUID = UnitGUID(unit)
          if unitGUID then
            isHealer = true
            break
          end
        end
      end
    end
  end
end

There may be a dynamic way to get spec names to store as a reference table but i don't know it.

commented

Hi,
Thank you for suggestion. But I personally prefer not to parse strings in UI:

  1. Localization required.
  2. Strings can (and will) be changed in any language without any notice.
  3. It's unreliable, because sometimes spec info in tooltip is just stuck with "Retrieving information..."
commented

oh okay i wasn't aware of the 3rd one, thats good to know.

thanks for the response!

Do you know where the source of LibHealerCheck came from btw? i couldn't find it anywhere

commented

LibHealerCheck? I don't know.
NameplateCooldowns uses LibHealerTracker. IIRC I've wrote it.

commented

oh sorry yea i meant LibHealerTracker, oh okay awesome!

Just out of curiosity, and for my learning (im new to wow api + lua), for that lib how come you've moved away from using the UPDATE_BATTLEFIELD_SCORE method you have commented out?

commented

Sorry, I don't remember. ๐Ÿ˜… Maybe GetBattlefieldScore method was returned irrelevant data...
BTW, this code is primitive and straightforward. As you can see, there is 'reset' of healer status only on PLAYER_ENTERING_WORLD event. Please consider it if you'll use this code.

commented

okay good to know, thanks again!