anchoring for modules rewritten

This commit is contained in:
Sumsebrum 2021-05-18 16:39:43 +02:00
parent eaf8129143
commit 2db3db21ec
5 changed files with 301 additions and 473 deletions

View File

@ -284,4 +284,18 @@ function Gladdy:CreateButton(i)
for k, v in self:IterModules() do for k, v in self:IterModules() do
self:Call(v, "CreateFrame", button.unit) self:Call(v, "CreateFrame", button.unit)
end end
end
function Gladdy:GetAnchor(unit, position)
local anchor = "healthBar"
if Gladdy.db.classIconPos == position then
anchor = "classIcon"
end
if Gladdy.db.trinketPos == position then
anchor = "trinket"
end
if anchor == Gladdy.db.racialAnchor and Gladdy.db.racialPos == position then
anchor = "racial"
end
return Gladdy.buttons[unit][anchor]
end end

View File

@ -87,6 +87,8 @@ function BuffsDebuffs:Initialize()
self.trackedCC = {} self.trackedCC = {}
self.framePool = {} self.framePool = {}
self:RegisterMessage("JOINED_ARENA") self:RegisterMessage("JOINED_ARENA")
self:RegisterMessage("UNIT_DESTROYED")
self:RegisterMessage("UNIT_DEATH")
self:RegisterMessage("AURA_FADE") self:RegisterMessage("AURA_FADE")
self:RegisterMessage("AURA_GAIN") self:RegisterMessage("AURA_GAIN")
self:RegisterMessage("AURA_GAIN_LIMIT") self:RegisterMessage("AURA_GAIN_LIMIT")
@ -126,6 +128,14 @@ function BuffsDebuffs:ResetUnit(unit)
end end
end end
function BuffsDebuffs:UNIT_DESTROYED(unit)
BuffsDebuffs:ResetUnit(unit)
end
function BuffsDebuffs:UNIT_DEATH(unit)
BuffsDebuffs:ResetUnit(unit)
end
function BuffsDebuffs:Reset() function BuffsDebuffs:Reset()
for i=1,#self.framePool do for i=1,#self.framePool do
self.framePool[i]:Hide() self.framePool[i]:Hide()
@ -282,55 +292,22 @@ function BuffsDebuffs:UpdateFrame(unit)
self.frames[unit].debuffFrame:SetPoint("TOPRIGHT", Gladdy.buttons[unit].powerBar, "BOTTOMLEFT", Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset -verticalMargin) self.frames[unit].debuffFrame:SetPoint("TOPRIGHT", Gladdy.buttons[unit].powerBar, "BOTTOMLEFT", Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset -verticalMargin)
end end
elseif Gladdy.db.buffsCooldownPos == "LEFT" then elseif Gladdy.db.buffsCooldownPos == "LEFT" then
horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding horizontalMargin = Gladdy.db.highlightBorderSize - 1 + Gladdy.db.padding
if (Gladdy.db.trinketPos == "LEFT" and Gladdy.db.trinketEnabled) then local anchor = Gladdy:GetAnchor(unit, "LEFT")
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding if anchor == Gladdy.buttons[unit].healthBar then
if (Gladdy.db.classIconPos == "LEFT") then self.frames[unit].debuffFrame:SetPoint("RIGHT", anchor, "LEFT", -horizontalMargin + Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset)
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding else
end self.frames[unit].debuffFrame:SetPoint("RIGHT", anchor, "LEFT", -Gladdy.db.padding + Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset)
elseif (Gladdy.db.classIconPos == "LEFT") then
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding
if (Gladdy.db.trinketPos == "LEFT" and Gladdy.db.trinketEnabled) then
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding
end
end end
if (Gladdy.db.drCooldownPos == "LEFT" and Gladdy.db.drEnabled) then
verticalMargin = verticalMargin + Gladdy.db.drIconSize/2 + Gladdy.db.padding/2
end
if (Gladdy.db.castBarPos == "LEFT") then
verticalMargin = verticalMargin -
(((Gladdy.db.castBarHeight < Gladdy.db.castBarIconSize) and Gladdy.db.castBarIconSize
or Gladdy.db.castBarHeight)/2 + Gladdy.db.padding/2)
end
if (Gladdy.db.cooldownYPos == "LEFT" and Gladdy.db.cooldown) then
verticalMargin = verticalMargin + (Gladdy.db.buffsIconSize/2 + Gladdy.db.padding/2)
end
self.frames[unit].debuffFrame:SetPoint("RIGHT", Gladdy.buttons[unit].healthBar, "LEFT", -horizontalMargin + Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset + verticalMargin)
elseif Gladdy.db.buffsCooldownPos == "RIGHT" then elseif Gladdy.db.buffsCooldownPos == "RIGHT" then
horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding
if (Gladdy.db.trinketPos == "RIGHT" and Gladdy.db.trinketEnabled) then local anchor = Gladdy:GetAnchor(unit, "RIGHT")
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding if anchor == Gladdy.buttons[unit].healthBar then
if (Gladdy.db.classIconPos == "RIGHT") then self.frames[unit].debuffFrame:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset)
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding else
end self.frames[unit].debuffFrame:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset)
elseif (Gladdy.db.classIconPos == "RIGHT") then
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding
if (Gladdy.db.trinketPos == "RIGHT" and Gladdy.db.trinketEnabled) then
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding
end
end end
if (Gladdy.db.drCooldownPos == "RIGHT" and Gladdy.db.drEnabled) then
verticalMargin = verticalMargin + Gladdy.db.drIconSize/2 + Gladdy.db.padding/2
end
if (Gladdy.db.castBarPos == "RIGHT") then
verticalMargin = verticalMargin -
(((Gladdy.db.castBarHeight < Gladdy.db.castBarIconSize) and Gladdy.db.castBarIconSize
or Gladdy.db.castBarHeight)/2 + Gladdy.db.padding/2)
end
if (Gladdy.db.cooldownYPos == "RIGHT" and Gladdy.db.cooldown) then
verticalMargin = verticalMargin + (Gladdy.db.buffsIconSize/2 + Gladdy.db.padding/2)
end
self.frames[unit].debuffFrame:SetPoint("LEFT", Gladdy.buttons[unit].healthBar, "RIGHT", horizontalMargin + Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset + verticalMargin)
end end
self.frames[unit].buffFrame:SetHeight(Gladdy.db.buffsBuffsIconSize) self.frames[unit].buffFrame:SetHeight(Gladdy.db.buffsBuffsIconSize)
@ -381,7 +358,16 @@ function BuffsDebuffs:UpdateFrame(unit)
if (Gladdy.db.cooldownYPos == "LEFT" and Gladdy.db.cooldown) then if (Gladdy.db.cooldownYPos == "LEFT" and Gladdy.db.cooldown) then
verticalMargin = verticalMargin + (Gladdy.db.buffsBuffsIconSize/2 + Gladdy.db.padding/2) verticalMargin = verticalMargin + (Gladdy.db.buffsBuffsIconSize/2 + Gladdy.db.padding/2)
end end
self.frames[unit].buffFrame:SetPoint("RIGHT", Gladdy.buttons[unit].healthBar, "LEFT", -horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset + verticalMargin) --self.frames[unit].buffFrame:SetPoint("RIGHT", Gladdy.buttons[unit].healthBar, "LEFT", -horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset + verticalMargin)
local anchor = Gladdy:GetAnchor(unit, "LEFT")
horizontalMargin = Gladdy.db.highlightBorderSize - 1 + Gladdy.db.padding
if anchor == Gladdy.buttons[unit].healthBar then
self.frames[unit].buffFrame:SetPoint("RIGHT", anchor, "LEFT", -horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset)
else
self.frames[unit].buffFrame:SetPoint("RIGHT", anchor, "LEFT", -Gladdy.db.padding + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset)
end
elseif Gladdy.db.buffsBuffsCooldownPos == "RIGHT" then elseif Gladdy.db.buffsBuffsCooldownPos == "RIGHT" then
horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding
if (Gladdy.db.trinketPos == "RIGHT" and Gladdy.db.trinketEnabled) then if (Gladdy.db.trinketPos == "RIGHT" and Gladdy.db.trinketEnabled) then
@ -406,7 +392,15 @@ function BuffsDebuffs:UpdateFrame(unit)
if (Gladdy.db.cooldownYPos == "RIGHT" and Gladdy.db.cooldown) then if (Gladdy.db.cooldownYPos == "RIGHT" and Gladdy.db.cooldown) then
verticalMargin = verticalMargin + (Gladdy.db.buffsBuffsIconSize/2 + Gladdy.db.padding/2) verticalMargin = verticalMargin + (Gladdy.db.buffsBuffsIconSize/2 + Gladdy.db.padding/2)
end end
self.frames[unit].buffFrame:SetPoint("LEFT", Gladdy.buttons[unit].healthBar, "RIGHT", horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset + verticalMargin) --self.frames[unit].buffFrame:SetPoint("LEFT", Gladdy.buttons[unit].healthBar, "RIGHT", horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset + verticalMargin)
local anchor = Gladdy:GetAnchor(unit, "RIGHT")
horizontalMargin = Gladdy.db.highlightBorderSize - 1 + Gladdy.db.padding
if anchor == Gladdy.buttons[unit].healthBar then
self.frames[unit].buffFrame:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset)
else
self.frames[unit].buffFrame:SetPoint("LEFT", anchor, "RIGHT", Gladdy.db.padding + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset)
end
end end
for i=1, #self.frames[unit].auras[AURA_TYPE_BUFF] do for i=1, #self.frames[unit].auras[AURA_TYPE_BUFF] do
styleIcon(self.frames[unit].auras[AURA_TYPE_BUFF][i], AURA_TYPE_BUFF) styleIcon(self.frames[unit].auras[AURA_TYPE_BUFF][i], AURA_TYPE_BUFF)
@ -490,7 +484,7 @@ local function iconTimer(auraFrame, elapsed)
auraFrame.cooldown:SetFormattedText("%d", timeLeftSec) auraFrame.cooldown:SetFormattedText("%d", timeLeftSec)
elseif timeLeftMilliSec <= 3 and timeLeftMilliSec > 0 then elseif timeLeftMilliSec <= 3 and timeLeftMilliSec > 0 then
if Gladdy.db.buffsDynamicColor then auraFrame.cooldown:SetTextColor(1, 0, 0) end if Gladdy.db.buffsDynamicColor then auraFrame.cooldown:SetTextColor(1, 0, 0) end
auraFrame.cooldown:SetFormattedText("%.1f", timeLeftMilliSec) auraFrame.cooldown:SetFormattedText("%.1f", timeLeftMilliSec >= 0.0 and timeLeftMilliSec or 0.0)
elseif timeLeftMilliSec <= 0 and timeLeftMilliSec > -0.05 then -- 50ms ping max wait for SPELL_AURA_REMOVED event elseif timeLeftMilliSec <= 0 and timeLeftMilliSec > -0.05 then -- 50ms ping max wait for SPELL_AURA_REMOVED event
auraFrame.cooldown:SetText("") auraFrame.cooldown:SetText("")
else -- fallback in case SPELL_AURA_REMOVED is not fired else -- fallback in case SPELL_AURA_REMOVED is not fired

