From 55f21591198166ac1010089eb4619254828349f7 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Wed, 14 Dec 2022 08:06:39 -0300 Subject: [PATCH] Framework update --- Libs/DF/dropdown.lua | 68 ++++++++++++++++----------------- Libs/DF/fw.lua | 2 +- Libs/DF/panel.lua | 91 ++++++++++++++++++++++++++++++++++++++------ Libs/DF/spells.lua | 2 + 4 files changed, 116 insertions(+), 47 deletions(-) diff --git a/Libs/DF/dropdown.lua b/Libs/DF/dropdown.lua index eb79027f5..2da300f4e 100644 --- a/Libs/DF/dropdown.lua +++ b/Libs/DF/dropdown.lua @@ -48,60 +48,60 @@ DF:Mixin(DropDownMetaFunctions, DF.ScriptHookMixin) ------------------------------------------------------------------------------------------------------------ --members --selected value - local gmember_value = function(object) + local gmemberValue = function(object) return object:GetValue() end --tooltip - local gmember_tooltip = function(object) + local gmemberTooltip = function(object) return object:GetTooltip() end --shown - local gmember_shown = function(object) + local gmemberShown = function(object) return object:IsShown() end --frame width - local gmember_width = function(object) + local gmemberWidth = function(object) return object.button:GetWidth() end --frame height - local gmember_height = function(object) + local gmemberHeight = function(object) return object.button:GetHeight() end --current text - local gmember_text = function(object) + local gmemberText = function(object) return object.label:GetText() end --menu creation function - local gmember_function = function(object) + local gmemberFunction = function(object) return object:GetFunction() end --menu width - local gmember_menuwidth = function(object) + local gmemberMenuWidth = function(object) return rawget(object, "realsizeW") end --menu height - local gmember_menuheight = function(object) + local gmemberMenuHeight = function(object) return rawget(object, "realsizeH") end DropDownMetaFunctions.GetMembers = DropDownMetaFunctions.GetMembers or {} - DropDownMetaFunctions.GetMembers["value"] = gmember_value - DropDownMetaFunctions.GetMembers["text"] = gmember_text - DropDownMetaFunctions.GetMembers["shown"] = gmember_shown - DropDownMetaFunctions.GetMembers["width"] = gmember_width - DropDownMetaFunctions.GetMembers["menuwidth"] = gmember_menuwidth - DropDownMetaFunctions.GetMembers["height"] = gmember_height - DropDownMetaFunctions.GetMembers["menuheight"] = gmember_menuheight - DropDownMetaFunctions.GetMembers["tooltip"] = gmember_tooltip - DropDownMetaFunctions.GetMembers["func"] = gmember_function + DropDownMetaFunctions.GetMembers["value"] = gmemberValue + DropDownMetaFunctions.GetMembers["text"] = gmemberText + DropDownMetaFunctions.GetMembers["shown"] = gmemberShown + DropDownMetaFunctions.GetMembers["width"] = gmemberWidth + DropDownMetaFunctions.GetMembers["menuwidth"] = gmemberMenuWidth + DropDownMetaFunctions.GetMembers["height"] = gmemberHeight + DropDownMetaFunctions.GetMembers["menuheight"] = gmemberMenuHeight + DropDownMetaFunctions.GetMembers["tooltip"] = gmemberTooltip + DropDownMetaFunctions.GetMembers["func"] = gmemberFunction DropDownMetaFunctions.__index = function(object, key) local func = DropDownMetaFunctions.GetMembers[key] @@ -120,12 +120,12 @@ DF:Mixin(DropDownMetaFunctions, DF.ScriptHookMixin) ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --tooltip - local smember_tooltip = function(object, value) + local smemberTooltip = function(object, value) return object:SetTooltip(value) end --show - local smember_show = function(object, value) + local smemberShow = function(object, value) if (value) then return object:Show() else @@ -134,7 +134,7 @@ DF:Mixin(DropDownMetaFunctions, DF.ScriptHookMixin) end --hide - local smember_hide = function(object, value) + local smemberHide = function(object, value) if (not value) then return object:Show() else @@ -143,39 +143,39 @@ DF:Mixin(DropDownMetaFunctions, DF.ScriptHookMixin) end --frame width - local smember_width = function(object, value) + local smemberWidth = function(object, value) return object.dropdown:SetWidth(value) end --frame height - local smember_height = function(object, value) + local smemberHeight = function(object, value) return object.dropdown:SetHeight(value) end --menu creation function - local smember_function = function(object, value) + local smemberFunction = function(object, value) return object:SetFunction(value) end --menu width - local smember_menuwidth = function(object, value) + local smemberMenuWidth = function(object, value) object:SetMenuSize(value, nil) end --menu height - local smember_menuheight = function(object, value) + local smemberMenuHeight = function(object, value) object:SetMenuSize(nil, value) end DropDownMetaFunctions.SetMembers = DropDownMetaFunctions.SetMembers or {} - DropDownMetaFunctions.SetMembers["tooltip"] = smember_tooltip - DropDownMetaFunctions.SetMembers["show"] = smember_show - DropDownMetaFunctions.SetMembers["hide"] = smember_hide - DropDownMetaFunctions.SetMembers["width"] = smember_width - DropDownMetaFunctions.SetMembers["menuwidth"] = smember_menuwidth - DropDownMetaFunctions.SetMembers["height"] = smember_height - DropDownMetaFunctions.SetMembers["menuheight"] = smember_menuheight - DropDownMetaFunctions.SetMembers["func"] = smember_function + DropDownMetaFunctions.SetMembers["tooltip"] = smemberTooltip + DropDownMetaFunctions.SetMembers["show"] = smemberShow + DropDownMetaFunctions.SetMembers["hide"] = smemberHide + DropDownMetaFunctions.SetMembers["width"] = smemberWidth + DropDownMetaFunctions.SetMembers["menuwidth"] = smemberMenuWidth + DropDownMetaFunctions.SetMembers["height"] = smemberHeight + DropDownMetaFunctions.SetMembers["menuheight"] = smemberMenuHeight + DropDownMetaFunctions.SetMembers["func"] = smemberFunction DropDownMetaFunctions.__newindex = function(object, key, value) local func = DropDownMetaFunctions.SetMembers[key] diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index c3427b4d1..cfc3174c8 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 403 +local dversion = 405 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index b6c291da3..c1a1435bc 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -7966,7 +7966,7 @@ detailsFramework.CastFrameFunctions = { --[[if not self.spellEndTime then self:UpdateChannelInfo(self.unit) end]]-- - self.value = self.spellEndTime - GetTime() + self.value = self.empowered and (GetTime() - self.spellStartTime) or (self.spellEndTime - GetTime()) end self:RunHooksForWidget("OnShow", self, self.unit) @@ -8005,7 +8005,7 @@ detailsFramework.CastFrameFunctions = { self.percentText:SetText(format("%.1f", abs(self.value - self.maxValue))) elseif (self.channeling) then - local remainingTime = abs(self.value) + local remainingTime = self.empowered and abs(self.value - self.maxValue) or abs(self.value) if (remainingTime > 999) then self.percentText:SetText("") else @@ -8035,6 +8035,7 @@ detailsFramework.CastFrameFunctions = { --update spark position local sparkPosition = self.value / self.maxValue * self:GetWidth() self.Spark:SetPoint("center", self, "left", sparkPosition + self.Settings.SparkOffset, 0) + --in order to allow the lazy tick run, it must return true, it tell that the cast didn't finished return true @@ -8042,7 +8043,7 @@ detailsFramework.CastFrameFunctions = { --tick function for channeling casts OnTick_Channeling = function(self, deltaTime) - self.value = self.value - deltaTime + self.value = self.empowered and self.value + deltaTime or self.value - deltaTime if (self:CheckCastIsDone()) then return @@ -8053,6 +8054,8 @@ detailsFramework.CastFrameFunctions = { --update spark position local sparkPosition = self.value / self.maxValue * self:GetWidth() self.Spark:SetPoint("center", self, "left", sparkPosition + self.Settings.SparkOffset, 0) + + self:CreateOrUpdateEmpoweredPips() return true end, @@ -8185,6 +8188,14 @@ detailsFramework.CastFrameFunctions = { if (not self:IsValid (unit, name, isTradeSkill, true)) then return end + + --empowered? no! + self.holdAtMaxTime = nil + self.empowered = false + self.curStage = nil + self.numStages = nil + self.empStages = nil + self:CreateOrUpdateEmpoweredPips() --setup cast self.casting = true @@ -8239,6 +8250,51 @@ detailsFramework.CastFrameFunctions = { self:RunHooksForWidget("OnCastStart", self, self.unit, "UNIT_SPELLCAST_START") end, + + CreateOrUpdateEmpoweredPips = function(self, unit, numStages, startTime, endTime) + unit = unit or self.unit + numStages = numStages or self.numStages + startTime = startTime or ((self.spellStartTime or 0) * 1000) + endTime = endTime or ((self.spellEndTime or 0) * 1000) + + if not self.empStages or not numStages or numStages <= 0 then + self.stagePips = self.stagePips or {} + for i, stagePip in pairs(self.stagePips) do + stagePip:Hide() + end + return + end + + local width = self:GetWidth() + local height = self:GetHeight() + for i = 1, numStages, 1 do + local curStartTime = self.empStages[i] and self.empStages[i].start + local curEndTime = self.empStages[i] and self.empStages[i].finish + local curDuration = curEndTime - curStartTime + local offset = width * curEndTime / (endTime - startTime) * 1000 + if curDuration > -1 then + + stagePip = self.stagePips[i] + if not stagePip then + stagePip = self:CreateTexture(nil, "overlay", nil, 2) + stagePip:SetBlendMode("ADD") + stagePip:SetTexture([[Interface\CastingBar\UI-CastingBar-Spark]]) + stagePip:SetTexCoord(11/32,18/32,9/32,23/32) + stagePip:SetSize(2, height) + --stagePip = CreateFrame("FRAME", nil, self, "CastingBarFrameStagePipTemplate") + self.stagePips[i] = stagePip + end + + stagePip:ClearAllPoints() + --stagePip:SetPoint("TOP", self, "TOPLEFT", offset, -1) + --stagePip:SetPoint("BOTTOM", self, "BOTTOMLEFT", offset, 1) + --stagePip.BasePip:SetVertexColor(1, 1, 1, 1) + stagePip:SetPoint("CENTER", self, "LEFT", offset, 0) + stagePip:SetVertexColor(1, 1, 1, 1) + stagePip:Show() + end + end + end, UpdateChannelInfo = function(self, unit, ...) local name, text, texture, startTime, endTime, isTradeSkill, notInterruptible, spellID, _, numStages = UnitChannelInfo (unit) @@ -8250,15 +8306,22 @@ detailsFramework.CastFrameFunctions = { --empowered? self.empStages = {} + self.stagePips = self.stagePips or {} + for i, stagePip in pairs(self.stagePips) do + stagePip:Hide() + end + if numStages and numStages > 0 then - self.holdAtMaxTime = GetUnitEmpowerHoldAtMaxTime(unit) + self.holdAtMaxTime = GetUnitEmpowerHoldAtMaxTime(self.unit) self.empowered = true + self.numStages = numStages + local lastStageEndTime = 0 for i = 1, numStages do self.empStages[i] = { start = lastStageEndTime, - finish = lastStageEndTime - GetUnitEmpowerStageDuration(unit, i - 1) / 1000, + finish = lastStageEndTime + GetUnitEmpowerStageDuration(unit, i - 1) / 1000, } lastStageEndTime = self.empStages[i].finish @@ -8270,10 +8333,14 @@ detailsFramework.CastFrameFunctions = { if (self.Settings.ShowEmpoweredDuration) then endTime = endTime + self.holdAtMaxTime end + + --create/update pips + self:CreateOrUpdateEmpoweredPips(unit, numStages, startTime, endTime) else - self.holdAtMaxTime = 0 + self.holdAtMaxTime = nil self.empowered = false - self.curStage = 0 + self.curStage = nil + self.numStages = nil end --setup cast @@ -8289,9 +8356,9 @@ detailsFramework.CastFrameFunctions = { self.spellTexture = texture self.spellStartTime = startTime / 1000 self.spellEndTime = endTime / 1000 - self.value = self.spellEndTime - GetTime() + self.value = self.empowered and (GetTime() - self.spellStartTime) or (self.spellEndTime - GetTime()) self.maxValue = self.spellEndTime - self.spellStartTime - self.numStages = numStages + self.reverseChanneling = self.empowered self:SetMinMaxValues(0, self.maxValue) self:SetValue(self.value) @@ -8494,13 +8561,13 @@ detailsFramework.CastFrameFunctions = { --update the cast time self.spellStartTime = startTime / 1000 self.spellEndTime = endTime / 1000 - self.value = self.spellEndTime - GetTime() + self.value = self.empowered and (GetTime() - self.spellStartTime) or (self.spellEndTime - GetTime()) + self.maxValue = self.spellEndTime - self.spellStartTime - if (self.value < 0) then + if (self.value < 0 or self.value >= self.maxValue) then self.value = 0 end - self.maxValue = self.spellEndTime - self.spellStartTime self:SetMinMaxValues(0, self.maxValue) self:SetValue(self.value) end, diff --git a/Libs/DF/spells.lua b/Libs/DF/spells.lua index 7d647def6..9fe14301e 100644 --- a/Libs/DF/spells.lua +++ b/Libs/DF/spells.lua @@ -1030,6 +1030,8 @@ DF.CrowdControlSpells = { [183752] = "DEMONHUNTER", --Disrupt [331866] = "COVENANT|VENTHYR", --Agent of Chaos (Nadia soulbind) + + [372245] = "EVOKER", --Terror of the Skies } -- additionals for classic