Thread: ySeries
View Single Post
09-05-17, 08:49 AM   #4
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
What if, instead of three separate addons for the primary stats, you had just one for primary stats that dynamically changed depending on which spec you're in?

Using GetSpecialization() you can get the spec ID for the spec the player is currently in, and with GetSpecializationInfo() you can know which primary stat is used (without having to hardcode in a list.)

Code:
local _, _, _, _, _, primaryStat = GetSpecializationInfo(GetSpecialization())
(GetSpecializationInfo() info isn't quite up-to-date on wowprogramming; it does not return background anymore.)
This will output 1 (strength), 2 (agility) or 4 (intellect) into primaryStat, which are the same as the LE_UNIT_STAT_STRENGTH, LE_UNIT_STAT_AGILITY and LE_UNIT_STAT_INTELLECT constants.


That way you only need to have one addon installed and it'll cover whichever primary stat you'd be interested in seeing for your current character. Also only need to maintain 1 addon if it needs to be worked on and updated
  Reply With Quote