diff --git a/api/config.lua b/api/config.lua index 7797aaa4..87099537 100644 --- a/api/config.lua +++ b/api/config.lua @@ -74,6 +74,7 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("appearance", "cd", "threshold", "2") pfUI:UpdateConfig("appearance", "cd", "font_size", "12") pfUI:UpdateConfig("appearance", "cd", "debuffs", "1") + pfUI:UpdateConfig("appearance", "cd", "blizzard", "1") pfUI:UpdateConfig("appearance", "castbar", "castbarcolor", ".7,.7,.9,.8") pfUI:UpdateConfig("appearance", "castbar", "channelcolor", ".9,.9,.7,.8") pfUI:UpdateConfig("appearance", "infight", "screen", "0") diff --git a/api/unitframes.lua b/api/unitframes.lua index 0129b68d..7ca73cb4 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -350,6 +350,7 @@ function pfUI.uf:UpdateConfig() f.buffs[i].stacks:SetShadowOffset(0.8, -0.8) f.buffs[i].stacks:SetTextColor(1,1,.5) f.buffs[i].cd = f.buffs[i].cd or CreateFrame("Model", nil, f.buffs[i], "CooldownFrameTemplate") + f.buffs[i].cd.pfCooldownType = "ALL" f.buffs[i].cd:SetAlpha(0) f.buffs[i]:RegisterForClicks("RightButtonUp") @@ -428,6 +429,7 @@ function pfUI.uf:UpdateConfig() f.debuffs[i].stacks:SetShadowOffset(0.8, -0.8) f.debuffs[i].stacks:SetTextColor(1,1,.5) f.debuffs[i].cd = f.debuffs[i].cd or CreateFrame("Model", nil, f.debuffs[i], "CooldownFrameTemplate") + f.debuffs[i].cd.pfCooldownType = "ALL" f.debuffs[i].cd:SetAlpha(0) f.debuffs[i]:RegisterForClicks("RightButtonUp") diff --git a/modules/actionbar.lua b/modules/actionbar.lua index 03e9963b..b74496cc 100644 --- a/modules/actionbar.lua +++ b/modules/actionbar.lua @@ -557,6 +557,9 @@ pfUI:RegisterModule("actionbar", function () button:SetHeight(C.bars.icon_size) button:Show() + local cooldown = _G["PetActionButton"..i..'Cooldown'] + cooldown.pfCooldownType = "NOGCD" + local icon = _G["PetActionButton"..i..'Icon'] icon:SetAllPoints(button) icon:SetParent(button) @@ -592,6 +595,9 @@ pfUI:RegisterModule("actionbar", function () button:SetNormalTexture("") button.SetNormalTexture = function() return end + local cooldown = _G[actionbutton..i..'Cooldown'] + cooldown.pfCooldownType = "NOGCD" + local icon = _G[actionbutton..i..'Icon'] icon:SetAllPoints(button) icon:SetTexCoord(.08, .92, .08, .92) diff --git a/modules/bags.lua b/modules/bags.lua index 395106eb..f791d0cd 100644 --- a/modules/bags.lua +++ b/modules/bags.lua @@ -263,13 +263,17 @@ pfUI:RegisterModule("bags", function () if tpl == "BankItemButtonGenericTemplate" then local bankslot = pfUI.bags[bag].slots[slot].frame local name = "pfBag" .. bag .. "item" .. slot .. "Cooldown" - bankslot.cooldown = CreateFrame("Model", name, bankslot, "CooldownFrameTemplate") - bankslot.cooldown:SetAllPoints(bankslot) + bankslot.cd = CreateFrame("Model", name, bankslot, "CooldownFrameTemplate") + bankslot.cd:SetAllPoints(bankslot) + bankslot.cd.pfCooldownType = "ALL" + else + local bagslot = pfUI.bags[bag].slots[slot].frame + bagslot.cd = _G[bagslot:GetName().."Cooldown"] + bagslot.cd.pfCooldownType = "ALL" end CreateBackdrop(pfUI.bags[bag].slots[slot].frame, default_border) pfUI.bags[bag].slots[slot].frame:SetNormalTexture("") - pfUI.bags[bag].slots[slot].bag = bag pfUI.bags[bag].slots[slot].slot = slot pfUI.bags[bag].slots[slot].frame:SetID(slot) diff --git a/modules/cooldown.lua b/modules/cooldown.lua index 5a58103a..783a382a 100644 --- a/modules/cooldown.lua +++ b/modules/cooldown.lua @@ -46,15 +46,21 @@ pfUI:RegisterModule("cooldown", function () -- hook hooksecurefunc("CooldownFrame_SetTimer", function(this, start, duration, enable) + local parent = this.GetParent and this:GetParent() + + if not this.pfCooldownType or ( this.pfCooldownType == "NOGCD" and duration < tonumber(C.appearance.cd.threshold)) then + return + end + -- realign guessed cooldown frames - if this:GetParent() and this:GetParent():GetWidth() / 36 > 0 then - this:SetScale(this:GetParent():GetWidth() / 36) - this:SetPoint("TOPLEFT", this:GetParent(), "TOPLEFT", -1, 1) - this:SetPoint("BOTTOMRIGHT", this:GetParent(), "BOTTOMRIGHT", 1, -1) + if parent and parent:GetWidth() / 36 > 0 then + this:SetScale(parent:GetWidth() / 36) + this:SetPoint("TOPLEFT", parent, "TOPLEFT", -1, 1) + this:SetPoint("BOTTOMRIGHT", parent, "BOTTOMRIGHT", 1, -1) end -- print time as text on cooldown frames - if ( start > 0 and duration > tonumber(C.appearance.cd.threshold) and enable > 0) then + if start > 0 and duration > 0 and enable > 0 then if( not this.cd ) then pfCreateCoolDown(this, start, duration) end diff --git a/modules/gui.lua b/modules/gui.lua index 6468a169..618be6e1 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -739,6 +739,7 @@ pfUI:RegisterModule("gui", function () CreateConfig(nil, this, T["Cooldown Text Threshold"], C.appearance.cd, "threshold") CreateConfig(nil, this, T["Cooldown Text Font Size"], C.appearance.cd, "font_size") CreateConfig(nil, this, T["Display Debuff Durations"], C.appearance.cd, "debuffs", "checkbox") + CreateConfig(nil, this, T["Enable Durations On Blizzard Frames"], C.appearance.cd, "blizzard", "checkbox") this.setup = true end end) diff --git a/modules/nameplates.lua b/modules/nameplates.lua index f2817323..18abf648 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -526,6 +526,7 @@ pfUI:RegisterModule("nameplates", function () if pfUI.debuffs and pfUI.debuffs.active and name then this.debuffs[j].cd = this.debuffs[j].cd or CreateFrame("Model", nil, this.debuffs[j], "CooldownFrameTemplate") + this.debuffs[j].cd.pfCooldownType = "ALL" local start, duration, timeleft = pfUI.debuffs:GetDebuffInfo("target", name) this.debuffs[j].cd:SetAlpha(0) CooldownFrame_SetTimer(this.debuffs[j].cd, start, duration, 1) diff --git a/modules/skin.lua b/modules/skin.lua index ed17b5a2..3f925747 100644 --- a/modules/skin.lua +++ b/modules/skin.lua @@ -16,6 +16,18 @@ pfUI:RegisterModule("skin", function () EnableMovable("ClassTrainerFrame", "Blizzard_TrainerUI") EnableMovable("InspectFrame", "Blizzard_InspectUI", { "InspectHonorFrame" }) + if C.appearance.cd.blizzard == "1" then + hooksecurefunc("PaperDollItemSlotButton_Update", function() + local cooldown = getglobal(this:GetName().."Cooldown") + cooldown.pfCooldownType = "ALL" + end) + + hooksecurefunc("SpellButton_UpdateButton", function() + local cooldown = getglobal(this:GetName().."Cooldown") + cooldown.pfCooldownType = "ALL" + end) + end + _, class = UnitClass("player") local color = RAID_CLASS_COLORS[class] local cr, cg, cb = color.r , color.g, color.b