Skip to content

Commit

Permalink
Major rework on the M+ end of run panel
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Aug 9, 2024
1 parent 512efc9 commit 702309e
Show file tree
Hide file tree
Showing 14 changed files with 838 additions and 364 deletions.
2 changes: 1 addition & 1 deletion Libs/DF/auras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ local tinsert = table.insert
local GetSpellInfo = GetSpellInfo or function(spellID) if not spellID then return nil end local si = C_Spell.GetSpellInfo(spellID) if si then return si.name, nil, si.iconID, si.castTime, si.minRange, si.maxRange, si.spellID, si.originalIconID end end
local lower = string.lower
local SpellBookItemTypeMap = Enum.SpellBookItemType and {[Enum.SpellBookItemType.Spell] = "SPELL", [Enum.SpellBookItemType.None] = "NONE", [Enum.SpellBookItemType.Flyout] = "FLYOUT", [Enum.SpellBookItemType.FutureSpell] = "FUTURESPELL", [Enum.SpellBookItemType.PetAction] = "PETACTION" } or {}
local GetSpellBookItemInfo = GetSpellBookItemInfo or function(...) local si = C_SpellBook.GetSpellBookItemInfo(...) if si then return SpellBookItemTypeMap[si.itemType] or "NONE", si.spellID end end
local GetSpellBookItemInfo = GetSpellBookItemInfo or function(...) local si = C_SpellBook.GetSpellBookItemInfo(...) if si then return SpellBookItemTypeMap[si.itemType] or "NONE", (si.itemType == Enum.SpellBookItemType.Flyout or si.itemType == Enum.SpellBookItemType.PetAction) and si.actionID or si.spellID or si.actionID, si end end
local SPELLBOOK_BANK_PLAYER = Enum.SpellBookSpellBank and Enum.SpellBookSpellBank.Player or "player"
local GetNumSpellTabs = GetNumSpellTabs or C_SpellBook.GetNumSpellBookSkillLines
local GetSpellTabInfo = GetSpellTabInfo or function(tabLine) local skillLine = C_SpellBook.GetSpellBookSkillLineInfo(tabLine) if skillLine then return skillLine.name, skillLine.iconID, skillLine.itemIndexOffset, skillLine.numSpellBookItems, skillLine.isGuild, skillLine.offSpecID end end
Expand Down
2 changes: 1 addition & 1 deletion Libs/DF/button.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion Libs/DF/definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,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.
Expand Down
10 changes: 7 additions & 3 deletions Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


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

Expand Down Expand Up @@ -34,7 +34,7 @@ local GetSpellBookItemName = GetSpellBookItemName or C_SpellBook.GetSpellBookIte
local GetNumSpellTabs = GetNumSpellTabs or C_SpellBook.GetNumSpellBookSkillLines
local GetSpellTabInfo = GetSpellTabInfo or function(tabLine) local skillLine = C_SpellBook.GetSpellBookSkillLineInfo(tabLine) if skillLine then return skillLine.name, skillLine.iconID, skillLine.itemIndexOffset, skillLine.numSpellBookItems, skillLine.isGuild, skillLine.offSpecID end end
local SpellBookItemTypeMap = Enum.SpellBookItemType and {[Enum.SpellBookItemType.Spell] = "SPELL", [Enum.SpellBookItemType.None] = "NONE", [Enum.SpellBookItemType.Flyout] = "FLYOUT", [Enum.SpellBookItemType.FutureSpell] = "FUTURESPELL", [Enum.SpellBookItemType.PetAction] = "PETACTION" } or {}
local GetSpellBookItemInfo = GetSpellBookItemInfo or function(...) local si = C_SpellBook.GetSpellBookItemInfo(...) if si then return SpellBookItemTypeMap[si.itemType] or "NONE", si.spellID end end
local GetSpellBookItemInfo = GetSpellBookItemInfo or function(...) local si = C_SpellBook.GetSpellBookItemInfo(...) if si then return SpellBookItemTypeMap[si.itemType] or "NONE", (si.itemType == Enum.SpellBookItemType.Flyout or si.itemType == Enum.SpellBookItemType.PetAction) and si.actionID or si.spellID or si.actionID, si end end
local SPELLBOOK_BANK_PLAYER = Enum.SpellBookSpellBank and Enum.SpellBookSpellBank.Player or "player"
local SPELLBOOK_BANK_PET = Enum.SpellBookSpellBank and Enum.SpellBookSpellBank.Pet or "pet"
local IsPassiveSpell = IsPassiveSpell or C_Spell.IsSpellPassive
Expand Down Expand Up @@ -2017,6 +2017,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()

Expand Down Expand Up @@ -2915,7 +2919,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()}
Expand Down
53 changes: 45 additions & 8 deletions Libs/DF/panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ local CreateFrame = CreateFrame
local GetSpellInfo = GetSpellInfo or function(spellID) if not spellID then return nil end local si = C_Spell.GetSpellInfo(spellID) if si then return si.name, nil, si.iconID, si.castTime, si.minRange, si.maxRange, si.spellID, si.originalIconID end end
local GetNumSpellTabs = GetNumSpellTabs or C_SpellBook.GetNumSpellBookSkillLines
local GetSpellTabInfo = GetSpellTabInfo or function(tabLine) local skillLine = C_SpellBook.GetSpellBookSkillLineInfo(tabLine) if skillLine then return skillLine.name, skillLine.iconID, skillLine.itemIndexOffset, skillLine.numSpellBookItems, skillLine.isGuild, skillLine.offSpecID end end
local SPELLBOOK_BANK_PLAYER = Enum.SpellBookSpellBank and Enum.SpellBookSpellBank.Player or "player"
local SpellBookItemTypeMap = Enum.SpellBookItemType and {[Enum.SpellBookItemType.Spell] = "SPELL", [Enum.SpellBookItemType.None] = "NONE", [Enum.SpellBookItemType.Flyout] = "FLYOUT", [Enum.SpellBookItemType.FutureSpell] = "FUTURESPELL", [Enum.SpellBookItemType.PetAction] = "PETACTION" } or {}
local GetSpellBookItemInfo = GetSpellBookItemInfo or function(...) local si = C_SpellBook.GetSpellBookItemInfo(...) if si then return SpellBookItemTypeMap[si.itemType] or "NONE", si.spellID end end
local GetSpellBookItemInfo = GetSpellBookItemInfo or function(...) local si = C_SpellBook.GetSpellBookItemInfo(...) if si then return SpellBookItemTypeMap[si.itemType] or "NONE", (si.itemType == Enum.SpellBookItemType.Flyout or si.itemType == Enum.SpellBookItemType.PetAction) and si.actionID or si.spellID or si.actionID, si end end
local GetSpellBookItemTexture = GetSpellBookItemTexture or function(...) return C_SpellBook.GetSpellBookItemTexture(...) end
local GetSpellTexture = GetSpellTexture or function(...) return C_Spell.GetSpellTexture(...) end

local IS_WOW_PROJECT_MAINLINE = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE
local IS_WOW_PROJECT_NOT_MAINLINE = WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE
Expand Down Expand Up @@ -1710,9 +1713,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
Expand All @@ -1722,10 +1728,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
Expand All @@ -1736,6 +1743,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
Expand Down Expand Up @@ -1808,10 +1816,20 @@ 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
end
Expand Down Expand Up @@ -1844,7 +1862,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
Expand All @@ -1859,7 +1896,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
Expand Down
Loading

0 comments on commit 702309e

Please sign in to comment.