Skip to content

Commit

Permalink
Framework Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Dec 19, 2023
1 parent 2a2e9eb commit 0bd0343
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 205 deletions.
200 changes: 0 additions & 200 deletions Libs/DF/auras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,7 @@ local aura_panel_defaultoptions = {
}

function DF:CreateAuraConfigPanel(parent, name, db, changeCallback, options, texts)
local options_text_template = DF:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")
local options_dropdown_template = DF:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")
local options_switch_template = DF:GetTemplate("switch", "OPTIONS_CHECKBOX_TEMPLATE")
local options_slider_template = DF:GetTemplate("slider", "OPTIONS_SLIDER_TEMPLATE")
local options_button_template = DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")

local newAuraPanel = CreateFrame("frame", name, parent, "BackdropTemplate")
newAuraPanel.db = db
Expand Down Expand Up @@ -629,202 +625,6 @@ function DF:CreateAuraConfigPanel(parent, name, db, changeCallback, options, tex

local scrollWidth = 208

do --deprecated, using a scrollbox tempate from scrollbox.lua
local scrollHeight = 343
local lineAmount = 18
local lineHeight = 18
local backdropColor = {.8, .8, .8, 0.2}
local backdropColor_OnEnter = {.8, .8, .8, 0.4}

--aura scroll box default settings
local auraScrollDefaultSettings = {
show_spell_tooltip = false,
line_height = 18,
line_amount = 18,
}

local autoTrackList_LineOnEnter = function(self, capsule, value)
local flag = self.Flag
value = value or self.SpellID

if not flag then
GameCooltip2:Preset(2)
GameCooltip2:SetOwner(self, "left", "right", 2, 0)
GameCooltip2:SetOption("TextSize", 10)

local spellName, _, spellIcon = GetSpellInfo(value)
if (spellName) then
GameCooltip2:AddLine(spellName .. "(" .. value .. ")")
GameCooltip2:AddIcon(spellIcon, 1, 1, 14, 14, .1, .9, .1, .9)
end
GameCooltip2:Show()

else
local spellName, _, spellIcon = GetSpellInfo(value)
if (spellName and spellsWithSameName) then
local spellNameLower = spellName:lower()
local sameNameSpells = spellsWithSameName[spellNameLower]

if (sameNameSpells) then
GameCooltip2:Preset(2)
GameCooltip2:SetOwner(self, "left", "right", 2, 0)
GameCooltip2:SetOption("TextSize", 10)

for i, spellId in ipairs(sameNameSpells) do
GameCooltip2:AddLine(spellName .. " (" .. spellId .. ")")
GameCooltip2:AddIcon(spellIcon, 1, 1, 14, 14, .1, .9, .1, .9)
end

GameCooltip2:Show()
end
end
end
end

local autoTrackList_LineOnLeave = function()
GameCooltip2:Hide()
end


local createAuraScrollBox = function(scrollBoxParent, scrollBoxName, scrollBoxParentKey, scrollBoxTitle, databaseTable, removeAuraFunc, options)
local scrollOptions = {}
detailsFramework.OptionsFunctions.BuildOptionsTable(scrollOptions, auraScrollDefaultSettings, options)

local updateFunc = function(self, data, offset, totalLines)
for i = 1, totalLines do
local index = i + offset
local auraTable = data[index]
if (auraTable) then
local line = self:GetLine(i)
local spellId, spellName, spellIcon, lowerSpellName, flag = unpack(auraTable)

line.SpellID = spellId
line.SpellName = spellName
line.SpellNameLower = lowerSpellName
line.SpellIcon = spellIcon
line.Flag = flag

if (flag) then
line.name:SetText(spellName)
else
line.name:SetText(spellName .. "(" .. spellId .. ")")
end

line.icon:SetTexture(spellIcon)
line.icon:SetTexCoord(.1, .9, .1, .9)
end
end
end

local auraLineOnEnter = function(line)
if (scrollOptions.options.show_spell_tooltip and line.SpellID and GetSpellInfo(line.SpellID)) then
GameTooltip:SetOwner(line, "ANCHOR_CURSOR")
GameTooltip:SetSpellByID(line.SpellID)
GameTooltip:AddLine(" ")
GameTooltip:Show()
end

line:SetBackdropColor(unpack(backdropColor_OnEnter))
end

local auraLineOnLeave = function(self)
self:SetBackdropColor(unpack(backdropColor))
GameTooltip:Hide()
end

local onAuraRemoveButtonClick = function(self)
local spellId = self:GetParent().SpellID
databaseTable[spellId] = nil
databaseTable["" .. (spellId or "")] = nil -- cleanup...
scrollBoxParent[scrollBoxParentKey]:Refresh()
if (removeAuraFunc) then --upvalue
detailsFramework:QuickDispatch(removeAuraFunc)
end
end

local createLineFunc = function(self, index)
local line = CreateFrame("button", "$parentLine" .. index, self, "BackdropTemplate")
local lineHeight = scrollOptions.options.line_height

line:SetPoint("topleft", self, "topleft", 1, -((index - 1) * (lineHeight + 1)) - 1)
line:SetSize(scrollWidth - 2, lineHeight)
line:SetScript("OnEnter", autoTrackList_LineOnEnter)
line:HookScript("OnEnter", auraLineOnEnter)
line:SetScript("OnLeave", autoTrackList_LineOnLeave)
line:HookScript("OnLeave", auraLineOnLeave)

line:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
line:SetBackdropColor(unpack(backdropColor))

local icon = line:CreateTexture("$parentIcon", "overlay")
icon:SetSize(lineHeight - 2, lineHeight - 2)

local name = line:CreateFontString("$parentName", "overlay", "GameFontNormal")
DF:SetFontSize(name, 10)

local removeButton = CreateFrame("button", "$parentRemoveButton", line, "UIPanelCloseButton")
removeButton:SetSize(16, 16)
removeButton:SetScript("OnClick", onAuraRemoveButtonClick)
removeButton:SetPoint("topright", line, "topright")
removeButton:GetNormalTexture():SetDesaturated(true)

icon:SetPoint("left", line, "left", 2, 0)
name:SetPoint("left", icon, "right", 3, 0)

line.icon = icon
line.name = name
line.removebutton = removeButton

return line
end

local auraScrollBox = DF:CreateScrollBox(scrollBoxParent, scrollBoxName, updateFunc, databaseTable, scrollWidth, scrollHeight, scrollOptions.options.line_amount, scrollOptions.options.line_height)
DF:ReskinSlider(auraScrollBox)
scrollBoxParent[scrollBoxParentKey] = auraScrollBox
auraScrollBox.OriginalData = databaseTable

function auraScrollBox:Refresh()
local t = {}
local added = {}
for spellID, flag in pairs(auraScrollBox.OriginalData) do
local spellName, _, spellIcon = GetSpellInfo(spellID)
if (spellName and not added[tonumber(spellID) or 0]) then
local lowerSpellName = spellName:lower()
tinsert(t, {spellID, spellName, spellIcon, lowerSpellName, flag})
added[tonumber(spellID) or 0] = true
end
end

table.sort(t, function(t1, t2) return t1[4] < t2[4] end)

self:SetData(t)
self:Refresh()
end

function auraScrollBox:DoSetData(newDB)
self:SetData(newDB)
self.OriginalData = newDB
if (self.Refresh) then
self:Refresh()
else
self:Refresh()
end
end

local titleLabel = DF:CreateLabel(scrollBoxParent, scrollBoxTitle)
titleLabel.textcolor = "silver"
titleLabel.textsize = 10
titleLabel:SetPoint("bottomleft", auraScrollBox, "topleft", 0, 2)

for i = 1, lineAmount do
auraScrollBox:CreateLine(createLineFunc)
end

auraScrollBox:Refresh()
return auraScrollBox
end
end

local onAuraRemoveCallback = function()
if (changeCallback) then
DF:QuickDispatch(changeCallback)
Expand Down
2 changes: 1 addition & 1 deletion Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


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

Expand Down
6 changes: 5 additions & 1 deletion Libs/DF/rounded_panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,10 @@ function detailsFramework:CreateRoundedPanel(parent, name, optionsTable)

if (newRoundedPanel.options.use_titlebar) then
---@type df_roundedpanel
local titleBar = detailsFramework:CreateRoundedPanel(newRoundedPanel, "$parentTitleBar", {height = newRoundedPanel.options.titlebar_height})
local titleBar = newRoundedPanel:CreateTitleBar(newRoundedPanel.options)

--[=[
local titleBar = detailsFramework:CreateRoundedPanel(newRoundedPanel, "$parentTitleBar", {height = newRoundedPanel.options.titlebar_height, title = newRoundedPanel.options.title})
titleBar:SetColor(unpack(titleBarColor))
titleBar:SetPoint("top", newRoundedPanel, "top", 0, -7)
Expand All @@ -552,6 +555,7 @@ function detailsFramework:CreateRoundedPanel(parent, name, optionsTable)
newRoundedPanel.TitleBar = titleBar
titleBar:SetRoundness(5)
newRoundedPanel.bHasTitleBar = true
--]=]
end

if (newRoundedPanel.options.use_scalebar) then
Expand Down
4 changes: 2 additions & 2 deletions boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
local addonName, Details222 = ...
local version, build, date, tocversion = GetBuildInfo()

Details.build_counter = 12109
Details.alpha_build_counter = 12109 --if this is higher than the regular counter, use it instead
Details.build_counter = 12111
Details.alpha_build_counter = 12111 --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
Expand Down
4 changes: 3 additions & 1 deletion core/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@
local tierPieceMultiplier = 1 --bHasFourPieces and 1.08 or 1
local evokerItemLevel = gearCache[evokerSourceSerial] and gearCache[evokerSourceSerial].ilevel or 400
evokerItemLevel = max(evokerItemLevel, 400)
local itemLevelMultiplier = 1 + ((evokerItemLevel - 400) * 0.01)
local itemLevelMultiplier = 1 + ((evokerItemLevel - 400) * 0.006)

local predictedAmount = 0
if (Details.zone_type == "raid") then --0x410b
Expand Down Expand Up @@ -7284,3 +7284,5 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
end
end


0 comments on commit 0bd0343

Please sign in to comment.