Added empowered spells and first wave of polish on the new breakdown window

This commit is contained in:
Tercio Jose
2023-05-02 22:06:36 -03:00
parent 4fc8a45713
commit abcb6e9086
6 changed files with 158 additions and 74 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
## Interface: 100007
## Interface: 100100
## Title: Details! Damage Meter
## Notes: Essential tool to impress that chick in your raid.
## SavedVariables: _detalhes_global, __details_backup
+1 -1
View File
@@ -1,4 +1,4 @@
## Interface: 100005
## Interface: 100100
## Title: Lib: LibDFramework-1.0
## Notes: Base Framework for many Addons
+1 -1
View File
@@ -1,6 +1,6 @@
local dversion = 422
local dversion = 423
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)
+10
View File
@@ -4526,6 +4526,9 @@ end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- ~standard backdrop
---this is the standard backdrop for detailsframework, it's a dark-ish color semi transparent with a thin opaque black border
---for the background it uses UI-Tooltip-Background with detailsFramework:GetDefaultBackdropColor() color
---for the border it uses Interface\Buttons\WHITE8X8
---also creates an additional texture frame.__background = texture with the same setting of the backdrop background
---@param frame table
---@param bUseSolidColor any
---@param alphaScale number
@@ -7954,6 +7957,7 @@ detailsFramework.CastFrameFunctions = {
end,
UpdateChannelInfo = function(self, unit, ...)
local unitID, castID, spellID = ...
local name, text, texture, startTime, endTime, isTradeSkill, notInterruptible, spellID, _, numStages = UnitChannelInfo (unit)
--is valid?
@@ -8081,7 +8085,9 @@ detailsFramework.CastFrameFunctions = {
end
self.casting = nil
self.channeling = nil
self.finished = true
self.castID = nil
if (not self:HasScheduledHide()) then
--check if settings has no fade option or if its parents are not visible
@@ -8112,8 +8118,10 @@ detailsFramework.CastFrameFunctions = {
local _, maxValue = self:GetMinMaxValues()
self:SetValue(self.maxValue or maxValue or 1)
self.casting = nil
self.channeling = nil
self.finished = true
self.castID = nil
if (not self:HasScheduledHide()) then
--check if settings has no fade option or if its parents are not visible
@@ -8153,6 +8161,7 @@ detailsFramework.CastFrameFunctions = {
self.channeling = nil
self.failed = true
self.finished = true
self.castID = nil
self:SetValue(self.maxValue or select(2, self:GetMinMaxValues()) or 1)
--set the statusbar color
@@ -8174,6 +8183,7 @@ detailsFramework.CastFrameFunctions = {
self.channeling = nil
self.interrupted = true
self.finished = true
self.castID = nil
if (self.Settings.FillOnInterrupt) then
self:SetValue(self.maxValue or select(2, self:GetMinMaxValues()) or 1)
+78 -66
View File
@@ -218,7 +218,7 @@ function Details:OpenBreakdownWindow(instanceObject, actorObject, bFromAttribute
breakdownWindow.attributeName:Show()
end
breakdownWindow.attributeName:SetPoint("CENTER", breakdownWindow.actorName, "CENTER", 0, 14)
breakdownWindow.attributeName:SetPoint("bottomleft", breakdownWindow.actorName, "topleft", 0, 2)
---@type string
local actorClass = actorObject.classe --classe not registered because it should be renamed to english 'class'
@@ -431,32 +431,27 @@ function Details222.BreakdownWindow.SendTargetData(targetList, actorObject, comb
end
end
function breakdownWindow.SetClassIcon(jogador, classe)
if (classe ~= "UNKNOW" and classe ~= "UNGROUPPLAYER") then
breakdownWindow.classIcon:SetTexCoord(Details.class_coords [classe][1], Details.class_coords [classe][2], Details.class_coords [classe][3], Details.class_coords [classe][4])
if (jogador.enemy) then
if (Details.faction_against == "Horde") then
breakdownWindow.actorName:SetTextColor(1, 91/255, 91/255, 1)
else
breakdownWindow.actorName:SetTextColor(151/255, 215/255, 1, 1)
end
else
breakdownWindow.actorName:SetTextColor(1, 1, 1, 1)
end
---set the class or spec icon for the actor displayed
---@param actorObject actor
---@param class string
function breakdownWindow.SetClassIcon(actorObject, class)
if (actorObject.spellicon) then
breakdownWindow.classIcon:SetTexture(actorObject.spellicon)
breakdownWindow.classIcon:SetTexCoord(.1, .9, .1, .9)
elseif (actorObject.spec) then
breakdownWindow.classIcon:SetTexture([[Interface\AddOns\Details\images\spec_icons_normal_alpha]])
breakdownWindow.classIcon:SetTexCoord(unpack(_detalhes.class_specs_coords [actorObject.spec]))
else
if (jogador.enemy) then
if (Details.class_coords [Details.faction_against]) then
breakdownWindow.classIcon:SetTexCoord(unpack(Details.class_coords [Details.faction_against]))
if (Details.faction_against == "Horde") then
breakdownWindow.actorName:SetTextColor(1, 91/255, 91/255, 1)
else
breakdownWindow.actorName:SetTextColor(151/255, 215/255, 1, 1)
end
else
breakdownWindow.actorName:SetTextColor(1, 1, 1, 1)
end
local coords = CLASS_ICON_TCOORDS[class]
if (coords) then
breakdownWindow.classIcon:SetTexture([[Interface\Glues\CHARACTERCREATE\UI-CHARACTERCREATE-CLASSES]])
local l, r, t, b = unpack(coords)
breakdownWindow.classIcon:SetTexCoord(l+0.01953125, r-0.01953125, t+0.01953125, b-0.01953125)
else
breakdownWindow.classIcon:SetTexCoord(Details.class_coords ["MONSTER"][1], Details.class_coords ["MONSTER"][2], Details.class_coords ["MONSTER"][3], Details.class_coords ["MONSTER"][4])
local c = _detalhes.class_coords ["MONSTER"]
breakdownWindow.classIcon:SetTexture("Interface\\AddOns\\Details\\images\\classes")
breakdownWindow.classIcon:SetTexCoord(c[1], c[2], c[3], c[4])
end
end
end
@@ -512,9 +507,10 @@ function Details:CreateBreakdownWindow()
breakdownWindow:SetScale(Details.player_details_window.scale)
--class icon
breakdownWindow.classIcon = breakdownWindow:CreateTexture(nil, "BACKGROUND", nil, 1)
breakdownWindow.classIcon:SetPoint("topleft", breakdownWindow, "topleft", 4, 0)
breakdownWindow.classIcon:SetSize(64, 64)
breakdownWindow.classIcon = breakdownWindow:CreateTexture(nil, "overlay", nil, 1)
breakdownWindow.classIcon:SetPoint("topleft", breakdownWindow, "topleft", 2, -17)
breakdownWindow.classIcon:SetSize(54, 54)
breakdownWindow.classIcon:SetAlpha(0.7)
--close button
breakdownWindow.closeButton = CreateFrame("Button", nil, breakdownWindow, "UIPanelCloseButton")
@@ -528,14 +524,14 @@ function Details:CreateBreakdownWindow()
end)
--title
detailsFramework:NewLabel(breakdownWindow, breakdownWindow, nil, "titleText", Loc ["STRING_PLAYER_DETAILS"] .. " (|cFFFF8811Under Maintenance|r) - Report Bugs At Discord > 'breakdown-bug-report' channel", "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255})
detailsFramework:NewLabel(breakdownWindow, breakdownWindow, nil, "titleText", Loc ["STRING_PLAYER_DETAILS"] .. " (|cFFFF8811Under Maintenance|r) - Report Bugs At Discord", "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255})
breakdownWindow.titleText:SetPoint("center", breakdownWindow, "center")
breakdownWindow.titleText:SetPoint("top", breakdownWindow, "top", 0, -18)
breakdownWindow.titleText:SetPoint("top", breakdownWindow, "top", 0, -6)
--create the texts shown on the window
do
breakdownWindow.actorName = breakdownWindow:CreateFontString(nil, "OVERLAY", "QuestFont_Large")
breakdownWindow.actorName:SetPoint("TOPLEFT", breakdownWindow, "TOPLEFT", 105, -54)
breakdownWindow.actorName = breakdownWindow:CreateFontString(nil, "overlay", "QuestFont_Large")
breakdownWindow.actorName:SetPoint("left", breakdownWindow.classIcon, "right", 20, -7)
breakdownWindow.attributeName = breakdownWindow:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
@@ -558,15 +554,6 @@ function Details:CreateBreakdownWindow()
breakdownWindow.avatar_nick:Hide()
end
--create the gradients in the top and bottom side of the breakdown window
if false then
local gradientStartColor = Details222.ColorScheme.GetColorFor("gradient-background")
local gradientUp = detailsFramework:CreateTexture(breakdownWindow, {gradient = "vertical", fromColor = "transparent", toColor = gradientStartColor}, 1, 40, "artwork", {0, 1, 0, 1})
gradientUp:SetPoint("tops", 1, 1)
local gradientDown = detailsFramework:CreateTexture(breakdownWindow, {gradient = "vertical", fromColor = gradientStartColor, toColor = "transparent"}, 1, 50, "artwork", {0, 1, 0, 1})
gradientDown:SetPoint("bottoms")
end
--statusbar
local statusBar = CreateFrame("frame", nil, breakdownWindow, "BackdropTemplate")
statusBar:SetPoint("bottomleft", breakdownWindow, "bottomleft")
@@ -574,10 +561,21 @@ function Details:CreateBreakdownWindow()
statusBar:SetHeight(PLAYER_DETAILS_STATUSBAR_HEIGHT)
detailsFramework:ApplyStandardBackdrop(statusBar)
statusBar:SetAlpha(PLAYER_DETAILS_STATUSBAR_ALPHA)
breakdownWindow.statusBar = statusBar
statusBar.Text = detailsFramework:CreateLabel(statusBar)
statusBar.Text:SetPoint("left", 2, 0)
--create the gradients in the top and bottom side of the breakdown window
local gradientStartColor = Details222.ColorScheme.GetColorFor("gradient-background")
local gradientUp = detailsFramework:CreateTexture(breakdownWindow, {gradient = "vertical", fromColor = gradientStartColor, toColor = {0, 0, 0, 0.2}}, 1, 68, "artwork", {0, 1, 0, 1})
gradientUp:SetPoint("tops", 1, 1)
local gradientHeight = 481
local gradientDown = detailsFramework:CreateTexture(breakdownWindow, {gradient = "vertical", fromColor = "transparent", toColor = {0, 0, 0, 0.7}}, 1, gradientHeight, "border", {0, 1, 0, 1})
gradientDown:SetPoint("bottomleft", breakdownWindow.statusBar, "topleft", 1, 1)
gradientDown:SetPoint("bottomright", breakdownWindow.statusBar, "topright", -1, 1)
function breakdownWindow:SetStatusbarText(text, fontSize, fontColor)
if (not text) then
breakdownWindow:SetStatusbarText("Details! Damage Meter | Use '/details stats' for statistics", 10, "gray")
@@ -601,11 +599,11 @@ function Details:CreateBreakdownWindow()
local tablePool = Details:GetBreakdownTabsInUse()
for index = 1, #tablePool do
local tab = tablePool[index]
local tabButton = tablePool[index]
if (tab:condition(breakdownWindow.jogador, breakdownWindow.atributo, breakdownWindow.sub_atributo) and not tab.replaced) then
if (tabButton:condition(breakdownWindow.jogador, breakdownWindow.atributo, breakdownWindow.sub_atributo) and not tabButton.replaced) then
--test if can show the tutorial for the comparison tab
if (tab.tabname == "Compare") then
if (tabButton.tabname == "Compare") then
--Details:SetTutorialCVar ("DETAILS_INFO_TUTORIAL1", false)
if (not Details:GetTutorialCVar("DETAILS_INFO_TUTORIAL1")) then
Details:SetTutorialCVar ("DETAILS_INFO_TUTORIAL1", true)
@@ -614,15 +612,15 @@ function Details:CreateBreakdownWindow()
alert.ArrowUP:Show()
alert.ArrowGlowUP:Show()
alert.Text:SetText(Loc ["STRING_INFO_TUTORIAL_COMPARISON1"])
alert:SetPoint("bottom", tab.widget or tab, "top", 5, 28)
alert:SetPoint("bottom", tabButton.widget or tabButton, "top", 5, 28)
alert:Show()
end
end
tab:Show()
tabButton:Show()
tabsShown = tabsShown + 1
tab:ClearAllPoints()
tabButton:ClearAllPoints()
--get the button width
local buttonTemplate = gump:GetTemplate("button", "DETAILS_TAB_BUTTON_TEMPLATE")
@@ -630,44 +628,45 @@ function Details:CreateBreakdownWindow()
--pixelutil might not be compatible with classic wow
if (PixelUtil) then
PixelUtil.SetSize(tab, buttonTemplate.width, buttonTemplate.height)
PixelUtil.SetSize(tabButton, buttonTemplate.width, buttonTemplate.height)
if (tabsShown >= breakLine) then --next row of icons
PixelUtil.SetPoint(tab, "bottomright", breakdownWindow, "topright", -514 + (buttonWidth * (secondRowIndex)), -50)
PixelUtil.SetPoint(tabButton, "bottomright", breakdownWindow, "topright", -514 + (buttonWidth * (secondRowIndex)), -50)
secondRowIndex = secondRowIndex + 1
else
PixelUtil.SetPoint(tab, "bottomright", breakdownWindow, "topright", -514 + (buttonWidth * tabsShown), -72)
PixelUtil.SetPoint(tabButton, "bottomright", breakdownWindow, "topright", -514 + (buttonWidth * tabsShown), -69)
end
else
tab:SetSize(buttonTemplate.width, buttonTemplate.height)
tabButton:SetSize(buttonTemplate.width, buttonTemplate.height)
if (tabsShown >= breakLine) then --next row of icons
tab:SetPoint("bottomright", breakdownWindow, "topright", -514 + (buttonWidth * (secondRowIndex)), -50)
tabButton:SetPoint("bottomright", breakdownWindow, "topright", -514 + (buttonWidth * (secondRowIndex)), -50)
secondRowIndex = secondRowIndex + 1
else
tab:SetPoint("bottomright", breakdownWindow, "topright", -514 + (buttonWidth * tabsShown), -72)
tabButton:SetPoint("bottomright", breakdownWindow, "topright", -514 + (buttonWidth * tabsShown), -69)
end
end
tab:SetAlpha(0.8)
tabButton:SetAlpha(0.8)
else
tab.frame:Hide()
tab:Hide()
tabButton.frame:Hide()
tabButton:Hide()
end
end
if (tabsShown < 2) then
tablePool[1]:SetPoint("BOTTOMLEFT", breakdownWindow.container_barras, "TOPLEFT", 490 - (94 * (1-0)), 1)
tablePool[1]:SetPoint("bottomleft", breakdownWindow.container_barras, "topleft", 490 - (94 * (1-0)), 1)
end
--selected by default
tablePool[1]:Click()
end
breakdownWindow:SetScript("OnHide", function(self)
Details:CloseBreakdownWindow()
for _, tab in ipairs(Details.player_details_tabs) do
tab:Hide()
tab.frame:Hide()
end
end)
breakdownWindow:SetScript("OnHide", function(self)
Details:CloseBreakdownWindow()
for _, tab in ipairs(Details.player_details_tabs) do
tab:Hide()
tab.frame:Hide()
end
end)
breakdownWindow.tipo = 1 --tipo da janela // 1 = janela normal
return breakdownWindow
@@ -695,15 +694,28 @@ function Details:CreatePlayerDetailsTab(tabName, locName, conditionFunc, fillFun
tabButton.localized_name = locName
tabButton.onclick = tabOnClickFunc
tabButton.fillfunction = fillFunc
tabButton.last_actor = {}
tabButton.last_actor = {} --need to double check is this getting cleared
---@type tabframe
local tabFrame = CreateFrame("frame", breakdownWindow:GetName() .. "TabFrame" .. tabName .. math.random(1, 10000), breakdownWindow, "BackdropTemplate")
tabFrame:SetFrameLevel(breakdownWindow:GetFrameLevel()+1)
tabFrame:SetPoint("topleft", breakdownWindow, "topleft", 0, -70)
tabFrame:SetPoint("bottomright", breakdownWindow, "bottomright", 0, 20)
tabFrame:SetPoint("bottomright", breakdownWindow, "bottomright", -1, 20)
tabFrame:Hide()
DetailsFramework:ApplyStandardBackdrop(tabFrame)
tabFrame:SetBackdropBorderColor(0, 0, 0, 0.3)
tabFrame.__background:SetAlpha(0.3)
tabFrame.RightEdge:Hide()
--create the gradients in the top and bottom side of the breakdown window
local gradientStartColor = Details222.ColorScheme.GetColorFor("gradient-background")
local red, green, blue = unpack(gradientStartColor)
local gradientUpDown = detailsFramework:CreateTexture(tabFrame, {gradient = "vertical", fromColor = {red, green, blue, 0}, toColor = {red, green, blue, 0.4}}, 1, 34*2, "artwork", {0, 1, 0, 1})
gradientUpDown:SetPoint("topleft", tabFrame, "topleft", 0, 0)
gradientUpDown:SetPoint("topright", tabFrame, "topright", 0, 0)
tabButton.tabFrame = tabFrame
tabButton.frame = tabFrame
+67 -5
View File
@@ -408,7 +408,6 @@ end
---@param tabFrame breakdownspellstab
function spellsTab.OnCreateTabCallback(tabButton, tabFrame) --~init
spellBreakdownSettings = Details.breakdown_spell_tab
DetailsFramework:ApplyStandardBackdrop(tabFrame)
--create the scrollbar to show the spells in the breakdown window
spellsTab.CreateSpellScrollContainer(tabFrame) --finished
@@ -423,10 +422,10 @@ function spellsTab.OnCreateTabCallback(tabButton, tabFrame) --~init
spellsTab.TabFrame = tabFrame
--create a button in the breakdown window to open the options for this tab
local optionsButton = DF:CreateButton(Details.playerDetailWindow, Details.OpenSpellBreakdownOptions, 130, 20, "Options", 10, nil, nil, nil, nil, nil, DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"))
optionsButton:SetPoint("topleft", Details.playerDetailWindow, "topleft", 210, -45)
optionsButton.textsize = 15
optionsButton.textcolor = "white"
local optionsButton = DF:CreateButton(tabFrame, Details.OpenSpellBreakdownOptions, 130, 20, "options", 14, nil, nil, nil, nil, nil, DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"))
optionsButton:SetPoint("bottomright", tabFrame, "bottomright", -5, 5)
optionsButton.textsize = 16
optionsButton.textcolor = "yellow"
--open the breakdown window at startup for testing
--[=[ debug
@@ -621,6 +620,68 @@ local onEnterSpellBar = function(spellBar, motion) --parei aqui: precisa por nom
blockLine3.rightText:SetText(Loc ["STRING_DPS"] .. ": " .. Details:CommaValue(spellTable.c_total / critTempoPercent))
end
local emporwerSpell = spellTable.e_total
if (emporwerSpell) then
local empowerLevelSum = spellTable.e_total --total sum of empower levels
local empowerAmount = spellTable.e_amt --amount of casts with empower
local empowerAmountPerLevel = spellTable.e_lvl --{[1] = 4; [2] = 9; [3] = 15}
local empowerDamagePerLevel = spellTable.e_dmg --{[1] = 54548745, [2] = 74548745}
---@type breakdownspellblock
local empowerBlock = spellBlockContainer:GetBlock(blockIndex)
empowerBlock:Show()
blockIndex = blockIndex + 1
local level1AverageDamage = "0"
local level2AverageDamage = "0"
local level3AverageDamage = "0"
local level4AverageDamage = "0"
local level5AverageDamage = "0"
if (empowerDamagePerLevel[1]) then
level1AverageDamage = Details:Format(empowerDamagePerLevel[1] / empowerAmountPerLevel[1])
end
if (empowerDamagePerLevel[2]) then
level2AverageDamage = Details:Format(empowerDamagePerLevel[2] / empowerAmountPerLevel[2])
end
if (empowerDamagePerLevel[3]) then
level3AverageDamage = Details:Format(empowerDamagePerLevel[3] / empowerAmountPerLevel[3])
end
if (empowerDamagePerLevel[4]) then
level4AverageDamage = Details:Format(empowerDamagePerLevel[4] / empowerAmountPerLevel[4])
end
if (empowerDamagePerLevel[5]) then
level5AverageDamage = Details:Format(empowerDamagePerLevel[5] / empowerAmountPerLevel[5])
end
empowerBlock:SetValue(100)
empowerBlock.sparkTexture:SetPoint("left", empowerBlock, "left", empowerBlock:GetWidth() + spellBreakdownSettings.blockspell_spark_offset, 0)
empowerBlock:SetColor(0.200, 0.576, 0.498, 0.6)
local blockLine1, blockLine2, blockLine3 = empowerBlock:GetLines()
blockLine1.leftText:SetText("Spell Empower Average Level: " .. string.format("%.2f", empowerLevelSum / empowerAmount))
if (level1AverageDamage ~= "0") then
blockLine2.leftText:SetText("Level 1 Avg: " .. level1AverageDamage .. " (" .. (empowerAmountPerLevel[1] or 0) .. ")")
end
if (level2AverageDamage ~= "0") then
blockLine2.centerText:SetText("Level 2 Avg: " .. level2AverageDamage .. " (" .. (empowerAmountPerLevel[2] or 0) .. ")")
end
if (level3AverageDamage ~= "0") then
blockLine2.rightText:SetText("Level 3 Avg: " .. level3AverageDamage .. " (" .. (empowerAmountPerLevel[3] or 0) .. ")")
end
if (level4AverageDamage ~= "0") then
blockLine3.leftText:SetText("Level 4 Avg: " .. level4AverageDamage .. " (" .. (empowerAmountPerLevel[4] or 0) .. ")")
end
if (level5AverageDamage ~= "0") then
blockLine3.rightText:SetText("Level 5 Avg: " .. level5AverageDamage .. " (" .. (empowerAmountPerLevel[5] or 0) .. ")")
end
end
if (trinketData[spellId]) then
---@type trinketdata
local trinketInfo = trinketData[spellId]
@@ -633,6 +694,7 @@ local onEnterSpellBar = function(spellBar, motion) --parei aqui: precisa por nom
local trinketBlock = spellBlockContainer:GetBlock(blockIndex)
trinketBlock:Show()
trinketBlock:SetValue(100)
trinketBlock.sparkTexture:SetPoint("left", trinketBlock, "left", trinketBlock:GetWidth() + spellBreakdownSettings.blockspell_spark_offset, 0)
blockIndex = blockIndex + 1
local blockLine1, blockLine2, blockLine3 = trinketBlock:GetLines()