From 27573b75306c789239dc7e92503866dbc205fc66 Mon Sep 17 00:00:00 2001 From: Sumsebrum Date: Thu, 3 Mar 2022 23:37:42 +0100 Subject: [PATCH] cooldown refactor + positioning --- Constants.lua | 55 ++++++-- Images/downarrow.blp | Bin 0 -> 2564 bytes Images/uparrow.blp | Bin 0 -> 2564 bytes Modules/Cooldowns.lua | 307 ++++++++++++++++++++++++++++++------------ 4 files changed, 268 insertions(+), 94 deletions(-) create mode 100644 Images/downarrow.blp create mode 100644 Images/uparrow.blp diff --git a/Constants.lua b/Constants.lua index 8df815c..3f39ba3 100644 --- a/Constants.lua +++ b/Constants.lua @@ -13,6 +13,34 @@ tbl_sort(Gladdy.CLASSES) Gladdy.RACES = {"Scourge", "BloodElf", "Tauren", "Orc", "Troll", "NightElf", "Draenei", "Human", "Gnome", "Dwarf"} tbl_sort(Gladdy.RACES) +local RACE_ICON_TCOORDS = { + ["HUMAN_MALE"] = {0, 0.125, 0, 0.25}, + ["DWARF_MALE"] = {0.125, 0.25, 0, 0.25}, + ["GNOME_MALE"] = {0.25, 0.375, 0, 0.25}, + ["NIGHTELF_MALE"] = {0.375, 0.5, 0, 0.25}, + + ["TAUREN_MALE"] = {0, 0.125, 0.25, 0.5}, + ["SCOURGE_MALE"] = {0.125, 0.25, 0.25, 0.5}, + ["TROLL_MALE"] = {0.25, 0.375, 0.25, 0.5}, + ["ORC_MALE"] = {0.375, 0.5, 0.25, 0.5}, + + ["HUMAN_FEMALE"] = {0, 0.125, 0.5, 0.75}, + ["DWARF_FEMALE"] = {0.125, 0.25, 0.5, 0.75}, + ["GNOME_FEMALE"] = {0.25, 0.375, 0.5, 0.75}, + ["NIGHTELF_FEMALE"] = {0.375, 0.5, 0.5, 0.75}, + + ["TAUREN_FEMALE"] = {0, 0.125, 0.75, 1.0}, + ["SCOURGE_FEMALE"] = {0.125, 0.25, 0.75, 1.0}, + ["TROLL_FEMALE"] = {0.25, 0.375, 0.75, 1.0}, + ["ORC_FEMALE"] = {0.375, 0.5, 0.75, 1.0}, + + ["BLOODELF_MALE"] = {0.5, 0.625, 0.25, 0.5}, + ["BLOODELF_FEMALE"] = {0.5, 0.625, 0.75, 1.0}, + + ["DRAENEI_MALE"] = {0.5, 0.625, 0, 0.25}, + ["DRAENEI_FEMALE"] = {0.5, 0.625, 0.5, 0.75}, +} + local specBuffs = { -- DRUID [GetSpellInfo(45283)] = L["Restoration"], -- Natural Perfection @@ -958,23 +986,28 @@ local cooldownList = { [19503] = 30, -- Scatter Shot [14327] = 30, -- Scare Beast [19263] = 300, -- Deterrence; not on BM but can't do 2 specs - [14311] = { cd = 30, -- Freezing Trap - sharedCD = { - [13809] = true, -- Frost Trap - [34600] = true, -- Snake Trap - }, - }, + + [13809] = { cd = 30, -- Frost Trap sharedCD = { [14311] = true, -- Freezing Trap [34600] = true, -- Snake Trap }, + icon = select(3, GetSpellInfo(14311)), + }, + [14311] = { cd = 30, -- Freezing Trap + sharedCD = { + [13809] = true, -- Frost Trap + [34600] = true, -- Snake Trap + }, + icon = select(3, GetSpellInfo(14311)), }, [34600] = { cd = 30, -- Snake Trap sharedCD = { [14311] = true, -- Freezing Trap [13809] = true, -- Frost Trap }, + icon = select(3, GetSpellInfo(14311)), }, [34490] = { cd = 20, spec = L["Marksmanship"], }, -- Silencing Shot [19386] = { cd = 60, spec = L["Survival"], }, -- Wyvern Sting @@ -1024,19 +1057,19 @@ local cooldownList = { }, ["NightElf"] = { - [2651] = { cd = 180, spec = L["Discipline"], }, -- Elune's Grace - [10797] = { cd = 30, spec = L["Discipline"], }, -- Star Shards + [2651] = { cd = 180, spec = L["Discipline"], class = "PRIEST"}, -- Elune's Grace + [10797] = { cd = 30, spec = L["Discipline"], class = "PRIEST"}, -- Star Shards }, ["Draenei"] = { - [32548] = { cd = 300, spec = L["Discipline"], }, -- Hymn of Hope + [32548] = { cd = 300, spec = L["Discipline"], class = "PRIEST"}, -- Hymn of Hope }, ["Human"] = { - [13908] = { cd = 600, spec = L["Discipline"], }, -- Desperate Prayer + [13908] = { cd = 600, spec = L["Discipline"], class = "PRIEST"}, -- Desperate Prayer }, ["Gnome"] = { }, ["Dwarf"] = { - [13908] = { cd = 600, spec = L["Discipline"], }, -- Desperate Prayer + [13908] = { cd = 600, spec = L["Discipline"], class = "PRIEST"}, -- Desperate Prayer }, } function Gladdy:GetCooldownList() diff --git a/Images/downarrow.blp b/Images/downarrow.blp new file mode 100644 index 0000000000000000000000000000000000000000..464f90c425313603346b6165e22ea5d2adf9bdd7 GIT binary patch literal 2564 zcmbtVeM}Tb6n}SM1RKfGHfc;S?46#~s%b3RXqw7_B9eaab)(p50$8c?N84x{+8Tot zFnci-L}_npWR!Ddr%rMW*IX9CVdfb%%704^%j;)S6pZ=Ox>SvftO&t@tsdE5~bx?D!(xSheZpUL28a_R50j;E`b@9#F@6lSG z65LDn7S4!=tVw@>{+jFt!XDEemP$;%BxEn&7iD{GKS#hkmmY?H_JV$IeizmY}G}ruD^1StlQ-q74LR~Dj{4Bi!iiki@ z`6giWk$3M^QO}gSgQ8wmzE^X03w&W*=J~=GQ)4O;4Iy3{{*wMxX)CG2p#G}#t3UtD zP8;ILiD$+BZF64~?IFAO|B(LVOR^NFsORC=MSfOX<%1a_PI&tFB0r8ob+(`V*{r{; z`)vThd#XNH*n=4-&;7Q*Wl7RM8uvhwu!kjYjo-m|7LS$h10q6!Z=z6#4 z_x%fHA3Rtt{S`CsKPx{G_V@oD5O&Kwg<^HC+b8ySbV+{8ezC`OlXznJ!OSly#{T7U z>2ICSiQgbm53%7$dlaWVC4LSbjRy~71xlb=L0;tVD^`2-e4%gf8cuLOb^m`xEn(ust4zpgGvI^!EWJx1NHh& zrKg#<3^fOub`2md@FKq)ZCx(NMtM^H;&REao%410{63ZH!*A(2=MjF6cSJ@F1*Xkw zZ{$NfFw_+Axo;}48u^+uAD&E1dg`H^XJotRM=BthwlGgJDyo~tr?&or=5jDg9Xc9YD$PG)sa^=(ES(5It zd>CDEeCHXXeq*c=yT;`T1}_^M@!tW@!zDJxRz$H4=0U6N7pxCsYuD%X<$X(|YMBDH zSy@?{=2I^jzwtv|RSw1`615K1Z+yc8vj^=bl_LE{z{6ZAzo!56YUx7_19S_u7 zbiM=IJeZ+j z1Um^=EyH{fx7y~48#uI8#)ITzgJCT^R#IJ(z$P{_+RWaRGrLP1tn%ZJ!as%8 zVD;EF& literal 0 HcmV?d00001 diff --git a/Images/uparrow.blp b/Images/uparrow.blp new file mode 100644 index 0000000000000000000000000000000000000000..421372b7c810453a844e162cc1f536fff565be44 GIT binary patch literal 2564 zcmbtVe@xV67=P}-0GsTnwseE|-r13)t`)Y)nsA_qE{h-DE81*RC{+H)rfW2;@l*G` zRpKw|4w;xi^S)e`8!P2ZG{isbZnO?IOHYZAH63J2E4PEU=Xu}n7x0#4^Lh93-sgRO ze4gidpW|{@6+UMI0CT*_q~J;WKrHTf+z9~vxQB7y!W}ykmG>j)4;a*ehh^H1+~yqN zzYF>{dq_-Womf@`?;`XkqM`f{Y%#&o~%&;#l^U zhIykaV*0aRa7z6govGP7UXYpw5MBoje^wjxH?z%HHldoY(ihN4dO8=4Jh_R^ie&#@ zvNv!}EaXl31N1cH?<4Hc?P0OR}Lk%_2|x zN0)x#B7ceLlHwV0jJSrM<*KYBI-J2%Wf?nGy z>BkrDCq#dfZwE!cjC==Iz9;a-F`4J%AH+pBLD zi1*B%0$~q&oI?A{0+%OB|H-(A5`{fH|I*kkjA!r|`A!fK3S>z=%eG4BT! z$~lu>RUO`^u?=Dq8U-RF$#{1{!=e zV8FP@W$9N1=yOk8>u`K#7yzmgIL7hjlzSxg_e1T722Fm zXNTXV(u&VT1IC!YLseC`yX#yjfQDGp5Ub6TdhL?xrnP%Jz|*LYG>$h$aJBoakheTP zKL)vJP4*+2U$FC*!`l=4-8Qrz7#QHhO{=Zb2KgxW%fF#Q@@tWAk~=a`A-J{idVL?KwxZ)^YY5NQtU4dpv0Ax zrBV1u1&zm~zTCD$+Ve)fZnu58+2jM*xONRQC9d)$87go=y{R)@1j1U22Qk=Q{5rT(bVO`D?K#{%REIUD!QXq`>PaH~8hS3*Yx_ zrxKqq&KPeAe}>Rq7F6KPYR07ZX|v()7`3#66?;L$0kGuNadtXcO$j6 1) then + local current = Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)] + local next + for k,v in pairs(Gladdy.db.cooldownCooldownsOrder[class]) do + if v == current - 1 then + next = k + end + end + Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)] = Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)] - 1 + Gladdy.db.cooldownCooldownsOrder[class][next] = Gladdy.db.cooldownCooldownsOrder[class][next] + 1 + Gladdy.options.args["Cooldowns"].args.cooldowns.args[class].args[tostring(spellId)].order = Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)] + Gladdy.options.args["Cooldowns"].args.cooldowns.args[class].args[next].order = Gladdy.db.cooldownCooldownsOrder[class][next] + Gladdy:UpdateFrame() + end + end, + }, + downarrow = { + type = "execute", + name = "", + order = 3, + width = 0.1, + image = "Interface\\Addons\\Gladdy\\Images\\downarrow", + imageWidth = 20, + imageHeight = 20, + func = function() + if (Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)] < tblLength) then + local current = Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)] + local next + for k,v in pairs(Gladdy.db.cooldownCooldownsOrder[class]) do + if v == current + 1 then + next = k + end + end + Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)] = Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)] + 1 + Gladdy.db.cooldownCooldownsOrder[class][next] = Gladdy.db.cooldownCooldownsOrder[class][next] - 1 + Gladdy.options.args["Cooldowns"].args.cooldowns.args[class].args[tostring(spellId)].order = Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)] + Gladdy.options.args["Cooldowns"].args.cooldowns.args[class].args[next].order = Gladdy.db.cooldownCooldownsOrder[class][next] + Gladdy:UpdateFrame() + end + end, + } + } } - o = o + 1 end p = p + i end for i,race in ipairs(Gladdy.RACES) do - group[race] = { - type = "group", - name = L[race], - order = i + p, - icon = "Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Races", - iconCoords = RACE_ICON_TCOORDS[upper(race) .. "_FEMALE"], - args = {} - } - local o = 1 for spellId,cooldown in pairs(Gladdy:GetCooldownList()[race]) do - group[race].args[tostring(spellId)] = { - type = "toggle", - name = select(1, GetSpellInfo(spellId)) .. (type(cooldown) == "table" and cooldown.spec and (" - " .. cooldown.spec) or ""), - order = o, - width = "full", - image = select(3, GetSpellInfo(spellId)), - get = function() - return Gladdy.db.cooldownCooldowns[tostring(spellId)] - end, - set = function(_, value) - Gladdy.db.cooldownCooldowns[tostring(spellId)] = value - Gladdy:UpdateFrame() - end + local tblLength = tableLength(Gladdy.db.cooldownCooldownsOrder[cooldown.class]) + local class = cooldown.class + group[class].args[tostring(spellId)] = { + name = "", + type = "group", + inline = true, + order = Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)], + args = { + toggle = { + type = "toggle", + name = select(1, GetSpellInfo(spellId)) .. (type(cooldown) == "table" and cooldown.spec and (" - " .. cooldown.spec) or ""), + order = 1, + width = 1.1, + image = select(3, GetSpellInfo(spellId)), + get = function() + return Gladdy.db.cooldownCooldowns[tostring(spellId)] + end, + set = function(_, value) + Gladdy.db.cooldownCooldowns[tostring(spellId)] = value + Gladdy:UpdateFrame() + end + }, + uparrow = { + type = "execute", + name = "", + order = 2, + width = 0.1, + image = "Interface\\Addons\\Gladdy\\Images\\uparrow", + imageWidth = 20, + imageHeight = 20, + func = function() + if (Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)] > 1) then + local current = Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)] + local next + for k,v in pairs(Gladdy.db.cooldownCooldownsOrder[class]) do + if v == current - 1 then + next = k + end + end + Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)] = Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)] - 1 + Gladdy.db.cooldownCooldownsOrder[class][next] = Gladdy.db.cooldownCooldownsOrder[class][next] + 1 + Gladdy.options.args["Cooldowns"].args.cooldowns.args[class].args[tostring(spellId)].order = Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)] + Gladdy.options.args["Cooldowns"].args.cooldowns.args[class].args[next].order = Gladdy.db.cooldownCooldownsOrder[class][next] + Gladdy:UpdateFrame() + end + end, + }, + downarrow = { + type = "execute", + name = "", + order = 3, + width = 0.1, + image = "Interface\\Addons\\Gladdy\\Images\\downarrow", + imageWidth = 20, + imageHeight = 20, + func = function() + if (Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)] < tblLength) then + local current = Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)] + local next + for k,v in pairs(Gladdy.db.cooldownCooldownsOrder[class]) do + if v == current + 1 then + next = k + end + end + Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)] = Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)] + 1 + Gladdy.db.cooldownCooldownsOrder[class][next] = Gladdy.db.cooldownCooldownsOrder[class][next] - 1 + Gladdy.options.args["Cooldowns"].args.cooldowns.args[class].args[tostring(spellId)].order = Gladdy.db.cooldownCooldownsOrder[class][tostring(spellId)] + Gladdy.options.args["Cooldowns"].args.cooldowns.args[class].args[next].order = Gladdy.db.cooldownCooldownsOrder[class][next] + Gladdy:UpdateFrame() + end + end, + } + } } - o = o + 1 end end return group