nUI Maintainer
Join Date: Feb 2006
Posts: 5,939
|
Okay, this bit of code allowed me to get hold of some spec and talent information. At the moment it is coded for the player but there looks like you might be able to use it for inspect purposes as well but not sure where the restrictions might be there. But hopefully it will get you part way there.
wherever the nil is the code had TalentFrame.inspect
wherever PLAYER is the code had either PLAYER or talentUnit which was passed into the Update function for the TalentFrame.
Lua Code:
local addonName, addonData = ... XrystalUI_Traits_SV = {} local talentsLoaded = false local addonLoaded = false local variablesLoaded = false local function DoStuff() local activeSpecGroup = GetActiveSpecGroup(false) local numSpecGroups = GetNumSpecGroups(false) XrystalUI_Traits_SV["ActiveSpecGroup"] = activeSpecGroup XrystalUI_Traits_SV["NumSpecGroups"] = numSpecGroups local spec = GetSpecialization(nil, false, activeSpecGroup); XrystalUI_Traits_SV["Specialization"] = spec XrystalUI_Traits_SV["SpecializationInfo"] = { GetSpecializationInfo(spec)} XrystalUI_Traits_SV["TierInfo"] = {} XrystalUI_Traits_SV["TalentInfo"] = {} for tier=1, MAX_TALENT_TIERS do local tierAvailable, selectedTalent, tierUnlockLevel = GetTalentTierInfo(tier, activeSpecGroup, nil, "PLAYER"); table.insert(XrystalUI_Traits_SV["TierInfo"],{ GetTalentTierInfo(tier, activeSpecGroup, nil, "PLAYER")}) for column=1, NUM_TALENT_COLUMNS do local talentID, name, iconTexture, selected, available, _, _, _, _, _, grantedByAura = GetTalentInfo(tier, column, activeSpecGroup, nil, "PLAYER") table.insert(XrystalUI_Traits_SV["TalentInfo"],{ GetTalentInfo(tier, column, activeSpecGroup, nil, "PLAYER")}) end end end local function OnEvent(self,event,...) local args = {...} print(event,...) if event == "ADDON_LOADED" then if args[1] == "Blizzard_TalentUI" then talentsLoaded = true elseif args[1] == addonName then addonLoaded = true if not talentsLoaded then LoadAddOn("Blizzard_TalentUI") end end elseif event == "VARIABLES_LOADED" then XrystalUI_Traits_SV = {} -- Start with a fresh table for testing purposes variablesLoaded = true elseif event == "PLAYER_LOGIN" then DoStuff() end end local frame = CreateFrame("Frame") frame:RegisterEvent("ADDON_LOADED") frame:RegisterEvent("VARIABLES_LOADED") frame:RegisterEvent("PLAYER_LOGIN") frame:SetScript("OnEvent", OnEvent)
The DoStuff function resulted in this Saved Variable Table of Data
Lua Code:
XrystalUI_Traits_SV = { ["Specialization"] = 3, ["TierInfo"] = { { false, -- [1] 0, -- [2] 15, -- [3] }, -- [1] { false, -- [1] 0, -- [2] 25, -- [3] }, -- [2] { false, -- [1] 0, -- [2] 30, -- [3] }, -- [3] { false, -- [1] 0, -- [2] 35, -- [3] }, -- [4] { false, -- [1] 0, -- [2] 40, -- [3] }, -- [5] { false, -- [1] 0, -- [2] 45, -- [3] }, -- [6] { false, -- [1] 0, -- [2] 100, -- [3] }, -- [7] }, ["ActiveSpecGroup"] = 1, ["NumSpecGroups"] = 1, ["TalentInfo"] = { { 22419, -- [1] "Brambles", -- [2] 415052, -- [3] false, -- [4] false, -- [5] 203953, -- [6] nil, -- [7] 1, -- [8] 1, -- [9] false, -- [10] false, -- [11] }, -- [1] { 22418, -- [1] "Blood Frenzy", -- [2] 132139, -- [3] false, -- [4] false, -- [5] 203962, -- [6] nil, -- [7] 1, -- [8] 2, -- [9] false, -- [10] false, -- [11] }, -- [2] { 22420, -- [1] "Bristling Fur", -- [2] 1033476, -- [3] false, -- [4] false, -- [5] 155835, -- [6] nil, -- [7] 1, -- [8] 3, -- [9] false, -- [10] false, -- [11] }, -- [3] { 19283, -- [1] "Tiger Dash", -- [2] 1817485, -- [3] false, -- [4] false, -- [5] 252216, -- [6] nil, -- [7] 2, -- [8] 1, -- [9] false, -- [10] false, -- [11] }, -- [4] { 18570, -- [1] "Renewal", -- [2] 136059, -- [3] false, -- [4] false, -- [5] 108238, -- [6] nil, -- [7] 2, -- [8] 2, -- [9] false, -- [10] false, -- [11] }, -- [5] { 18571, -- [1] "Wild Charge", -- [2] 538771, -- [3] false, -- [4] false, -- [5] 102401, -- [6] nil, -- [7] 2, -- [8] 3, -- [9] false, -- [10] false, -- [11] }, -- [6] { 22163, -- [1] "Balance Affinity", -- [2] 236156, -- [3] false, -- [4] false, -- [5] 197488, -- [6] nil, -- [7] 3, -- [8] 1, -- [9] false, -- [10] false, -- [11] }, -- [7] { 22156, -- [1] "Feral Affinity", -- [2] 611425, -- [3] false, -- [4] false, -- [5] 202155, -- [6] nil, -- [7] 3, -- [8] 2, -- [9] false, -- [10] false, -- [11] }, -- [8] { 22159, -- [1] "Restoration Affinity", -- [2] 236157, -- [3] false, -- [4] false, -- [5] 197492, -- [6] nil, -- [7] 3, -- [8] 3, -- [9] false, -- [10] false, -- [11] }, -- [9] { 21778, -- [1] "Mighty Bash", -- [2] 132114, -- [3] false, -- [4] false, -- [5] 5211, -- [6] nil, -- [7] 4, -- [8] 1, -- [9] false, -- [10] false, -- [11] }, -- [10] { 18576, -- [1] "Mass Entanglement", -- [2] 538515, -- [3] false, -- [4] false, -- [5] 102359, -- [6] nil, -- [7] 4, -- [8] 2, -- [9] false, -- [10] false, -- [11] }, -- [11] { 18577, -- [1] "Heart of the Wild", -- [2] 135879, -- [3] false, -- [4] false, -- [5] 319454, -- [6] nil, -- [7] 4, -- [8] 3, -- [9] false, -- [10] false, -- [11] }, -- [12] { 21709, -- [1] "Soul of the Forest", -- [2] 236160, -- [3] false, -- [4] false, -- [5] 158477, -- [6] nil, -- [7] 5, -- [8] 1, -- [9] false, -- [10] false, -- [11] }, -- [13] { 21707, -- [1] "Galactic Guardian", -- [2] 135853, -- [3] false, -- [4] false, -- [5] 203964, -- [6] nil, -- [7] 5, -- [8] 2, -- [9] false, -- [10] false, -- [11] }, -- [14] { 22388, -- [1] "Incarnation: Guardian of Ursoc", -- [2] 571586, -- [3] false, -- [4] false, -- [5] 102558, -- [6] nil, -- [7] 5, -- [8] 3, -- [9] false, -- [10] false, -- [11] }, -- [15] { 22423, -- [1] "Earthwarden", -- [2] 237573, -- [3] false, -- [4] false, -- [5] 203974, -- [6] nil, -- [7] 6, -- [8] 1, -- [9] false, -- [10] false, -- [11] }, -- [16] { 21713, -- [1] "Survival of the Fittest", -- [2] 132126, -- [3] false, -- [4] false, -- [5] 203965, -- [6] nil, -- [7] 6, -- [8] 2, -- [9] false, -- [10] false, -- [11] }, -- [17] { 22390, -- [1] "Guardian of Elune", -- [2] 1033479, -- [3] false, -- [4] false, -- [5] 155578, -- [6] nil, -- [7] 6, -- [8] 3, -- [9] false, -- [10] false, -- [11] }, -- [18] { 22426, -- [1] "Rend and Tear", -- [2] 132143, -- [3] false, -- [4] false, -- [5] 204053, -- [6] nil, -- [7] 7, -- [8] 1, -- [9] false, -- [10] false, -- [11] }, -- [19] { 22427, -- [1] "Tooth and Claw", -- [2] 134298, -- [3] false, -- [4] false, -- [5] 135288, -- [6] nil, -- [7] 7, -- [8] 2, -- [9] false, -- [10] false, -- [11] }, -- [20] { 22425, -- [1] "Pulverize", -- [2] 1033490, -- [3] false, -- [4] false, -- [5] 80313, -- [6] nil, -- [7] 7, -- [8] 3, -- [9] false, -- [10] false, -- [11] }, -- [21] }, ["SpecializationInfo"] = { 104, -- [1] "Guardian", -- [2] "Takes on the form of a mighty bear to absorb damage and protect allies.\r\n\r\nPreferred Weapon: Staff, Polearm", -- [3] 132276, -- [4] "TANK", -- [5] 2, -- [6] }, }
|