This commit is contained in:
Sumsebrum 2021-07-29 15:53:34 +02:00
parent 720e5b63ec
commit 51cd2b7311
13 changed files with 83 additions and 91 deletions

View File

@ -131,8 +131,8 @@ function Gladdy:Call(module, func, ...)
end
end
function Gladdy:SendMessage(message, ...)
for k, v in self:IterModules() do
self:Call(v, v.messages[message], ...)
for _, module in self:IterModules() do
self:Call(module, module.messages[message], ...)
end
end
@ -224,8 +224,8 @@ function Gladdy:OnInitialize()
self:SetupOptions()
for k, v in self:IterModules() do
self:Call(v, "Initialize") -- B.E > A.E :D
for _, module in self:IterModules() do
self:Call(module, "Initialize") -- B.E > A.E :D
end
self:DeleteUnknownOptions(self.db, self.defaults.profile)
if Gladdy.db.hideBlizzard == "always" then
@ -304,8 +304,8 @@ function Gladdy:Test()
button[k] = v
end
for k, v in self:IterModules() do
self:Call(v, "Test", unit)
for _, module in self:IterModules() do
self:Call(module, "Test", unit)
end
button:SetAlpha(1)
@ -369,7 +369,7 @@ end
function Gladdy:Reset()
if type(self.guids) == "table" then
for k, v in pairs(self.guids) do
for k,_ in pairs(self.guids) do
self.guids[k] = nil
end
end
@ -377,8 +377,8 @@ function Gladdy:Reset()
self.curBracket = nil
self.curUnit = 1
for k1, v1 in self:IterModules() do
self:Call(v1, "Reset")
for _, module in self:IterModules() do
self:Call(module, "Reset")
end
for unit in pairs(self.buttons) do
@ -398,8 +398,8 @@ function Gladdy:ResetUnit(unit)
button:SetAlpha(0)
self:ResetButton(unit)
for k2, v2 in self:IterModules() do
self:Call(v2, "ResetUnit", unit)
for _, module in self:IterModules() do
self:Call(module, "ResetUnit", unit)
end
end

View File

@ -1,6 +1,5 @@
local floor, str_len, tostring, str_sub, str_find, pairs = math.floor, string.len, tostring, string.sub, string.find, pairs
local CreateFrame = CreateFrame
local GetLocale = GetLocale
local GetTime = GetTime
local Gladdy = LibStub("Gladdy")

View File

