View Single Post
09-06-23, 01:25 PM   #8
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,909
With the talent reset I haven't updated most of my characterss (and the Era PTR isn't available) so this is just what I would have done first.

Changed:
Lua Code:
  1. local playerRole = LibClassicSpecs.Role
to:
Lua Code:
  1. local playerRole, specIndex

And then in the PLAYER_ENTERING_WORLD event, added:
Lua Code:
  1. if not playerRole then
  2.     specIndex = GetSpecialization()
  3.     playerRole = select(6, GetSpecializationInfo(specIndex))
  4.    print("playerRole", playerRole, specIndex) -- What did we get?
  5. end

That should get you a playerRole of "TANK", "HEALER", "DAMAGER" at login.

Then you could use:
Lua Code:
  1. if playerRole == nil then
  2.         --xxx                Text:SetText(hexa.."No Stats"..hexb)
  3. else
  4.     if playerRole == "TANK" then
  5.         UpdateTank(self)
  6.     elseif playerRole == "HEALER" then
  7.         UpdateCaster(self)
  8.     elseif playerRole == "DAMAGER" then
  9.         UpdateDamager(self)
  10.     end
  11. end

You would need to handle updating when changing/adding talents during a session.

I would probably do most/all class, spec. etc. initialisation at PLAYER_LOGIN or the initial PLAYER_ENTERING_WORLD rather than just as your addon is loaded as it gives the game some time to know more about you current character.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 09-06-23 at 01:29 PM.
  Reply With Quote