View File

@ -164,52 +164,21 @@ function Castbar:UpdateFrame(unit)
castBar:ClearAllPoints() castBar:ClearAllPoints()
local horizontalMargin = Gladdy.db.highlightBorderSize + Gladdy.db.padding local horizontalMargin = Gladdy.db.highlightBorderSize + Gladdy.db.padding
local verticalMargin = -(Gladdy.db.powerBarHeight)/2
if (Gladdy.db.castBarPos == "LEFT") then if (Gladdy.db.castBarPos == "LEFT") then
if (Gladdy.db.trinketPos == "LEFT" and Gladdy.db.trinketEnabled) then local anchor = Gladdy:GetAnchor(unit, "LEFT")
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding if anchor == Gladdy.buttons[unit].healthBar then
if (Gladdy.db.classIconPos == "LEFT") then castBar:SetPoint("RIGHT", anchor, "LEFT", -horizontalMargin - leftMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset)
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding else
end castBar:SetPoint("RIGHT", anchor, "LEFT", -Gladdy.db.padding - leftMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset)
elseif (Gladdy.db.classIconPos == "LEFT") then
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding
if (Gladdy.db.trinketPos == "LEFT" and Gladdy.db.trinketEnabled) then
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding
end
end end
if (Gladdy.db.cooldownYPos == "LEFT" and Gladdy.db.cooldown) then
verticalMargin = verticalMargin + (Gladdy.db.cooldownSize/2 + Gladdy.db.padding/2)
end
if (Gladdy.db.drCooldownPos == "LEFT" and Gladdy.db.drEnabled) then
verticalMargin = verticalMargin + (Gladdy.db.drIconSize/2 + Gladdy.db.padding/2)
end
if (Gladdy.db.buffsCooldownPos == "LEFT" and Gladdy.db.buffsEnabled) then
verticalMargin = verticalMargin + Gladdy.db.buffsIconSize/2 + Gladdy.db.padding/2
end
castBar:SetPoint("RIGHT", button.healthBar, "LEFT", -horizontalMargin - leftMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset + verticalMargin)
end end
if (Gladdy.db.castBarPos == "RIGHT") then if (Gladdy.db.castBarPos == "RIGHT") then
if (Gladdy.db.trinketPos == "RIGHT" and Gladdy.db.trinketEnabled) then local anchor = Gladdy:GetAnchor(unit, "RIGHT")
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding if anchor == Gladdy.buttons[unit].healthBar then
if (Gladdy.db.classIconPos == "RIGHT") then castBar:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + rightMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset)
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding else
end castBar:SetPoint("LEFT", anchor, "RIGHT", Gladdy.db.padding + rightMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset)
elseif (Gladdy.db.classIconPos == "RIGHT") then
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding
if (Gladdy.db.trinketPos == "LEFT" and Gladdy.db.trinketEnabled) then
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding
end
end end
if (Gladdy.db.cooldownYPos == "RIGHT" and Gladdy.db.cooldown) then
verticalMargin = verticalMargin + (Gladdy.db.cooldownSize/2 + Gladdy.db.padding/2)
end
if (Gladdy.db.drCooldownPos == "RIGHT" and Gladdy.db.drEnabled) then
verticalMargin = verticalMargin + (Gladdy.db.drIconSize/2 + Gladdy.db.padding/2)
end
if (Gladdy.db.buffsCooldownPos == "RIGHT" and Gladdy.db.buffsEnabled) then
verticalMargin = verticalMargin + Gladdy.db.buffsIconSize/2 + Gladdy.db.padding/2
end
castBar:SetPoint("LEFT", button.healthBar, "RIGHT", horizontalMargin + rightMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset + verticalMargin)
end end
castBar.spellText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.auraFont), Gladdy.db.castBarFontSize) castBar.spellText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.auraFont), Gladdy.db.castBarFontSize)
@ -515,7 +484,7 @@ function Castbar:Test(unit)
if (unit == "arena2") then if (unit == "arena2") then
spell, _, icon = GetSpellInfo(27072) spell, _, icon = GetSpellInfo(27072)
value, maxValue, event = 0, 2, "cast" value, maxValue, event = 0, 40, "cast"
elseif (unit == "arena1") then elseif (unit == "arena1") then
spell, _, icon = GetSpellInfo(27220) spell, _, icon = GetSpellInfo(27220)
endTime = GetTime() * 1000 + 60*1000 endTime = GetTime() * 1000 + 60*1000