@ -8,7 +8,7 @@ local Gladdy = LibStub("Gladdy")
local L = Gladdy.L
local function defaultSpells(auraType)
local spells = {}
for k,v in pairs(Gladdy:GetImportantAuras()) do
for _,v in pairs(Gladdy:GetImportantAuras()) do
if not auraType or auraType == v.track then
spells[tostring(v.spellID)] = {}
spells[tostring(v.spellID)].enabled = true
@ -20,7 +20,7 @@ local function defaultSpells(auraType)
end
local function defaultInterrupts()
local spells = {}
for k,v in pairs(Gladdy:GetInterrupts()) do
for _,v in pairs(Gladdy:GetInterrupts()) do
spells[tostring(v.spellID)] = {}
spells[tostring(v.spellID)].enabled = true
spells[tostring(v.spellID)].priority = v.priority
@ -327,10 +327,10 @@ function Auras:Test(unit)
end
function Auras:JOINED_ARENA()
for i=1, Gladdy.curBracket do
--self.frames["arena" .. i]:RegisterUnitEvent("UNIT_AURA", "arena" .. i)
--self.frames["arena" .. i]:SetScript("OnEvent", Auras.OnEvent)
end
--[[for i=1, Gladdy.curBracket do
self.frames["arena" .. i]:RegisterUnitEvent("UNIT_AURA", "arena" .. i)
self.frames["arena" .. i]:SetScript("OnEvent", Auras.OnEvent)
end--]]
end
function Auras:AURA_GAIN(unit, auraType, spellID, spellName, icon, duration, expirationTime, count, debuffType)
@ -498,7 +498,7 @@ function Auras:GetOptions()
order = i + 13,
hasAlpha = true,
width = "0.8",
set = function(info, r, g, b, a)
set = function(_, r, g, b, a)
Gladdy.db.auraInterruptColors[v.key].r = r
Gladdy.db.auraInterruptColors[v.key].g = g
Gladdy.db.auraInterruptColors[v.key].b = b
@ -626,8 +626,8 @@ function Auras:GetAuraOptions(auraType)
width = "0.7",
name = L["Check All"],
type = "execute",
func = function(info)
for k,v in pairs(defaultSpells(auraType)) do
func = function()
for k,_ in pairs(defaultSpells(auraType)) do
Gladdy.db.auraListDefault[k].enabled = true
end
end,
@ -637,15 +637,15 @@ function Auras:GetAuraOptions(auraType)
width = "0.7",
name = L["Uncheck All"],
type = "execute",
func = function(info)
for k,v in pairs(defaultSpells(auraType)) do
func = function()
for k,_ in pairs(defaultSpells(auraType)) do
Gladdy.db.auraListDefault[k].enabled = false
end
end,
},
}
local auras = {}
for k,v in pairs(Gladdy:GetImportantAuras()) do
for _,v in pairs(Gladdy:GetImportantAuras()) do
if v.track == auraType then
tinsert(auras, v.spellID)
end
@ -670,10 +670,10 @@ function Auras:GetAuraOptions(auraType)
type = "toggle",
image = Gladdy:GetImportantAuras()[GetSpellInfo(k)] and Gladdy:GetImportantAuras()[GetSpellInfo(k)].texture or select(3, GetSpellInfo(k)),
width = "2",
set = function(info, value)
set = function(_, value)
Gladdy.db.auraListDefault[tostring(k)].enabled = value
end,
get = function(info)
get = function()
return Gladdy.db.auraListDefault[tostring(k)].enabled
end
},
@ -685,10 +685,10 @@ function Auras:GetAuraOptions(auraType)
max = 50,
width = "2",
step = 1,
get = function(info)
get = function()
return Gladdy.db.auraListDefault[tostring(k)].priority
end,
set = function(info, value)
set = function(_, value)
Gladdy.db.auraListDefault[tostring(k)].priority = value
end,
width = "full",
@ -706,8 +706,8 @@ function Auras:GetInterruptOptions()
width = "0.7",
name = L["Check All"],
type = "execute",
func = function(info)
for k,v in pairs(defaultInterrupts()) do
func = function()
for k,_ in pairs(defaultInterrupts()) do
Gladdy.db.auraListInterrupts[k].enabled = true
end
end,
@ -717,15 +717,15 @@ function Auras:GetInterruptOptions()
width = "0.7",
name = L["Uncheck All"],
type = "execute",
func = function(info)
for k,v in pairs(defaultInterrupts()) do
func = function()
for k,_ in pairs(defaultInterrupts()) do
Gladdy.db.auraListInterrupts[k].enabled = false
end
end,
},
}
local auras = {}
for k,v in pairs(Gladdy:GetInterrupts()) do
for _,v in pairs(Gladdy:GetInterrupts()) do
tinsert(auras, v.spellID)
end
tbl_sort(auras, function(a, b) return GetSpellInfo(a) < GetSpellInfo(b) end)
@ -745,10 +745,10 @@ function Auras:GetInterruptOptions()
type = "toggle",
image = Gladdy:GetInterrupts()[GetSpellInfo(k)] and Gladdy:GetInterrupts()[GetSpellInfo(k)].texture or select(3, GetSpellInfo(k)),
width = "2",
set = function(info, value)
set = function(_, value)
Gladdy.db.auraListInterrupts[tostring(k)].enabled = value
end,
get = function(info)
get = function()
return Gladdy.db.auraListInterrupts[tostring(k)].enabled
end
},
@ -760,10 +760,10 @@ function Auras:GetInterruptOptions()
max = 50,
width = "2",
step = 1,
get = function(info)
get = function()
return Gladdy.db.auraListInterrupts[tostring(k)].priority
end,
set = function(info, value)
set = function(_, value)
Gladdy.db.auraListInterrupts[tostring(k)].priority = value
end,
width = "full",

