Major rework on the M+ end of run panel

This commit is contained in:
Tercio Jose
2024-08-09 20:55:16 -03:00
committed by andrew6180
parent c6fbc67442
commit 065c61c8ff
12 changed files with 816 additions and 289 deletions
+1 -1
View File
@@ -892,7 +892,7 @@ end
---@field IsEnabled fun(self: df_button) : boolean returns true if the button is enabled
---@field SetIcon fun(self: df_button,texture: string|number, width: number|nil, height: number|nil, layout: string|nil, texcoord: table|nil, overlay: table|nil, textDistance: number|nil, leftPadding: number|nil, textHeight: number|nil, shortMethod: any|nil)
---@field GetIconTexture fun(self: df_button) : string returns the texture path of the button icon
---@field SetTexture fun(self: df_button, normalTexture: string, highlightTexture: string, pressedTexture: string, disabledTexture: string) set the regular button textures
---@field SetTexture fun(self: df_button, normalTexture: any, highlightTexture: any, pressedTexture: any, disabledTexture: any) set the regular button textures
---@field SetFontFace fun(self: df_button, font: string) set the button font
---@field SetFontSize fun(self: df_button, size: number) set the button font size
---@field SetTextColor fun(self: df_button, color: any) set the button text color
+2 -1
View File
@@ -314,7 +314,8 @@
---@field CreateHeader fun(self:table, parent:frame, headerTable:df_headercolumndata[], options:table?, frameName:string?) : df_headerframe
---@field CreateGraphicMultiLineFrame fun(self:table, parent:frame, name:string) : df_chartmulti
---@field CreateGraphicLineFrame fun(self:table, parent:frame, name:string) : df_chart
---@field
---@field CreateFlashAnimation fun(self:table, frame:uiobject, onFinishFunc:function?, onLoopFunc:function?) : animationgroup
---@field CreateTimeBar fun(self:table, parent:frame, texture:texturepath|textureid, width:number?, height:number?, value:number?, member:string?, name:string?) : df_timebar
--[=[
Wrapped objects: when using the following functions, the object will be wrapped in a table, e.g. detailsFramework:CreateButton() will return a table with the button, the button will be accessible through the "button" key.
+6 -2
View File
@@ -1,6 +1,6 @@
local dversion = 557
local dversion = 559
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)
@@ -1723,6 +1723,10 @@ local startFlash_Method = function(self, fadeInTime, fadeOutTime, flashDuration,
flashAnimation:Play()
end
---create a flash animation for a frame
---@param frame table
---@param onFinishFunc function?
---@param onLoopFunc function?
function DF:CreateFlashAnimation(frame, onFinishFunc, onLoopFunc)
local flashAnimation = frame:CreateAnimationGroup()
@@ -2619,7 +2623,7 @@ end
--DF.font_templates ["ORANGE_FONT_TEMPLATE"] = {color = "orange", size = 11, font = "Accidental Presidency"}
--DF.font_templates ["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 12, font = "Accidental Presidency"}
--DF.font_templates["ORANGE_FONT_TEMPLATE"] = {color = "orange", size = 10, font = DF:GetBestFontForLanguage()}
DF.font_templates["ORANGE_FONT_TEMPLATE"] = {color = {1, 0.8235, 0, 1}, size = 12, font = DF:GetBestFontForLanguage()}
DF.font_templates["ORANGE_FONT_TEMPLATE"] = {color = {1, 0.8235, 0, 1}, size = 11, font = DF:GetBestFontForLanguage()}
--DF.font_templates["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 9.6, font = DF:GetBestFontForLanguage()}
DF.font_templates["OPTIONS_FONT_TEMPLATE"] = {color = {1, 1, 1, 0.9}, size = 9.6, font = DF:GetBestFontForLanguage()}
DF.font_templates["SMALL_SILVER"] = {color = "silver", size = 9, font = DF:GetBestFontForLanguage()}
+41 -7
View File
@@ -1646,9 +1646,12 @@ function detailsFramework:IconPick (callback, close_when_select, param1, param2)
--fill with icons
local MACRO_ICON_FILENAMES = {}
local SPELLNAMES_CACHE = {}
local SPELLIDS_CACHE = {}
detailsFramework.IconPickFrame:SetScript("OnShow", function()
MACRO_ICON_FILENAMES[1] = "INV_MISC_QUESTIONMARK"
SPELLNAMES_CACHE[1] = "INV_MISC_QUESTIONMARK"
SPELLIDS_CACHE[1] = IS_WOW_PROJECT_MAINLINE and 74008 or 25675
local index = 2
for i = 1, GetNumSpellTabs() do
@@ -1658,10 +1661,11 @@ function detailsFramework:IconPick (callback, close_when_select, param1, param2)
for j = offset, tabEnd - 1 do
--to get spell info by slot, you have to pass in a pet argument
local spellType, ID = GetSpellBookItemInfo(j, "player")
local spellType, ID, si = GetSpellBookItemInfo(j, SPELLBOOK_BANK_PLAYER)
if (spellType ~= "FLYOUT") then
MACRO_ICON_FILENAMES [index] = GetSpellBookItemTexture(j, "player") or 0
SPELLNAMES_CACHE [index] = GetSpellInfo(ID)
MACRO_ICON_FILENAMES [index] = si and si.iconID or GetSpellBookItemTexture(j, SPELLBOOK_BANK_PLAYER) or 0
SPELLNAMES_CACHE [index] = si and si.name or GetSpellInfo(ID)
SPELLIDS_CACHE [index] = si and (si.spellID or si.actionID) or ID
index = index + 1
elseif (spellType == "FLYOUT") then
@@ -1672,6 +1676,7 @@ function detailsFramework:IconPick (callback, close_when_select, param1, param2)
if (isKnown) then
MACRO_ICON_FILENAMES [index] = GetSpellTexture(spellID) or 0
SPELLNAMES_CACHE [index] = GetSpellInfo(spellID)
SPELLIDS_CACHE [index] = spellID
index = index + 1
end
end
@@ -1744,9 +1749,19 @@ function detailsFramework:IconPick (callback, close_when_select, param1, param2)
line.buttons[o].icon:SetTexture(texture)
line.buttons[o].texture = texture
else
line.buttons[o].icon:SetTexture(iconsInThisLine[o])
line.buttons[o].texture = iconsInThisLine[o]
local lineIcon = iconsInThisLine[o]
if type(lineIcon) == "string" and not string.find(lineIcon, "^[Ii]nterface") then
lineIcon = "Interface/ICONS/" .. lineIcon
end
DevTool:AddData(lineIcon, "lineIcon")
line.buttons[o].icon:SetTexture(lineIcon)
line.buttons[o].texture = lineIcon
end
end
for o = #iconsInThisLine+1, 10 do -- cleanup unused
line.buttons[o].icon:SetTexture(nil)
line.buttons[o].texture = nil
end
end
end
@@ -1780,7 +1795,26 @@ function detailsFramework:IconPick (callback, close_when_select, param1, param2)
currentTable = t
end
currentTable[index] = SPELLNAMES_CACHE[i]
currentTable[index] = SPELLIDS_CACHE[i] --SPELLNAMES_CACHE[i] --spellName won't work in 11.0, use IDs instead.
index = index + 1
if (index == 11) then
index = nil
end
end
end
for i = 1, #MACRO_ICON_FILENAMES do
if (MACRO_ICON_FILENAMES[i] and type(MACRO_ICON_FILENAMES[i]) == "string" and MACRO_ICON_FILENAMES[i]:lower():find(filter)) then
if (not index) then
index = 1
local t = {}
iconList[#iconList+1] = t
currentTable = t
end
currentTable[index] = MACRO_ICON_FILENAMES[i]
index = index + 1
if (index == 11) then
@@ -1795,7 +1829,7 @@ function detailsFramework:IconPick (callback, close_when_select, param1, param2)
iconList[#iconList+1] = t
for o = i, i+9 do
if (SPELLNAMES_CACHE[o]) then
t[#t+1] = SPELLNAMES_CACHE[o]
t[#t+1] = SPELLIDS_CACHE[o] --SPELLNAMES_CACHE[o] --spellName won't work in 11.0, use IDs instead.
end
end
end
+111 -25
View File
@@ -1,6 +1,7 @@
local DF = _G["DetailsFramework"]
if (not DF or not DetailsFrameworkCanLoad) then
---@type detailsframework
local detailsFramework = _G["DetailsFramework"]
if (not detailsFramework or not DetailsFrameworkCanLoad) then
return
end
@@ -9,20 +10,69 @@ local type = type
local floor = math.floor
local GetTime = GetTime
---@class df_timebar : statusbar, df_scripthookmixin, df_widgets
---@field type string
---@field dframework boolean
---@field statusBar df_timebar_statusbar
---@field widget statusbar
---@field direction string
---@field HookList table
---@field tooltip string
---@field locked boolean
---@field HasTimer fun(self:df_timebar):boolean return if the timer bar is active showing a timer
---@field SetTimer fun(self:df_timebar, currentTime:number, startTime:number|boolean|nil, endTime:number|nil)
---@field StartTimer fun(self:df_timebar, currentTime:number, startTime:number, endTime:number)
---@field StopTimer fun(self:df_timebar)
---@field ShowSpark fun(self:df_timebar, state:boolean, alpha:number|nil, color:string|nil)
---@field ShowTimer fun(self:df_timebar, bShowTimer:boolean)
---@field SetIcon fun(self:df_timebar, texture:string, L:number|nil, R:number|nil, T:number|nil, B:number|nil)
---@field SetIconSize fun(self:df_timebar, width:number, height:number)
---@field SetTexture fun(self:df_timebar, texture:texturepath|textureid)
---@field SetColor fun(self:df_timebar, color:any, green:number|nil, blue:number|nil, alpha:number|nil)
---@field SetLeftText fun(self:df_timebar, text:string)
---@field SetRightText fun(self:df_timebar, text:string)
---@field SetFont fun(self:df_timebar, font:string|nil, size:number|nil, color:any, shadow:boolean|nil)
---@field SetThrottle fun(self:df_timebar, seconds:number)
---@field SetDirection fun(self:df_timebar, direction:string)
---@class df_timebar_statusbar : statusbar
---@field MyObject df_timebar
---@field hasTimer boolean
---@field startTime number
---@field endTime number
---@field timeLeft1 number
---@field timeLeft2 number
---@field throttle number
---@field isUsingThrottle boolean
---@field showTimer boolean
---@field amountThrottle number
---@field sparkAlpha number
---@field sparkColorR number
---@field sparkColorG number
---@field sparkColorB number
---@field dontShowSpark boolean
---@field direction string
---@field spark texture
---@field icon texture
---@field leftText fontstring
---@field rightText fontstring
---@field backgroundTexture texture
---@field barTexture texture
local APITimeBarFunctions
do
local metaPrototype = {
WidgetType = "timebar",
dversion = DF.dversion,
dversion = detailsFramework.dversion,
}
--check if there's a metaPrototype already existing
if (_G[DF.GlobalWidgetControlNames["timebar"]]) then
if (_G[detailsFramework.GlobalWidgetControlNames["timebar"]]) then
--get the already existing metaPrototype
local oldMetaPrototype = _G[DF.GlobalWidgetControlNames["timebar"]]
local oldMetaPrototype = _G[detailsFramework.GlobalWidgetControlNames["timebar"]]
--check if is older
if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then
if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < detailsFramework.dversion) ) then
--the version is older them the currently loading one
--copy the new values into the old metatable
for funcName, _ in pairs(metaPrototype) do
@@ -31,12 +81,12 @@ do
end
else
--first time loading the framework
_G[DF.GlobalWidgetControlNames["timebar"]] = metaPrototype
_G[detailsFramework.GlobalWidgetControlNames["timebar"]] = metaPrototype
end
end
local TimeBarMetaFunctions = _G[DF.GlobalWidgetControlNames["timebar"]]
DF:Mixin(TimeBarMetaFunctions, DF.ScriptHookMixin)
local TimeBarMetaFunctions = _G[detailsFramework.GlobalWidgetControlNames["timebar"]]
detailsFramework:Mixin(TimeBarMetaFunctions, detailsFramework.ScriptHookMixin)
--methods
TimeBarMetaFunctions.SetMembers = TimeBarMetaFunctions.SetMembers or {}
@@ -159,7 +209,7 @@ function TimeBarMetaFunctions:SetTexture(texture)
end
function TimeBarMetaFunctions:SetColor(color, green, blue, alpha)
local r, g, b, a = DF:ParseColors(color, green, blue, alpha)
local r, g, b, a = detailsFramework:ParseColors(color, green, blue, alpha)
self.statusBar.barTexture:SetVertexColor(r, g, b, a)
end
@@ -172,22 +222,25 @@ end
function TimeBarMetaFunctions:SetFont(font, size, color, shadow)
if (font) then
DF:SetFontFace(self.statusBar.leftText, font)
detailsFramework:SetFontFace(self.statusBar.leftText, font)
end
if (size) then
DF:SetFontSize(self.statusBar.leftText, size)
detailsFramework:SetFontSize(self.statusBar.leftText, size)
end
if (color) then
DF:SetFontColor(self.statusBar.leftText, color)
detailsFramework:SetFontColor(self.statusBar.leftText, color)
end
if (shadow) then
DF:SetFontOutline(self.statusBar.leftText, shadow)
detailsFramework:SetFontOutline(self.statusBar.leftText, shadow)
end
end
---set a throttle for the timer bar, the timer will only update every X seconds
---calling without parameters will disable the throttle
---@param seconds number|nil the amount of seconds to throttle the timer
function TimeBarMetaFunctions:SetThrottle(seconds)
if (seconds and seconds > 0) then
self.statusBar.isUsingThrottle = true
@@ -197,6 +250,8 @@ function TimeBarMetaFunctions:SetThrottle(seconds)
end
end
---accept 'left' 'right' or nil, if ommited will default to right
---@param direction "left"|"right"|nil the direction of the timer bar
function TimeBarMetaFunctions:SetDirection(direction)
direction = direction or "right"
self.direction = direction
@@ -225,6 +280,14 @@ function TimeBarMetaFunctions:StopTimer()
statusBar.spark:Hide()
end
function TimeBarMetaFunctions:ShowTimer(bShowTimer)
if (bShowTimer) then
self.statusBar.showTimer = true
else
self.statusBar.showTimer = nil
end
end
function TimeBarMetaFunctions:ShowSpark(state, alpha, color)
if (type(state) == "boolean" and state == false) then
self.statusBar.dontShowSpark = true
@@ -239,7 +302,7 @@ function TimeBarMetaFunctions:ShowSpark(state, alpha, color)
end
if (color) then
local r, g, b = DF:ParseColors(color)
local r, g, b = detailsFramework:ParseColors(color)
if (r and g and b) then
self.statusBar.sparkColorR = r
self.statusBar.sparkColorG = g
@@ -252,6 +315,8 @@ function TimeBarMetaFunctions:ShowSpark(state, alpha, color)
end
end
---@param self df_timebar_statusbar
---@param deltaTime number
local OnUpdateFunc = function(self, deltaTime)
if (self.isUsingThrottle) then
self.throttle = self.throttle + deltaTime
@@ -283,9 +348,11 @@ local OnUpdateFunc = function(self, deltaTime)
end
end
if (self.showTimer) then
local timeLeft = floor(endTime - timeNow)
local formatedTimeLeft = DF:IntegerToTimer(timeLeft)
local formatedTimeLeft = detailsFramework:IntegerToTimer(timeLeft)
self.rightText:SetText(formatedTimeLeft)
end
--check if finished
if (timeNow >= self.endTime) then
@@ -293,6 +360,12 @@ local OnUpdateFunc = function(self, deltaTime)
end
end
---start a timer on the timebar
---calling without parameters will stop the timer
---@param self df_timebar
---@param currentTime number the time in seconds if startTime is a boolean true. GetTime() when start and end time are passed
---@param startTime number|boolean|nil GetTime() when the timer started. if passed true: startTime and endTime are GetTime() and GetTime() + currentTime, currenTime is the time in seconds
---@param endTime number|nil GetTime() when the timer will end. ignored if startTime is a boolean true
function TimeBarMetaFunctions:SetTimer(currentTime, startTime, endTime)
self.statusBar:Show()
@@ -306,7 +379,7 @@ function TimeBarMetaFunctions:SetTimer(currentTime, startTime, endTime)
--it is the same timer called again
return
end
self.statusBar.startTime = startTime
self.statusBar.startTime = tonumber(startTime) or 0 --fit the number type
self.statusBar.endTime = endTime
else
local bForceNewTimer = type(startTime) == "boolean" and startTime
@@ -352,18 +425,26 @@ function TimeBarMetaFunctions:SetTimer(currentTime, startTime, endTime)
end
end
function DF:CreateTimeBar(parent, texture, width, height, value, member, name)
---create a time bar widget, a timebar is a statubar that can have a timer and a spark
---@param parent frame the parent frame
---@param texture texturepath|textureid the texture of the bar
---@param width number? the width of the bar, default is 150
---@param height number? the height of the bar, default is 20
---@param value number? the initial value of the bar, default is 0
---@param member string? the name of the member in the parent frame
---@param name string? the name of the widget
---@return df_timebar
function detailsFramework:CreateTimeBar(parent, texture, width, height, value, member, name)
if (not name) then
name = "DetailsFrameworkBarNumber" .. DF.BarNameCounter
DF.BarNameCounter = DF.BarNameCounter + 1
name = "DetailsFrameworkBarNumber" .. detailsFramework.BarNameCounter
detailsFramework.BarNameCounter = detailsFramework.BarNameCounter + 1
elseif (not parent) then
return error("Details! FrameWork: parent not found.", 2)
error("Details! FrameWork: parent not found.", 2)
end
if (name:find("$parent")) then
local parentName = DF:GetParentName(parent)
local parentName = detailsFramework:GetParentName(parent)
name = name:gsub("$parent", parentName)
end
@@ -375,18 +456,21 @@ function DF:CreateTimeBar(parent, texture, width, height, value, member, name)
if (member) then
parent[member] = timeBar
end
---@diagnostic disable-next-line: undefined-field
if (parent.dframework) then
---@diagnostic disable-next-line: undefined-field
parent = parent.widget
end
value = value or 0
width = width or 150
height = height or 14
height = height or 20
timeBar.locked = false
timeBar.statusBar = CreateFrame("statusbar", name, parent, "BackdropTemplate")
timeBar.widget = timeBar.statusBar
DF:Mixin(timeBar.statusBar, DF.WidgetFunctions)
detailsFramework:Mixin(timeBar.statusBar, detailsFramework.WidgetFunctions)
timeBar.statusBar.MyObject = timeBar
timeBar.direction = "right"
@@ -397,11 +481,13 @@ function DF:CreateTimeBar(parent, texture, width, height, value, member, name)
if (not TimeBarMetaFunctions[funcName]) then
TimeBarMetaFunctions[funcName] = function(object, ...)
local x = loadstring("return _G['"..object.statusBar:GetName().."']:"..funcName.."(...)")
if (x) then
return x(...)
end
end
end
end
end
--create widgets
timeBar.statusBar:SetWidth(width)
+1 -1
View File
@@ -31,7 +31,7 @@ LIB_OPEN_RAID_CAN_LOAD = false
local major = "LibOpenRaid-1.0"
local CONST_LIB_VERSION = 134
local CONST_LIB_VERSION = 136
if (LIB_OPEN_RAID_MAX_VERSION) then
if (CONST_LIB_VERSION <= LIB_OPEN_RAID_MAX_VERSION) then
+3 -2
View File
@@ -19,8 +19,8 @@
local addonName, Details222 = ...
local version = GetBuildInfo()
Details.build_counter = 12829
Details.alpha_build_counter = 12829 --if this is higher than the regular counter, use it instead
Details.build_counter = 12830
Details.alpha_build_counter = 12830 --if this is higher than the regular counter, use it instead
Details.dont_open_news = true
Details.game_version = version
Details.userversion = version .. " " .. Details.build_counter
@@ -1237,6 +1237,7 @@ do
_detalhes.empty_table = {}
--register textures and fonts for shared media
---@type table
local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0")
--default bars
SharedMedia:Register("statusbar", "Details Hyanda", [[Interface\AddOns\Details\images\bar_hyanda]])
+14 -4
View File
@@ -5343,10 +5343,12 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
local keystoneLevels = {}
local playerRatings = {}
Details.KeystoneLevels = keystoneLevels
--save the keystone level for each of the 5 party members
Details.PlayerRatings = playerRatings
--save the keystone and rating level for each of the 5 party members
local saveGroupMembersKeystoneLevel = function()
local saveGroupMembersKeystoneAndRatingLevel = function()
wipe(keystoneLevels)
local libOpenRaid = LibStub("LibOpenRaid-1.0", true)
@@ -5358,6 +5360,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
if (unitKeystoneInfo) then
local unitName = Details:GetFullName(unitId)
keystoneLevels[unitName] = unitKeystoneInfo.level
playerRatings[unitName] = unitKeystoneInfo.rating
end
end
end
@@ -5368,6 +5371,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
if (unitKeystoneInfo) then
local unitName = Details:GetFullName(unitId)
keystoneLevels[unitName] = unitKeystoneInfo.level
playerRatings[unitName] = unitKeystoneInfo.rating
end
end
end
@@ -5376,7 +5380,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
function Details222.CacheKeystoneForAllGroupMembers()
local _, instanceType, difficultyID = GetInstanceInfo()
if (instanceType == "party") then
saveGroupMembersKeystoneLevel()
saveGroupMembersKeystoneAndRatingLevel()
end
end
@@ -5384,7 +5388,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
Details222.MythicPlus.WorldStateTimerEndAt = time()
--wait until the keystone is updated and send it to the party
saveGroupMembersKeystoneLevel()
saveGroupMembersKeystoneAndRatingLevel()
---@type number mapID
---@type number level
@@ -5982,8 +5986,14 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
end
--open world out of combat spell damage
local outofcombat_spell_damage = function(unused, token, time, whoGUID, whoName, whoFlags, targetGUID, targetName, targetFlags)
--identify if the attacker is a group member
end
local out_of_combat_interresting_events = {
["SPELL_SUMMON"] = parser.summon,
["SPELL_DAMAGE"] = outofcombat_spell_damage,
}
function Details222.Parser.OnParserEventOutOfCombat(self, event, ...)
File diff suppressed because it is too large Load Diff
+5 -1
View File
@@ -1450,7 +1450,11 @@ local default_global_data = {
last_mythicrun_chart = {},
mythicrun_chart_frame = {},
mythicrun_chart_frame_minimized = {},
finished_run_frame = {}, --end of mythic+ panel
finished_run_frame = {},
finished_run_frame_options = {
orientation = "horizontal",
grow_direction = "left",
},
mythicrun_time_type = 1, --1: combat time (the amount of time the player is in combat) 2: run time (the amount of time it took to finish the mythic+ run)
}, --implementar esse time_type quando estiver dando refresh na janela
Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB