From bbd3a9364e7e1cfaf90b8f3493aeb5517db99f92 Mon Sep 17 00:00:00 2001 From: Aviana Date: Wed, 20 Apr 2016 20:25:21 +0200 Subject: [PATCH 01/34] Create README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..2dbb1251 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# LunaUnitFrames +Unit Frames for WoW 1.12.1 + + +Be reminded that this project is frozen at the moment since i don't play vanilla. Only big errors will be taken care of. From 8fbec5f179dcb0ac6498a143de6fc4d3249ca18f Mon Sep 17 00:00:00 2001 From: Aviana Date: Wed, 20 Apr 2016 20:29:19 +0200 Subject: [PATCH 02/34] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2dbb1251..a81fa711 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,4 @@ Unit Frames for WoW 1.12.1 Be reminded that this project is frozen at the moment since i don't play vanilla. Only big errors will be taken care of. +Feel free to fork this but give credit (at least author & link to this github) From 63b841a842d40cac98cd153cc6d0a35b370466f2 Mon Sep 17 00:00:00 2001 From: sipertruk Date: Fri, 13 May 2016 23:49:34 +0200 Subject: [PATCH 03/34] quick buff timer test + right click cancel --- modules/auras.lua | 56 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/modules/auras.lua b/modules/auras.lua index 1af56fcd..3ae95091 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -45,8 +45,17 @@ local function BuffUpdate(frame) button.stack:SetText(stacks == 1 and "" or stacks) button.filter = "HELPFUL" button.auraID = i + if (frame:GetParent().unitGroup == "player") then + button:SetScript("OnUpdate", BuffButtonUpdate) + button:SetScript("OnClick", BuffButtonClick) + else + button:SetScript("OnUpdate", nil) + button:SetScript("OnClick", nil) + end button:Show() else + button:SetScript("OnUpdate", nil) + button:SetScript("OnClick", nil) button:Hide() end end @@ -57,13 +66,44 @@ local function BuffUpdate(frame) button.stack:SetText(stacks == 1 and "" or stacks) button.filter = "HARMFUL" button.auraID = i + if (frame:GetParent().unitGroup == "player") then + button:SetScript("OnUpdate", BuffButtonUpdate) + else + button:SetScript("OnUpdate", nil) + end button:Show() else + button:SetScript("OnUpdate", nil) button:Hide() end end end +function BuffButtonClick() + if (arg1 ~= "RightButton") then return; end + local buffIndex, untilCancelled = GetPlayerBuff(this.auraID - 1, this.filter); + CancelPlayerBuff(buffIndex) +end + +function BuffButtonUpdate() + --if(this.timeFontstrings == nil) then return; end + local buffIndex, untilCancelled = GetPlayerBuff(this.auraID - 1, this.filter); + local timeString = "" + local timeLeft = math.floor(GetPlayerBuffTimeLeft(buffIndex)); + if (timeLeft and timeLeft > 0) then + if (timeLeft > 59) then + local minutes = math.floor(timeLeft / 60) + timeString = minutes..":" + timeLeft = timeLeft - minutes * 60; + if (timeLeft < 10) then + timeString = timeString.."0" + end + end + timeString = timeString..timeLeft + end + this.timeFontstrings:SetText(timeString) +end + local function OnEvent() if arg1 == this:GetParent().unit then BuffUpdate(this) @@ -90,6 +130,13 @@ function Auras:OnEnable(frame) -- button.cooldown:SetReverse(true) button.cooldown:SetFrameLevel(7) button.cooldown:Hide() + button.timeFontstrings = button:CreateFontString(nil, "ARTWORK"); + button.timeFontstrings:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", 12) + button.timeFontstrings:SetShadowColor(0, 0, 0, 1.0) + button.timeFontstrings:SetShadowOffset(0.80, -0.80) + button.timeFontstrings:SetJustifyH("CENTER") + button.timeFontstrings:SetPoint("TOPLEFT", button, "BOTTOMLEFT",0,0) + button.timeFontstrings:SetPoint("TOPRIGHT", button, "BOTTOMRIGHT",0,0) end button.stack = button:CreateFontString(nil, "OVERLAY") @@ -123,6 +170,13 @@ function Auras:OnEnable(frame) -- button.cooldown:SetReverse(true) button.cooldown:SetFrameLevel(7) button.cooldown:Hide() + button.timeFontstrings = button:CreateFontString(nil, "ARTWORK"); + button.timeFontstrings:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", 12) + button.timeFontstrings:SetShadowColor(0, 0, 0, 1.0) + button.timeFontstrings:SetShadowOffset(0.80, -0.80) + button.timeFontstrings:SetJustifyH("CENTER") + button.timeFontstrings:SetPoint("TOPLEFT", button, "BOTTOMLEFT",0,0) + button.timeFontstrings:SetPoint("TOPRIGHT", button, "BOTTOMRIGHT",0,0) end button.stack = button:CreateFontString(nil, "OVERLAY") @@ -261,4 +315,4 @@ function Auras:FullUpdate(frame) end end BuffUpdate(frame.auras) -end \ No newline at end of file +end From 32b16ff4bcf12c1bbded6c280e6435398e122616 Mon Sep 17 00:00:00 2001 From: sipertruk Date: Sun, 15 May 2016 04:53:17 +0200 Subject: [PATCH 04/34] clean timer text,replace unitbuff by getplayerbuff --- modules/auras.lua | 118 +++++++++++++++++++++++++++++----------------- 1 file changed, 76 insertions(+), 42 deletions(-) diff --git a/modules/auras.lua b/modules/auras.lua index 3ae95091..9b98e540 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -15,6 +15,8 @@ local function showTooltip() GameTooltip:SetOwner(this, "ANCHOR_BOTTOMLEFT") if( this.filter == "TEMP" ) then GameTooltip:SetInventoryItem("player", this.auraID) + elseif this:GetParent():GetParent().unitGroup == "player" then + GameTooltip:SetPlayerBuff(this.auraID); elseif this.filter == "HELPFUL" then GameTooltip:SetUnitBuff(this:GetParent():GetParent().unit, this.auraID) else @@ -39,18 +41,25 @@ local function BuffUpdate(frame) auraframe:SetHeight(height == 0 and 1 or height) local texture,stacks for i,button in ipairs(auraframe.buffbuttons) do - texture,stacks = UnitBuff(unit,i) + local buffIndex = GetPlayerBuff(i - 1, "HELPFUL"); + if (frame:GetParent().unitGroup == "player") then + texture = GetPlayerBuffTexture(buffIndex); + stacks = GetPlayerBuffApplications(buffIndex); + else + texture,stacks = UnitBuff(unit,i) + end if texture then button.icon:SetTexture(texture) button.stack:SetText(stacks == 1 and "" or stacks) button.filter = "HELPFUL" - button.auraID = i if (frame:GetParent().unitGroup == "player") then button:SetScript("OnUpdate", BuffButtonUpdate) button:SetScript("OnClick", BuffButtonClick) + button.auraID = buffIndex else button:SetScript("OnUpdate", nil) button:SetScript("OnClick", nil) + button.auraID = i end button:Show() else @@ -60,15 +69,22 @@ local function BuffUpdate(frame) end end for i,button in ipairs(auraframe.debuffbuttons) do - texture,stacks = UnitDebuff(unit,i) + local buffIndex = GetPlayerBuff(i - 1, "HARMFUL"); + if (frame:GetParent().unitGroup == "player") then + texture = GetPlayerBuffTexture(buffIndex); + stacks = GetPlayerBuffApplications(buffIndex); + else + texture,stacks = UnitDebuff(unit,i) + end if texture then button.icon:SetTexture(texture) button.stack:SetText(stacks == 1 and "" or stacks) button.filter = "HARMFUL" - button.auraID = i if (frame:GetParent().unitGroup == "player") then button:SetScript("OnUpdate", BuffButtonUpdate) + button.auraID = buffIndex else + button.auraID = i button:SetScript("OnUpdate", nil) end button:Show() @@ -81,34 +97,46 @@ end function BuffButtonClick() if (arg1 ~= "RightButton") then return; end - local buffIndex, untilCancelled = GetPlayerBuff(this.auraID - 1, this.filter); - CancelPlayerBuff(buffIndex) + this:SetScript("OnUpdate", nil) + this:SetScript("OnClick", nil) + CancelPlayerBuff(this.auraID) end function BuffButtonUpdate() - --if(this.timeFontstrings == nil) then return; end - local buffIndex, untilCancelled = GetPlayerBuff(this.auraID - 1, this.filter); local timeString = "" - local timeLeft = math.floor(GetPlayerBuffTimeLeft(buffIndex)); + local timeLeft = GetPlayerBuffTimeLeft(this.auraID); + local centered = (timeLeft < 10); if (timeLeft and timeLeft > 0) then if (timeLeft > 59) then - local minutes = math.floor(timeLeft / 60) - timeString = minutes..":" - timeLeft = timeLeft - minutes * 60; - if (timeLeft < 10) then - timeString = timeString.."0" - end + timeString = math.ceil(timeLeft / 60).." m" + elseif not centered then + timeString = timeLeft.." s" + else + timeString = timeLeft end - timeString = timeString..timeLeft end - this.timeFontstrings:SetText(timeString) + if centered then + this.timeFontstrings["CENTER"]:SetText(timeString) + this.timeFontstrings["TOP"]:SetText("") + else + this.timeFontstrings["CENTER"]:SetText("") + this.timeFontstrings["TOP"]:SetText(timeString) + end end local function OnEvent() if arg1 == this:GetParent().unit then + this.updateNeeded = true + --BuffUpdate(this) + end +end + +local function OnUpdate() + if this.updateNeeded then + this.updateNeeded = nil BuffUpdate(this) end -end +end function Auras:OnEnable(frame) local isPlayer = frame.unitGroup == "player" @@ -123,22 +151,25 @@ function Auras:OnEnable(frame) if isPlayer then button:SetScript("OnClick", cancelBuff) button:RegisterForClicks("RightButtonUp") - button.cooldown = CreateFrame("Model", button:GetName().."CD", button, "CooldownFrameTemplate") + button.cooldown = CreateFrame("Model", button:GetName().."CD", button, "CooldownFrameTemplate") button.cooldown:SetPoint("TOPLEFT", button, "TOPLEFT") button.cooldown:SetHeight(36) button.cooldown:SetWidth(36) -- button.cooldown:SetReverse(true) button.cooldown:SetFrameLevel(7) button.cooldown:Hide() - button.timeFontstrings = button:CreateFontString(nil, "ARTWORK"); - button.timeFontstrings:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", 12) - button.timeFontstrings:SetShadowColor(0, 0, 0, 1.0) - button.timeFontstrings:SetShadowOffset(0.80, -0.80) - button.timeFontstrings:SetJustifyH("CENTER") - button.timeFontstrings:SetPoint("TOPLEFT", button, "BOTTOMLEFT",0,0) - button.timeFontstrings:SetPoint("TOPRIGHT", button, "BOTTOMRIGHT",0,0) + button.timeFontstrings = {} + button.timeFontstrings["TOP"] = button:CreateFontString(nil, "ARTWORK"); + button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", 12, "OUTLINE") + button.timeFontstrings["TOP"]:SetJustifyH("CENTER") + button.timeFontstrings["TOP"]:SetPoint("TOPLEFT", button, "TOPLEFT",0,0) + button.timeFontstrings["TOP"]:SetPoint("TOPRIGHT", button, "TOPRIGHT",0,0) + button.timeFontstrings["CENTER"] = button:CreateFontString(nil, "ARTWORK"); + button.timeFontstrings["CENTER"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", 30, "OUTLINE") + button.timeFontstrings["CENTER"]:SetJustifyH("CENTER") + button.timeFontstrings["CENTER"]:SetPoint("CENTER", button, "CENTER",0,0) end - + button.stack = button:CreateFontString(nil, "OVERLAY") button.stack:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", 10, "OUTLINE") button.stack:SetShadowColor(0, 0, 0, 1.0) @@ -150,12 +181,12 @@ function Auras:OnEnable(frame) button.stack:SetJustifyH("RIGHT") button.border = button:CreateTexture(nil, "OVERLAY") - button.border:SetPoint("CENTER", button) - + button.border:SetPoint("CENTER", button) + button.icon = button:CreateTexture(nil, "BACKGROUND") button.icon:SetAllPoints(button) button.icon:SetTexCoord(0.07, 0.93, 0.07, 0.93) - + frame.auras.buffbuttons[i] = button end for i=1, 16 do @@ -163,22 +194,25 @@ function Auras:OnEnable(frame) button:SetScript("OnEnter", showTooltip) button:SetScript("OnLeave", hideTooltip) if isPlayer then - button.cooldown = CreateFrame("Model", button:GetName().."CD", button, "CooldownFrameTemplate") + button.cooldown = CreateFrame("Model", button:GetName().."CD", button, "CooldownFrameTemplate") button.cooldown:SetPoint("TOPLEFT", button, "TOPLEFT") button.cooldown:SetHeight(36) button.cooldown:SetWidth(36) -- button.cooldown:SetReverse(true) button.cooldown:SetFrameLevel(7) button.cooldown:Hide() - button.timeFontstrings = button:CreateFontString(nil, "ARTWORK"); - button.timeFontstrings:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", 12) - button.timeFontstrings:SetShadowColor(0, 0, 0, 1.0) - button.timeFontstrings:SetShadowOffset(0.80, -0.80) - button.timeFontstrings:SetJustifyH("CENTER") - button.timeFontstrings:SetPoint("TOPLEFT", button, "BOTTOMLEFT",0,0) - button.timeFontstrings:SetPoint("TOPRIGHT", button, "BOTTOMRIGHT",0,0) + button.timeFontstrings = {} + button.timeFontstrings["TOP"] = button:CreateFontString(nil, "ARTWORK"); + button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", 12, "OUTLINE") + button.timeFontstrings["TOP"]:SetJustifyH("CENTER") + button.timeFontstrings["TOP"]:SetPoint("TOPLEFT", button, "TOPLEFT",0,0) + button.timeFontstrings["TOP"]:SetPoint("TOPRIGHT", button, "TOPRIGHT",0,0) + button.timeFontstrings["CENTER"] = button:CreateFontString(nil, "ARTWORK"); + button.timeFontstrings["CENTER"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", 30, "OUTLINE") + button.timeFontstrings["CENTER"]:SetJustifyH("CENTER") + button.timeFontstrings["CENTER"]:SetPoint("CENTER", button, "CENTER",0,0) end - + button.stack = button:CreateFontString(nil, "OVERLAY") button.stack:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", 10, "OUTLINE") button.stack:SetShadowColor(0, 0, 0, 1.0) @@ -190,12 +224,12 @@ function Auras:OnEnable(frame) button.stack:SetJustifyH("RIGHT") button.border = button:CreateTexture(nil, "OVERLAY") - button.border:SetPoint("CENTER", button) - + button.border:SetPoint("CENTER", button) + button.icon = button:CreateTexture(nil, "BACKGROUND") button.icon:SetAllPoints(button) button.icon:SetTexCoord(0.07, 0.93, 0.07, 0.93) - + frame.auras.debuffbuttons[i] = button end end From 41e18fe3f5a5638d82224d722aa3d766461b95b3 Mon Sep 17 00:00:00 2001 From: sipertruk Date: Sun, 15 May 2016 22:12:21 +0200 Subject: [PATCH 05/34] add timer text setting in auras --- modules/auras.lua | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/modules/auras.lua b/modules/auras.lua index 9b98e540..434910b3 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -53,11 +53,16 @@ local function BuffUpdate(frame) button.stack:SetText(stacks == 1 and "" or stacks) button.filter = "HELPFUL" if (frame:GetParent().unitGroup == "player") then - button:SetScript("OnUpdate", BuffButtonUpdate) + if (config.timertextenabled) then + button:SetScript("OnUpdate", BuffButtonUpdate) + else + button:SetScript("OnUpdate", nil) + button.timeFontstrings["CENTER"]:SetText("") + button.timeFontstrings["TOP"]:SetText("") + end button:SetScript("OnClick", BuffButtonClick) button.auraID = buffIndex else - button:SetScript("OnUpdate", nil) button:SetScript("OnClick", nil) button.auraID = i end @@ -71,8 +76,8 @@ local function BuffUpdate(frame) for i,button in ipairs(auraframe.debuffbuttons) do local buffIndex = GetPlayerBuff(i - 1, "HARMFUL"); if (frame:GetParent().unitGroup == "player") then - texture = GetPlayerBuffTexture(buffIndex); - stacks = GetPlayerBuffApplications(buffIndex); + texture = GetPlayerBuffTexture(buffIndex); + stacks = GetPlayerBuffApplications(buffIndex); else texture,stacks = UnitDebuff(unit,i) end @@ -81,11 +86,16 @@ local function BuffUpdate(frame) button.stack:SetText(stacks == 1 and "" or stacks) button.filter = "HARMFUL" if (frame:GetParent().unitGroup == "player") then - button:SetScript("OnUpdate", BuffButtonUpdate) + if (config.timertextenabled) then + button:SetScript("OnUpdate", BuffButtonUpdate) + else + button:SetScript("OnUpdate", nil) + button.timeFontstrings["CENTER"]:SetText("") + button.timeFontstrings["TOP"]:SetText("") + end button.auraID = buffIndex else button.auraID = i - button:SetScript("OnUpdate", nil) end button:Show() else @@ -110,9 +120,9 @@ function BuffButtonUpdate() if (timeLeft > 59) then timeString = math.ceil(timeLeft / 60).." m" elseif not centered then - timeString = timeLeft.." s" + timeString = math.ceil(timeLeft).." s" else - timeString = timeLeft + timeString = math.ceil(timeLeft) end end if centered then From 6ab8a39591f31fc0682cf95d9977e5c8efbebf46 Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Sun, 15 May 2016 23:23:09 +0200 Subject: [PATCH 06/34] add timer text setting in Options --- modules/Options.lua | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/modules/Options.lua b/modules/Options.lua index f86e4708..4d7653ba 100644 --- a/modules/Options.lua +++ b/modules/Options.lua @@ -654,6 +654,9 @@ function LunaUF:LoadOptions() LunaOptionsFrame.pages[i].enableauras:SetChecked(LunaUF.db.profile.units[unit].auras.enabled) SetDropDownValue(LunaOptionsFrame.pages[i].auraposition,LunaUF.db.profile.units[unit].auras.position) LunaOptionsFrame.pages[i].aurasizeslider:SetValue(17-LunaUF.db.profile.units[unit].auras.AurasPerRow) + if (unit == "player") then + LunaOptionsFrame.pages[i].enableaurastimertext:SetChecked(LunaUF.db.profile.units[unit].auras.timertextenabled) + end LunaOptionsFrame.pages[i].enabletags:SetChecked(LunaUF.db.profile.units[unit].tags.enabled) LunaOptionsFrame.pages[i].tags.load(LunaOptionsFrame.pages[i].tags,LunaUF.db.profile.units[unit].tags.bartags) LunaOptionsFrame.pages[i].barorder.load(LunaOptionsFrame.pages[i].barorder,LunaUF.db.profile.units[unit].barorder) @@ -2032,8 +2035,25 @@ function LunaUF:CreateOptionsMenu() LunaOptionsFrame.pages[i].aurasizeslider:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].auraheader, "BOTTOMLEFT", 280, -10) LunaOptionsFrame.pages[i].aurasizeslider:SetWidth(190) + if (LunaUF.unitList[i-1] == "player") then + LunaOptionsFrame.pages[i].enableaurastimertext = CreateFrame("CheckButton", "Enable"..LunaUF.unitList[i-1].."AurasTimerText", LunaOptionsFrame.pages[i], "UICheckButtonTemplate") + LunaOptionsFrame.pages[i].enableaurastimertext:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].enableauras, "BOTTOMLEFT", 0, -10) + LunaOptionsFrame.pages[i].enableaurastimertext:SetHeight(30) + LunaOptionsFrame.pages[i].enableaurastimertext:SetWidth(30) + LunaOptionsFrame.pages[i].enableaurastimertext:SetScript("OnClick", function() + local unit = this:GetParent().id + LunaUF.db.profile.units[unit].auras.timertextenabled = not LunaUF.db.profile.units[unit].auras.timertextenabled + for _,frame in pairs(LunaUF.Units.frameList) do + if frame.unitGroup == unit then + LunaUF.Units.FullUpdate(frame) + end + end + end) + getglobal("Enable"..LunaUF.unitList[i-1].."AurasTimerText".."Text"):SetText(L["Enable Timer Text"]) + end + LunaOptionsFrame.pages[i].tagheader = LunaOptionsFrame.pages[i]:CreateFontString(nil, "OVERLAY", "GameFontHighlight") - LunaOptionsFrame.pages[i].tagheader:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].auraheader, "BOTTOMLEFT", 0, -60) + LunaOptionsFrame.pages[i].tagheader:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].enableaurastimertext and LunaOptionsFrame.pages[i].enableauras or LunaOptionsFrame.pages[i].auraheader, "BOTTOMLEFT", 0, -60) LunaOptionsFrame.pages[i].tagheader:SetHeight(24) LunaOptionsFrame.pages[i].tagheader:SetJustifyH("LEFT") LunaOptionsFrame.pages[i].tagheader:SetTextColor(1,1,0) From 8859a72633057cf9bcba14fd61e19c5ffd61184b Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Sun, 15 May 2016 23:33:09 +0200 Subject: [PATCH 07/34] add timer text setting in locale --- locales/enUS.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/locales/enUS.lua b/locales/enUS.lua index ef1cd2a2..ac17a1b2 100644 --- a/locales/enUS.lua +++ b/locales/enUS.lua @@ -257,6 +257,7 @@ local function enUS() return { ["XP Bar"] = "XP Bar", ["Frame background"] = "Frame background", ["Color"] = "Color", +["Enable Timer Text"] = "Enable Timer Text", ["Returns plain name of the unit"] = "Returns plain name of the unit", ["Returns shortened names (Marshall Williams = M. Williams)"] = "Returns shortened names (Marshall Williams = M. Williams)", From 4e1d089d76fe1c5d56466d879b98aa151981c88e Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Sun, 15 May 2016 23:37:56 +0200 Subject: [PATCH 08/34] add timer text setting in default --- LunaUnitFrames.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LunaUnitFrames.lua b/LunaUnitFrames.lua index 35691140..25170676 100644 --- a/LunaUnitFrames.lua +++ b/LunaUnitFrames.lua @@ -222,7 +222,7 @@ LunaUF.defaults = { totemBar = { enabled = true, size = 2, hide=true }, druidBar = { enabled = true, size = 2 }, portrait = { enabled = true, type = "3D", side = "left", size = 6 }, - auras = { enabled = false, AurasPerRow = 12, position = "BOTTOM", weaponbuffs = true }, + auras = { enabled = false, AurasPerRow = 12, position = "BOTTOM", weaponbuffs = true, timertextenabled = true }, highlight = { enabled = true, ontarget = false, ondebuff = true, onmouse = false }, fader = { enabled = false, inactiveAlpha = 0.2, combatAlpha = 1 }, tags = { From ef17f65bbf48546888bc7df2ac4f8a0646eb398a Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Mon, 16 May 2016 03:02:42 +0200 Subject: [PATCH 09/34] fix init failing --- modules/auras.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/auras.lua b/modules/auras.lua index 434910b3..157ad15d 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -358,5 +358,6 @@ function Auras:FullUpdate(frame) button:SetPoint("TOPLEFT", frame.auras, "BOTTOMLEFT", (i-1)*(buttonsize+1)-((math.ceil(i/config.AurasPerRow)-1)*(config.AurasPerRow)*(buttonsize+1)), -(math.ceil(i/config.AurasPerRow)-1)*(buttonsize+1)) end end - BuffUpdate(frame.auras) + frame.auras.updateNeeded = true + --BuffUpdate(frame.auras) end From c6fbd9eebd86bc86ad60bb316c91aec06dfa0b1c Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Mon, 16 May 2016 16:40:01 +0200 Subject: [PATCH 10/34] fix centered at 10s instead of 9 --- modules/auras.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/auras.lua b/modules/auras.lua index 157ad15d..7ec39318 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -114,15 +114,15 @@ end function BuffButtonUpdate() local timeString = "" - local timeLeft = GetPlayerBuffTimeLeft(this.auraID); + local timeLeft = math.ceil(GetPlayerBuffTimeLeft(this.auraID)); local centered = (timeLeft < 10); if (timeLeft and timeLeft > 0) then if (timeLeft > 59) then timeString = math.ceil(timeLeft / 60).." m" elseif not centered then - timeString = math.ceil(timeLeft).." s" + timeString = timeLeft.." s" else - timeString = math.ceil(timeLeft) + timeString = timeLeft end end if centered then From 38fae5f2eaaedf95750c77906e087034d4ff8c2f Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Mon, 16 May 2016 20:29:21 +0200 Subject: [PATCH 11/34] better string layout, handle buff>1hour --- modules/auras.lua | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/modules/auras.lua b/modules/auras.lua index 7ec39318..f7ed5395 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -114,10 +114,15 @@ end function BuffButtonUpdate() local timeString = "" - local timeLeft = math.ceil(GetPlayerBuffTimeLeft(this.auraID)); - local centered = (timeLeft < 10); + local timeLeft = GetPlayerBuffTimeLeft(this.auraID); + local centered + if (timeLeft and timeLeft > 0) then - if (timeLeft > 59) then + timeLeft = math.ceil(timeLeft); + centered = (timeLeft < 10) + if (timeLeft > 3599) then + timeString = math.ceil(timeLeft / 3600).." h" + elseif (timeLeft > 59) then timeString = math.ceil(timeLeft / 60).." m" elseif not centered then timeString = timeLeft.." s" @@ -169,12 +174,11 @@ function Auras:OnEnable(frame) button.cooldown:SetFrameLevel(7) button.cooldown:Hide() button.timeFontstrings = {} - button.timeFontstrings["TOP"] = button:CreateFontString(nil, "ARTWORK"); + button.timeFontstrings["TOP"] = button:CreateFontString(nil, "OVERLAY"); button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", 12, "OUTLINE") button.timeFontstrings["TOP"]:SetJustifyH("CENTER") - button.timeFontstrings["TOP"]:SetPoint("TOPLEFT", button, "TOPLEFT",0,0) - button.timeFontstrings["TOP"]:SetPoint("TOPRIGHT", button, "TOPRIGHT",0,0) - button.timeFontstrings["CENTER"] = button:CreateFontString(nil, "ARTWORK"); + button.timeFontstrings["TOP"]:SetPoint("TOP", button, "TOP",0,0) + button.timeFontstrings["CENTER"] = button:CreateFontString(nil, "OVERLAY"); button.timeFontstrings["CENTER"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", 30, "OUTLINE") button.timeFontstrings["CENTER"]:SetJustifyH("CENTER") button.timeFontstrings["CENTER"]:SetPoint("CENTER", button, "CENTER",0,0) @@ -212,12 +216,11 @@ function Auras:OnEnable(frame) button.cooldown:SetFrameLevel(7) button.cooldown:Hide() button.timeFontstrings = {} - button.timeFontstrings["TOP"] = button:CreateFontString(nil, "ARTWORK"); + button.timeFontstrings["TOP"] = button:CreateFontString(nil, "OVERLAY"); button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", 12, "OUTLINE") button.timeFontstrings["TOP"]:SetJustifyH("CENTER") - button.timeFontstrings["TOP"]:SetPoint("TOPLEFT", button, "TOPLEFT",0,0) - button.timeFontstrings["TOP"]:SetPoint("TOPRIGHT", button, "TOPRIGHT",0,0) - button.timeFontstrings["CENTER"] = button:CreateFontString(nil, "ARTWORK"); + button.timeFontstrings["TOP"]:SetPoint("TOP", button, "TOP",0,0) + button.timeFontstrings["CENTER"] = button:CreateFontString(nil, "OVERLAY"); button.timeFontstrings["CENTER"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", 30, "OUTLINE") button.timeFontstrings["CENTER"]:SetJustifyH("CENTER") button.timeFontstrings["CENTER"]:SetPoint("CENTER", button, "CENTER",0,0) From efc2358821634fd45f9f1b9a49e5388dc1c7b10f Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Sat, 21 May 2016 17:56:13 +0200 Subject: [PATCH 12/34] Cooldown spin first shot --- LunaUnitFrames.lua | 2 +- locales/enUS.lua | 1 + modules/Options.lua | 18 +++++++++- modules/auras.lua | 82 +++++++++++++++++++++++++++++++++++++++------ 4 files changed, 91 insertions(+), 12 deletions(-) diff --git a/LunaUnitFrames.lua b/LunaUnitFrames.lua index 25170676..5f0e9f5a 100644 --- a/LunaUnitFrames.lua +++ b/LunaUnitFrames.lua @@ -222,7 +222,7 @@ LunaUF.defaults = { totemBar = { enabled = true, size = 2, hide=true }, druidBar = { enabled = true, size = 2 }, portrait = { enabled = true, type = "3D", side = "left", size = 6 }, - auras = { enabled = false, AurasPerRow = 12, position = "BOTTOM", weaponbuffs = true, timertextenabled = true }, + auras = { enabled = false, AurasPerRow = 12, position = "BOTTOM", weaponbuffs = true, timertextenabled = true, timerspinenabled = true }, highlight = { enabled = true, ontarget = false, ondebuff = true, onmouse = false }, fader = { enabled = false, inactiveAlpha = 0.2, combatAlpha = 1 }, tags = { diff --git a/locales/enUS.lua b/locales/enUS.lua index ac17a1b2..d18c6600 100644 --- a/locales/enUS.lua +++ b/locales/enUS.lua @@ -258,6 +258,7 @@ local function enUS() return { ["Frame background"] = "Frame background", ["Color"] = "Color", ["Enable Timer Text"] = "Enable Timer Text", +["Enable Timer Spin"] = "Enable Timer Spin", ["Returns plain name of the unit"] = "Returns plain name of the unit", ["Returns shortened names (Marshall Williams = M. Williams)"] = "Returns shortened names (Marshall Williams = M. Williams)", diff --git a/modules/Options.lua b/modules/Options.lua index 4d7653ba..9e1e2455 100644 --- a/modules/Options.lua +++ b/modules/Options.lua @@ -656,6 +656,7 @@ function LunaUF:LoadOptions() LunaOptionsFrame.pages[i].aurasizeslider:SetValue(17-LunaUF.db.profile.units[unit].auras.AurasPerRow) if (unit == "player") then LunaOptionsFrame.pages[i].enableaurastimertext:SetChecked(LunaUF.db.profile.units[unit].auras.timertextenabled) + LunaOptionsFrame.pages[i].enableaurastimerspin:SetChecked(LunaUF.db.profile.units[unit].auras.timerspinenabled) end LunaOptionsFrame.pages[i].enabletags:SetChecked(LunaUF.db.profile.units[unit].tags.enabled) LunaOptionsFrame.pages[i].tags.load(LunaOptionsFrame.pages[i].tags,LunaUF.db.profile.units[unit].tags.bartags) @@ -2035,7 +2036,7 @@ function LunaUF:CreateOptionsMenu() LunaOptionsFrame.pages[i].aurasizeslider:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].auraheader, "BOTTOMLEFT", 280, -10) LunaOptionsFrame.pages[i].aurasizeslider:SetWidth(190) - if (LunaUF.unitList[i-1] == "player") then + if (LunaUF.unitList[i-1] == "player") then LunaOptionsFrame.pages[i].enableaurastimertext = CreateFrame("CheckButton", "Enable"..LunaUF.unitList[i-1].."AurasTimerText", LunaOptionsFrame.pages[i], "UICheckButtonTemplate") LunaOptionsFrame.pages[i].enableaurastimertext:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].enableauras, "BOTTOMLEFT", 0, -10) LunaOptionsFrame.pages[i].enableaurastimertext:SetHeight(30) @@ -2050,6 +2051,21 @@ function LunaUF:CreateOptionsMenu() end end) getglobal("Enable"..LunaUF.unitList[i-1].."AurasTimerText".."Text"):SetText(L["Enable Timer Text"]) + + LunaOptionsFrame.pages[i].enableaurastimerspin = CreateFrame("CheckButton", "Enable"..LunaUF.unitList[i-1].."AurasTimerSpin", LunaOptionsFrame.pages[i], "UICheckButtonTemplate") + LunaOptionsFrame.pages[i].enableaurastimerspin:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].enableauras, "BOTTOMLEFT", 150, -10) + LunaOptionsFrame.pages[i].enableaurastimerspin:SetHeight(30) + LunaOptionsFrame.pages[i].enableaurastimerspin:SetWidth(30) + LunaOptionsFrame.pages[i].enableaurastimerspin:SetScript("OnClick", function() + local unit = this:GetParent().id + LunaUF.db.profile.units[unit].auras.timerspinenabled = not LunaUF.db.profile.units[unit].auras.timerspinenabled + for _,frame in pairs(LunaUF.Units.frameList) do + if frame.unitGroup == unit then + LunaUF.Units.FullUpdate(frame) + end + end + end) + getglobal("Enable"..LunaUF.unitList[i-1].."AurasTimerSpin".."Text"):SetText(L["Enable Timer Spin"]) end LunaOptionsFrame.pages[i].tagheader = LunaOptionsFrame.pages[i]:CreateFontString(nil, "OVERLAY", "GameFontHighlight") diff --git a/modules/auras.lua b/modules/auras.lua index f7ed5395..41e834cb 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -19,7 +19,7 @@ local function showTooltip() GameTooltip:SetPlayerBuff(this.auraID); elseif this.filter == "HELPFUL" then GameTooltip:SetUnitBuff(this:GetParent():GetParent().unit, this.auraID) - else + elseif this.filter == "HARMFULL" then GameTooltip:SetUnitDebuff(this:GetParent():GetParent().unit, this.auraID) end end @@ -60,6 +60,18 @@ local function BuffUpdate(frame) button.timeFontstrings["CENTER"]:SetText("") button.timeFontstrings["TOP"]:SetText("") end + if (config.timerspinenabled) then + if(texture ~= button.cooldown.texture) then + button.cooldown.stopped = 1 + button.cooldown.texture = texture + end + CooldownFrame_SetTimer(button.cooldown, GetTime(), GetPlayerBuffTimeLeft(buffIndex), button.cooldown.stopped) + button.cooldown.stopped = 0; + button.cooldown:Show(); + else + button.cooldown.stopped = 1 + button.cooldown:Hide(); + end button:SetScript("OnClick", BuffButtonClick) button.auraID = buffIndex else @@ -68,8 +80,12 @@ local function BuffUpdate(frame) end button:Show() else - button:SetScript("OnUpdate", nil) - button:SetScript("OnClick", nil) + if (frame:GetParent().unitGroup == "player") then + button:SetScript("OnUpdate", nil) + button:SetScript("OnClick", nil) + button.cooldown.stopped = 1; + button.cooldown:Hide(); + end button:Hide() end end @@ -93,13 +109,29 @@ local function BuffUpdate(frame) button.timeFontstrings["CENTER"]:SetText("") button.timeFontstrings["TOP"]:SetText("") end + if (config.timerspinenabled) then + if(texture ~= button.cooldown.texture) then + button.cooldown.stopped = 1 + button.cooldown.texture = texture + end + CooldownFrame_SetTimer(button.cooldown, GetTime(), GetPlayerBuffTimeLeft(buffIndex), button.cooldown.stopped) + button.cooldown.stopped = 0; + button.cooldown:Show(); + else + button.cooldown.stopped = 1 + button.cooldown:Hide(); + end button.auraID = buffIndex else button.auraID = i end button:Show() else - button:SetScript("OnUpdate", nil) + if (frame:GetParent().unitGroup == "player") then + button:SetScript("OnUpdate", nil) + button.cooldown.stopped = 1; + button.cooldown:Hide(); + end button:Hide() end end @@ -167,11 +199,11 @@ function Auras:OnEnable(frame) button:SetScript("OnClick", cancelBuff) button:RegisterForClicks("RightButtonUp") button.cooldown = CreateFrame("Model", button:GetName().."CD", button, "CooldownFrameTemplate") - button.cooldown:SetPoint("TOPLEFT", button, "TOPLEFT") - button.cooldown:SetHeight(36) - button.cooldown:SetWidth(36) + --button.cooldown:SetHeight(36) + --button.cooldown:SetWidth(36) -- button.cooldown:SetReverse(true) button.cooldown:SetFrameLevel(7) + button.cooldown.stopped = 1; button.cooldown:Hide() button.timeFontstrings = {} button.timeFontstrings["TOP"] = button:CreateFontString(nil, "OVERLAY"); @@ -209,11 +241,11 @@ function Auras:OnEnable(frame) button:SetScript("OnLeave", hideTooltip) if isPlayer then button.cooldown = CreateFrame("Model", button:GetName().."CD", button, "CooldownFrameTemplate") - button.cooldown:SetPoint("TOPLEFT", button, "TOPLEFT") - button.cooldown:SetHeight(36) - button.cooldown:SetWidth(36) + --button.cooldown:SetHeight(36) + --button.cooldown:SetWidth(36) -- button.cooldown:SetReverse(true) button.cooldown:SetFrameLevel(7) + button.cooldown.stopped = 1; button.cooldown:Hide() button.timeFontstrings = {} button.timeFontstrings["TOP"] = button:CreateFontString(nil, "OVERLAY"); @@ -306,6 +338,11 @@ function Auras:FullUpdate(frame) button.border:SetWidth(buttonsize+1) button.stack:SetText(i) button:SetPoint("BOTTOMLEFT", frame.auras, "BOTTOMLEFT", (i-1)*(buttonsize+1)-((math.ceil(i/config.AurasPerRow)-1)*(config.AurasPerRow)*(buttonsize+1)), (math.ceil(i/config.AurasPerRow)-1)*(buttonsize+1)) + if button.cooldown then + button.cooldown:SetModelScale(buttonsize/48) + button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT") + button.cooldown:SetPoint("BOTTOMRIGHT", button.border, "BOTTOMRIGHT",1,0) + end end for i,button in ipairs(frame.auras.debuffbuttons) do button:ClearAllPoints() @@ -315,6 +352,11 @@ function Auras:FullUpdate(frame) button.border:SetWidth(buttonsize+1) button.stack:SetText(i) button:SetPoint("BOTTOMLEFT", frame.auras, "TOPLEFT", (i-1)*(buttonsize+1)-((math.ceil(i/config.AurasPerRow)-1)*(config.AurasPerRow)*(buttonsize+1)), (math.ceil(i/config.AurasPerRow)-1)*(buttonsize+1)) + if button.cooldown then + button.cooldown:SetModelScale(buttonsize/48) + button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT") + button.cooldown:SetPoint("BOTTOMRIGHT", button.border, "BOTTOMRIGHT",1,0) + end end elseif config.position == "LEFT" then frame.auras:SetPoint("TOPRIGHT", frame, "TOPLEFT", -3, 0) @@ -326,6 +368,11 @@ function Auras:FullUpdate(frame) button.border:SetWidth(buttonsize+1) button.stack:SetText(i) button:SetPoint("TOPRIGHT", frame.auras, "TOPRIGHT", -((i-1)*(buttonsize+1)-((math.ceil(i/config.AurasPerRow)-1)*(config.AurasPerRow)*(buttonsize+1))), -(math.ceil(i/config.AurasPerRow)-1)*(buttonsize+1)) + if button.cooldown then + button.cooldown:SetModelScale(buttonsize/48) + button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT") + button.cooldown:SetPoint("BOTTOMRIGHT", button.border, "BOTTOMRIGHT",1,0) + end end for i,button in ipairs(frame.auras.debuffbuttons) do button:ClearAllPoints() @@ -335,6 +382,11 @@ function Auras:FullUpdate(frame) button.border:SetWidth(buttonsize+1) button.stack:SetText(i) button:SetPoint("TOPRIGHT", frame.auras, "BOTTOMRIGHT", -((i-1)*(buttonsize+1)-((math.ceil(i/config.AurasPerRow)-1)*(config.AurasPerRow)*(buttonsize+1))), -(math.ceil(i/config.AurasPerRow)-1)*(buttonsize+1)) + if button.cooldown then + button.cooldown:SetModelScale(buttonsize/48) + button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT") + button.cooldown:SetPoint("BOTTOMRIGHT", button.border, "BOTTOMRIGHT",1,0) + end end else if config.position == "BOTTOM" then @@ -350,6 +402,11 @@ function Auras:FullUpdate(frame) button.border:SetWidth(buttonsize+1) button.stack:SetText(i) button:SetPoint("TOPLEFT", frame.auras, "TOPLEFT", (i-1)*(buttonsize+1)-((math.ceil(i/config.AurasPerRow)-1)*(config.AurasPerRow)*(buttonsize+1)), -(math.ceil(i/config.AurasPerRow)-1)*(buttonsize+1)) + if button.cooldown then + button.cooldown:SetModelScale(buttonsize/48) + button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT") + button.cooldown:SetPoint("BOTTOMRIGHT", button.border, "BOTTOMRIGHT",1,0) + end end for i,button in ipairs(frame.auras.debuffbuttons) do button:ClearAllPoints() @@ -359,6 +416,11 @@ function Auras:FullUpdate(frame) button.border:SetWidth(buttonsize+1) button.stack:SetText(i) button:SetPoint("TOPLEFT", frame.auras, "BOTTOMLEFT", (i-1)*(buttonsize+1)-((math.ceil(i/config.AurasPerRow)-1)*(config.AurasPerRow)*(buttonsize+1)), -(math.ceil(i/config.AurasPerRow)-1)*(buttonsize+1)) + if button.cooldown then + button.cooldown:SetModelScale(buttonsize/48) + button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT") + button.cooldown:SetPoint("BOTTOMRIGHT", button.border, "BOTTOMRIGHT",1,0) + end end end frame.auras.updateNeeded = true From 629883aacc2519bffa71b07dab3769003c3ec363 Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Sat, 21 May 2016 18:35:35 +0200 Subject: [PATCH 13/34] Reverse spin --- modules/auras.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/auras.lua b/modules/auras.lua index 41e834cb..7253c91b 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -201,8 +201,8 @@ function Auras:OnEnable(frame) button.cooldown = CreateFrame("Model", button:GetName().."CD", button, "CooldownFrameTemplate") --button.cooldown:SetHeight(36) --button.cooldown:SetWidth(36) - -- button.cooldown:SetReverse(true) button.cooldown:SetFrameLevel(7) + button.cooldown.reverse = true button.cooldown.stopped = 1; button.cooldown:Hide() button.timeFontstrings = {} @@ -243,8 +243,8 @@ function Auras:OnEnable(frame) button.cooldown = CreateFrame("Model", button:GetName().."CD", button, "CooldownFrameTemplate") --button.cooldown:SetHeight(36) --button.cooldown:SetWidth(36) - -- button.cooldown:SetReverse(true) button.cooldown:SetFrameLevel(7) + button.cooldown.reverse = true button.cooldown.stopped = 1; button.cooldown:Hide() button.timeFontstrings = {} From 35d38b888c5b425e5c6a2c29c97924e4796ac287 Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Sun, 22 May 2016 02:57:59 +0200 Subject: [PATCH 14/34] text over cooldown --- modules/auras.lua | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/modules/auras.lua b/modules/auras.lua index 7253c91b..b867d5d9 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -205,15 +205,18 @@ function Auras:OnEnable(frame) button.cooldown.reverse = true button.cooldown.stopped = 1; button.cooldown:Hide() + button.textFrame = CreateFrame("Frame", nil, button) + button.textFrame:SetAllPoints(button) + button.textFrame:SetFrameLevel(button.cooldown:GetFrameLevel() + 1); button.timeFontstrings = {} - button.timeFontstrings["TOP"] = button:CreateFontString(nil, "OVERLAY"); + button.timeFontstrings["TOP"] = button.textFrame:CreateFontString(nil, "OVERLAY"); button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", 12, "OUTLINE") button.timeFontstrings["TOP"]:SetJustifyH("CENTER") - button.timeFontstrings["TOP"]:SetPoint("TOP", button, "TOP",0,0) - button.timeFontstrings["CENTER"] = button:CreateFontString(nil, "OVERLAY"); + button.timeFontstrings["TOP"]:SetPoint("TOP", button.textFrame, "TOP",0,0) + button.timeFontstrings["CENTER"] = button.textFrame:CreateFontString(nil, "OVERLAY"); button.timeFontstrings["CENTER"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", 30, "OUTLINE") button.timeFontstrings["CENTER"]:SetJustifyH("CENTER") - button.timeFontstrings["CENTER"]:SetPoint("CENTER", button, "CENTER",0,0) + button.timeFontstrings["CENTER"]:SetPoint("CENTER", button.textFrame, "CENTER",0,0) end button.stack = button:CreateFontString(nil, "OVERLAY") @@ -247,15 +250,18 @@ function Auras:OnEnable(frame) button.cooldown.reverse = true button.cooldown.stopped = 1; button.cooldown:Hide() + button.textFrame = CreateFrame("Frame", nil, button) + button.textFrame:SetAllPoints(button) + button.textFrame:SetFrameLevel(button.cooldown:GetFrameLevel() + 1); button.timeFontstrings = {} - button.timeFontstrings["TOP"] = button:CreateFontString(nil, "OVERLAY"); + button.timeFontstrings["TOP"] = button.textFrame:CreateFontString(nil, "OVERLAY"); button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", 12, "OUTLINE") button.timeFontstrings["TOP"]:SetJustifyH("CENTER") - button.timeFontstrings["TOP"]:SetPoint("TOP", button, "TOP",0,0) - button.timeFontstrings["CENTER"] = button:CreateFontString(nil, "OVERLAY"); + button.timeFontstrings["TOP"]:SetPoint("TOP", button.textFrame, "TOP",0,0) + button.timeFontstrings["CENTER"] = button.textFrame:CreateFontString(nil, "OVERLAY"); button.timeFontstrings["CENTER"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", 30, "OUTLINE") button.timeFontstrings["CENTER"]:SetJustifyH("CENTER") - button.timeFontstrings["CENTER"]:SetPoint("CENTER", button, "CENTER",0,0) + button.timeFontstrings["CENTER"]:SetPoint("CENTER", button.textFrame, "CENTER",0,0) end button.stack = button:CreateFontString(nil, "OVERLAY") From 20ac08d696b32cbfeb10b31601cf8719f0ca2117 Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Sun, 22 May 2016 23:23:15 +0200 Subject: [PATCH 15/34] timer font size options sliders --- LunaUnitFrames.lua | 2 +- locales/enUS.lua | 2 ++ modules/Options.lua | 38 ++++++++++++++++++++++++++++++++++++-- modules/auras.lua | 30 ++++++++++++++++++++++++++---- 4 files changed, 65 insertions(+), 7 deletions(-) diff --git a/LunaUnitFrames.lua b/LunaUnitFrames.lua index 5f0e9f5a..7b283e88 100644 --- a/LunaUnitFrames.lua +++ b/LunaUnitFrames.lua @@ -222,7 +222,7 @@ LunaUF.defaults = { totemBar = { enabled = true, size = 2, hide=true }, druidBar = { enabled = true, size = 2 }, portrait = { enabled = true, type = "3D", side = "left", size = 6 }, - auras = { enabled = false, AurasPerRow = 12, position = "BOTTOM", weaponbuffs = true, timertextenabled = true, timerspinenabled = true }, + auras = { enabled = false, AurasPerRow = 12, position = "BOTTOM", weaponbuffs = true, timertextenabled = true, timertextbigsize = 23,timertextsmallsize = 12, timerspinenabled = true }, highlight = { enabled = true, ontarget = false, ondebuff = true, onmouse = false }, fader = { enabled = false, inactiveAlpha = 0.2, combatAlpha = 1 }, tags = { diff --git a/locales/enUS.lua b/locales/enUS.lua index d18c6600..e388ddbd 100644 --- a/locales/enUS.lua +++ b/locales/enUS.lua @@ -258,6 +258,8 @@ local function enUS() return { ["Frame background"] = "Frame background", ["Color"] = "Color", ["Enable Timer Text"] = "Enable Timer Text", +["Small font size"] = "Small font size", +["Big font size"] = "Big font size", ["Enable Timer Spin"] = "Enable Timer Spin", ["Returns plain name of the unit"] = "Returns plain name of the unit", diff --git a/modules/Options.lua b/modules/Options.lua index 9e1e2455..80b2bc75 100644 --- a/modules/Options.lua +++ b/modules/Options.lua @@ -656,6 +656,8 @@ function LunaUF:LoadOptions() LunaOptionsFrame.pages[i].aurasizeslider:SetValue(17-LunaUF.db.profile.units[unit].auras.AurasPerRow) if (unit == "player") then LunaOptionsFrame.pages[i].enableaurastimertext:SetChecked(LunaUF.db.profile.units[unit].auras.timertextenabled) + LunaOptionsFrame.pages[i].auratimertextbigfontsizeslider:SetValue(LunaUF.db.profile.units[unit].auras.timertextbigsize) + LunaOptionsFrame.pages[i].auratimertextsmallfontsizeslider:SetValue(LunaUF.db.profile.units[unit].auras.timertextsmallsize) LunaOptionsFrame.pages[i].enableaurastimerspin:SetChecked(LunaUF.db.profile.units[unit].auras.timerspinenabled) end LunaOptionsFrame.pages[i].enabletags:SetChecked(LunaUF.db.profile.units[unit].tags.enabled) @@ -2052,8 +2054,40 @@ function LunaUF:CreateOptionsMenu() end) getglobal("Enable"..LunaUF.unitList[i-1].."AurasTimerText".."Text"):SetText(L["Enable Timer Text"]) + LunaOptionsFrame.pages[i].auratimertextbigfontsizeslider = CreateFrame("Slider", "AuraTimerBigFontSlider"..LunaUF.unitList[i-1], LunaOptionsFrame.pages[i], "OptionsSliderTemplate") + LunaOptionsFrame.pages[i].auratimertextbigfontsizeslider:SetMinMaxValues(1,23) + LunaOptionsFrame.pages[i].auratimertextbigfontsizeslider:SetValueStep(1) + LunaOptionsFrame.pages[i].auratimertextbigfontsizeslider:SetScript("OnValueChanged", function() + local unit = this:GetParent().id + LunaUF.db.profile.units[unit].auras.timertextbigsize = this:GetValue() + getglobal("AuraTimerBigFontSlider"..unit.."Text"):SetText(L["Big font size"]..": "..LunaUF.db.profile.units[unit].auras.timertextbigsize) + for _,frame in pairs(LunaUF.Units.frameList) do + if frame.unitGroup == unit then + LunaUF.Units.FullUpdate(frame) + end + end + end) + LunaOptionsFrame.pages[i].auratimertextbigfontsizeslider:SetPoint("LEFT", LunaOptionsFrame.pages[i].enableaurastimertext, "RIGHT", 120, 0) + LunaOptionsFrame.pages[i].auratimertextbigfontsizeslider:SetWidth(150) + + LunaOptionsFrame.pages[i].auratimertextsmallfontsizeslider = CreateFrame("Slider", "AuraTimerSmallFontSlider"..LunaUF.unitList[i-1], LunaOptionsFrame.pages[i], "OptionsSliderTemplate") + LunaOptionsFrame.pages[i].auratimertextsmallfontsizeslider:SetMinMaxValues(1,23) + LunaOptionsFrame.pages[i].auratimertextsmallfontsizeslider:SetValueStep(1) + LunaOptionsFrame.pages[i].auratimertextsmallfontsizeslider:SetScript("OnValueChanged", function() + local unit = this:GetParent().id + LunaUF.db.profile.units[unit].auras.timertextsmallsize = this:GetValue() + getglobal("AuraTimerSmallFontSlider"..unit.."Text"):SetText(L["Small font size"]..": "..LunaUF.db.profile.units[unit].auras.timertextsmallsize) + for _,frame in pairs(LunaUF.Units.frameList) do + if frame.unitGroup == unit then + LunaUF.Units.FullUpdate(frame) + end + end + end) + LunaOptionsFrame.pages[i].auratimertextsmallfontsizeslider:SetPoint("LEFT", LunaOptionsFrame.pages[i].enableaurastimertext, "RIGHT", 290, 0) + LunaOptionsFrame.pages[i].auratimertextsmallfontsizeslider:SetWidth(150) + LunaOptionsFrame.pages[i].enableaurastimerspin = CreateFrame("CheckButton", "Enable"..LunaUF.unitList[i-1].."AurasTimerSpin", LunaOptionsFrame.pages[i], "UICheckButtonTemplate") - LunaOptionsFrame.pages[i].enableaurastimerspin:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].enableauras, "BOTTOMLEFT", 150, -10) + LunaOptionsFrame.pages[i].enableaurastimerspin:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].enableaurastimertext, "BOTTOMLEFT", 0, -10) LunaOptionsFrame.pages[i].enableaurastimerspin:SetHeight(30) LunaOptionsFrame.pages[i].enableaurastimerspin:SetWidth(30) LunaOptionsFrame.pages[i].enableaurastimerspin:SetScript("OnClick", function() @@ -2069,7 +2103,7 @@ function LunaUF:CreateOptionsMenu() end LunaOptionsFrame.pages[i].tagheader = LunaOptionsFrame.pages[i]:CreateFontString(nil, "OVERLAY", "GameFontHighlight") - LunaOptionsFrame.pages[i].tagheader:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].enableaurastimertext and LunaOptionsFrame.pages[i].enableauras or LunaOptionsFrame.pages[i].auraheader, "BOTTOMLEFT", 0, -60) + LunaOptionsFrame.pages[i].tagheader:SetPoint("TOPLEFT", LunaOptionsFrame.pages[i].enableaurastimertext or LunaOptionsFrame.pages[i].auraheader, "BOTTOMLEFT", 0, -60) LunaOptionsFrame.pages[i].tagheader:SetHeight(24) LunaOptionsFrame.pages[i].tagheader:SetJustifyH("LEFT") LunaOptionsFrame.pages[i].tagheader:SetTextColor(1,1,0) diff --git a/modules/auras.lua b/modules/auras.lua index b867d5d9..90dce856 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -210,11 +210,11 @@ function Auras:OnEnable(frame) button.textFrame:SetFrameLevel(button.cooldown:GetFrameLevel() + 1); button.timeFontstrings = {} button.timeFontstrings["TOP"] = button.textFrame:CreateFontString(nil, "OVERLAY"); - button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", 12, "OUTLINE") + button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") button.timeFontstrings["TOP"]:SetJustifyH("CENTER") button.timeFontstrings["TOP"]:SetPoint("TOP", button.textFrame, "TOP",0,0) button.timeFontstrings["CENTER"] = button.textFrame:CreateFontString(nil, "OVERLAY"); - button.timeFontstrings["CENTER"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", 30, "OUTLINE") + button.timeFontstrings["CENTER"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextbigsize, "OUTLINE") button.timeFontstrings["CENTER"]:SetJustifyH("CENTER") button.timeFontstrings["CENTER"]:SetPoint("CENTER", button.textFrame, "CENTER",0,0) end @@ -255,11 +255,9 @@ function Auras:OnEnable(frame) button.textFrame:SetFrameLevel(button.cooldown:GetFrameLevel() + 1); button.timeFontstrings = {} button.timeFontstrings["TOP"] = button.textFrame:CreateFontString(nil, "OVERLAY"); - button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", 12, "OUTLINE") button.timeFontstrings["TOP"]:SetJustifyH("CENTER") button.timeFontstrings["TOP"]:SetPoint("TOP", button.textFrame, "TOP",0,0) button.timeFontstrings["CENTER"] = button.textFrame:CreateFontString(nil, "OVERLAY"); - button.timeFontstrings["CENTER"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", 30, "OUTLINE") button.timeFontstrings["CENTER"]:SetJustifyH("CENTER") button.timeFontstrings["CENTER"]:SetPoint("CENTER", button.textFrame, "CENTER",0,0) end @@ -349,6 +347,10 @@ function Auras:FullUpdate(frame) button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT") button.cooldown:SetPoint("BOTTOMRIGHT", button.border, "BOTTOMRIGHT",1,0) end + if button.timeFontstrings then + button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") + button.timeFontstrings["CENTER"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextbigsize, "OUTLINE") + end end for i,button in ipairs(frame.auras.debuffbuttons) do button:ClearAllPoints() @@ -363,6 +365,10 @@ function Auras:FullUpdate(frame) button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT") button.cooldown:SetPoint("BOTTOMRIGHT", button.border, "BOTTOMRIGHT",1,0) end + if button.timeFontstrings then + button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") + button.timeFontstrings["CENTER"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextbigsize, "OUTLINE") + end end elseif config.position == "LEFT" then frame.auras:SetPoint("TOPRIGHT", frame, "TOPLEFT", -3, 0) @@ -379,6 +385,10 @@ function Auras:FullUpdate(frame) button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT") button.cooldown:SetPoint("BOTTOMRIGHT", button.border, "BOTTOMRIGHT",1,0) end + if button.timeFontstrings then + button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") + button.timeFontstrings["CENTER"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextbigsize, "OUTLINE") + end end for i,button in ipairs(frame.auras.debuffbuttons) do button:ClearAllPoints() @@ -393,6 +403,10 @@ function Auras:FullUpdate(frame) button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT") button.cooldown:SetPoint("BOTTOMRIGHT", button.border, "BOTTOMRIGHT",1,0) end + if button.timeFontstrings then + button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") + button.timeFontstrings["CENTER"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextbigsize, "OUTLINE") + end end else if config.position == "BOTTOM" then @@ -413,6 +427,10 @@ function Auras:FullUpdate(frame) button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT") button.cooldown:SetPoint("BOTTOMRIGHT", button.border, "BOTTOMRIGHT",1,0) end + if button.timeFontstrings then + button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") + button.timeFontstrings["CENTER"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextbigsize, "OUTLINE") + end end for i,button in ipairs(frame.auras.debuffbuttons) do button:ClearAllPoints() @@ -427,6 +445,10 @@ function Auras:FullUpdate(frame) button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT") button.cooldown:SetPoint("BOTTOMRIGHT", button.border, "BOTTOMRIGHT",1,0) end + if button.timeFontstrings then + button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") + button.timeFontstrings["CENTER"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextbigsize, "OUTLINE") + end end end frame.auras.updateNeeded = true From ab9def9a34e9bb5e7eb41002cca44041fea78d69 Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Tue, 24 May 2016 02:50:30 +0200 Subject: [PATCH 16/34] Better BuffUpdate --- modules/auras.lua | 44 ++++++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/modules/auras.lua b/modules/auras.lua index 90dce856..b9f1d4b4 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -31,6 +31,7 @@ end local function BuffUpdate(frame) local auraframe = frame or this local unit = auraframe:GetParent().unit + local isPlayer = unit == "player" local config = LunaUF.db.profile.units[auraframe:GetParent().unitGroup].auras local numBuffs = 0 while UnitBuff(unit, numBuffs+1) do @@ -39,10 +40,10 @@ local function BuffUpdate(frame) local rows = math.ceil(numBuffs/config.AurasPerRow) local height = rows*auraframe.buffbuttons[1]:GetHeight()+rows auraframe:SetHeight(height == 0 and 1 or height) - local texture,stacks + local texture, stacks for i,button in ipairs(auraframe.buffbuttons) do - local buffIndex = GetPlayerBuff(i - 1, "HELPFUL"); - if (frame:GetParent().unitGroup == "player") then + local buffIndex, untilCancelled = GetPlayerBuff(i - 1, "HELPFUL"); + if isPlayer then texture = GetPlayerBuffTexture(buffIndex); stacks = GetPlayerBuffApplications(buffIndex); else @@ -52,24 +53,17 @@ local function BuffUpdate(frame) button.icon:SetTexture(texture) button.stack:SetText(stacks == 1 and "" or stacks) button.filter = "HELPFUL" - if (frame:GetParent().unitGroup == "player") then - if (config.timertextenabled) then + if isPlayer then + if (untilCancelled == 0 and config.timertextenabled) then button:SetScript("OnUpdate", BuffButtonUpdate) else button:SetScript("OnUpdate", nil) button.timeFontstrings["CENTER"]:SetText("") button.timeFontstrings["TOP"]:SetText("") end - if (config.timerspinenabled) then - if(texture ~= button.cooldown.texture) then - button.cooldown.stopped = 1 - button.cooldown.texture = texture - end - CooldownFrame_SetTimer(button.cooldown, GetTime(), GetPlayerBuffTimeLeft(buffIndex), button.cooldown.stopped) - button.cooldown.stopped = 0; + if (untilCancelled == 0 and config.timerspinenabled) then button.cooldown:Show(); else - button.cooldown.stopped = 1 button.cooldown:Hide(); end button:SetScript("OnClick", BuffButtonClick) @@ -80,10 +74,9 @@ local function BuffUpdate(frame) end button:Show() else - if (frame:GetParent().unitGroup == "player") then + if isPlayer then button:SetScript("OnUpdate", nil) button:SetScript("OnClick", nil) - button.cooldown.stopped = 1; button.cooldown:Hide(); end button:Hide() @@ -91,7 +84,7 @@ local function BuffUpdate(frame) end for i,button in ipairs(auraframe.debuffbuttons) do local buffIndex = GetPlayerBuff(i - 1, "HARMFUL"); - if (frame:GetParent().unitGroup == "player") then + if isPlayer then texture = GetPlayerBuffTexture(buffIndex); stacks = GetPlayerBuffApplications(buffIndex); else @@ -101,7 +94,7 @@ local function BuffUpdate(frame) button.icon:SetTexture(texture) button.stack:SetText(stacks == 1 and "" or stacks) button.filter = "HARMFUL" - if (frame:GetParent().unitGroup == "player") then + if isPlayer then if (config.timertextenabled) then button:SetScript("OnUpdate", BuffButtonUpdate) else @@ -110,15 +103,8 @@ local function BuffUpdate(frame) button.timeFontstrings["TOP"]:SetText("") end if (config.timerspinenabled) then - if(texture ~= button.cooldown.texture) then - button.cooldown.stopped = 1 - button.cooldown.texture = texture - end - CooldownFrame_SetTimer(button.cooldown, GetTime(), GetPlayerBuffTimeLeft(buffIndex), button.cooldown.stopped) - button.cooldown.stopped = 0; button.cooldown:Show(); else - button.cooldown.stopped = 1 button.cooldown:Hide(); end button.auraID = buffIndex @@ -127,9 +113,8 @@ local function BuffUpdate(frame) end button:Show() else - if (frame:GetParent().unitGroup == "player") then + if isPlayer then button:SetScript("OnUpdate", nil) - button.cooldown.stopped = 1; button.cooldown:Hide(); end button:Hide() @@ -150,6 +135,13 @@ function BuffButtonUpdate() local centered if (timeLeft and timeLeft > 0) then + -- local delta + -- if this.cooldown.start then delta = timeLeft + GetTime() - this.cooldown.start - this.cooldown.duration end + -- if not this.cooldown.start or math.abs(delta) > 0.1 then + -- DEFAULT_CHAT_FRAME:AddMessage("BuffButtonUpdate cdset "..this.auraID.." delta "..(delta or "nil")) + if not this.cooldown.start or math.abs(timeLeft + GetTime() - this.cooldown.start - this.cooldown.duration) > 0.1 then + CooldownFrame_SetTimer(this.cooldown, GetTime(), timeLeft, 1) + end timeLeft = math.ceil(timeLeft); centered = (timeLeft < 10) if (timeLeft > 3599) then From ba242581dc9dbbab2d1892d0c503c683c90adad4 Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Fri, 27 May 2016 02:01:20 +0200 Subject: [PATCH 17/34] bufftime db --- modules/auras.lua | 253 ++++++++++++++++++++++++++++------------------ 1 file changed, 153 insertions(+), 100 deletions(-) diff --git a/modules/auras.lua b/modules/auras.lua index b9f1d4b4..d55f89ca 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -2,6 +2,10 @@ local L = LunaUF.L local Auras = {} LunaUF:RegisterModule(Auras, "auras", L["Auras"]) +local PlayerScanTip = CreateFrame("GameTooltip", "PlayerScanTip", nil, "GameTooltipTemplate") +PlayerScanTip:SetOwner(WorldFrame, "ANCHOR_NONE") +LunaBuffDBPlayerString = UnitName("player") .. " of " .. GetCVar("realmName") + -- Thanks schaka! :D local function firstToUpper(str) if (str~=nil) then @@ -28,7 +32,7 @@ local function hideTooltip() GameTooltip:Hide() end -local function BuffUpdate(frame) +local function BuffFrameUpdate(frame) local auraframe = frame or this local unit = auraframe:GetParent().unit local isPlayer = unit == "player" @@ -42,8 +46,9 @@ local function BuffUpdate(frame) auraframe:SetHeight(height == 0 and 1 or height) local texture, stacks for i,button in ipairs(auraframe.buffbuttons) do - local buffIndex, untilCancelled = GetPlayerBuff(i - 1, "HELPFUL"); + local buffIndex, untilCancelled if isPlayer then + buffIndex, untilCancelled = GetPlayerBuff(i - 1, "HELPFUL"); texture = GetPlayerBuffTexture(buffIndex); stacks = GetPlayerBuffApplications(buffIndex); else @@ -54,18 +59,7 @@ local function BuffUpdate(frame) button.stack:SetText(stacks == 1 and "" or stacks) button.filter = "HELPFUL" if isPlayer then - if (untilCancelled == 0 and config.timertextenabled) then - button:SetScript("OnUpdate", BuffButtonUpdate) - else - button:SetScript("OnUpdate", nil) - button.timeFontstrings["CENTER"]:SetText("") - button.timeFontstrings["TOP"]:SetText("") - end - if (untilCancelled == 0 and config.timerspinenabled) then - button.cooldown:Show(); - else - button.cooldown:Hide(); - end + button.untilCancelled = untilCancelled button:SetScript("OnClick", BuffButtonClick) button.auraID = buffIndex else @@ -75,9 +69,7 @@ local function BuffUpdate(frame) button:Show() else if isPlayer then - button:SetScript("OnUpdate", nil) button:SetScript("OnClick", nil) - button.cooldown:Hide(); end button:Hide() end @@ -95,28 +87,12 @@ local function BuffUpdate(frame) button.stack:SetText(stacks == 1 and "" or stacks) button.filter = "HARMFUL" if isPlayer then - if (config.timertextenabled) then - button:SetScript("OnUpdate", BuffButtonUpdate) - else - button:SetScript("OnUpdate", nil) - button.timeFontstrings["CENTER"]:SetText("") - button.timeFontstrings["TOP"]:SetText("") - end - if (config.timerspinenabled) then - button.cooldown:Show(); - else - button.cooldown:Hide(); - end button.auraID = buffIndex else button.auraID = i end button:Show() else - if isPlayer then - button:SetScript("OnUpdate", nil) - button.cooldown:Hide(); - end button:Hide() end end @@ -124,61 +100,146 @@ end function BuffButtonClick() if (arg1 ~= "RightButton") then return; end - this:SetScript("OnUpdate", nil) this:SetScript("OnClick", nil) CancelPlayerBuff(this.auraID) end -function BuffButtonUpdate() - local timeString = "" - local timeLeft = GetPlayerBuffTimeLeft(this.auraID); - local centered - - if (timeLeft and timeLeft > 0) then - -- local delta - -- if this.cooldown.start then delta = timeLeft + GetTime() - this.cooldown.start - this.cooldown.duration end - -- if not this.cooldown.start or math.abs(delta) > 0.1 then - -- DEFAULT_CHAT_FRAME:AddMessage("BuffButtonUpdate cdset "..this.auraID.." delta "..(delta or "nil")) - if not this.cooldown.start or math.abs(timeLeft + GetTime() - this.cooldown.start - this.cooldown.duration) > 0.1 then - CooldownFrame_SetTimer(this.cooldown, GetTime(), timeLeft, 1) - end - timeLeft = math.ceil(timeLeft); - centered = (timeLeft < 10) - if (timeLeft > 3599) then - timeString = math.ceil(timeLeft / 3600).." h" - elseif (timeLeft > 59) then - timeString = math.ceil(timeLeft / 60).." m" - elseif not centered then - timeString = timeLeft.." s" - else - timeString = timeLeft - end - end - if centered then - this.timeFontstrings["CENTER"]:SetText(timeString) - this.timeFontstrings["TOP"]:SetText("") - else - this.timeFontstrings["CENTER"]:SetText("") - this.timeFontstrings["TOP"]:SetText(timeString) - end -end - local function OnEvent() if arg1 == this:GetParent().unit then - this.updateNeeded = true - --BuffUpdate(this) + this.frameUpdateNeeded = true end end local function OnUpdate() - if this.updateNeeded then - this.updateNeeded = nil - BuffUpdate(this) + if this.frameUpdateNeeded then + this.frameUpdateNeeded = false + BuffFrameUpdate(this) + end + + if not (this:GetParent().unit == "player") then return end + local config = LunaUF.db.profile.units[this:GetParent().unitGroup].auras + local OldLunaBuffDB = LunaBuffDB[LunaBuffDBPlayerString] + LunaBuffDB[LunaBuffDBPlayerString] = {} + for i,button in ipairs(this.buffbuttons) do + if (button:IsVisible() and button.untilCancelled == 0) then + local timeLeft = GetPlayerBuffTimeLeft(button.auraID) + PlayerScanTip:ClearLines() + PlayerScanTip:SetPlayerBuff(button.auraID) + local buffName = PlayerScanTipTextLeft1:GetText() + if OldLunaBuffDB[buffName] then + if timeLeft > OldLunaBuffDB[buffName] then + LunaBuffDB[LunaBuffDBPlayerString][buffName] = timeLeft + else + LunaBuffDB[LunaBuffDBPlayerString][buffName] = OldLunaBuffDB[buffName] + end + elseif timeLeft > 0 and buffName then + LunaBuffDB[LunaBuffDBPlayerString][buffName] = timeLeft + end + if (config.timertextenabled) then + local timeString = "" + local centered + local timeL = timeLeft + if (timeL and timeL > 0) then + timeL = math.ceil(timeL); + centered = (timeL < 10) + if (timeL > 3599) then + timeString = math.ceil(timeL / 3600).." h" + elseif (timeL > 59) then + timeString = math.ceil(timeL / 60).." m" + elseif not centered then + timeString = timeL.." s" + else + timeString = timeL + end + end + if centered then + button.timeFontstrings["CENTER"]:SetText(timeString) + button.timeFontstrings["TOP"]:SetText("") + else + button.timeFontstrings["CENTER"]:SetText("") + button.timeFontstrings["TOP"]:SetText(timeString) + end + else + button.timeFontstrings["CENTER"]:SetText("") + button.timeFontstrings["TOP"]:SetText("") + end + if (config.timerspinenabled) then + if timeLeft > 0 then + CooldownFrame_SetTimer(button.cooldown, GetTime() - (LunaBuffDB[LunaBuffDBPlayerString][buffName] - timeLeft), LunaBuffDB[LunaBuffDBPlayerString][buffName] , 1) + else + CooldownFrame_SetTimer(button.cooldown, 0, timeLeft, 0) + end + button.cooldown:Show(); + else + button.cooldown:Hide(); + end + end + end + for i,button in ipairs(this.debuffbuttons) do + if (button:IsVisible()) then + local timeLeft = GetPlayerBuffTimeLeft(button.auraID) + PlayerScanTip:ClearLines() + PlayerScanTip:SetPlayerBuff(button.auraID) + local buffName = PlayerScanTipTextLeft1:GetText() + if OldLunaBuffDB[buffName] then + if timeLeft > OldLunaBuffDB[buffName] then + LunaBuffDB[LunaBuffDBPlayerString][buffName] = timeLeft + else + LunaBuffDB[LunaBuffDBPlayerString][buffName] = OldLunaBuffDB[buffName] + end + elseif timeLeft > 0 and buffName then + LunaBuffDB[LunaBuffDBPlayerString][buffName] = timeLeft + end + if (config.timertextenabled) then + local timeString = "" + local centered + local timeL = timeLeft + if (timeL and timeL > 0) then + timeL = math.ceil(timeL); + centered = (timeL < 10) + if (timeL > 3599) then + timeString = math.ceil(timeL / 3600).." h" + elseif (timeL > 59) then + timeString = math.ceil(timeL / 60).." m" + elseif not centered then + timeString = timeL.." s" + else + timeString = timeL + end + end + if centered then + button.timeFontstrings["CENTER"]:SetText(timeString) + button.timeFontstrings["TOP"]:SetText("") + else + button.timeFontstrings["CENTER"]:SetText("") + button.timeFontstrings["TOP"]:SetText(timeString) + end + else + button.timeFontstrings["CENTER"]:SetText("") + button.timeFontstrings["TOP"]:SetText("") + end + if (config.timerspinenabled) then + if timeLeft > 0 then + CooldownFrame_SetTimer(button.cooldown, GetTime() - (LunaBuffDB[LunaBuffDBPlayerString][buffName] - timeLeft), LunaBuffDB[LunaBuffDBPlayerString][buffName], 1) + else + CooldownFrame_SetTimer(button.cooldown, 0, timeLeft, 0) + end + button.cooldown:Show(); + else + button.cooldown:Hide(); + end + end end end function Auras:OnEnable(frame) local isPlayer = frame.unitGroup == "player" + if not LunaBuffDB then + LunaBuffDB = {} + end + if not LunaBuffDB[LunaBuffDBPlayerString] then + LunaBuffDB[LunaBuffDBPlayerString] = {} + end if not frame.auras then frame.auras = CreateFrame("Frame", nil, frame) frame.auras.buffbuttons = {} @@ -191,22 +252,20 @@ function Auras:OnEnable(frame) button:SetScript("OnClick", cancelBuff) button:RegisterForClicks("RightButtonUp") button.cooldown = CreateFrame("Model", button:GetName().."CD", button, "CooldownFrameTemplate") - --button.cooldown:SetHeight(36) - --button.cooldown:SetWidth(36) + button.cooldown:ClearAllPoints() + button.cooldown:SetHeight(36) + button.cooldown:SetWidth(36) button.cooldown:SetFrameLevel(7) button.cooldown.reverse = true - button.cooldown.stopped = 1; button.cooldown:Hide() button.textFrame = CreateFrame("Frame", nil, button) button.textFrame:SetAllPoints(button) button.textFrame:SetFrameLevel(button.cooldown:GetFrameLevel() + 1); button.timeFontstrings = {} button.timeFontstrings["TOP"] = button.textFrame:CreateFontString(nil, "OVERLAY"); - button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") button.timeFontstrings["TOP"]:SetJustifyH("CENTER") button.timeFontstrings["TOP"]:SetPoint("TOP", button.textFrame, "TOP",0,0) button.timeFontstrings["CENTER"] = button.textFrame:CreateFontString(nil, "OVERLAY"); - button.timeFontstrings["CENTER"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextbigsize, "OUTLINE") button.timeFontstrings["CENTER"]:SetJustifyH("CENTER") button.timeFontstrings["CENTER"]:SetPoint("CENTER", button.textFrame, "CENTER",0,0) end @@ -236,11 +295,11 @@ function Auras:OnEnable(frame) button:SetScript("OnLeave", hideTooltip) if isPlayer then button.cooldown = CreateFrame("Model", button:GetName().."CD", button, "CooldownFrameTemplate") - --button.cooldown:SetHeight(36) - --button.cooldown:SetWidth(36) + button.cooldown:ClearAllPoints() + button.cooldown:SetHeight(36) + button.cooldown:SetWidth(36) button.cooldown:SetFrameLevel(7) button.cooldown.reverse = true - button.cooldown.stopped = 1; button.cooldown:Hide() button.textFrame = CreateFrame("Frame", nil, button) button.textFrame:SetAllPoints(button) @@ -302,6 +361,7 @@ function Auras:OnEnable(frame) end frame.auras:Show() frame.auras:RegisterEvent("UNIT_AURA") + frame.auras:RegisterEvent("PLAYER_AURAS_CHANGED") frame.auras:SetScript("OnEvent", OnEvent) frame.auras:SetScript("OnUpdate", OnUpdate) end @@ -335,9 +395,8 @@ function Auras:FullUpdate(frame) button.stack:SetText(i) button:SetPoint("BOTTOMLEFT", frame.auras, "BOTTOMLEFT", (i-1)*(buttonsize+1)-((math.ceil(i/config.AurasPerRow)-1)*(config.AurasPerRow)*(buttonsize+1)), (math.ceil(i/config.AurasPerRow)-1)*(buttonsize+1)) if button.cooldown then - button.cooldown:SetModelScale(buttonsize/48) - button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT") - button.cooldown:SetPoint("BOTTOMRIGHT", button.border, "BOTTOMRIGHT",1,0) + button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT",0,0) + button.cooldown:SetScale((button.border:GetWidth()+1)/36) end if button.timeFontstrings then button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") @@ -353,9 +412,8 @@ function Auras:FullUpdate(frame) button.stack:SetText(i) button:SetPoint("BOTTOMLEFT", frame.auras, "TOPLEFT", (i-1)*(buttonsize+1)-((math.ceil(i/config.AurasPerRow)-1)*(config.AurasPerRow)*(buttonsize+1)), (math.ceil(i/config.AurasPerRow)-1)*(buttonsize+1)) if button.cooldown then - button.cooldown:SetModelScale(buttonsize/48) - button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT") - button.cooldown:SetPoint("BOTTOMRIGHT", button.border, "BOTTOMRIGHT",1,0) + button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT",0,0) + button.cooldown:SetScale((button.border:GetWidth()+1)/36) end if button.timeFontstrings then button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") @@ -373,9 +431,8 @@ function Auras:FullUpdate(frame) button.stack:SetText(i) button:SetPoint("TOPRIGHT", frame.auras, "TOPRIGHT", -((i-1)*(buttonsize+1)-((math.ceil(i/config.AurasPerRow)-1)*(config.AurasPerRow)*(buttonsize+1))), -(math.ceil(i/config.AurasPerRow)-1)*(buttonsize+1)) if button.cooldown then - button.cooldown:SetModelScale(buttonsize/48) - button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT") - button.cooldown:SetPoint("BOTTOMRIGHT", button.border, "BOTTOMRIGHT",1,0) + button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT",0,0) + button.cooldown:SetScale((button.border:GetWidth()+1)/36) end if button.timeFontstrings then button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") @@ -391,9 +448,8 @@ function Auras:FullUpdate(frame) button.stack:SetText(i) button:SetPoint("TOPRIGHT", frame.auras, "BOTTOMRIGHT", -((i-1)*(buttonsize+1)-((math.ceil(i/config.AurasPerRow)-1)*(config.AurasPerRow)*(buttonsize+1))), -(math.ceil(i/config.AurasPerRow)-1)*(buttonsize+1)) if button.cooldown then - button.cooldown:SetModelScale(buttonsize/48) - button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT") - button.cooldown:SetPoint("BOTTOMRIGHT", button.border, "BOTTOMRIGHT",1,0) + button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT",0,0) + button.cooldown:SetScale((button.border:GetWidth()+1)/36) end if button.timeFontstrings then button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") @@ -415,9 +471,8 @@ function Auras:FullUpdate(frame) button.stack:SetText(i) button:SetPoint("TOPLEFT", frame.auras, "TOPLEFT", (i-1)*(buttonsize+1)-((math.ceil(i/config.AurasPerRow)-1)*(config.AurasPerRow)*(buttonsize+1)), -(math.ceil(i/config.AurasPerRow)-1)*(buttonsize+1)) if button.cooldown then - button.cooldown:SetModelScale(buttonsize/48) - button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT") - button.cooldown:SetPoint("BOTTOMRIGHT", button.border, "BOTTOMRIGHT",1,0) + button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT",0,0) + button.cooldown:SetScale((button.border:GetWidth()+1)/36) end if button.timeFontstrings then button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") @@ -433,9 +488,8 @@ function Auras:FullUpdate(frame) button.stack:SetText(i) button:SetPoint("TOPLEFT", frame.auras, "BOTTOMLEFT", (i-1)*(buttonsize+1)-((math.ceil(i/config.AurasPerRow)-1)*(config.AurasPerRow)*(buttonsize+1)), -(math.ceil(i/config.AurasPerRow)-1)*(buttonsize+1)) if button.cooldown then - button.cooldown:SetModelScale(buttonsize/48) - button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT") - button.cooldown:SetPoint("BOTTOMRIGHT", button.border, "BOTTOMRIGHT",1,0) + button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT",0,0) + button.cooldown:SetScale((button.border:GetWidth()+1)/36) end if button.timeFontstrings then button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") @@ -443,6 +497,5 @@ function Auras:FullUpdate(frame) end end end - frame.auras.updateNeeded = true - --BuffUpdate(frame.auras) + frame.auras.frameUpdateNeeded = true end From bec8c109c3f2efefd39539485f430be5a9648a51 Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Fri, 27 May 2016 04:49:09 +0200 Subject: [PATCH 18/34] better event dispatch --- modules/auras.lua | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/modules/auras.lua b/modules/auras.lua index d55f89ca..01faf35f 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -105,17 +105,13 @@ function BuffButtonClick() end local function OnEvent() - if arg1 == this:GetParent().unit then - this.frameUpdateNeeded = true + if (((this:GetParent().unit == "player") and (event == "PLAYER_AURAS_CHANGED")) + or ((this:GetParent().unit ~= "player") and (arg1 == this:GetParent().unit))) then + BuffFrameUpdate(this) end end local function OnUpdate() - if this.frameUpdateNeeded then - this.frameUpdateNeeded = false - BuffFrameUpdate(this) - end - if not (this:GetParent().unit == "player") then return end local config = LunaUF.db.profile.units[this:GetParent().unitGroup].auras local OldLunaBuffDB = LunaBuffDB[LunaBuffDBPlayerString] @@ -497,5 +493,5 @@ function Auras:FullUpdate(frame) end end end - frame.auras.frameUpdateNeeded = true + BuffFrameUpdate(frame.auras) end From 714111507bda92b07f194b952d2d6667128be611 Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Fri, 27 May 2016 19:38:48 +0200 Subject: [PATCH 19/34] hide text properly --- modules/auras.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/auras.lua b/modules/auras.lua index 01faf35f..528e82a1 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -169,6 +169,10 @@ local function OnUpdate() else button.cooldown:Hide(); end + else + button.cooldown:Hide() + button.timeFontstrings["CENTER"]:SetText("") + button.timeFontstrings["TOP"]:SetText("") end end for i,button in ipairs(this.debuffbuttons) do @@ -224,6 +228,10 @@ local function OnUpdate() else button.cooldown:Hide(); end + else + button.cooldown:Hide() + button.timeFontstrings["CENTER"]:SetText("") + button.timeFontstrings["TOP"]:SetText("") end end end From dcda91449b7865ffc79e31ed37d3574e874e21d6 Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Sun, 29 May 2016 13:47:27 +0200 Subject: [PATCH 20/34] typo in showtooltip --- modules/auras.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/auras.lua b/modules/auras.lua index 528e82a1..68b01d34 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -23,7 +23,7 @@ local function showTooltip() GameTooltip:SetPlayerBuff(this.auraID); elseif this.filter == "HELPFUL" then GameTooltip:SetUnitBuff(this:GetParent():GetParent().unit, this.auraID) - elseif this.filter == "HARMFULL" then + elseif this.filter == "HARMFUL" then GameTooltip:SetUnitDebuff(this:GetParent():GetParent().unit, this.auraID) end end From 83a3890ce700a828e9b300702883094ff1964fe8 Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Sun, 5 Jun 2016 04:38:36 +0200 Subject: [PATCH 21/34] Aviana's feedback --- modules/auras.lua | 78 ++++++++++++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 32 deletions(-) diff --git a/modules/auras.lua b/modules/auras.lua index 68b01d34..df0cea5a 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -2,8 +2,6 @@ local L = LunaUF.L local Auras = {} LunaUF:RegisterModule(Auras, "auras", L["Auras"]) -local PlayerScanTip = CreateFrame("GameTooltip", "PlayerScanTip", nil, "GameTooltipTemplate") -PlayerScanTip:SetOwner(WorldFrame, "ANCHOR_NONE") LunaBuffDBPlayerString = UnitName("player") .. " of " .. GetCVar("realmName") -- Thanks schaka! :D @@ -32,7 +30,7 @@ local function hideTooltip() GameTooltip:Hide() end -local function BuffFrameUpdate(frame) +local function BuffFrameUpdate(frame, buildOnly) local auraframe = frame or this local unit = auraframe:GetParent().unit local isPlayer = unit == "player" @@ -44,7 +42,13 @@ local function BuffFrameUpdate(frame) local rows = math.ceil(numBuffs/config.AurasPerRow) local height = rows*auraframe.buffbuttons[1]:GetHeight()+rows auraframe:SetHeight(height == 0 and 1 or height) - local texture, stacks + local texture, stacks, OldLunaBuffDB + if isPlayer and not buildOnly then + OldLunaBuffDB = LunaBuffDB[LunaBuffDBPlayerString] + for k, v in pairs(LunaBuffDB[LunaBuffDBPlayerString]) do + LunaBuffDB[LunaBuffDBPlayerString][k] = nil + end + end for i,button in ipairs(auraframe.buffbuttons) do local buffIndex, untilCancelled if isPlayer then @@ -62,6 +66,21 @@ local function BuffFrameUpdate(frame) button.untilCancelled = untilCancelled button:SetScript("OnClick", BuffButtonClick) button.auraID = buffIndex + if OldLunaBuffDB then + local timeLeft = GetPlayerBuffTimeLeft(buffIndex) + LunaUF.ScanTip:ClearLines() + LunaUF.ScanTip:SetPlayerBuff(buffIndex) + local buffName = LunaScanTipTextLeft1:GetText() + if OldLunaBuffDB[buffName] then + if timeLeft > OldLunaBuffDB[buffName] then + LunaBuffDB[LunaBuffDBPlayerString][buffName] = math.ceil(timeLeft) + else + LunaBuffDB[LunaBuffDBPlayerString][buffName] = OldLunaBuffDB[buffName] + end + elseif timeLeft > 0 and buffName then + LunaBuffDB[LunaBuffDBPlayerString][buffName] = math.ceil(timeLeft) + end + end else button:SetScript("OnClick", nil) button.auraID = i @@ -88,6 +107,21 @@ local function BuffFrameUpdate(frame) button.filter = "HARMFUL" if isPlayer then button.auraID = buffIndex + if OldLunaBuffDB then + local timeLeft = GetPlayerBuffTimeLeft(buffIndex) + LunaUF.ScanTip:ClearLines() + LunaUF.ScanTip:SetPlayerBuff(buffIndex) + local buffName = LunaScanTipTextLeft1:GetText() + if OldLunaBuffDB[buffName] then + if timeLeft > OldLunaBuffDB[buffName] then + LunaBuffDB[LunaBuffDBPlayerString][buffName] = math.ceil(timeLeft) + else + LunaBuffDB[LunaBuffDBPlayerString][buffName] = OldLunaBuffDB[buffName] + end + elseif timeLeft > 0 and buffName then + LunaBuffDB[LunaBuffDBPlayerString][buffName] = math.ceil(timeLeft) + end + end else button.auraID = i end @@ -107,30 +141,16 @@ end local function OnEvent() if (((this:GetParent().unit == "player") and (event == "PLAYER_AURAS_CHANGED")) or ((this:GetParent().unit ~= "player") and (arg1 == this:GetParent().unit))) then - BuffFrameUpdate(this) + BuffFrameUpdate(this, false) end end local function OnUpdate() if not (this:GetParent().unit == "player") then return end local config = LunaUF.db.profile.units[this:GetParent().unitGroup].auras - local OldLunaBuffDB = LunaBuffDB[LunaBuffDBPlayerString] - LunaBuffDB[LunaBuffDBPlayerString] = {} for i,button in ipairs(this.buffbuttons) do if (button:IsVisible() and button.untilCancelled == 0) then local timeLeft = GetPlayerBuffTimeLeft(button.auraID) - PlayerScanTip:ClearLines() - PlayerScanTip:SetPlayerBuff(button.auraID) - local buffName = PlayerScanTipTextLeft1:GetText() - if OldLunaBuffDB[buffName] then - if timeLeft > OldLunaBuffDB[buffName] then - LunaBuffDB[LunaBuffDBPlayerString][buffName] = timeLeft - else - LunaBuffDB[LunaBuffDBPlayerString][buffName] = OldLunaBuffDB[buffName] - end - elseif timeLeft > 0 and buffName then - LunaBuffDB[LunaBuffDBPlayerString][buffName] = timeLeft - end if (config.timertextenabled) then local timeString = "" local centered @@ -160,6 +180,9 @@ local function OnUpdate() button.timeFontstrings["TOP"]:SetText("") end if (config.timerspinenabled) then + LunaUF.ScanTip:ClearLines() + LunaUF.ScanTip:SetPlayerBuff(button.auraID) + local buffName = LunaScanTipTextLeft1:GetText() if timeLeft > 0 then CooldownFrame_SetTimer(button.cooldown, GetTime() - (LunaBuffDB[LunaBuffDBPlayerString][buffName] - timeLeft), LunaBuffDB[LunaBuffDBPlayerString][buffName] , 1) else @@ -178,18 +201,6 @@ local function OnUpdate() for i,button in ipairs(this.debuffbuttons) do if (button:IsVisible()) then local timeLeft = GetPlayerBuffTimeLeft(button.auraID) - PlayerScanTip:ClearLines() - PlayerScanTip:SetPlayerBuff(button.auraID) - local buffName = PlayerScanTipTextLeft1:GetText() - if OldLunaBuffDB[buffName] then - if timeLeft > OldLunaBuffDB[buffName] then - LunaBuffDB[LunaBuffDBPlayerString][buffName] = timeLeft - else - LunaBuffDB[LunaBuffDBPlayerString][buffName] = OldLunaBuffDB[buffName] - end - elseif timeLeft > 0 and buffName then - LunaBuffDB[LunaBuffDBPlayerString][buffName] = timeLeft - end if (config.timertextenabled) then local timeString = "" local centered @@ -219,6 +230,9 @@ local function OnUpdate() button.timeFontstrings["TOP"]:SetText("") end if (config.timerspinenabled) then + LunaUF.ScanTip:ClearLines() + LunaUF.ScanTip:SetPlayerBuff(button.auraID) + local buffName = LunaScanTipTextLeft1:GetText() if timeLeft > 0 then CooldownFrame_SetTimer(button.cooldown, GetTime() - (LunaBuffDB[LunaBuffDBPlayerString][buffName] - timeLeft), LunaBuffDB[LunaBuffDBPlayerString][buffName], 1) else @@ -501,5 +515,5 @@ function Auras:FullUpdate(frame) end end end - BuffFrameUpdate(frame.auras) + BuffFrameUpdate(frame.auras, true) end From b9f74bee8a1092db60a85108b0bee6fac7b77ad5 Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Tue, 7 Jun 2016 04:25:56 +0200 Subject: [PATCH 22/34] move CooldownFrame_SetTimer & reuse tables --- modules/auras.lua | 56 +++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/modules/auras.lua b/modules/auras.lua index df0cea5a..e52ae6fd 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -3,6 +3,7 @@ local Auras = {} LunaUF:RegisterModule(Auras, "auras", L["Auras"]) LunaBuffDBPlayerString = UnitName("player") .. " of " .. GetCVar("realmName") +OldLunaBuffDB = {} -- Thanks schaka! :D local function firstToUpper(str) @@ -42,10 +43,10 @@ local function BuffFrameUpdate(frame, buildOnly) local rows = math.ceil(numBuffs/config.AurasPerRow) local height = rows*auraframe.buffbuttons[1]:GetHeight()+rows auraframe:SetHeight(height == 0 and 1 or height) - local texture, stacks, OldLunaBuffDB + local texture, stacks if isPlayer and not buildOnly then - OldLunaBuffDB = LunaBuffDB[LunaBuffDBPlayerString] for k, v in pairs(LunaBuffDB[LunaBuffDBPlayerString]) do + OldLunaBuffDB[k] = LunaBuffDB[LunaBuffDBPlayerString][k] LunaBuffDB[LunaBuffDBPlayerString][k] = nil end end @@ -66,7 +67,7 @@ local function BuffFrameUpdate(frame, buildOnly) button.untilCancelled = untilCancelled button:SetScript("OnClick", BuffButtonClick) button.auraID = buffIndex - if OldLunaBuffDB then + if not buildOnly then local timeLeft = GetPlayerBuffTimeLeft(buffIndex) LunaUF.ScanTip:ClearLines() LunaUF.ScanTip:SetPlayerBuff(buffIndex) @@ -80,6 +81,16 @@ local function BuffFrameUpdate(frame, buildOnly) elseif timeLeft > 0 and buffName then LunaBuffDB[LunaBuffDBPlayerString][buffName] = math.ceil(timeLeft) end + if (config.timerspinenabled) then + if timeLeft > 0 then + CooldownFrame_SetTimer(button.cooldown, GetTime() - (LunaBuffDB[LunaBuffDBPlayerString][buffName] - timeLeft), LunaBuffDB[LunaBuffDBPlayerString][buffName], 1) + else + CooldownFrame_SetTimer(button.cooldown, 0, timeLeft, 0) + end + button.cooldown:Show(); + else + button.cooldown:Hide(); + end end else button:SetScript("OnClick", nil) @@ -121,6 +132,16 @@ local function BuffFrameUpdate(frame, buildOnly) elseif timeLeft > 0 and buffName then LunaBuffDB[LunaBuffDBPlayerString][buffName] = math.ceil(timeLeft) end + if (config.timerspinenabled) then + if timeLeft > 0 then + CooldownFrame_SetTimer(button.cooldown, GetTime() - (LunaBuffDB[LunaBuffDBPlayerString][buffName] - timeLeft), LunaBuffDB[LunaBuffDBPlayerString][buffName] , 1) + else + CooldownFrame_SetTimer(button.cooldown, 0, timeLeft, 0) + end + button.cooldown:Show(); + else + button.cooldown:Hide(); + end end else button.auraID = i @@ -130,6 +151,9 @@ local function BuffFrameUpdate(frame, buildOnly) button:Hide() end end + for k, v in pairs(OldLunaBuffDB) do + OldLunaBuffDB[k] = nil + end end function BuffButtonClick() @@ -179,19 +203,6 @@ local function OnUpdate() button.timeFontstrings["CENTER"]:SetText("") button.timeFontstrings["TOP"]:SetText("") end - if (config.timerspinenabled) then - LunaUF.ScanTip:ClearLines() - LunaUF.ScanTip:SetPlayerBuff(button.auraID) - local buffName = LunaScanTipTextLeft1:GetText() - if timeLeft > 0 then - CooldownFrame_SetTimer(button.cooldown, GetTime() - (LunaBuffDB[LunaBuffDBPlayerString][buffName] - timeLeft), LunaBuffDB[LunaBuffDBPlayerString][buffName] , 1) - else - CooldownFrame_SetTimer(button.cooldown, 0, timeLeft, 0) - end - button.cooldown:Show(); - else - button.cooldown:Hide(); - end else button.cooldown:Hide() button.timeFontstrings["CENTER"]:SetText("") @@ -229,19 +240,6 @@ local function OnUpdate() button.timeFontstrings["CENTER"]:SetText("") button.timeFontstrings["TOP"]:SetText("") end - if (config.timerspinenabled) then - LunaUF.ScanTip:ClearLines() - LunaUF.ScanTip:SetPlayerBuff(button.auraID) - local buffName = LunaScanTipTextLeft1:GetText() - if timeLeft > 0 then - CooldownFrame_SetTimer(button.cooldown, GetTime() - (LunaBuffDB[LunaBuffDBPlayerString][buffName] - timeLeft), LunaBuffDB[LunaBuffDBPlayerString][buffName], 1) - else - CooldownFrame_SetTimer(button.cooldown, 0, timeLeft, 0) - end - button.cooldown:Show(); - else - button.cooldown:Hide(); - end else button.cooldown:Hide() button.timeFontstrings["CENTER"]:SetText("") From a73cc88266007e2e7a551540c1e07d16c385bf42 Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Tue, 7 Jun 2016 23:39:59 +0200 Subject: [PATCH 23/34] timers tracking tables from luna 1.X --- modules/auras.lua | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/modules/auras.lua b/modules/auras.lua index e52ae6fd..cfb93a77 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -2,8 +2,10 @@ local L = LunaUF.L local Auras = {} LunaUF:RegisterModule(Auras, "auras", L["Auras"]) -LunaBuffDBPlayerString = UnitName("player") .. " of " .. GetCVar("realmName") -OldLunaBuffDB = {} +local LunaBuffDBPlayerString = UnitName("player") .. " of " .. GetCVar("realmName") +local OldLunaBuffDB = {} +local bufftimers = {} +local debufftimers = {} -- Thanks schaka! :D local function firstToUpper(str) @@ -172,9 +174,14 @@ end local function OnUpdate() if not (this:GetParent().unit == "player") then return end local config = LunaUF.db.profile.units[this:GetParent().unitGroup].auras + local changed for i,button in ipairs(this.buffbuttons) do + local timeLeft = button.auraID and GetPlayerBuffTimeLeft(button.auraID) or 0 + if bufftimers[i] and timeLeft > bufftimers[i] then + changed = 1 + end + bufftimers[i] = timeLeft if (button:IsVisible() and button.untilCancelled == 0) then - local timeLeft = GetPlayerBuffTimeLeft(button.auraID) if (config.timertextenabled) then local timeString = "" local centered @@ -210,8 +217,12 @@ local function OnUpdate() end end for i,button in ipairs(this.debuffbuttons) do + local timeLeft = button.auraID and GetPlayerBuffTimeLeft(button.auraID) or 0 + if debufftimers[i] and timeLeft > debufftimers[i] then + changed = 1 + end + debufftimers[i] = timeLeft if (button:IsVisible()) then - local timeLeft = GetPlayerBuffTimeLeft(button.auraID) if (config.timertextenabled) then local timeString = "" local centered @@ -246,6 +257,9 @@ local function OnUpdate() button.timeFontstrings["TOP"]:SetText("") end end + if changed then + BuffFrameUpdate(this, false) + end end function Auras:OnEnable(frame) From c83c0626a866f8b39fde1f7826e3a37a4f2aeb6e Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Wed, 8 Jun 2016 03:39:42 +0200 Subject: [PATCH 24/34] fine-tune cooldown position --- modules/auras.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/auras.lua b/modules/auras.lua index cfb93a77..e60915a2 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -425,8 +425,8 @@ function Auras:FullUpdate(frame) button.stack:SetText(i) button:SetPoint("BOTTOMLEFT", frame.auras, "BOTTOMLEFT", (i-1)*(buttonsize+1)-((math.ceil(i/config.AurasPerRow)-1)*(config.AurasPerRow)*(buttonsize+1)), (math.ceil(i/config.AurasPerRow)-1)*(buttonsize+1)) if button.cooldown then - button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT",0,0) - button.cooldown:SetScale((button.border:GetWidth()+1)/36) + button.cooldown:SetPoint("TOPLEFT", button, "TOPLEFT", 0, 0) + button.cooldown:SetScale((button:GetWidth() + 0.7)/36) end if button.timeFontstrings then button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") @@ -442,8 +442,8 @@ function Auras:FullUpdate(frame) button.stack:SetText(i) button:SetPoint("BOTTOMLEFT", frame.auras, "TOPLEFT", (i-1)*(buttonsize+1)-((math.ceil(i/config.AurasPerRow)-1)*(config.AurasPerRow)*(buttonsize+1)), (math.ceil(i/config.AurasPerRow)-1)*(buttonsize+1)) if button.cooldown then - button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT",0,0) - button.cooldown:SetScale((button.border:GetWidth()+1)/36) + button.cooldown:SetPoint("TOPLEFT", button, "TOPLEFT", 0, 0) + button.cooldown:SetScale((button:GetWidth() + 0.7)/36) end if button.timeFontstrings then button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") @@ -461,8 +461,8 @@ function Auras:FullUpdate(frame) button.stack:SetText(i) button:SetPoint("TOPRIGHT", frame.auras, "TOPRIGHT", -((i-1)*(buttonsize+1)-((math.ceil(i/config.AurasPerRow)-1)*(config.AurasPerRow)*(buttonsize+1))), -(math.ceil(i/config.AurasPerRow)-1)*(buttonsize+1)) if button.cooldown then - button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT",0,0) - button.cooldown:SetScale((button.border:GetWidth()+1)/36) + button.cooldown:SetPoint("TOPLEFT", button, "TOPLEFT", 0, 0) + button.cooldown:SetScale((button:GetWidth() + 0.7)/36) end if button.timeFontstrings then button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") @@ -478,8 +478,8 @@ function Auras:FullUpdate(frame) button.stack:SetText(i) button:SetPoint("TOPRIGHT", frame.auras, "BOTTOMRIGHT", -((i-1)*(buttonsize+1)-((math.ceil(i/config.AurasPerRow)-1)*(config.AurasPerRow)*(buttonsize+1))), -(math.ceil(i/config.AurasPerRow)-1)*(buttonsize+1)) if button.cooldown then - button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT",0,0) - button.cooldown:SetScale((button.border:GetWidth()+1)/36) + button.cooldown:SetPoint("TOPLEFT", button, "TOPLEFT", 0, 0) + button.cooldown:SetScale((button:GetWidth() + 0.7)/36) end if button.timeFontstrings then button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") @@ -501,8 +501,8 @@ function Auras:FullUpdate(frame) button.stack:SetText(i) button:SetPoint("TOPLEFT", frame.auras, "TOPLEFT", (i-1)*(buttonsize+1)-((math.ceil(i/config.AurasPerRow)-1)*(config.AurasPerRow)*(buttonsize+1)), -(math.ceil(i/config.AurasPerRow)-1)*(buttonsize+1)) if button.cooldown then - button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT",0,0) - button.cooldown:SetScale((button.border:GetWidth()+1)/36) + button.cooldown:SetPoint("TOPLEFT", button, "TOPLEFT", 0, 0) + button.cooldown:SetScale((button:GetWidth() + 0.7)/36) end if button.timeFontstrings then button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") @@ -518,8 +518,8 @@ function Auras:FullUpdate(frame) button.stack:SetText(i) button:SetPoint("TOPLEFT", frame.auras, "BOTTOMLEFT", (i-1)*(buttonsize+1)-((math.ceil(i/config.AurasPerRow)-1)*(config.AurasPerRow)*(buttonsize+1)), -(math.ceil(i/config.AurasPerRow)-1)*(buttonsize+1)) if button.cooldown then - button.cooldown:SetPoint("TOPLEFT", button.border, "TOPLEFT",0,0) - button.cooldown:SetScale((button.border:GetWidth()+1)/36) + button.cooldown:SetPoint("TOPLEFT", button, "TOPLEFT", 0, 0) + button.cooldown:SetScale((button:GetWidth() + 0.7)/36) end if button.timeFontstrings then button.timeFontstrings["TOP"]:SetFont("Interface\\AddOns\\LunaUnitFrames\\media\\fonts\\Luna.ttf", LunaUF.db.profile.units["player"].auras.timertextsmallsize, "OUTLINE") From 63a0b2d30b5442e804df9cb881e996e0e34cf36b Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Fri, 10 Jun 2016 21:32:30 +0200 Subject: [PATCH 25/34] correctly hide the cooldown --- modules/auras.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/auras.lua b/modules/auras.lua index e60915a2..0ba6e07c 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -83,7 +83,7 @@ local function BuffFrameUpdate(frame, buildOnly) elseif timeLeft > 0 and buffName then LunaBuffDB[LunaBuffDBPlayerString][buffName] = math.ceil(timeLeft) end - if (config.timerspinenabled) then + if (config.timerspinenabled and untilCancelled == 0) then if timeLeft > 0 then CooldownFrame_SetTimer(button.cooldown, GetTime() - (LunaBuffDB[LunaBuffDBPlayerString][buffName] - timeLeft), LunaBuffDB[LunaBuffDBPlayerString][buffName], 1) else @@ -211,7 +211,6 @@ local function OnUpdate() button.timeFontstrings["TOP"]:SetText("") end else - button.cooldown:Hide() button.timeFontstrings["CENTER"]:SetText("") button.timeFontstrings["TOP"]:SetText("") end @@ -252,7 +251,6 @@ local function OnUpdate() button.timeFontstrings["TOP"]:SetText("") end else - button.cooldown:Hide() button.timeFontstrings["CENTER"]:SetText("") button.timeFontstrings["TOP"]:SetText("") end From 48c00deb74c67b399354097d8b3003384fdcdc3b Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Sat, 11 Jun 2016 19:03:56 +0200 Subject: [PATCH 26/34] no db copy & less table wiping --- modules/auras.lua | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/modules/auras.lua b/modules/auras.lua index 0ba6e07c..77d79497 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -3,7 +3,7 @@ local Auras = {} LunaUF:RegisterModule(Auras, "auras", L["Auras"]) local LunaBuffDBPlayerString = UnitName("player") .. " of " .. GetCVar("realmName") -local OldLunaBuffDB = {} +local currentBuffTable = {} local bufftimers = {} local debufftimers = {} @@ -46,12 +46,7 @@ local function BuffFrameUpdate(frame, buildOnly) local height = rows*auraframe.buffbuttons[1]:GetHeight()+rows auraframe:SetHeight(height == 0 and 1 or height) local texture, stacks - if isPlayer and not buildOnly then - for k, v in pairs(LunaBuffDB[LunaBuffDBPlayerString]) do - OldLunaBuffDB[k] = LunaBuffDB[LunaBuffDBPlayerString][k] - LunaBuffDB[LunaBuffDBPlayerString][k] = nil - end - end + local currentEventTime = GetTime() for i,button in ipairs(auraframe.buffbuttons) do local buffIndex, untilCancelled if isPlayer then @@ -69,21 +64,18 @@ local function BuffFrameUpdate(frame, buildOnly) button.untilCancelled = untilCancelled button:SetScript("OnClick", BuffButtonClick) button.auraID = buffIndex - if not buildOnly then + if not buildOnly and untilCancelled == 0 then local timeLeft = GetPlayerBuffTimeLeft(buffIndex) LunaUF.ScanTip:ClearLines() LunaUF.ScanTip:SetPlayerBuff(buffIndex) local buffName = LunaScanTipTextLeft1:GetText() - if OldLunaBuffDB[buffName] then - if timeLeft > OldLunaBuffDB[buffName] then + if timeLeft and timeLeft > 0 then + currentBuffTable[buffName] = currentEventTime + if not LunaBuffDB[LunaBuffDBPlayerString][buffName] or timeLeft > LunaBuffDB[LunaBuffDBPlayerString][buffName] then LunaBuffDB[LunaBuffDBPlayerString][buffName] = math.ceil(timeLeft) - else - LunaBuffDB[LunaBuffDBPlayerString][buffName] = OldLunaBuffDB[buffName] end - elseif timeLeft > 0 and buffName then - LunaBuffDB[LunaBuffDBPlayerString][buffName] = math.ceil(timeLeft) end - if (config.timerspinenabled and untilCancelled == 0) then + if config.timerspinenabled then if timeLeft > 0 then CooldownFrame_SetTimer(button.cooldown, GetTime() - (LunaBuffDB[LunaBuffDBPlayerString][buffName] - timeLeft), LunaBuffDB[LunaBuffDBPlayerString][buffName], 1) else @@ -93,6 +85,8 @@ local function BuffFrameUpdate(frame, buildOnly) else button.cooldown:Hide(); end + else + button.cooldown:Hide(); end else button:SetScript("OnClick", nil) @@ -120,19 +114,17 @@ local function BuffFrameUpdate(frame, buildOnly) button.filter = "HARMFUL" if isPlayer then button.auraID = buffIndex - if OldLunaBuffDB then + if not buildOnly then local timeLeft = GetPlayerBuffTimeLeft(buffIndex) LunaUF.ScanTip:ClearLines() LunaUF.ScanTip:SetPlayerBuff(buffIndex) local buffName = LunaScanTipTextLeft1:GetText() - if OldLunaBuffDB[buffName] then - if timeLeft > OldLunaBuffDB[buffName] then - LunaBuffDB[LunaBuffDBPlayerString][buffName] = math.ceil(timeLeft) - else - LunaBuffDB[LunaBuffDBPlayerString][buffName] = OldLunaBuffDB[buffName] + if timeLeft and timeLeft > 0 then + currentBuffTable[buffName] = currentEventTime + if not LunaBuffDB[LunaBuffDBPlayerString][buffName] or timeLeft > LunaBuffDB[LunaBuffDBPlayerString][buffName] then + LunaBuffDB[LunaBuffDBPlayerString][buffName] = math.ceil(timeLeft) + currentBuffTable[buffName] = currentEventTime end - elseif timeLeft > 0 and buffName then - LunaBuffDB[LunaBuffDBPlayerString][buffName] = math.ceil(timeLeft) end if (config.timerspinenabled) then if timeLeft > 0 then @@ -153,8 +145,12 @@ local function BuffFrameUpdate(frame, buildOnly) button:Hide() end end - for k, v in pairs(OldLunaBuffDB) do - OldLunaBuffDB[k] = nil + if isPlayer and not buildOnly then + for k, v in pairs(LunaBuffDB[LunaBuffDBPlayerString]) do + if currentBuffTable[k] ~= currentEventTime then + LunaBuffDB[LunaBuffDBPlayerString][k] = nil + end + end end end From 1713ece5672b5a9a984a35d7625c8f2501f02fe1 Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Sun, 12 Jun 2016 00:57:40 +0200 Subject: [PATCH 27/34] fix broken config mode --- modules/auras.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/auras.lua b/modules/auras.lua index 77d79497..fb787302 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -6,6 +6,7 @@ local LunaBuffDBPlayerString = UnitName("player") .. " of " .. GetCVar("realmNam local currentBuffTable = {} local bufftimers = {} local debufftimers = {} +local FrameUpdateNeeded -- Thanks schaka! :D local function firstToUpper(str) @@ -36,7 +37,7 @@ end local function BuffFrameUpdate(frame, buildOnly) local auraframe = frame or this local unit = auraframe:GetParent().unit - local isPlayer = unit == "player" + local isPlayer = auraframe:GetParent().unitGroup == "player" local config = LunaUF.db.profile.units[auraframe:GetParent().unitGroup].auras local numBuffs = 0 while UnitBuff(unit, numBuffs+1) do @@ -161,14 +162,14 @@ function BuffButtonClick() end local function OnEvent() - if (((this:GetParent().unit == "player") and (event == "PLAYER_AURAS_CHANGED")) - or ((this:GetParent().unit ~= "player") and (arg1 == this:GetParent().unit))) then + if (((this:GetParent().unitGroup == "player") and (event == "PLAYER_AURAS_CHANGED")) + or ((this:GetParent().unitGroup ~= "player") and (arg1 == this:GetParent().unit))) then BuffFrameUpdate(this, false) end end local function OnUpdate() - if not (this:GetParent().unit == "player") then return end + if not (this:GetParent().unitGroup == "player") then return end local config = LunaUF.db.profile.units[this:GetParent().unitGroup].auras local changed for i,button in ipairs(this.buffbuttons) do @@ -251,8 +252,9 @@ local function OnUpdate() button.timeFontstrings["TOP"]:SetText("") end end - if changed then + if changed or FrameUpdateNeeded then BuffFrameUpdate(this, false) + FrameUpdateNeeded = false end end @@ -522,4 +524,5 @@ function Auras:FullUpdate(frame) end end BuffFrameUpdate(frame.auras, true) + FrameUpdateNeeded = true end From 62074c199bf44fa237b0c872c9a779f2eedc839b Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Fri, 15 Jul 2016 23:18:29 +0200 Subject: [PATCH 28/34] UnitBuff don't work for player when mc --- modules/auras.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/auras.lua b/modules/auras.lua index fb787302..3427ee76 100644 --- a/modules/auras.lua +++ b/modules/auras.lua @@ -40,8 +40,14 @@ local function BuffFrameUpdate(frame, buildOnly) local isPlayer = auraframe:GetParent().unitGroup == "player" local config = LunaUF.db.profile.units[auraframe:GetParent().unitGroup].auras local numBuffs = 0 - while UnitBuff(unit, numBuffs+1) do - numBuffs = numBuffs + 1 + if isPlayer then + while GetPlayerBuff(numBuffs, "HELPFUL") ~= -1 do + numBuffs = numBuffs + 1 + end + else + while UnitBuff(unit, numBuffs+1) do + numBuffs = numBuffs + 1 + end end local rows = math.ceil(numBuffs/config.AurasPerRow) local height = rows*auraframe.buffbuttons[1]:GetHeight()+rows From 096982cf48ded9c9e4766cae52461481bed6175a Mon Sep 17 00:00:00 2001 From: LaYt Date: Mon, 18 Jul 2016 14:45:58 +0600 Subject: [PATCH 29/34] fix some nil errors --- modules/squares.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/squares.lua b/modules/squares.lua index b720c01d..5a0830f4 100644 --- a/modules/squares.lua +++ b/modules/squares.lua @@ -170,7 +170,8 @@ function Squares:UpdateAuras(frame) while UnitBuff(frame.unit,i) do ScanTip:ClearLines() ScanTip:SetUnitBuff(frame.unit,i) - buffname = LunaScanTipTextLeft1:GetText() + buffname = LunaScanTipTextLeft1:GetText() or "" + if config.hottracker then if buffname == BS["Rejuvenation"] then frame.squares.centericons[1]:Show() @@ -187,6 +188,7 @@ function Squares:UpdateAuras(frame) break end end + i = i + 1 end i = 1 @@ -204,7 +206,7 @@ function Squares:UpdateAuras(frame) while UnitDebuff(frame.unit,i) do ScanTip:ClearLines() ScanTip:SetUnitDebuff(frame.unit,i) - buffname = LunaScanTipTextLeft1:GetText() + buffname = LunaScanTipTextLeft1:GetText() or "" texture,_,disptype = UnitDebuff(frame.unit,i,config.dispellabledebuffs) if disptype and config.enabledebuffs and num <= 3 then @@ -265,4 +267,4 @@ function Squares:FullUpdate(frame) Squares:UpdateTimers(frame) Squares:UpdateAggro(frame) Squares:UpdateAuras(frame) -end \ No newline at end of file +end From d14aa255c2f9dddfa68ca90ef4d3238819b9ac27 Mon Sep 17 00:00:00 2001 From: LaYt Date: Mon, 18 Jul 2016 14:50:50 +0600 Subject: [PATCH 30/34] fix some nil errors --- modules/squares.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/squares.lua b/modules/squares.lua index 5a0830f4..24190d26 100644 --- a/modules/squares.lua +++ b/modules/squares.lua @@ -171,7 +171,6 @@ function Squares:UpdateAuras(frame) ScanTip:ClearLines() ScanTip:SetUnitBuff(frame.unit,i) buffname = LunaScanTipTextLeft1:GetText() or "" - if config.hottracker then if buffname == BS["Rejuvenation"] then frame.squares.centericons[1]:Show() From c67aca2e4b3f106b2c845506e210ae16b677da23 Mon Sep 17 00:00:00 2001 From: LaYt Date: Mon, 18 Jul 2016 14:54:43 +0600 Subject: [PATCH 31/34] fix some nil errors --- modules/totems.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/totems.lua b/modules/totems.lua index 809d324d..29884a72 100644 --- a/modules/totems.lua +++ b/modules/totems.lua @@ -229,14 +229,14 @@ local oldUseAction = UseAction local function newUseAction(a1, a2, a3) tooltip:ClearLines() tooltip:SetAction(a1) - local spellName = LunaScanTipTextLeft1:GetText() + local spellName = LunaScanTipTextLeft1:GetText() or "" -- Call the original function oldUseAction(a1, a2, a3) -- Test to see if this is a macro if ( GetActionText(a1) or not spellName ) then return end - local rank = LunaScanTipTextRight1:GetText() + local rank = LunaScanTipTextRight1:GetText() or "" if rank then _,_,rank = string.find(rank,"(%d+)") else @@ -314,4 +314,4 @@ function Totems:SetBarTexture(frame,texture) totem:SetStatusBarColor(unpack(totemcolors[i])) end end -end \ No newline at end of file +end From a221e883b026aafdbbfb1af9b96a822a8925b2d9 Mon Sep 17 00:00:00 2001 From: Aviana Date: Mon, 18 Jul 2016 23:25:04 +0200 Subject: [PATCH 32/34] Update LunaUnitFrames.lua Version bump --- LunaUnitFrames.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LunaUnitFrames.lua b/LunaUnitFrames.lua index 7b283e88..db57bde6 100644 --- a/LunaUnitFrames.lua +++ b/LunaUnitFrames.lua @@ -2,7 +2,7 @@ LunaUF = AceLibrary("AceAddon-2.0"):new("AceEvent-2.0", "AceConsole-2.0", "AceDB LunaUF:RegisterDB("LunaDB") -- Assets ---------------------------------------------------------------------------------- -LunaUF.Version = 2007 +LunaUF.Version = 2008 LunaUF.BS = AceLibrary("Babble-Spell-2.2") LunaUF.Banzai = AceLibrary("Banzai-1.0") LunaUF.HealComm = AceLibrary("HealComm-1.0") @@ -1123,4 +1123,4 @@ function LunaUF:LoadUnits() for _, type in pairs(self.unitList) do self.Units:InitializeFrame(type) end -end \ No newline at end of file +end From 5d665d5078a073a7b4ec3df5b4b99917761565b9 Mon Sep 17 00:00:00 2001 From: LaYt Date: Tue, 16 Aug 2016 15:18:19 +0700 Subject: [PATCH 33/34] Small fix in order to "target" and "menu" options work Small fix in order to "target" and "menu" options work from LUF. Just setup them on unused in clique key combinations. --- modules/units.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/units.lua b/modules/units.lua index 0d2d3959..2e09d9ff 100644 --- a/modules/units.lua +++ b/modules/units.lua @@ -243,8 +243,8 @@ local function ShowMenu() end local function OnClick() - if Luna_Custom_ClickFunction then - Luna_Custom_ClickFunction(arg1, this.unit) + if Luna_Custom_ClickFunction and Luna_Custom_ClickFunction(arg1, this.unit) then + return; else local button = (IsControlKeyDown() and "Ctrl-" or "") .. (IsShiftKeyDown() and "Shift-" or "") .. (IsAltKeyDown() and "Alt-" or "") .. arg1 local action = LunaUF.db.profile.clickcasting.bindings[button] @@ -867,4 +867,4 @@ function Units:InitializeFrame(type) else self:LoadUnit(type) end -end \ No newline at end of file +end From 759e815509ead65f465f9666f0b48e543ea24663 Mon Sep 17 00:00:00 2001 From: Sipertruk Date: Sun, 25 Sep 2016 16:59:06 +0200 Subject: [PATCH 34/34] keep blizz casting bar running --- LunaUnitFrames.lua | 48 ++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/LunaUnitFrames.lua b/LunaUnitFrames.lua index db57bde6..4940f439 100644 --- a/LunaUnitFrames.lua +++ b/LunaUnitFrames.lua @@ -980,23 +980,39 @@ function LunaUF:HideBlizzard() -- Castbar local CastingBarFrame = getglobal("CastingBarFrame") if self.db.profile.blizzard.castbar then - CastingBarFrame:RegisterEvent("SPELLCAST_START") - CastingBarFrame:RegisterEvent("SPELLCAST_STOP") - CastingBarFrame:RegisterEvent("SPELLCAST_FAILED") - CastingBarFrame:RegisterEvent("SPELLCAST_INTERRUPTED") - CastingBarFrame:RegisterEvent("SPELLCAST_DELAYED") - CastingBarFrame:RegisterEvent("SPELLCAST_CHANNEL_START") - CastingBarFrame:RegisterEvent("SPELLCAST_CHANNEL_UPDATE") - CastingBarFrame:RegisterEvent("SPELLCAST_CHANNEL_STOP") + if CastingBarFrame.OldShow then + CastingBarFrame.Show = CastingBarFrame.OldShow + end + if CastingBarFrame.OldHide then + CastingBarFrame.Hide = CastingBarFrame.OldHide + end + if CastingBarFrame.OldIsShown then + CastingBarFrame.IsShown = CastingBarFrame.OldIsShown + end + if CastingBarFrame.OldIsVisible then + CastingBarFrame.IsVisible = CastingBarFrame.OldIsVisible + end + if CastingBarFrame.LUAFShown then + CastingBarFrame.LUAFShown = nil + CastingBarFrame:Show() + end else - CastingBarFrame:UnregisterEvent("SPELLCAST_START") - CastingBarFrame:UnregisterEvent("SPELLCAST_STOP") - CastingBarFrame:UnregisterEvent("SPELLCAST_FAILED") - CastingBarFrame:UnregisterEvent("SPELLCAST_INTERRUPTED") - CastingBarFrame:UnregisterEvent("SPELLCAST_DELAYED") - CastingBarFrame:UnregisterEvent("SPELLCAST_CHANNEL_START") - CastingBarFrame:UnregisterEvent("SPELLCAST_CHANNEL_UPDATE") - CastingBarFrame:UnregisterEvent("SPELLCAST_CHANNEL_STOP") + CastingBarFrame.OldShow = CastingBarFrame.Show + CastingBarFrame.OldHide = CastingBarFrame.Hide + CastingBarFrame.OldIsShown = CastingBarFrame.IsShown + CastingBarFrame.OldIsVisible = CastingBarFrame.IsVisible + CastingBarFrame.Show = function(this) + this.LUAFShown = true + end + CastingBarFrame.Hide = function(this) + this.LUAFShown = nil + end + CastingBarFrame.IsShown = function(this) + return this.LUAFShown + end + CastingBarFrame.IsVisible = function(this) + return this.LUAFShown and this:GetParent():IsVisible() + end end --Buffs if self.db.profile.blizzard.buffs then