View File

@ -178,8 +178,8 @@ function Classicon:GetOptions()
name = L["Show Spec Icon"],
desc = L["Shows Spec Icon once spec is detected"],
order = 3,
get = function(info) return Gladdy.db.classIconSpecIcon end,
set = function(info, value)
get = function() return Gladdy.db.classIconSpecIcon end,
set = function(_, value)
Gladdy.db.classIconSpecIcon = value
if Gladdy.curBracket and Gladdy.curBracket > 0 then
for i=1,Gladdy.curBracket do

View File

@ -70,7 +70,7 @@ function Clicks:UpdateFrame(unit)
end
function Clicks:UpdateFrameOnce()
for k, v in pairs(Gladdy.buttons) do
for _, v in pairs(Gladdy.buttons) do
local left = GetBindingKey(("GLADDYBUTTON%d_LEFT"):format(v.id))
local right = GetBindingKey(("GLADDYBUTTON%d_RIGHT"):format(v.id))
local middle = GetBindingKey(("GLADDYBUTTON%d_MIDDLE"):format(v.id))
@ -107,7 +107,7 @@ function Clicks:SetupAttributes(unit)
return
end
for k, v in pairs(Gladdy.db.attributes) do
for _, v in pairs(Gladdy.db.attributes) do
self:SetupAttribute(button, v.button, v.modifier, v.action, v.spell)
end
end

View File

