Skip to content

Commit

Permalink
Framework update
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Aug 29, 2022
1 parent ab2d87b commit e092c4d
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 15 deletions.
4 changes: 3 additions & 1 deletion Details.toc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## Interface: 90207
## Interface-Mainline: 90207
## Interface-BCC: 20504
## Interface-Wrath: 30400
## Title: Details! Damage Meter
## Notes: Essential tool to impress that chick in your raid.
## SavedVariables: _detalhes_global
Expand Down
16 changes: 15 additions & 1 deletion Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


local dversion = 331
local dversion = 332
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)

Expand Down Expand Up @@ -722,6 +722,20 @@ function DF:SetFontShadow (fontString, r, g, b, a, x, y)
fontString:SetShadowOffset (x, y)
end

function DF:SetFontRotation(fontString, degrees)
if (type(degrees) == "number") then
if (not fontString.__rotationAnimation) then
fontString.__rotationAnimation = DF:CreateAnimationHub(fontString)
fontString.__rotationAnimation.rotator = DF:CreateAnimation(fontString.__rotationAnimation, "rotation", 1, 0, 0)
fontString.__rotationAnimation.rotator:SetEndDelay(math.huge)
fontString.__rotationAnimation.rotator:SetSmoothProgress(1)
end
fontString.__rotationAnimation.rotator:SetDegrees(degrees)
fontString.__rotationAnimation:Play()
fontString.__rotationAnimation:Pause()
end
end

function DF:AddClassColorToText (text, class)
if (type (class) ~= "string") then
return DF:RemoveRealName (text)
Expand Down
17 changes: 16 additions & 1 deletion Libs/DF/label.lua
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,21 @@ local LabelMetaFunctions = _G[DF.GlobalWidgetControlNames ["label"]]
local smember_outline = function (_object, _value)
DF:SetFontOutline (_object.label, _value)
end


local smember_rotation = function(object, rotation)
if (type(rotation) == "number") then
if (not object.__rotationAnimation) then
object.__rotationAnimation = DF:CreateAnimationHub(object.label)
object.__rotationAnimation.rotator = DF:CreateAnimation(object.__rotationAnimation, "rotation", 1, 0, 0)
object.__rotationAnimation.rotator:SetEndDelay(math.huge)
object.__rotationAnimation.rotator:SetSmoothProgress(1)
end
object.__rotationAnimation.rotator:SetDegrees(rotation)
object.__rotationAnimation:Play()
object.__rotationAnimation:Pause()
end
end

LabelMetaFunctions.SetMembers = LabelMetaFunctions.SetMembers or {}
LabelMetaFunctions.SetMembers["show"] = smember_show
LabelMetaFunctions.SetMembers["hide"] = smember_hide
Expand All @@ -200,6 +214,7 @@ local LabelMetaFunctions = _G[DF.GlobalWidgetControlNames ["label"]]
LabelMetaFunctions.SetMembers["textsize"] = smember_textsize--alias
LabelMetaFunctions.SetMembers["shadow"] = smember_outline
LabelMetaFunctions.SetMembers["outline"] = smember_outline--alias
LabelMetaFunctions.SetMembers["rotation"] = smember_rotation--alias

LabelMetaFunctions.__newindex = function (_table, _key, _value)
local func = LabelMetaFunctions.SetMembers [_key]
Expand Down
9 changes: 6 additions & 3 deletions Libs/DF/panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5275,7 +5275,7 @@ DF.IconRowFunctions = {
end
end,

SetIcon = function (self, spellId, borderColor, startTime, duration, forceTexture, descText, count, debuffType, caster, canStealOrPurge, spellName, isBuff)
SetIcon = function (self, spellId, borderColor, startTime, duration, forceTexture, descText, count, debuffType, caster, canStealOrPurge, spellName, isBuff, modRate)

local actualSpellName, _, spellIcon = GetSpellInfo (spellId)

Expand All @@ -5284,6 +5284,7 @@ DF.IconRowFunctions = {
end

spellName = spellName or actualSpellName or "unknown_aura"
modRate = modRate or 1

if (spellIcon) then
local iconFrame = self:GetIcon()
Expand All @@ -5297,14 +5298,14 @@ DF.IconRowFunctions = {
end

if (startTime) then
CooldownFrame_Set (iconFrame.Cooldown, startTime, duration, true, true)
CooldownFrame_Set (iconFrame.Cooldown, startTime, duration, true, true, modRate)

if (self.options.show_text) then
iconFrame.CountdownText:Show()

local now = GetTime()

iconFrame.timeRemaining = startTime + duration - now
iconFrame.timeRemaining = (startTime + duration - now) / modRate
iconFrame.expirationTime = startTime + duration

local formattedTime = (iconFrame.timeRemaining > 0) and self.options.decimal_timer and iconFrame.parentIconRow.FormatCooldownTimeDecimal(iconFrame.timeRemaining) or iconFrame.parentIconRow.FormatCooldownTime(iconFrame.timeRemaining) or ""
Expand All @@ -5328,6 +5329,7 @@ DF.IconRowFunctions = {
end

iconFrame.Cooldown:SetReverse (self.options.cooldown_reverse)
iconFrame.Cooldown:SetDrawSwipe (self.options.cooldown_swipe_enabled)
iconFrame.Cooldown:SetHideCountdownNumbers (self.options.surpress_blizzard_cd_timer)
else
iconFrame.timeRemaining = nil
Expand Down Expand Up @@ -5620,6 +5622,7 @@ local default_icon_row_options = {
on_tick_cooldown_update = true,
decimal_timer = false,
cooldown_reverse = false,
cooldown_swipe = true,
}

function DF:CreateIconRow (parent, name, options)
Expand Down
4 changes: 2 additions & 2 deletions boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

local version, build, date, tocversion = GetBuildInfo()

_detalhes.build_counter = 10001
_detalhes.alpha_build_counter = 10001 --if this is higher than the regular counter, use it instead
_detalhes.build_counter = 10008
_detalhes.alpha_build_counter = 10008 --if this is higher than the regular counter, use it instead
_detalhes.bcc_counter = 41
_detalhes.wotlk_counter = 4
_detalhes.dont_open_news = true
Expand Down
14 changes: 7 additions & 7 deletions frames/window_main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4143,13 +4143,13 @@ function gump:CreateNewLine (instancia, index)
icone_classe:SetTexCoord (.75, 1, .75, 1)
newLine.icone_classe = icone_classe

local icon_frame = CreateFrame ("frame", "DetailsBarra_IconFrame_" .. instancia.meu_id .. "_" .. index, newLine.statusbar)
icon_frame:SetPoint ("topleft", icone_classe, "topleft")
icon_frame:SetPoint ("bottomright", icone_classe, "bottomright")
icon_frame:SetFrameLevel (newLine.statusbar:GetFrameLevel()+1)
icon_frame.instance_id = instancia.meu_id
icon_frame.row = newLine
newLine.icon_frame = icon_frame
local iconFrame = CreateFrame ("frame", "DetailsBarra_IconFrame_" .. instancia.meu_id .. "_" .. index, newLine.statusbar)
iconFrame:SetPoint ("topleft", icone_classe, "topleft")
iconFrame:SetPoint ("bottomright", icone_classe, "bottomright")
iconFrame:SetFrameLevel (newLine.statusbar:GetFrameLevel()+1)
iconFrame.instance_id = instancia.meu_id
iconFrame.row = newLine
newLine.icon_frame = iconFrame

icone_classe:SetPoint ("left", newLine, "left")
newLine.statusbar:SetPoint ("topleft", icone_classe, "topright")
Expand Down

0 comments on commit e092c4d

Please sign in to comment.