View File

@ -1,12 +1,54 @@
local type, pairs, ceil, tonumber, mod = type, pairs, ceil, tonumber, mod local type, pairs, ceil, tonumber, mod, tostring, upper, select = type, pairs, ceil, tonumber, mod, tostring, string.upper, select
local GetTime = GetTime local GetTime = GetTime
local CreateFrame = CreateFrame local CreateFrame = CreateFrame
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 GetSpellInfo = GetSpellInfo local GetSpellInfo = GetSpellInfo
local Gladdy = LibStub("Gladdy") local Gladdy = LibStub("Gladdy")
local L = Gladdy.L 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)
if spellName then
cooldowns[tostring(spellId)] = true
else
Gladdy:Print("spellid does not exist " .. spellId)
end
end
end
return cooldowns
end
local Cooldowns = Gladdy:NewModule("Cooldowns", nil, { local Cooldowns = Gladdy:NewModule("Cooldowns", nil, {
cooldownFont = "DorisPP", cooldownFont = "DorisPP",
cooldownFontScale = 1, cooldownFontScale = 1,
@ -23,13 +65,14 @@ local Cooldowns = Gladdy:NewModule("Cooldowns", nil, {
cooldownBorderStyle = "Interface\\AddOns\\Gladdy\\Images\\Border_Gloss", cooldownBorderStyle = "Interface\\AddOns\\Gladdy\\Images\\Border_Gloss",
cooldownBorderColor = { r = 1, g = 1, b = 1, a = 1 }, cooldownBorderColor = { r = 1, g = 1, b = 1, a = 1 },
cooldownDisableCircle = false, cooldownDisableCircle = false,
cooldownCooldownAlpha = 1 cooldownCooldownAlpha = 1,
cooldownCooldowns = getDefaultCooldown()
}) })
function Cooldowns:Initialize() function Cooldowns:Initialize()
self.cooldownSpellIds = {} self.cooldownSpellIds = {}
self.spellTextures = {} self.spellTextures = {}
for class, t in pairs(self.cooldownSpells) do for class, t in pairs(Gladdy:GetCooldownList()) do
for k, v in pairs(t) do for k, v in pairs(t) do
local spellName, _, texture = GetSpellInfo(k) local spellName, _, texture = GetSpellInfo(k)
if spellName then if spellName then
@ -43,6 +86,7 @@ function Cooldowns:Initialize()
self:RegisterMessage("ENEMY_SPOTTED") self:RegisterMessage("ENEMY_SPOTTED")
self:RegisterMessage("SPEC_DETECTED") self:RegisterMessage("SPEC_DETECTED")
self:RegisterMessage("UNIT_DEATH") self:RegisterMessage("UNIT_DEATH")
self:RegisterMessage("UNIT_DESTROYED")
end end
function Cooldowns:CreateFrame(unit) function Cooldowns:CreateFrame(unit)
@ -102,56 +146,19 @@ function Cooldowns:UpdateFrame(unit)
button.spellCooldownFrame:SetPoint("TOPLEFT", button.powerBar, "BOTTOMLEFT", Gladdy.db.cooldownXOffset, -Gladdy.db.highlightBorderSize + Gladdy.db.cooldownYOffset) button.spellCooldownFrame:SetPoint("TOPLEFT", button.powerBar, "BOTTOMLEFT", Gladdy.db.cooldownXOffset, -Gladdy.db.highlightBorderSize + Gladdy.db.cooldownYOffset)
end end
elseif Gladdy.db.cooldownYPos == "LEFT" then elseif Gladdy.db.cooldownYPos == "LEFT" then
local horizontalMargin = Gladdy.db.highlightBorderSize + Gladdy.db.padding local anchor = Gladdy:GetAnchor(unit, "LEFT")
if (Gladdy.db.trinketPos == "LEFT" and Gladdy.db.trinketEnabled) then if anchor == Gladdy.buttons[unit].healthBar then
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding button.spellCooldownFrame:SetPoint("RIGHT", anchor, "LEFT", -(Gladdy.db.highlightBorderSize + Gladdy.db.padding) + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset)
if (Gladdy.db.classIconPos == "LEFT") then else
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding button.spellCooldownFrame:SetPoint("RIGHT", anchor, "LEFT", -Gladdy.db.padding + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset)
end
elseif (Gladdy.db.classIconPos == "LEFT") then
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding
if (Gladdy.db.trinketPos == "LEFT" and Gladdy.db.trinketEnabled) then
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding
end
end end
if (Gladdy.db.drCooldownPos == "LEFT" and Gladdy.db.drEnabled) then
verticalMargin = verticalMargin + Gladdy.db.drIconSize/2 + Gladdy.db.padding/2
end
if (Gladdy.db.castBarPos == "LEFT") then
verticalMargin = verticalMargin -
((Gladdy.db.castBarHeight < Gladdy.db.castBarIconSize) and Gladdy.db.castBarIconSize
or Gladdy.db.castBarHeight)/2 + Gladdy.db.padding/2
end
if (Gladdy.db.buffsCooldownPos == "LEFT" and Gladdy.db.buffsEnabled) then
verticalMargin = verticalMargin - (Gladdy.db.buffsIconSize/2 + Gladdy.db.padding/2)
end
button.spellCooldownFrame:SetPoint("RIGHT", button.healthBar, "LEFT", -horizontalMargin + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset + verticalMargin)
elseif Gladdy.db.cooldownYPos == "RIGHT" then elseif Gladdy.db.cooldownYPos == "RIGHT" then
verticalMargin = -(Gladdy.db.powerBarHeight)/2 local anchor = Gladdy:GetAnchor(unit, "RIGHT")
local horizontalMargin = Gladdy.db.highlightBorderSize + Gladdy.db.padding if anchor == Gladdy.buttons[unit].healthBar then
if (Gladdy.db.trinketPos == "RIGHT" and Gladdy.db.trinketEnabled) then button.spellCooldownFrame:SetPoint("LEFT", anchor, "RIGHT", Gladdy.db.highlightBorderSize + Gladdy.db.padding + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset)
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding else
if (Gladdy.db.classIconPos == "RIGHT") then button.spellCooldownFrame:SetPoint("LEFT", anchor, "RIGHT", Gladdy.db.padding + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset)
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding
end
elseif (Gladdy.db.classIconPos == "RIGHT") then
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding
if (Gladdy.db.trinketPos == "RIGHT" and Gladdy.db.trinketEnabled) then
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding
end
end end
if (Gladdy.db.drCooldownPos == "RIGHT" and Gladdy.db.drEnabled) then
verticalMargin = verticalMargin + Gladdy.db.drIconSize/2 + Gladdy.db.padding/2
end
if (Gladdy.db.castBarPos == "RIGHT") then
verticalMargin = verticalMargin -
((Gladdy.db.castBarHeight < Gladdy.db.castBarIconSize) and Gladdy.db.castBarIconSize
or Gladdy.db.castBarHeight)/2 + Gladdy.db.padding/2
end
if (Gladdy.db.buffsCooldownPos == "RIGHT" and Gladdy.db.buffsEnabled) then
verticalMargin = verticalMargin - (Gladdy.db.buffsIconSize/2 + Gladdy.db.padding/2)
end
button.spellCooldownFrame:SetPoint("LEFT", button.healthBar, "RIGHT", horizontalMargin + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset + verticalMargin)
end end
button.spellCooldownFrame:SetHeight(Gladdy.db.cooldownSize) button.spellCooldownFrame:SetHeight(Gladdy.db.cooldownSize)
button.spellCooldownFrame:SetWidth(1) button.spellCooldownFrame:SetWidth(1)
@ -227,12 +234,10 @@ function Cooldowns:UpdateFrame(unit)
end end
function Cooldowns:Test(unit) function Cooldowns:Test(unit)
if Gladdy.db.cooldown then local button = Gladdy.buttons[unit]
local button = Gladdy.buttons[unit] button.spellCooldownFrame:Show()
button.spellCooldownFrame:Show() button.lastCooldownSpell = 1
button.lastCooldownSpell = 1 self:UpdateTestCooldowns(unit)
self:UpdateTestCooldowns(unit)
end
end end
function Cooldowns:UpdateTestCooldowns(unit) function Cooldowns:UpdateTestCooldowns(unit)
@ -246,12 +251,12 @@ function Cooldowns:UpdateTestCooldowns(unit)
button.test = true button.test = true
-- use class spells -- use class spells
for k, v in pairs(self.cooldownSpells[button.class]) do for k, v in pairs(Gladdy:GetCooldownList()[button.class]) do
--k is spellId --k is spellId
self:CooldownUsed(unit, button.class, k, nil) self:CooldownUsed(unit, button.class, k, nil)
end end
-- use race spells -- use race spells
for k, v in pairs(self.cooldownSpells[button.race]) do for k, v in pairs(Gladdy:GetCooldownList()[button.race]) do
self:CooldownUsed(unit, button.race, k, nil) self:CooldownUsed(unit, button.race, k, nil)
end end
end end
@ -345,30 +350,32 @@ function Cooldowns:DetectSpec(unit, spec)
if (Gladdy.db.cooldown) then if (Gladdy.db.cooldown) then
local class = Gladdy.buttons[unit].class local class = Gladdy.buttons[unit].class
local race = Gladdy.buttons[unit].race local race = Gladdy.buttons[unit].race
for k, v in pairs(self.cooldownSpells[class]) do for k, v in pairs(Gladdy:GetCooldownList()[class]) do
--if (self.db.cooldownList[k] ~= false and self.db.cooldownList[class] ~= false) then if Gladdy.db.cooldownCooldowns[tostring(k)] then
if (type(v) == "table" and ((v.spec ~= nil and v.spec == spec) or (v.notSpec ~= nil and v.notSpec ~= spec))) then --if (self.db.cooldownList[k] ~= false and self.db.cooldownList[class] ~= false) then
local sharedCD = false if (type(v) == "table" and ((v.spec ~= nil and v.spec == spec) or (v.notSpec ~= nil and v.notSpec ~= spec))) then
if (type(v) == "table" and v.sharedCD ~= nil and v.sharedCD.cd == nil) then local sharedCD = false
for spellId, _ in pairs(v.sharedCD) do if (type(v) == "table" and v.sharedCD ~= nil and v.sharedCD.cd == nil) then
for i = 1, button.lastCooldownSpell do for spellId, _ in pairs(v.sharedCD) do
local icon = button.spellCooldownFrame["icon" .. i] for i = 1, button.lastCooldownSpell do
if (icon.spellId == spellId) then local icon = button.spellCooldownFrame["icon" .. i]
sharedCD = true if (icon.spellId == spellId) then
sharedCD = true
end
end end
end end
end end
end if sharedCD then
if sharedCD then return
return end
end
local icon = button.spellCooldownFrame["icon" .. button.lastCooldownSpell] local icon = button.spellCooldownFrame["icon" .. button.lastCooldownSpell]
icon:Show() icon:Show()
icon.texture:SetTexture(self.spellTextures[k]) icon.texture:SetTexture(self.spellTextures[k])
icon.spellId = k icon.spellId = k
button.spellCooldownFrame["icon" .. button.lastCooldownSpell] = icon button.spellCooldownFrame["icon" .. button.lastCooldownSpell] = icon
button.lastCooldownSpell = button.lastCooldownSpell + 1 button.lastCooldownSpell = button.lastCooldownSpell + 1
end
end end
end end
--end --end
@ -377,31 +384,33 @@ function Cooldowns:DetectSpec(unit, spec)
--- RACE FUNCTIONALITY --- RACE FUNCTIONALITY
---------------------- ----------------------
local race = Gladdy.buttons[unit].race local race = Gladdy.buttons[unit].race
if self.cooldownSpells[race] then if Gladdy:GetCooldownList()[race] then
for k, v in pairs(self.cooldownSpells[race]) do for k, v in pairs(Gladdy:GetCooldownList()[race]) do
--if (self.db.cooldownList[k] ~= false and self.db.cooldownList[class] ~= false) then if Gladdy.db.cooldownCooldowns[tostring(k)] then
if (type(v) == "table" and ((v.spec ~= nil and v.spec == spec) or (v.notSpec ~= nil and v.notSpec ~= spec))) then --if (self.db.cooldownList[k] ~= false and self.db.cooldownList[class] ~= false) then
local sharedCD = false if (type(v) == "table" and ((v.spec ~= nil and v.spec == spec) or (v.notSpec ~= nil and v.notSpec ~= spec))) then
if (type(v) == "table" and v.sharedCD ~= nil and v.sharedCD.cd == nil) then local sharedCD = false
for spellId, _ in pairs(v.sharedCD) do if (type(v) == "table" and v.sharedCD ~= nil and v.sharedCD.cd == nil) then
for i = 1, button.lastCooldownSpell do for spellId, _ in pairs(v.sharedCD) do
local icon = button.spellCooldownFrame["icon" .. i] for i = 1, button.lastCooldownSpell do
if (icon.spellId == spellId) then local icon = button.spellCooldownFrame["icon" .. i]
sharedCD = true if (icon.spellId == spellId) then
sharedCD = true
end
end end
end end
end end
end if sharedCD then
if sharedCD then return
return end
end
local icon = button.spellCooldownFrame["icon" .. button.lastCooldownSpell] local icon = button.spellCooldownFrame["icon" .. button.lastCooldownSpell]
icon:Show() icon:Show()
icon.texture:SetTexture(self.spellTextures[k]) icon.texture:SetTexture(self.spellTextures[k])
icon.spellId = k icon.spellId = k
button.spellCooldownFrame["icon" .. button.lastCooldownSpell] = icon button.spellCooldownFrame["icon" .. button.lastCooldownSpell] = icon
button.lastCooldownSpell = button.lastCooldownSpell + 1 button.lastCooldownSpell = button.lastCooldownSpell + 1
end
end end
end end
end end
@ -412,6 +421,10 @@ function Cooldowns:ResetUnit(unit)
Gladdy.buttons[unit].test = nil Gladdy.buttons[unit].test = nil
end end
function Cooldowns:UNIT_DESTROYED(unit)
end
function Cooldowns:UpdateCooldowns(button) function Cooldowns:UpdateCooldowns(button)
local class = button.class local class = button.class
local race = button.race local race = button.race
@ -420,29 +433,31 @@ function Cooldowns:UpdateCooldowns(button)
end end
if (Gladdy.db.cooldown) then if (Gladdy.db.cooldown) then
for k, v in pairs(self.cooldownSpells[class]) do for k, v in pairs(Gladdy:GetCooldownList()[class]) do
if (type(v) ~= "table" or (type(v) == "table" and v.spec == nil and v.notSpec == nil)) then if Gladdy.db.cooldownCooldowns[tostring(k)] then
-- see if we have shared cooldowns without a cooldown defined if (type(v) ~= "table" or (type(v) == "table" and v.spec == nil and v.notSpec == nil)) then
-- e.g. hunter traps have shared cooldowns, so only display one trap instead all of them -- see if we have shared cooldowns without a cooldown defined
local sharedCD = false -- e.g. hunter traps have shared cooldowns, so only display one trap instead all of them
if (type(v) == "table" and v.sharedCD ~= nil and v.sharedCD.cd == nil) then local sharedCD = false
for spellId, _ in pairs(v.sharedCD) do if (type(v) == "table" and v.sharedCD ~= nil and v.sharedCD.cd == nil) then
for i = 1, button.lastCooldownSpell do for spellId, _ in pairs(v.sharedCD) do
local icon = button.spellCooldownFrame["icon" .. i] for i = 1, button.lastCooldownSpell do
if (icon.spellId == spellId) then local icon = button.spellCooldownFrame["icon" .. i]
sharedCD = true if (icon.spellId == spellId) then
sharedCD = true
end
end end
end end
end end
end
if (not sharedCD) then if (not sharedCD) then
local icon = button.spellCooldownFrame["icon" .. button.lastCooldownSpell] local icon = button.spellCooldownFrame["icon" .. button.lastCooldownSpell]
icon:Show() icon:Show()
icon.spellId = k icon.spellId = k
icon.texture:SetTexture(self.spellTextures[k]) icon.texture:SetTexture(self.spellTextures[k])
button.spellCooldownFrame["icon" .. button.lastCooldownSpell] = icon button.spellCooldownFrame["icon" .. button.lastCooldownSpell] = icon
button.lastCooldownSpell = button.lastCooldownSpell + 1 button.lastCooldownSpell = button.lastCooldownSpell + 1
end
end end
end end
end end
@ -450,14 +465,16 @@ function Cooldowns:UpdateCooldowns(button)
-- RACE FUNCTIONALITY -- RACE FUNCTIONALITY
---- ----
for k, v in pairs(self.cooldownSpells[race]) do for k, v in pairs(Gladdy:GetCooldownList()[race]) do
if (type(v) ~= "table" or (type(v) == "table" and v.spec == nil and v.notSpec == nil)) then if Gladdy.db.cooldownCooldowns[tostring(k)] then
local icon = button.spellCooldownFrame["icon" .. button.lastCooldownSpell] if (type(v) ~= "table" or (type(v) == "table" and v.spec == nil and v.notSpec == nil)) then
icon:Show() local icon = button.spellCooldownFrame["icon" .. button.lastCooldownSpell]
icon.spellId = k icon:Show()
icon.texture:SetTexture(self.spellTextures[k]) icon.spellId = k
button.spellCooldownFrame["icon" .. button.lastCooldownSpell] = icon icon.texture:SetTexture(self.spellTextures[k])
button.lastCooldownSpell = button.lastCooldownSpell + 1 button.spellCooldownFrame["icon" .. button.lastCooldownSpell] = icon
button.lastCooldownSpell = button.lastCooldownSpell + 1
end
end end
end end
end end
@ -470,7 +487,7 @@ function Cooldowns:CooldownUsed(unit, unitClass, spellId, spellName)
end end
-- if (self.db.cooldownList[spellId] == false) then return end -- if (self.db.cooldownList[spellId] == false) then return end
local cooldown = self.cooldownSpells[unitClass][spellId] local cooldown = Gladdy:GetCooldownList()[unitClass][spellId]
local cd = cooldown local cd = cooldown
if (type(cooldown) == "table") then if (type(cooldown) == "table") then
-- return if the spec doesn't have a cooldown for this spell -- return if the spec doesn't have a cooldown for this spell
@ -755,9 +772,80 @@ function Cooldowns:GetOptions()
}, },
}, },
}, },
cooldowns = {
type = "group",
childGroups = "tree",
name = "Cooldowns",
order = 4,
args = Cooldowns:GetCooldownOptions(),
},
} }
end end
function Cooldowns:GetCooldownOptions()
local group = {}
local p = 1
for i,class in ipairs(Gladdy.CLASSES) do
group[class] = {
type = "group",
name = LOCALIZED_CLASS_NAMES_MALE[class],
order = i,
icon = "Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Classes",
iconCoords = CLASS_ICON_TCOORDS[class],
args = {}
}
local o = 1
for spellId,cooldown in pairs(Gladdy:GetCooldownList()[class]) do
group[class].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(info)
return Gladdy.db.cooldownCooldowns[tostring(spellId)]
end,
set = function(info, value)
Gladdy.db.cooldownCooldowns[tostring(spellId)] = value
Gladdy:UpdateFrame()
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(info)
return Gladdy.db.cooldownCooldowns[tostring(spellId)]
end,
set = function(info, value)
Gladdy.db.cooldownCooldowns[tostring(spellId)] = value
Gladdy:UpdateFrame()
end
}
o = o + 1
end
end
return group
end
function Gladdy:UpdateTestCooldowns(i) function Gladdy:UpdateTestCooldowns(i)
local unit = "arena" .. i local unit = "arena" .. i
local button = Gladdy.buttons[unit] local button = Gladdy.buttons[unit]
@ -769,219 +857,13 @@ function Gladdy:UpdateTestCooldowns(i)
Cooldowns:DetectSpec(unit, button.testSpec) Cooldowns:DetectSpec(unit, button.testSpec)
-- use class spells -- use class spells
for k, v in pairs(Cooldowns.cooldownSpells[button.class]) do for k, v in pairs(Gladdy:GetCooldownList()[button.class]) do
--k is spellId --k is spellId
Cooldowns:CooldownUsed(unit, button.class, k, nil) Cooldowns:CooldownUsed(unit, button.class, k, nil)
end end
-- use race spells -- use race spells
for k, v in pairs(Cooldowns.cooldownSpells[button.race]) do for k, v in pairs(Gladdy:GetCooldownList()[button.race]) do
Cooldowns:CooldownUsed(unit, button.race, k, nil) Cooldowns:CooldownUsed(unit, button.race, k, nil)
end end
end end
end end
Cooldowns.cooldownSpells = {
-- Spell Name Cooldown[, Spec]
-- Mage
["MAGE"] = {
[1953] = 15, -- Blink
--[122] = 22, -- Frost Nova
--[12051] = 480, --Evocation
[2139] = 24, -- Counterspell
[45438] = { cd = 300, [L["Frost"]] = 240, }, -- Ice Block
[12472] = { cd = 180, spec = L["Frost"], }, -- Icy Veins
[31687] = { cd = 180, spec = L["Frost"], }, -- Summon Water Elemental
[12043] = { cd = 180, spec = L["Arcane"], }, -- Presence of Mind
[11129] = { cd = 180, spec = L["Fire"] }, -- Combustion
[120] = { cd = 10,
sharedCD = {
[31661] = true, -- Cone of Cold
}, spec = L["Fire"] }, -- Dragon's Breath
[31661] = { cd = 20,
sharedCD = {
[120] = true, -- Cone of Cold
}, spec = L["Fire"] }, -- Dragon's Breath
[12042] = { cd = 180, spec = L["Arcane"], }, -- Arcane Power
[11958] = { cd = 384, spec = L["Frost"], -- Coldsnap
resetCD = {
[12472] = true,
[45438] = true,
[31687] = true,
},
},
},
-- Priest
["PRIEST"] = {
[10890] = { cd = 27, [L["Shadow"]] = 23, }, -- Psychic Scream
[15487] = { cd = 45, spec = L["Shadow"], }, -- Silence
[10060] = { cd = 180, spec = L["Discipline"], }, -- Power Infusion
[33206] = { cd = 120, spec = L["Discipline"], }, -- Pain Suppression
[34433] = 300, -- Shadowfiend
},
-- Druid
["DRUID"] = {
[22812] = 60, -- Barkskin
[29166] = 360, -- Innervate
[8983] = 60, -- Bash
[16689] = 60, -- Natures Grasp
[17116] = { cd = 180, spec = L["Restoration"], }, -- Natures Swiftness
[33831] = { cd = 180, spec = L["Balance"], }, -- Force of Nature
},
-- Shaman
["SHAMAN"] = {
[8042] = { cd = 6, -- Earth Shock
sharedCD = {
[8056] = true, -- Frost Shock
[8050] = true, -- Flame Shock
},
},
[30823] = { cd = 120, spec = L["Enhancement"], }, -- Shamanistic Rage
[16166] = { cd = 180, spec = L["Elemental"], }, -- Elemental Mastery
[16188] = { cd = 180, spec = L["Restoration"], }, -- Natures Swiftness
[16190] = { cd = 300, spec = L["Restoration"], }, -- Mana Tide Totem
},
-- Paladin
["PALADIN"] = {
[10278] = 180, -- Blessing of Protection
[1044] = 25, -- Blessing of Freedom
[10308] = { cd = 60, [L["Retribution"]] = 40, }, -- Hammer of Justice
[642] = { cd = 300, -- Divine Shield
sharedCD = {
cd = 60, -- no actual shared CD but debuff
[31884] = true,
},
},
[31884] = { cd = 180, spec = L["Retribution"], -- Avenging Wrath
sharedCD = {
cd = 60,
[642] = true,
},
},
[20066] = { cd = 60, spec = L["Retribution"], }, -- Repentance
[31842] = { cd = 180, spec = L["Holy"], }, -- Divine Illumination
[31935] = { cd = 30, spec = L["Protection"], }, -- Avengers Shield
},
-- Warlock
["WARLOCK"] = {
[17928] = 40, -- Howl of Terror
[27223] = 120, -- Death Coil
--[19647] = { cd = 24 }, -- Spell Lock; how will I handle pet spells?
[30414] = { cd = 20, spec = L["Destruction"], }, -- Shadowfury
[17877] = { cd = 15, spec = L["Destruction"], }, -- Shadowburn
[18708] = { cd = 900, spec = L["Demonology"], }, -- Feldom
},
-- Warrior
["WARRIOR"] = {
--[[6552] = { cd = 10, -- Pummel
sharedCD = {
[72] = true,
},
},
[72] = { cd = 12, -- Shield Bash
sharedCD = {
[6552] = true,
},
}, ]]
--[23920] = 10, -- Spell Reflection
[3411] = 30, -- Intervene
[676] = 60, -- Disarm
[5246] = 180, -- Intimidating Shout
--[2565] = 60, -- Shield Block
[12292] = { cd = 180, spec = L["Arms"], }, -- Death Wish
[12975] = { cd = 180, spec = L["Protection"], }, -- Last Stand
[12809] = { cd = 30, spec = L["Protection"], }, -- Concussion Blow
},
-- Hunter
["HUNTER"] = {
[19503] = 30, -- Scatter Shot
[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
},
},
[34600] = { cd = 30, -- Snake Trap
sharedCD = {
[14311] = true, -- Freezing Trap
[13809] = true, -- Frost Trap
},
},
[34490] = { cd = 20, spec = L["Marksmanship"], }, -- Silencing Shot
[19386] = { cd = 60, spec = L["Survival"], }, -- Wyvern Sting
[19577] = { cd = 60, spec = L["Beast Mastery"], }, -- Intimidation
[38373] = { cd = 120, spec = L["Beast Mastery"], }, -- The Beast Within
},
-- Rogue
["ROGUE"] = {
[1766] = 10, -- Kick
[8643] = 20, -- Kidney Shot
[31224] = 60, -- Cloak of Shadow
[26889] = { cd = 300, [L["Subtlety"]] = 180, }, -- Vanish
[2094] = { cd = 180, [L["Subtlety"]] = 90, }, -- Blind
[11305] = { cd = 300, [L["Combat"]] = 180, }, -- Sprint
[26669] = { cd = 300, [L["Combat"]] = 180, }, -- Evasion
[14177] = { cd = 180, spec = L["Assassination"], }, -- Cold Blood
[13750] = { cd = 300, spec = L["Combat"], }, -- Adrenaline Rush
[13877] = { cd = 120, spec = L["Combat"], }, -- Blade Flurry
[36554] = { cd = 30, spec = L["Subtlety"], }, -- Shadowstep
[14185] = { cd = 600, spec = L["Subtlety"], -- Preparation
resetCD = {
[26669] = true,
[11305] = true,
[26889] = true,
[14177] = true,
[36554] = true,
},
},
},
["Scourge"] = {
[7744] = 120, -- Will of the Forsaken
},
["BloodElf"] = {
[28730] = 120, -- Arcane Torrent
},
["Tauren"] = {
[20549] = 120, -- War Stomp
},
["Orc"] = {
},
["Troll"] = {
},
["NightElf"] = {
[2651] = { cd = 180, spec = L["Discipline"], }, -- Elune's Grace
[10797] = { cd = 30, spec = L["Discipline"], }, -- Star Shards
},
["Draenei"] = {
[32548] = { cd = 300, spec = L["Discipline"], }, -- Hymn of Hope
},
["Human"] = {
[13908] = { cd = 600, spec = L["Discipline"], }, -- Desperate Prayer
[20600] = 180, -- Perception
},
["Gnome"] = {
[20589] = 105, -- Escape Artist
},
["Dwarf"] = {
[20594] = 180, -- Stoneform
[13908] = { cd = 600, spec = L["Discipline"], }, -- Desperate Prayer
},
}