@ -36,9 +36,9 @@ local L = Gladdy.L
local function getDefaultCooldown()
local cooldowns = {}
for class, t in pairs(Gladdy:GetCooldownList()) do
for spellId, v in pairs(t) do
local spellName, _, texture = GetSpellInfo(spellId)
for _,spellTable in pairs(Gladdy:GetCooldownList()) do
for spellId,_ in pairs(spellTable) do
local spellName = GetSpellInfo(spellId)
if spellName then
cooldowns[tostring(spellId)] = true
else
@ -72,14 +72,14 @@ local Cooldowns = Gladdy:NewModule("Cooldowns", nil, {
function Cooldowns:Initialize()
self.cooldownSpellIds = {}
self.spellTextures = {}
for class, t in pairs(Gladdy:GetCooldownList()) do
for k, v in pairs(t) do
local spellName, _, texture = GetSpellInfo(k)
for _,spellTable in pairs(Gladdy:GetCooldownList()) do
for spellId,_ in pairs(spellTable) do
local spellName, _, texture = GetSpellInfo(spellId)
if spellName then
self.cooldownSpellIds[spellName] = k
self.spellTextures[k] = texture
self.cooldownSpellIds[spellName] = spellId
self.spellTextures[spellId] = texture
else
Gladdy:Print("spellid does not exist " .. k)
Gladdy:Print("spellid does not exist " .. spellId)
end
end
end
@ -261,13 +261,12 @@ function Cooldowns:UpdateTestCooldowns(unit)
button.test = true
-- use class spells
for k, v in pairs(Gladdy:GetCooldownList()[button.class]) do
--k is spellId
self:CooldownUsed(unit, button.class, k, nil)
for spellId,_ in pairs(Gladdy:GetCooldownList()[button.class]) do
self:CooldownUsed(unit, button.class, spellId)
end
-- use race spells
for k, v in pairs(Gladdy:GetCooldownList()[button.race]) do
self:CooldownUsed(unit, button.race, k, nil)
for spellId,_ in pairs(Gladdy:GetCooldownList()[button.race]) do
self:CooldownUsed(unit, button.race, spellId)
end
end
end
@ -353,7 +352,6 @@ function Cooldowns:DetectSpec(unit, spec)
]]
if (Gladdy.db.cooldown) then
local class = Gladdy.buttons[unit].class
local race = Gladdy.buttons[unit].race
for k, v in pairs(Gladdy:GetCooldownList()[class]) do
if Gladdy.db.cooldownCooldowns[tostring(k)] then
--if (self.db.cooldownList[k] ~= false and self.db.cooldownList[class] ~= false) then
@ -484,7 +482,7 @@ function Cooldowns:UpdateCooldowns(button)
end
end
function Cooldowns:CooldownUsed(unit, unitClass, spellId, spellName)
function Cooldowns:CooldownUsed(unit, unitClass, spellId)
local button = Gladdy.buttons[unit]
if not button then
return
@ -502,8 +500,8 @@ function Cooldowns:CooldownUsed(unit, unitClass, spellId, spellName)
-- check if we need to reset other cooldowns because of this spell
if (cooldown.resetCD ~= nil) then
for k, v in pairs(cooldown.resetCD) do
self:CooldownReady(button, k, false)
for spellID,_ in pairs(cooldown.resetCD) do
self:CooldownReady(button, spellID, false)
end
end
@ -519,9 +517,9 @@ function Cooldowns:CooldownUsed(unit, unitClass, spellId, spellName)
if (cooldown.sharedCD ~= nil) then
local sharedCD = cooldown.sharedCD.cd and cooldown.sharedCD.cd or cd
for k, v in pairs(cooldown.sharedCD) do
if (k ~= "cd") then
self:CooldownStart(button, k, sharedCD)
for spellID,_ in pairs(cooldown.sharedCD) do
if (spellID ~= "cd") then
self:CooldownStart(button, spellID, sharedCD)
end
end
end
@ -816,10 +814,10 @@ function Cooldowns:GetCooldownOptions()
order = o,
width = "full",
image = select(3, GetSpellInfo(spellId)),
get = function(info)
get = function()
return Gladdy.db.cooldownCooldowns[tostring(spellId)]
end,
set = function(info, value)
set = function(_, value)
Gladdy.db.cooldownCooldowns[tostring(spellId)] = value
Gladdy:UpdateFrame()
end
@ -845,10 +843,10 @@ function Cooldowns:GetCooldownOptions()
order = o,
width = "full",
image = select(3, GetSpellInfo(spellId)),
get = function(info)
get = function()
return Gladdy.db.cooldownCooldowns[tostring(spellId)]
end,
set = function(info, value)
set = function(_, value)
Gladdy.db.cooldownCooldowns[tostring(spellId)] = value
Gladdy:UpdateFrame()
end
@ -870,13 +868,13 @@ function Gladdy:UpdateTestCooldowns(i)
Cooldowns:DetectSpec(unit, button.testSpec)
-- use class spells
for k, v in pairs(Gladdy:GetCooldownList()[button.class]) do
for spellID,_ in pairs(Gladdy:GetCooldownList()[button.class]) do
--k is spellId
Cooldowns:CooldownUsed(unit, button.class, k, nil)
Cooldowns:CooldownUsed(unit, button.class, spellID)
end
-- use race spells
for k, v in pairs(Gladdy:GetCooldownList()[button.race]) do
Cooldowns:CooldownUsed(unit, button.race, k, nil)
for spellID,_ in pairs(Gladdy:GetCooldownList()[button.race]) do
Cooldowns:CooldownUsed(unit, button.race, spellID)
end
end
end

View File

@ -15,7 +15,7 @@ local function defaultCategories()
tinsert(indexList, {spellID = k, category = v})
end
tbl_sort(indexList, function(a, b) return a.spellID < b.spellID end)
for i,v in ipairs(indexList) do
for _,v in ipairs(indexList) do
if not categories[v.category] then
categories[v.category] = {
enabled = true,
@ -596,7 +596,7 @@ end
function Diminishings:CategoryOptions()
local categories = {}
local indexList = {}
for k,v in pairs(DRData:GetCategories()) do
for k,_ in pairs(DRData:GetCategories()) do
tinsert(indexList, k)
end
tbl_sort(indexList)
@ -611,10 +611,10 @@ function Diminishings:CategoryOptions()
type = "toggle",
name = L["Enabled"],
order = 1,
get = function(info)
get = function()
return Gladdy.db.drCategories[k].enabled
end,
set = function(info, value)
set = function(_, value)
Gladdy.db.drCategories[k].enabled = value
end,
},
@ -622,10 +622,10 @@ function Diminishings:CategoryOptions()
type = "toggle",
name = L["Force Icon"],
order = 2,
get = function(info)
get = function()
return Gladdy.db.drCategories[k].forceIcon
end,
set = function(info, value)
set = function(_, value)
Gladdy.db.drCategories[k].forceIcon = value
end,
},
@ -635,10 +635,10 @@ function Diminishings:CategoryOptions()
desc = L["Icon of the DR"],
order = 4,
values = Diminishings:GetDRIcons(k),
get = function(info)
get = function()
return Gladdy.db.drCategories[k].icon
end,
set = function(info, value)
set = function(_, value)
Gladdy.db.drCategories[k].icon = value
Gladdy.options.args.Diminishings.args.categories.args[k].icon = value
end,

