diff --git a/Definitions.lua b/Definitions.lua index a0a8fc7e7..145c7bbc7 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -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) diff --git a/Libs/DF/button.lua b/Libs/DF/button.lua index e18e54950..10442c1a9 100644 --- a/Libs/DF/button.lua +++ b/Libs/DF/button.lua @@ -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 diff --git a/Libs/DF/definitions.lua b/Libs/DF/definitions.lua index f60dd20ec..934fddae1 100644 --- a/Libs/DF/definitions.lua +++ b/Libs/DF/definitions.lua @@ -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 + + diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 564350ed3..9b1e830bd 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 511 +local dversion = 512 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) diff --git a/Libs/LibLuaServer/LibLuaServer.lua b/Libs/LibLuaServer/LibLuaServer.lua index 1237f5550..d822999b5 100644 --- a/Libs/LibLuaServer/LibLuaServer.lua +++ b/Libs/LibLuaServer/LibLuaServer.lua @@ -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 diff --git a/boot.lua b/boot.lua index 68177c37c..5aaac68c2 100644 --- a/boot.lua +++ b/boot.lua @@ -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 diff --git a/classes/class_damage.lua b/classes/class_damage.lua index 3a5f6db02..59bd746ae 100644 --- a/classes/class_damage.lua +++ b/classes/class_damage.lua @@ -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] diff --git a/classes/class_instance.lua b/classes/class_instance.lua index 98d7aa805..a544aa8cb 100644 --- a/classes/class_instance.lua +++ b/classes/class_instance.lua @@ -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 --n�o precionou enter antes de clicar no okey local texto = Details:trim (editbox:GetText()) diff --git a/core/parser.lua b/core/parser.lua index 222c3e500..cc4799029 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -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() diff --git a/frames/window_breakdown/breakdown_spells_spellframes.lua b/frames/window_breakdown/breakdown_spells_spellframes.lua index cb7fd6634..89b221449 100644 --- a/frames/window_breakdown/breakdown_spells_spellframes.lua +++ b/frames/window_breakdown/breakdown_spells_spellframes.lua @@ -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) diff --git a/frames/window_breakdown/window_playerbreakdown_spells.lua b/frames/window_breakdown/window_playerbreakdown_spells.lua index e2deacbda..8eb4bbedf 100644 --- a/frames/window_breakdown/window_playerbreakdown_spells.lua +++ b/frames/window_breakdown/window_playerbreakdown_spells.lua @@ -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() diff --git a/frames/window_report.lua b/frames/window_report.lua index e835d6f53..4223eb180 100644 --- a/frames/window_report.lua +++ b/frames/window_report.lua @@ -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) - - 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) + --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) + table.insert(window.all_widgets, titlebar) table.insert(window.widgets, titlebar) end