More fixes for text color and bar color. Early and under development report button addon to the Player Breakdown window.

This commit is contained in:
Tercio Jose
2024-02-15 17:02:29 -03:00
parent 2fd02eebb1
commit cd8266fff6
12 changed files with 98 additions and 41 deletions
+1
View File
@@ -85,6 +85,7 @@
---@field CommaValue fun(self: details, number: number) : string
---@field CreateEventListener fun(self: details) : table
---@field GetFullName fun(self: details, unitId: any, ambiguateString: any) : string create a CLEU compatible name of the unit passed, return string is in the format "playerName-realmName", the string will also be ambiguated using the ambiguateString passed
---@field GetTextColor fun(self:actor, instanceObject: instance, textSide: string) : number, number, number, number
---@class detailseventlistener : table
---@field RegisterEvent fun(self: detailseventlistener, event: detailsevent, callback: function)
+4 -4
View File
@@ -896,8 +896,8 @@ end
---@field SetClickFunction fun(self: df_button, func: function, param1: any, param2: any, clickType: "left"|"right"|nil)
---create a Details Framework button
---@param parent table
---@param func function
---@param parent frame
---@param callback function
---@param width number
---@param height number
---@param text any
@@ -910,8 +910,8 @@ end
---@param buttonTemplate table|nil
---@param textTemplate table|nil
---@return df_button
function detailsFramework:CreateButton(parent, func, width, height, text, param1, param2, texture, member, name, shortMethod, buttonTemplate, textTemplate)
return detailsFramework:NewButton(parent, parent, name, member, width, height, func, param1, param2, texture, text, shortMethod, buttonTemplate, textTemplate)
function detailsFramework:CreateButton(parent, callback, width, height, text, param1, param2, texture, member, name, shortMethod, buttonTemplate, textTemplate)
return detailsFramework:NewButton(parent, parent, name, member, width, height, callback, param1, param2, texture, text, shortMethod, buttonTemplate, textTemplate)
end
---@return df_button
+3 -1
View File
@@ -151,6 +151,8 @@
---@field CreateIconRowGeneric fun(self:table, parent:frame, name:string?, options:table?)
---@field CreateColorPickButton fun(self:table, parent:frame, name:string?, member:string?, callback:function, alpha:number?, buttonTemplate:table?) : df_button
---@field CreateSlider fun(self:table, parent:frame, width:number?, height:number?, minValue:number?, maxValue:number?, step:number?, defaultv:number?, isDecemal:boolean?, member:string?, name:string?, label:string?, sliderTemplate:string|table?, labelTemplate:string|table?) : df_slider, df_label?
---@field CreateFrameContainer fun(self:table, parent:frame, options:table?, frameName:string?) : df_framecontainer create a frame container, which is a frame that envelops another frame, and can be moved, resized, etc.
---@field
---@field
---@field
+1 -1
View File
@@ -1,6 +1,6 @@
local dversion = 511
local dversion = 512
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)
+4 -3
View File
@@ -4175,9 +4175,10 @@ issecurevariable = function(varName) return true end
---@return any
securecall = function(func, ...) return nil end
---@param origFunc function
---@param hookFunc function
hooksecurefunc = function(origFunc, hookFunc) end
---@param tbl table|string the table where the function is located, if nil, the function is a global function
---@param origFunc string|function
---@param hookFunc function?
hooksecurefunc = function(tbl, origFunc, hookFunc) end
InCombatLockdown = function() end
+2 -2
View File
@@ -18,8 +18,8 @@
local addonName, Details222 = ...
local version, build, date, tocversion = GetBuildInfo()
Details.build_counter = 12307
Details.alpha_build_counter = 12307 --if this is higher than the regular counter, use it instead
Details.build_counter = 12325
Details.alpha_build_counter = 12325 --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
+8 -3
View File
@@ -339,7 +339,12 @@ function Details:GetTextColor(instanceObject, textSide)
end
if (bUseClassColor) then
return unpack(Details.class_colors[actorObject.classe or "UNKNOW"])
local actorClass = actorObject.classe or "UNKNOW"
if (actorClass == "UNKNOW") then
return unpack(instanceObject.row_info.fixed_text_color)
else
return unpack(Details.class_colors[actorClass])
end
else
return unpack(instanceObject.row_info.fixed_text_color)
end
@@ -3286,7 +3291,7 @@ function Details:SetBarColors(bar, instance, r, g, b, a) --[[exported]] --~color
end
bar.textura:SetVertexColor(r, g, b, a)
else
r, g, b = unpack(instance.row_info.fixed_texture_color)
r, g, b, a = unpack(instance.row_info.fixed_texture_color)
bar.textura:SetVertexColor(r, g, b, a)
end
@@ -3653,7 +3658,7 @@ function damageClass.PredictedAugSpellsOnEnter(self)
--add the buff uptime into the tooltip
local allPrescienceTargets = buffUptimeTable[CONST_SPELLID_PRESCIENCE]
if (#allPrescienceTargets > 0) then
if (allPrescienceTargets and #allPrescienceTargets > 0) then
for i = 1, math.min(30, #allPrescienceTargets) do
local uptimeTable = allPrescienceTargets[i]
+10 -5
View File
@@ -3796,16 +3796,21 @@ function Details:envia_relatorio (linhas, custom)
if (combatObject) then
local combatTime = combatObject:GetCombatTime()
segmentTime = Details.gump:IntegerToTimer(combatTime or 0)
else
combatObject = self:GetCombat()
local combatTime = combatObject:GetCombatTime()
segmentTime = Details.gump:IntegerToTimer(combatTime or 0)
end
--effective ou active time
if (Details.time_type == 2 or Details.use_realtimedps) then
linhas[1] = linhas[1] .. " [" .. segmentTime .. " EF]"
else
linhas[1] = linhas[1] .. " [" .. segmentTime .. " AC]"
if (not custom) then
if (Details.time_type == 2 or Details.use_realtimedps) then
linhas[1] = linhas[1] .. " [" .. segmentTime .. " EF]"
else
linhas[1] = linhas[1] .. " [" .. segmentTime .. " AC]"
end
end
local editbox = Details.janela_report.editbox
if (editbox.focus) then --no precionou enter antes de clicar no okey
local texto = Details:trim (editbox:GetText())
+3 -2
View File
@@ -5872,12 +5872,13 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
--if (level >= 28 or Details.user_is_patreon_supporter) then --debug
if (Details.mythic_plus.show_damage_graphic) then
C_Timer.After(0, function()
if (ChallengeModeCompleteBanner) then
ChallengeModeCompleteBanner.timeToHold = 0.1
ChallengeModeCompleteBanner.timeToHold = 0.01
end
end)
--end
end
--send mythic dungeon end event
local zoneName, instanceType, difficultyID, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceMapID, instanceGroupSize = GetInstanceInfo()
@@ -11,9 +11,11 @@ local GetSpellInfo = GetSpellInfo
local _GetSpellInfo = Details.GetSpellInfo
local GameTooltip = GameTooltip
local IsShiftKeyDown = IsShiftKeyDown
local DF = DetailsFramework
local tinsert = table.insert
---@type detailsframework
local DF = DetailsFramework
local spellsTab = DetailsSpellBreakdownTab
local CONST_BAR_HEIGHT = 20
@@ -1297,7 +1299,6 @@ function spellsTab.CreateSpellScrollContainer(tabFrame) --~scroll ~create ~spell
--amount of lines which will be created for the scrollframe
local defaultAmountOfLines = 50
--replace this with a framework scrollframe
---@type breakdownspellscrollframe
local scrollFrame = DF:CreateScrollBox(container, "$parentSpellScroll", refreshSpellsFunc, {}, width, height, defaultAmountOfLines, CONST_SPELLSCROLL_LINEHEIGHT)
DF:ReskinSlider(scrollFrame)
@@ -547,7 +547,7 @@ function spellsTab.OnCreateTabCallback(tabButton, tabFrame) --~init
--spellsTab.CreateReportButtons(tabFrame)
--create a button in the breakdown window to open the options for this tab
local optionsButton = DF:CreateButton(tabFrame, Details.OpenSpellBreakdownOptions, 130, 18, "options", 14)
local optionsButton = DF:CreateButton(tabFrame, Details.OpenSpellBreakdownOptions, 130, 18, Loc["STRING_OPTIONS_PLUGINS_OPTIONS"], 14)
--optionsButton:SetTemplate(DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"))
optionsButton:SetPoint("bottomright", tabFrame, "bottomright", -10, -19)
optionsButton.textsize = 12
@@ -561,6 +561,53 @@ function spellsTab.OnCreateTabCallback(tabButton, tabFrame) --~init
}
DF:AddRoundedCornersToFrame(optionsButton, preset)
--create a report button
local onClickReportButton = function(blizButton, buttonType, param1, param2)
--get what is shown in the breakdown window
local instance = spellsTab.GetInstance()
local actor = spellsTab.GetActor()
local combat = spellsTab.GetCombat()
local displayId, subDisplayId = instance:GetDisplay()
local spellScroll = spellsTab.GetSpellScrollFrame()
local getNumLines = spellScroll:GetNumFramesShown()
local dataToReport = {}
for i = 1, getNumLines do
---@type breakdownspellbar
local thisLine = spellScroll:GetLine(i)
--get the spell id
local spellId = thisLine.spellId
local spellName = GetSpellInfo(spellId)
--get the amount
local bkSpellData = thisLine.bkSpellData
if (bkSpellData) then
--dumpt(bkSpellData)
if (displayId == DETAILS_ATTRIBUTE_DAMAGE) then
if (subDisplayId == DETAILS_ATTRIBUTE_DAMAGE) then
dataToReport[#dataToReport+1] = spellName .. " .. " .. bkSpellData.total --, {bkSpellData.total, spellName, spellId}
end
end
end
end
if (#dataToReport > 0) then
instance:Reportar(dataToReport, {}, nil, nil)
end
end
local reportButton = DF:CreateButton(tabFrame, onClickReportButton, 130, 18, Loc["STRING_REPORT_TEXT"], 1, 2) --will have a text?
reportButton:SetPoint("right", optionsButton, "left", -5, 0)
reportButton.textsize = 12
reportButton.textcolor = "orange"
DF:AddRoundedCornersToFrame(reportButton, preset)
--open the breakdown window at startup for testing
--[=[ debug
C_Timer.After(1, function()
+11 -17
View File
@@ -200,7 +200,11 @@ local _
Details.janela_report.slider.amt:Show()
if (options) then
Details.janela_report.enviar:SetScript("OnClick", function() self:monta_relatorio(param2, options._custom) end)
--dumpt(param2) = {damage, spellName, spellId}
--print(param2, options._custom) options._custom = nil
--print("meu id:", self.meu_id)
local bIsCustom = true
Details.janela_report.enviar:SetScript("OnClick", function() self:monta_relatorio(param2, bIsCustom) end)
else
Details.janela_report.enviar:SetScript("OnClick", function() self:monta_relatorio(param2) end)
end
@@ -663,9 +667,9 @@ local createDropdown = function(thisFrame)
window:SetWidth(342/2 + 5)
window:SetHeight(195)
window:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
window:SetBackdropColor(1, 1, 1, 1)
window:SetBackdropBorderColor(0, 0, 0, 1)
--window:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
--window:SetBackdropColor(1, 1, 1, 1)
--window:SetBackdropBorderColor(0, 0, 0, 1)
if (not window.widgets) then
window.widgets = {}
@@ -674,20 +678,10 @@ local createDropdown = function(thisFrame)
titlebar:SetPoint("topleft", window, "topleft", 2, -3)
titlebar:SetPoint("topright", window, "topright", -2, -3)
titlebar:SetHeight(20)
titlebar:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]], tileSize = 64, tile = true})
titlebar:SetBackdropColor(.5, .5, .5, 1)
titlebar:SetBackdropBorderColor(0, 0, 0, 1)
--titlebar:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]], tileSize = 64, tile = true})
--titlebar:SetBackdropColor(.5, .5, .5, 1)
--titlebar:SetBackdropBorderColor(0, 0, 0, 1)
local bg1 = window:CreateTexture(nil, "background")
bg1:SetTexture([[Interface\AddOns\Details\images\background]], true)
bg1:SetAlpha(0.7)
bg1:SetVertexColor(0.27, 0.27, 0.27)
bg1:SetVertTile(true)
bg1:SetHorizTile(true)
bg1:SetAllPoints()
table.insert(window.all_widgets, bg1)
table.insert(window.widgets, bg1)
table.insert(window.all_widgets, titlebar)
table.insert(window.widgets, titlebar)
end