View File

@ -167,8 +167,6 @@ function Healthbar:UpdateFrame(unit)
return
end
local iconSize = Gladdy.db.healthBarHeight + Gladdy.db.powerBarHeight
healthBar.bg:SetTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.healthBarTexture))
healthBar.bg:SetVertexColor(Gladdy.db.healthBarBgColor.r, Gladdy.db.healthBarBgColor.g, Gladdy.db.healthBarBgColor.b, Gladdy.db.healthBarBgColor.a)

View File

@ -35,12 +35,12 @@ function Pets:Initialize()
end
function Pets:JOINED_ARENA()
for k,v in pairs(self.frames) do
for _,v in pairs(self.frames) do
v.healthBar:SetAlpha(0)
end
if Gladdy.db.petEnabled then
self:RegisterEvent("UNIT_PET")
self:SetScript("OnEvent", function(self, event, unitId)
self:SetScript("OnEvent", function(_, event, unitId)
if event == "UNIT_PET" then
local unit = Gladdy.guids[UnitGUID(unitId)]
if unit then

View File

@ -1,10 +1,8 @@
local ceil, floor, string_format, tonumber = ceil, floor, string.format, tonumber
local ceil = ceil
local CreateFrame = CreateFrame
local GetTime = GetTime
local Gladdy = LibStub("Gladdy")
local L = Gladdy.L
local Racial = Gladdy:NewModule("Racial", nil, {
@ -123,7 +121,6 @@ function Racial:UpdateFrame(unit)
racial.texture.overlay:SetVertexColor(Gladdy.db.racialBorderColor.r, Gladdy.db.racialBorderColor.g, Gladdy.db.racialBorderColor.b, Gladdy.db.racialBorderColor.a)
racial:ClearAllPoints()
local margin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding
local parent = Gladdy.buttons[unit][Gladdy.db.racialAnchor]
if (Gladdy.db.racialPos == "RIGHT") then
racial:SetPoint(ANCHORS[Gladdy.db.racialPos], parent, Gladdy.db.racialPos, Gladdy.db.padding + Gladdy.db.racialXOffset, Gladdy.db.racialYOffset)

View File

@ -1,4 +1,4 @@
local floor, str_len, tostring, str_sub, str_find, pairs = math.floor, string.len, tostring, string.sub, string.find, pairs
local floor, str_find, pairs = math.floor, string.find, pairs
local CreateFrame = CreateFrame
local Gladdy = LibStub("Gladdy")

View File

@ -1,4 +1,4 @@
local ceil, floor, string_format, tonumber = ceil, floor, string.format, tonumber
local ceil = ceil
local C_PvP = C_PvP
local CreateFrame = CreateFrame

View File

@ -1,11 +1,11 @@
local str_match, tonumber, tostring = string.match, tonumber, tostring
local tonumber, tostring = tonumber, tostring
local UnitName = UnitName
local IsInGroup, IsInRaid = IsInGroup, IsInRaid
local LE_PARTY_CATEGORY_HOME, LE_PARTY_CATEGORY_INSTANCE = LE_PARTY_CATEGORY_HOME, LE_PARTY_CATEGORY_INSTANCE
local Gladdy = LibStub("Gladdy")
local L = Gladdy.L
local VersionCheck = Gladdy:NewModule("VersionCheck", 1, {
})
LibStub("AceComm-3.0"):Embed(VersionCheck)