From d7d1b8b47290a39094e56663364b9656c257e443 Mon Sep 17 00:00:00 2001 From: Bunny67 Date: Sun, 6 Sep 2020 11:35:55 +0300 Subject: [PATCH] display talents for all classes --- WeakAuras/Prototypes.lua | 35 ++++++++++++++++++++++++++++++----- WeakAuras/WeakAuras.lua | 31 ++----------------------------- 2 files changed, 32 insertions(+), 34 deletions(-) diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index 3007e2b..f2c193c 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -651,6 +651,20 @@ function WeakAuras.IsSpellKnownIncludingPet(spell) end end +local talent_types_specific = {} +local talents_ids = { + DEATHKNIGHT = {{48979,48997,49182,48978,49004,55107,48982,48987,49467,48985,49145,49015,48977,49006,49005,48988,53137,49027,49016,50365,62905,49018,55233,49189,55050,49023,61154,49028}, {49175,49455,49042,55061,49140,49226,50880,49039,51468,51123,49149,49137,49186,49471,49796,55610,49024,49188,50040,49203,50384,65661,54639,51271,49200,49143,50187,49202,49184}, {51745,48962,55129,49036,48963,49588,48965,49013,51459,49158,49146,49219,55620,49194,49220,49223,55666,49224,49208,52143,66799,51052,50391,63560,49032,49222,49217,51099,55090,50117,49206}}, + DRUID = {{16814,57810,16845,35363,16821,16836,16880,57865,16819,16909,16850,33589,5570,57849,33597,16896,33592,24858,48384,33600,48389,33603,48516,50516,33831,48488,48506,48505}, {16934,16858,16947,16998,16929,17002,61336,16942,16966,16972,37116,48409,16940,49377,33872,57878,17003,33853,17007,34297,33851,57873,33859,48483,48492,33917,48532,48432,63503,50334}, {17050,17063,17056,17069,17118,16833,17106,16864,48411,24968,17111,17116,17104,17123,33879,17074,34151,18562,33881,33886,48496,48539,65139,48535,63410,51179,48438}}, + HUNTER = {{19552,19583,35029,19549,19609,24443,19559,53265,19616,19572,19598,19578,19577,19590,34453,19621,34455,19574,34462,53252,34466,53262,34692,53256,56314,53270}, {19407,53620,19426,34482,19421,19485,34950,19454,19434,34948,19464,19416,35100,23989,19461,34475,19507,53234,19506,35104,34485,53228,53215,34490,53221,53241,53209}, {52783,19498,19159,19290,19184,19376,34494,19255,19503,19295,19286,56333,56342,56339,19370,19306,19168,34491,34500,19386,34497,34506,53295,53298,3674,53302,53290,53301}}, + MAGE = {{11210,11222,11237,28574,29441,11213,11247,11242,44397,54646,11252,11255,18462,29447,31569,12043,11232,31574,15058,31571,31579,12042,44394,44378,31584,31589,44404,44400,35578,44425}, {11078,18459,11069,11119,54747,11108,11100,11103,11366,11083,11095,11094,29074,31638,11115,11113,31641,11124,34293,11129,31679,64353,31656,44442,31661,44445,44449,44457}, {11071,11070,31670,11207,11189,29438,11175,11151,12472,11185,16757,11160,11170,11958,11190,31667,55091,11180,44745,11426,31674,31682,44543,44546,31687,44557,44566,44572}}, + PALADIN = {{20205,20224,20237,20257,9453,31821,20210,20234,20254,20244,53660,31822,20216,20359,31825,5923,31833,20473,31828,53551,31837,31842,53671,53569,53556,53563}, {63646,20262,31844,20174,20096,64205,20468,20143,53527,20487,20138,20911,20177,31848,20196,31785,20925,31850,20127,31858,53590,31935,53583,53709,53695,53595}, {20060,20101,25956,20335,20042,9452,20117,20375,26022,9799,32043,31866,20111,31869,20049,31871,53486,20066,31876,31879,53375,53379,35395,53501,53380,53385}}, + PRIEST = {{14522,47586,14523,14747,14749,14531,14521,14751,14748,33167,14520,14750,33201,18551,63574,33186,34908,45234,10060,63504,57470,47535,47507,47509,33206,47516,52795,47540}, {14913,14908,14889,27900,18530,19236,27811,14892,27789,14912,14909,14911,20711,14901,33150,14898,34753,724,33142,64127,33158,63730,63534,34861,47558,47562,47788}, {15270,15337,15259,15318,15275,15260,15392,15273,15407,15274,17322,15257,15487,15286,27839,33213,14910,63625,15473,33221,47569,33191,64044,34914,47580,47573,47585}}, + ROGUE = {{14162,14144,14138,14156,51632,13733,14983,14168,14128,16513,14113,31208,14177,14174,31244,14186,14158,51625,58426,31380,51634,31234,31226,1329,51627,51664,51662}, {13741,13732,13715,14165,13713,13705,13742,14251,13706,13754,13743,13712,18427,13709,13877,13960,30919,31124,31122,13750,31130,5952,35541,51672,32601,51682,51685,51690}, {14179,13958,14057,30892,14076,13975,13981,14278,14171,13983,13976,14079,30894,14185,14082,16511,31221,30902,31211,14183,31228,31216,51692,51698,36554,58414,51708,51713}}, + SHAMAN = {{16039,16035,16038,28996,30160,16040,16164,16089,16086,29062,28999,16041,30664,30672,16578,16166,51483,63370,51466,30675,51474,30706,51480,62097,51490}, {16259,16043,17485,16258,16255,16262,16261,16266,43338,16254,16256,16252,29192,16268,51883,30802,29082,63373,30816,30798,17364,51525,60103,51521,30812,30823,51523,51528,51533}, {16182,16173,16184,29187,16179,16180,16181,55198,16176,16187,16194,29206,16188,30864,16178,30881,16190,51886,51554,30872,30867,51556,974,51560,51562,61295}}, + WARLOCK = {{18827,18174,17810,18179,18213,18182,17804,53754,17783,18288,18218,18094,32381,32385,63108,18223,54037,18271,47195,30060,18220,30054,32477,47198,30108,58435,47201,48181}, {18692,18694,18697,47230,18703,18705,18731,18754,19028,18708,30143,18769,18709,30326,18767,23785,47245,30319,47193,35691,30242,63156,54347,30146,63117,47236,59672}, {17793,17788,18119,63349,17778,18126,17877,17959,18135,17917,17927,34935,17815,18130,30299,17954,17962,30293,18096,30288,54117,47258,30283,47220,47266,50796}}, + WARRIOR = {{12282,16462,12286,12285,12300,12295,12290,12296,16493,12834,12163,56636,12700,12328,12284,12281,20504,12289,46854,29834,12294,46865,12862,64976,35446,46859,29723,29623,29836,46867,46924}, {61216,12321,12320,12324,12322,12329,12323,16487,12318,23584,20502,12317,29590,12292,29888,20500,12319,46908,23881,29721,46910,29759,60970,29801,46913,56927,46917}, {12301,12298,12287,50685,12297,12975,12797,29598,12299,59088,12313,12308,12312,12809,12311,16538,29593,50720,29787,29140,46945,57499,20243,47294,46951,58872,46968}} +} + local function valuesForTalentFunction(trigger) return function() local single_class; @@ -675,9 +689,20 @@ local function valuesForTalentFunction(trigger) end -- If a single specific class was found, load the specific list for it - if(single_class and WeakAuras.talent_types_specific[single_class] - and WeakAuras.talent_types_specific[single_class]) then - return WeakAuras.talent_types_specific[single_class]; + if single_class and talents_ids[single_class] then + if not talent_types_specific[single_class] then + talent_types_specific[single_class] = {} + for tab = 1, #talents_ids[single_class] do + for num_talent = 1, #talents_ids[single_class][tab] do + local spellName, _, spellIcon = GetSpellInfo(talents_ids[single_class][tab][num_talent]) + local talentId = (tab - 1) * MAX_NUM_TALENTS + num_talent + if spellName and spellIcon then + talent_types_specific[single_class][talentId] = ("|T%s:24|t %s"):format(spellIcon, spellName) + end + end + end + end + return talent_types_specific[single_class]; else return WeakAuras.talent_types; end @@ -3658,8 +3683,8 @@ WeakAuras.event_prototypes = { type = "multiselect", values = function() local class = select(2, UnitClass("player")); - if WeakAuras.talent_types_specific[class] then - return WeakAuras.talent_types_specific[class]; + if talent_types_specific[class] then + return talent_types_specific[class]; else return WeakAuras.talent_types; end diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index 7008a5c..90644db 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -6,7 +6,7 @@ local internalVersion = 33; local insert = table.insert -- WoW APIs -local GetTalentInfo, IsAddOnLoaded, InCombatLockdown = GetTalentInfo, IsAddOnLoaded, InCombatLockdown +local IsAddOnLoaded, InCombatLockdown = IsAddOnLoaded, InCombatLockdown local LoadAddOn, UnitName, GetRealmName, UnitFactionGroup, IsInRaid = LoadAddOn, UnitName, GetRealmName, UnitFactionGroup, IsInRaid local UnitClass, UnitExists, UnitGUID, UnitAffectingCombat, GetInstanceInfo, IsInInstance @@ -18,7 +18,6 @@ local SendChatMessage, GetChannelName, UnitInBattleground, UnitInRaid, UnitInPar local CreateFrame, IsShiftKeyDown, GetScreenWidth, GetScreenHeight, GetCursorPosition, UpdateAddOnCPUUsage, GetFrameCPUUsage, debugprofilestop = CreateFrame, IsShiftKeyDown, GetScreenWidth, GetScreenHeight, GetCursorPosition, UpdateAddOnCPUUsage, GetFrameCPUUsage, debugprofilestop local debugstack, IsSpellKnown = debugstack, IsSpellKnown -local GetNumTalentTabs, GetNumTalents = GetNumTalentTabs, GetNumTalents local ADDON_NAME = "WeakAuras" local WeakAuras = WeakAuras @@ -713,25 +712,6 @@ local function LoadCustomActionFunctions(data) end end - - -WeakAuras.talent_types_specific = {} -function WeakAuras.CreateTalentCache() - local _, player_class = UnitClass("player") - - WeakAuras.talent_types_specific[player_class] = WeakAuras.talent_types_specific[player_class] or {}; - - for tab = 1, GetNumTalentTabs() do - for num_talent = 1, GetNumTalents(tab) do - local talentName, talentIcon = GetTalentInfo(tab, num_talent); - local talentId = (tab - 1)*MAX_NUM_TALENTS+num_talent - if (talentName and talentIcon) then - WeakAuras.talent_types_specific[player_class][talentId] = "|T"..talentIcon..":0|t "..talentName - end - end - end -end - function WeakAuras.CountWagoUpdates() local WeakAurasSaved = WeakAurasSaved local updatedSlugs, updatedSlugsCount = {}, 0 @@ -991,8 +971,6 @@ WeakAuras.frames["Addon Initialization Handler"] = loadedFrame; loadedFrame:RegisterEvent("ADDON_LOADED"); loadedFrame:RegisterEvent("PLAYER_LOGIN"); loadedFrame:RegisterEvent("PLAYER_ENTERING_WORLD"); -loadedFrame:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED"); -loadedFrame:RegisterEvent("SPELL_UPDATE_USABLE"); loadedFrame:SetScript("OnEvent", function(self, event, addon) if(event == "ADDON_LOADED") then if(addon == ADDON_NAME) then @@ -1058,11 +1036,6 @@ loadedFrame:SetScript("OnEvent", function(self, event, addon) timer:ScheduleTimer(function() squelch_actions = false; end, remainingSquelch); -- No sounds while loading end end - elseif(event == "SPELL_UPDATE_USABLE") then - callback = WeakAuras.CreateTalentCache; - WeakAuras.frames["Addon Initialization Handler"]:UnregisterEvent("SPELL_UPDATE_USABLE") - elseif(event == "ACTIVE_TALENT_GROUP_CHANGED") then - callback = WeakAuras.CreateTalentCache; elseif(event == "PLAYER_REGEN_ENABLED") then callback = function() if (queueshowooc) then @@ -3555,7 +3528,7 @@ local function startStopTimers(id, cloneId, triggernum, state) timer:CancelTimer(record.handle); end - record.handle = timer:ScheduleTimerFixed( + record.handle = timer:ScheduleTimer( function() if (state.show ~= false and state.show ~= nil) then state.show = false;