View File

@ -62,7 +62,7 @@ end
function Diminishings:Initialize() function Diminishings:Initialize()
self.frames = {} self.frames = {}
self:RegisterMessage("UNIT_DEATH", "ResetUnit", "AURA_FADE") self:RegisterMessage("UNIT_DEATH", "ResetUnit", "AURA_FADE", "UNIT_DESTROYED")
end end
function Diminishings:CreateFrame(unit) function Diminishings:CreateFrame(unit)
@ -94,7 +94,7 @@ function Diminishings:CreateFrame(unit)
if self.timeLeft >=5 then if self.timeLeft >=5 then
self.timeText:SetFormattedText("%d", self.timeLeft) self.timeText:SetFormattedText("%d", self.timeLeft)
else else
self.timeText:SetFormattedText("%.1f", self.timeLeft) self.timeText:SetFormattedText("%.1f", self.timeLeft >= 0.0 and self.timeLeft or 0.0)
end end
end end
end end
@ -161,56 +161,21 @@ function Diminishings:UpdateFrame(unit)
drFrame:ClearAllPoints() drFrame:ClearAllPoints()
local horizontalMargin = Gladdy.db.highlightBorderSize + Gladdy.db.padding local horizontalMargin = Gladdy.db.highlightBorderSize + Gladdy.db.padding
local verticalMargin = -(Gladdy.db.powerBarHeight)/2
if (Gladdy.db.drCooldownPos == "LEFT") then if (Gladdy.db.drCooldownPos == "LEFT") then
if (Gladdy.db.trinketPos == "LEFT" and Gladdy.db.trinketEnabled) then local anchor = Gladdy:GetAnchor(unit, "LEFT")
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding if anchor == Gladdy.buttons[unit].healthBar then
if (Gladdy.db.classIconPos == "LEFT") then drFrame:SetPoint("RIGHT", anchor, "LEFT", -horizontalMargin + Gladdy.db.drXOffset, Gladdy.db.drYOffset)
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding else
end drFrame:SetPoint("RIGHT", anchor, "LEFT", -Gladdy.db.padding + Gladdy.db.drXOffset, Gladdy.db.drYOffset)
elseif (Gladdy.db.classIconPos == "LEFT") then
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding
if (Gladdy.db.trinketPos == "LEFT" and Gladdy.db.trinketEnabled) then
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding
end
end end
if (Gladdy.db.castBarPos == "LEFT") then
verticalMargin = verticalMargin -
(((Gladdy.db.castBarHeight < Gladdy.db.castBarIconSize) and Gladdy.db.castBarIconSize
or Gladdy.db.castBarHeight)/2 + Gladdy.db.padding/2)
end
if (Gladdy.db.cooldownYPos == "LEFT" and Gladdy.db.cooldown) then
verticalMargin = verticalMargin - (Gladdy.db.cooldownSize/2 + Gladdy.db.padding/2)
end
if (Gladdy.db.buffsCooldownPos == "LEFT" and Gladdy.db.buffsEnabled) then
verticalMargin = verticalMargin - (Gladdy.db.buffsIconSize/2 + Gladdy.db.padding/2)
end
drFrame:SetPoint("RIGHT", Gladdy.buttons[unit].healthBar, "LEFT", -horizontalMargin + Gladdy.db.drXOffset, Gladdy.db.drYOffset + verticalMargin)
end end
if (Gladdy.db.drCooldownPos == "RIGHT") then if (Gladdy.db.drCooldownPos == "RIGHT") then
if (Gladdy.db.trinketPos == "RIGHT" and Gladdy.db.trinketEnabled) then local anchor = Gladdy:GetAnchor(unit, "RIGHT")
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding if anchor == Gladdy.buttons[unit].healthBar then
if (Gladdy.db.classIconPos == "RIGHT") then drFrame:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + Gladdy.db.drXOffset, Gladdy.db.drYOffset)
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding else
end drFrame:SetPoint("LEFT", anchor, "RIGHT", Gladdy.db.padding + Gladdy.db.drXOffset, Gladdy.db.drYOffset)
elseif (Gladdy.db.classIconPos == "RIGHT") then
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding
if (Gladdy.db.trinketPos == "RIGHT" and Gladdy.db.trinketEnabled) then
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding
end
end end
if (Gladdy.db.castBarPos == "RIGHT") then
verticalMargin = verticalMargin -
(((Gladdy.db.castBarHeight < Gladdy.db.castBarIconSize) and Gladdy.db.castBarIconSize
or Gladdy.db.castBarHeight)/2 + Gladdy.db.padding/2)
end
if (Gladdy.db.cooldownYPos == "RIGHT" and Gladdy.db.cooldown) then
verticalMargin = verticalMargin - (Gladdy.db.cooldownSize/2 + Gladdy.db.padding/2)
end
if (Gladdy.db.buffsCooldownPos == "RIGHT" and Gladdy.db.buffsEnabled) then
verticalMargin = verticalMargin - (Gladdy.db.buffsIconSize/2 + Gladdy.db.padding/2)
end
drFrame:SetPoint("LEFT", Gladdy.buttons[unit].healthBar, "RIGHT", horizontalMargin + Gladdy.db.drXOffset, Gladdy.db.drYOffset + verticalMargin)
end end
drFrame:SetWidth(Gladdy.db.drIconSize * 16) drFrame:SetWidth(Gladdy.db.drIconSize * 16)
@ -289,6 +254,10 @@ function Diminishings:ResetUnit(unit)
end end
end end
function Diminishings:UNIT_DESTROYED(unit)
Diminishings:ResetUnit(unit)
end
function Diminishings:Test(unit) function Diminishings:Test(unit)
if Gladdy.db.drEnabled then if Gladdy.db.drEnabled then
local spells = { 33786, 118, 8643, 8983 } local spells = { 33786, 118, 8643, 8983 }