From 50d848e1d10dc6a716cd1aa3c17007238ba76f18 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Sun, 9 Apr 2023 22:26:05 -0300 Subject: [PATCH 01/22] breakdown 2.0 --- Definitions.lua | 220 ++- Details.toc | 1 + Details_Wrath.toc | 1 + Libs/DF/fw.lua | 2 +- Libs/DF/panel.lua | 25 +- boot.lua | 4 +- classes/class_combat.lua | 65 + classes/class_damage.lua | 263 ++- classes/class_spelldamage.lua | 5 +- classes/container_spells.lua | 2 +- core/control.lua | 8 + core/parser.lua | 6 +- core/util.lua | 10 + frames/window_playerbreakdown.lua | 2086 ++++------------------ frames/window_playerbreakdown_list.lua | 2 +- frames/window_playerbreakdown_spells.lua | 1907 ++++++++++++++++++++ functions/mixin.lua | 137 +- functions/profiles.lua | 12 + images/overlay_indicator_1.blp | Bin 0 -> 23044 bytes images/overlay_indicator_2.tga | Bin 0 -> 49196 bytes startup.lua | 2 + 21 files changed, 2847 insertions(+), 1911 deletions(-) create mode 100644 frames/window_playerbreakdown_spells.lua create mode 100644 images/overlay_indicator_1.blp create mode 100644 images/overlay_indicator_2.tga diff --git a/Definitions.lua b/Definitions.lua index 78fe596f..68f50813 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -4,6 +4,7 @@ ---@field RegisterStateDriver fun(statedriver: frame, attribute: string, conditional: string) ---@field UnitGUID fun(unit: unit): string ---@field UnitName fun(unit: unit): string +---@field GetCursorPosition fun(): number, number return the position of the cursor on the screen, in pixels, relative to the bottom left corner of the screen. ---@class unixtime : number const @@ -23,7 +24,7 @@ ---@class color : table, string @table(r: red|number, g: green|number, b: blue|number, a: alpha|number) @string(color name) @hex (000000-ffffff) value representing a color, the value must be a table with the following fields: r, g, b, a. r, g, b are numbers between 0 and 1, a is a number between 0 and 1. To retrieve a color from a string or table use: local red, green, blue, alpha = DetailsFramework:ParseColors(color) ---@class scale : number @number(0.65-2.40) value representing the scale factor of the UIObject, the value must be between 0.65 and 2.40, the width and height of the UIObject will be multiplied by this value. ---@class texture : string, number is an object that represents a graphical image. Textures are used to display visual elements such as icons, backgrounds, borders, and more. ----@class frame : UIObject represents a container for other UI elements, such as textures, buttons, text, and more. +---@class frame : uiobject represents a container for other UI elements, such as textures, buttons, text, and more. ---@class width : number property that represents the horizontal size of a UI element, such as a frame or a texture. ---@class height : number property that represents the vertical size of a UI element, such as a frame or a texture. ---@class script : string, function is a piece of code that is executed in response to a specific event, such as a button click or a frame update. Scripts can be used to implement behavior and logic for UI elements. @@ -34,30 +35,30 @@ ---@class health : number amount of hit points (health) of a unit. This value can be changed by taking damage or healing. ---@class role : string @string(TANK, HEALER, DAMAGER, NONE) is a string that represents the role of a unit, such as tank, healer, or damage dealer. ----@class UIObject ----@field Show fun(self: UIObject) ----@field Hide fun(self: UIObject) ----@field SetShown fun(self: UIObject, state: boolean) ----@field IsShown fun(self: UIObject) : boolean ----@field SetAllPoints fun(self: UIObject) ----@field SetParent fun(self: UIObject, parent: frame) ----@field SetSize fun(self: UIObject, width: width|number, height: height|number) ----@field SetWidth fun(self: UIObject, width: width|number) ----@field SetHeight fun(self: UIObject, height: height|number) ----@field SetAlpha fun(self: UIObject, alpha: alpha|number) ----@field SetScale fun(self: UIObject, scale: scale|number) ----@field GetWidth fun(self: UIObject) : width|number ----@field GetHeight fun(self: UIObject) : height|number ----@field GetScale fun(self: UIObject) : scale|number ----@field GetAlpha fun(self: UIObject) : alpha|number ----@field GetSize fun(self: UIObject) : width|number, height|number ----@field GetParent fun(self: UIObject) : frame ----@field GetPoint fun(self: UIObject, index: number): string, frame, string, number, number ----@field SetPoint fun(self: UIObject, point: string, relativeFrame: frame, relativePoint: string, xOffset: number, yOffset: number) ----@field ClearAllPoints fun(self: UIObject) ----@field CreateAnimationGroup fun(self: UIObject, name: string|nil, templateName: string|nil) : animationgroup +---@class uiobject +---@field Show fun(self: uiobject) +---@field Hide fun(self: uiobject) +---@field SetShown fun(self: uiobject, state: boolean) +---@field IsShown fun(self: uiobject) : boolean +---@field SetAllPoints fun(self: uiobject) +---@field SetParent fun(self: uiobject, parent: frame) +---@field SetSize fun(self: uiobject, width: width|number, height: height|number) +---@field SetWidth fun(self: uiobject, width: width|number) +---@field SetHeight fun(self: uiobject, height: height|number) +---@field SetAlpha fun(self: uiobject, alpha: alpha|number) +---@field SetScale fun(self: uiobject, scale: scale|number) +---@field GetWidth fun(self: uiobject) : width|number +---@field GetHeight fun(self: uiobject) : height|number +---@field GetScale fun(self: uiobject) : scale|number +---@field GetAlpha fun(self: uiobject) : alpha|number +---@field GetSize fun(self: uiobject) : width|number, height|number +---@field GetParent fun(self: uiobject) : frame +---@field GetPoint fun(self: uiobject, index: number): string, frame, string, number, number +---@field SetPoint fun(self: uiobject, point: "topleft"|"topright"|"bottomleft"|"bottomright"|"top"|"bottom"|"left"|"right"|"center", relativeFrame: uiobject, relativePoint: "topleft"|"topright"|"bottomleft"|"bottomright"|"top"|"bottom"|"left"|"right"|"center", xOffset: number, yOffset: number) +---@field ClearAllPoints fun(self: uiobject) +---@field CreateAnimationGroup fun(self: uiobject, name: string|nil, templateName: string|nil) : animationgroup ----@class animationgroup : UIObject +---@class animationgroup : uiobject ---@field CreateAnimation fun(self: animationgroup, animationType: string, name: string|nil, inheritsFrom: string|nil) : animation ---@field GetAnimation fun(self: animationgroup, name: string) : animation ---@field GetAnimations fun(self: animationgroup) : table @@ -79,7 +80,7 @@ ---@field SetSmoothProgress fun(self: animationgroup, smooth: boolean) ---@field Stop fun(self: animationgroup) ----@class animation : UIObject +---@class animation : uiobject ---@field GetDuration fun(self: animation) : number ---@field GetEndDelay fun(self: animation) : number ---@field GetOrder fun(self: animation) : number @@ -98,7 +99,7 @@ ---@field SetSmoothing fun(self: animation, smoothing: string) ---@field Stop fun(self: animation) ----@class frame : UIObject +---@class frame : uiobject ---@field SetAttribute fun(self: frame, name: string, value: any) ---@field SetScript fun(self: frame, event: string, handler: function) ---@field GetScript fun(self: frame, event: string) : function @@ -125,9 +126,10 @@ ---@field GetObjectType fun(self: frame) : string ---@field GetChildren fun(self: frame) : frame[] ---@field GetRegions fun(self: frame) : region[] ----@field CreateTexture fun(self: frame, name: string|nil, layer: string, inherits: string|nil, subLayer: number|nil) : texture ----@field CreateFontString fun(self: frame, name: string|nil, layer: string, inherits: string|nil, subLayer: number|nil) : fontstring +---@field CreateTexture fun(self: frame, name: string|nil, layer: "background"|"border"|"artwork"|"overlay"|"highlight", inherits: string|nil, subLayer: number|nil) : texture +---@field CreateFontString fun(self: frame, name: string|nil, layer: "background"|"border"|"artwork"|"overlay"|"highlight", inherits: string|nil, subLayer: number|nil) : fontstring ---@field EnableMouse fun(self: frame, enable: boolean) +---@field SetResizable fun(self: frame, enable: boolean) ---@class button : frame ---@field SetNormalTexture fun(self: button, texture: texture) @@ -150,10 +152,10 @@ ---@field GetButtonState fun(self: button, state: string) : boolean ---@field RegisterForClicks fun(self: button, button1: string|nil, button2: string|nil) ----@class fontstring : UIObject ----@field SetDrawLayer fun(self: fontstring, layer: string, subLayer: number|nil) +---@class fontstring : uiobject +---@field SetDrawLayer fun(self: fontstring, layer: "background"|"border"|"artwork"|"overlay"|"highlight", subLayer: number|nil) ---@field SetFont fun(self: fontstring, font: string, size: number, flags: string) ----@field SetText fun(self: fontstring, text: string) +---@field SetText fun(self: fontstring, text: string|number) ---@field GetText fun(self: fontstring) : string ---@field GetFont fun(self: fontstring) : string, number, string ---@field SetShadowColor fun(self: fontstring, r: red|number, g: green|number, b: blue|number, a: alpha|number) @@ -214,12 +216,12 @@ ---@field GetOrientation fun(self: statusbar) : string ---@field GetReverseFill fun(self: statusbar) : boolean ----@class texture : UIObject ----@field SetDrawLayer fun(self: texture, layer: string, subLayer: number|nil) +---@class texture : uiobject +---@field SetDrawLayer fun(self: texture, layer: "background"|"border"|"artwork"|"overlay"|"highlight", subLayer: number|nil) ---@field SetTexture fun(self: texture, path: string) ---@field SetColorTexture fun(self: texture, r: red|number, g: green|number, b: blue|number, a: alpha|number) ---@field SetDesaturated fun(self: texture, desaturate: boolean) ----@field SetBlendMode fun(self: texture, mode: string) +---@field SetBlendMode fun(self: texture, mode: "ADD"|"BLEND"|"DISABLE"|"MOD"|"MOD2X"|"OVERLAY"|"REPLACE"|"SUBTRACT") ---@field SetVertexColor fun(self: texture, r: red|number, g: green|number, b: blue|number, a: alpha|number) ---@field SetAlpha fun(self: texture, alpha: number) ---@field GetAlpha fun(self: texture) : number @@ -227,7 +229,6 @@ ---@field SetHeight fun(self: texture, height: number) ---@field GetWidth fun(self: texture) : number ---@field GetHeight fun(self: texture) : number ----@field SetPoint fun(self: texture, point: string, relativeFrame: table, relativePoint: string, xOfs: number, yOfs: number) ---@field GetPoint fun(self: texture, index: number) : string, table, string, number, number ---@field SetShown fun(self: texture, state: boolean) ---@field IsShown fun(self: texture) : boolean @@ -263,6 +264,19 @@ ---@field GetBlendMode fun(self: texture) : string ---@field GetVertexColor fun(self: texture) : number, number, number, number + + + + + + +---@class details +---@field GetInstance fun(self: details) : instance +---@field GetCombat fun(self: details) : combat +---@field GetSpellSchoolFormatedName fun(self: details, spellschool: number) : string +---@field CommaValue fun(self: details, number: number) : string +---@field SumSpellTables fun(self: details, spellTables: spelltable[], targetTable: table) + ---@class combat : table ---@field GetCombatTime fun(combat) ---@field GetDeaths fun(combat) --get the table which contains the deaths of the combat @@ -274,6 +288,8 @@ ---@field SetEndTime fun(combat: combat, time: number) ---@field CopyDeathsFrom fun(combat1: combat, combat2: combat, bMythicPlus: boolean) copy the deaths from combat2 to combat1, use true on bMythicPlus if the combat is from a mythic plus run ---@field GetContainer fun(combat: combat, containerType: number) get an actor container, containerType can be 1 for damage, 2 heal, 3 energy, 4 utility +---@field GetSpellCastAmount fun(combat: combat, actorName: string, spellId: number) get the amount of times a spell was casted +---@field GetSpellUptime fun(combat: combat, actorName: string, spellId: number, auraType: string|nil) get the uptime of a buff or debuff ---@field is_mythic_dungeon_trash boolean ---@field is_mythic_dungeon_run_id number ---@field is_mythic_dungeon_segment boolean @@ -289,24 +305,59 @@ ---@field GetActorTable fun(container: actorcontainer) get the table which contains the actors ---@field ListActors fun(container: actorcontainer) usage: for index, actorObject in container:ListActors() do - ---@class spellcontainer : table +---@field GetSpell fun(container: spellcontainer, spellId: number) get a spell by its id ---@field _ActorTable table ---@class spelltable : table +---@field uptime number +---@field total number +---@field spellschool number +---@field counter number amount of hits +---@field c_amt number critical hits +---@field c_min number +---@field c_max number +---@field c_dmg number +---@field n_amt number normal hits +---@field n_dmg number total damage made by normal hits +---@field n_min number min damage made by normal hits +---@field n_max number max damage made by normal hits +---@field targets table store the [target name] = total value +---@field id number --spellid +---@field successful_casted number successful casted times (only for enemies) +---@field g_amt number glacing hits +---@field g_dmg number +---@field r_amt number --resisted +---@field r_dmg number +---@field b_amt number --blocked +---@field b_dmg number +---@field a_amt number --absorved +---@field a_dmg number ---@class actor : table +---@field GetSpellContainer fun(actor: actor, containerType: string) +---@field Name fun(actor: actor) : string get the name of the actor +---@field Tempo fun(actor: actor) : number get the activity or effective time of the actor +---@field GetPets fun(actor: actor) : table get a table with all pet names that belong to the player +---@field GetSpellList fun(actor: actor) : table +---@field BuildSpellTargetFromBreakdownSpellData fun(actor: actor, bkSpellData: breakdownspelldata) : table +---@field BuildSpellTargetFromSpellTable fun(actor: actor, spellTable: spelltable) : table ---@field debuff_uptime_spells table ---@field buff_uptime_spells table ---@field spells table ---@field cooldowns_defensive_spells table ---@field nome string ---@field serial string +---@field spec number ---@field grupo boolean ---@field fight_component boolean ---@field boss_fight_component boolean ---@field boss boolean ---@field last_event unixtime +---@field total_without_pet number +---@field total number +---@field spell_cast table +---@field pets table ---@class segmentid : number ---@class instanceid : number @@ -344,6 +395,103 @@ ---@field RefreshData fun(instance: instance, force: boolean|nil) ---@field RefreshWindow fun(instance: instance, force: boolean|nil) +---@class breakdownscrolldata : table +---@field totalValue number total done by the actor +---@field combatTime number +---@field [breakdownspelldata] breakdownspelldata indexed part of the table + +---@class breakdownexpandbutton : button +---@field texture texture + +---@class breakdownspellscrollframe : frame + +---@class breakdownspellbar : button +---@field index number +---@field rank number +---@field spellId number +---@field name string +---@field combatTime number +---@field perSecond number +---@field percent number +---@field amountCasts number +---@field average number +---@field castAverage number +---@field onMouseUpTime number GetTime() of when the spellbar got OnMouseUp event +---@field cursorPosX number mouse position when the spellbar got OnMouseDown event +---@field cursorPosY number mouse position when the spellbar got OnMouseDown event +---@field spellTable spelltable +---@field bkSpellData breakdownspelldata +---@field statusBar statusbar +---@field expandButton breakdownexpandbutton +---@field spellIconFrame frame +---@field spellIcon texture +---@field targetsSquareFrame breakdowntargetframe +---@field targetsSquareTexture texture +---@field overlayTexture texture +---@field bIsExpandedSpell boolean +---@field ExpandedChildren breakdownspellbar[] store the spellbars which are expanded from this spellbar (spellbars shown when the expand button is pressed) +---@field InLineTexts fontstring[] +---@field AddFrameToHeaderAlignment fun(self: breakdownspellbar, frame: uiobject) +---@field AlignWithHeader fun(self: breakdownspellbar, header: table, align: string|"left") + +---@class breakdownspelldata : table +---@field id number main spellId to be used on the tooltip, name and icon +---@field total number total done by the spell +---@field counter number amount of hits +---@field spellschool number the school of the spell +---@field expanded boolean if is true the show the nested spells +---@field spellTables spelltable[] +---@field spellIds number[] +---@field petNames string[] +---@field bCanExpand boolean +---@field expandedIndex number +---@field bIsExpanded boolean +---@field c_amt number critical hits +---@field c_min number +---@field c_max number +---@field c_dmg number +---@field n_amt number normal hits +---@field n_dmg number total damage made by normal hits +---@field n_min number min damage made by normal hits +---@field n_max number max damage made by normal hits +---@field successful_casted number successful casted times (only for enemies) +---@field g_amt number glacing hits +---@field g_dmg number +---@field r_amt number --resisted +---@field r_dmg number +---@field b_amt number --blocked +---@field b_dmg number +---@field a_amt number --absorved +---@field a_dmg number + +---@class breakdowntargetframe : frame +---@field spellId number +---@field bkSpellData breakdownspelldata +---@field spellTable spelltable +---@field texture texture +---@field bIsMainLine boolean + +---@class tabframe : frame this is the tab frame object for the breakdown window + +---@class breakdownspellblockcontainer : frame container for the spellblocks in the breakdown window +---@field SpellBlocks breakdownspellblock[] +---@field UpdateBlocks fun(self: breakdownspellblockcontainer) +---@field ClearBlocks fun(self: breakdownspellblockcontainer) +---@field GetBlock fun(self: breakdownspellblockcontainer, index: number) : breakdownspellblock + +---@class breakdownspellblock : statusbar breakdownspellblock object which is created inside the breakdownspellblockcontainer +---@field Lines breakdownspellblockline[] +---@field reportButton button +---@field overlay texture +---@field sparkTexture texture +---@field gradientTexture texture +---@field GetLine fun(self: breakdownspellblock, index: number) : breakdownspellblockline +---@field GetLines fun(self: breakdownspellblock) : breakdownspellblockline, breakdownspellblockline, breakdownspellblockline + +---@class breakdownspellblockline : frame a line inside a breakdownspellblock, there's 3 of them in each breakdownspellblock +---@field leftText fontstring +---@field centerText fontstring +---@field rightText fontstring diff --git a/Details.toc b/Details.toc index 5015b2ae..4a0f7c5a 100644 --- a/Details.toc +++ b/Details.toc @@ -87,6 +87,7 @@ frames\window_playerbreakdown_list.lua frames\window_playerbreakdown_compare.lua frames\window_playerbreakdown_avoidance.lua frames\window_playerbreakdown_auras.lua +frames\window_playerbreakdown_spells.lua frames\window_report.lua frames\window_main.lua frames\window_custom.lua diff --git a/Details_Wrath.toc b/Details_Wrath.toc index 18fd73ce..6ef3fc4f 100644 --- a/Details_Wrath.toc +++ b/Details_Wrath.toc @@ -80,6 +80,7 @@ frames\window_playerbreakdown_list.lua frames\window_playerbreakdown_compare.lua frames\window_playerbreakdown_avoidance.lua frames\window_playerbreakdown_auras.lua +frames\window_playerbreakdown_spells.lua frames\window_report.lua frames\window_main.lua frames\window_custom.lua diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 5196683b..4adfe77a 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 421 +local dversion = 422 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index d1294be9..8fdb8a94 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -5084,6 +5084,15 @@ detailsFramework.HeaderFunctions = { tinsert(self.FramesToAlign, frame) end, + ResetFramesToHeaderAlignment = function(self) + wipe(self.FramesToAlign) + end, + + SetFramesToHeaderAlignment = function(self, ...) + wipe(self.FramesToAlign) + self.FramesToAlign = {...} + end, + GetFramesFromHeaderAlignment = function(self, frame) return self.FramesToAlign or {} end, @@ -5100,16 +5109,18 @@ detailsFramework.HeaderFunctions = { frame:ClearAllPoints() local columnHeader = columnHeaderFrames[i] - local offset = 0 + if (columnHeader) then + local offset = 0 - if (columnHeader.columnAlign == "right") then - offset = columnHeader:GetWidth() - if (frame:GetObjectType() == "FontString") then - frame:SetJustifyH("right") + if (columnHeader.columnAlign == "right") then + offset = columnHeader:GetWidth() + if (frame:GetObjectType() == "FontString") then + frame:SetJustifyH("right") + end end - end - frame:SetPoint(columnHeader.columnAlign, self, anchor, columnHeader.XPosition + columnHeader.columnOffset + offset, 0) + frame:SetPoint(columnHeader.columnAlign, self, anchor, columnHeader.XPosition + columnHeader.columnOffset + offset, 0) + end end end, diff --git a/boot.lua b/boot.lua index 49244b99..abc1b925 100644 --- a/boot.lua +++ b/boot.lua @@ -87,6 +87,7 @@ Details222.Perf = {} Details222.Cooldowns = {} Details222.GarbageCollector = {} + Details222.BreakdownWindow = {} ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --initialization stuff @@ -777,8 +778,9 @@ do local UIParent = UIParent --api locals --Info Window - _detalhes.playerDetailWindow = CreateFrame("Frame", "DetailsPlayerDetailsWindow", UIParent, "BackdropTemplate") + _detalhes.playerDetailWindow = CreateFrame("Frame", "DetailsBreakdownWindow", UIParent, "BackdropTemplate") _detalhes.PlayerDetailsWindow = _detalhes.playerDetailWindow + Details.BreakdownWindow = _detalhes.playerDetailWindow --Event Frame _detalhes.listener = CreateFrame("Frame", nil, UIParent) diff --git a/classes/class_combat.lua b/classes/class_combat.lua index bcdd8cb2..e964dac9 100644 --- a/classes/class_combat.lua +++ b/classes/class_combat.lua @@ -180,6 +180,71 @@ return self.alternate_power end + ---return the amount of casts of a spells from an actor + ---@param actorName string + ---@param spellId number + ---@return number + function combate:GetSpellCastAmount(actorName, spellId) + ---@type actorcontainer + local utilityContainer = self:GetContainer(DETAILS_ATTRIBUTE_MISC) + ---@type actor + local actorObject = utilityContainer:GetActor(actorName) + if (actorObject) then + return actorObject.spell_cast[spellId] or 0 + else + return 0 + end + end + + ---return the uptime of a buff from an actor + ---@param actorName string + ---@param spellId number + ---@param auraType string|nil if nil get 'buff' + ---@return number + function combate:GetSpellUptime(actorName, spellId, auraType) + ---@type actorcontainer + local utilityContainer = self:GetContainer(DETAILS_ATTRIBUTE_MISC) + ---@type actor + local actorObject = utilityContainer:GetActor(actorName) + if (actorObject) then + if (auraType) then + ---@type spellcontainer + local buffUptimeContainer = actorObject:GetSpellContainer(auraType) + if (buffUptimeContainer) then + ---@type spelltable + local spellTable = buffUptimeContainer:GetSpell(spellId) + if (spellTable) then + return spellTable.uptime or 0 + end + end + else + do --if not auraType passed, attempt to get the uptime from debuffs first, if it fails, get from buffs + ---@type spellcontainer + local debuffContainer = actorObject:GetSpellContainer("debuff") + if (debuffContainer) then + ---@type spelltable + local spellTable = debuffContainer:GetSpell(spellId) + if (spellTable) then + return spellTable.uptime or 0 + end + end + end + do + ---@type spellcontainer + local buffContainer = actorObject:GetSpellContainer("buff") + if (buffContainer) then + ---@type spelltable + local spellTable = buffContainer:GetSpell(spellId) + if (spellTable) then + return spellTable.uptime or 0 + end + end + end + end + end + return 0 + end + --return the name of the encounter or enemy function combate:GetCombatName(try_find) if (self.is_pvp) then diff --git a/classes/class_damage.lua b/classes/class_damage.lua index f2090439..d52b38e2 100644 --- a/classes/class_damage.lua +++ b/classes/class_damage.lua @@ -102,6 +102,41 @@ [73967] = true, --xuen } + --damage mixin + local damageClassMixin = { + ---check which data is shown in the instance and call a function to build the data for a broker + ---@param actor actor + ---@param instance instance + BuildSpellDetails = function(actor, instance, spellId) + local mainSection, subSection = instance:GetDisplay() + local combatObject = instance:GetCombat() + if (subSection == 1 or subSection == 2) then + return actor:BuildSpellDamageDoneDetails(instance, combatObject, spellId) + + elseif (subSection == 3) then + return self:MontaDetalhesDamageTaken (spellid, barra, instancia) + + elseif (subSection == 4) then + return self:MontaDetalhesFriendlyFire (spellid, barra, instancia) + + elseif (subSection == 6) then + if (bitBand(self.flag_original, 0x00000400) ~= 0) then --� um jogador + return self:MontaDetalhesDamageDone (spellid, barra, instancia) + end + return self:MontaDetalhesEnemy (spellid, barra, instancia) + end + end, + + } + + ---prepare data to send to a broker to show details about a spell + ---@param actor actor + ---@param combat combat + ---@param spellId number + damageClassMixin.BuildSpellDamageDoneDetails = function(actor, combat, spellId) + + end + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --exported functions @@ -492,6 +527,7 @@ end setmetatable(newDamageActor, atributo_damage) detailsFramework:Mixin(newDamageActor, Details222.Mixins.ActorMixin) + detailsFramework:Mixin(newDamageActor, damageClassMixin) return newDamageActor end @@ -3090,7 +3126,7 @@ end end end ---@self: actor object +---@self: actor object function Details:SetClassIcon(texture, instance, class) --[[ exported]] local customIcon if (Details.immersion_unit_special_icons) then @@ -4431,135 +4467,187 @@ local getSpellDetails = function(unitGUID, spellName) end end + +--[=[ + current: passando todas as spells para o breakdown, até mesmo as spells que não tem merge é enviado a spell total e a a spellTable logo em seguida + isso forma uma array com o dobro do tamanho e spells duplicadas + + passar as spells repetidas em uma segunda array? + + não passar nada e deixar o sistema aprender sozinho, como o sistema vai saber que precisa por uma arrow na linha? (para expandi-la) + + +--]=] + ------ Damage Done & Dps -function atributo_damage:MontaInfoDamageDone() +function atributo_damage:MontaInfoDamageDone() --I guess this fills the list of spells in the topleft scrollBar in the summary tab + --the goal of this function is to build a list of spells the actor used and send the data to Details! which will delivery to the summary tab actived + --so the script only need to build the list of spells and send it to Details! + ---@type actor local actorObject = self - - local allLines = info.barras1 + ---@type instance local instance = info.instancia - - --damage rank - local combatObject = instance:GetShowingCombat() + ---@type combat + local combatObject = instance:GetCombat() + ---@type number local diff = combatObject:GetDifficulty() - local attribute, subAttribute = instance:GetDisplay() + ---@type string + local playerName = actorObject:Name() + --guild ranking on a boss --check if is a raid encounter and if is heroic or mythic - if (diff and (diff == 15 or diff == 16)) then - local db = Details.OpenStorage() - if (db) then - local bestRank, encounterTable = Details.storage:GetBestFromPlayer (diff, combatObject:GetBossInfo().id, "damage", self.nome, true) - if (bestRank) then - --discover which are the player position in the guild rank - local playerTable, onEncounter, rankPosition = Details.storage:GetPlayerGuildRank (diff, combatObject:GetBossInfo().id, "damage", self.nome, true) - local text1 = self.nome .. " Guild Rank on " .. (combatObject:GetBossInfo().name or "") .. ": |cFFFFFF00" .. (rankPosition or "x") .. "|r Best Dps: |cFFFFFF00" .. Details:ToK2((bestRank[1] or 0) / encounterTable.elapsed) .. "|r (" .. encounterTable.date:gsub(".*%s", "") .. ")" - info:SetStatusbarText (text1, 10, "gray") + do + if (diff and (diff == 15 or diff == 16)) then + local db = Details.OpenStorage() + if (db) then + local bestRank, encounterTable = Details.storage:GetBestFromPlayer(diff, combatObject:GetBossInfo().id, "damage", playerName, true) + if (bestRank) then + --discover which are the player position in the guild rank + local playerTable, onEncounter, rankPosition = Details.storage:GetPlayerGuildRank (diff, combatObject:GetBossInfo().id, "damage", playerName, true) + local text1 = playerName .. " Guild Rank on " .. (combatObject:GetBossInfo().name or "") .. ": |cFFFFFF00" .. (rankPosition or "x") .. "|r Best Dps: |cFFFFFF00" .. Details:ToK2((bestRank[1] or 0) / encounterTable.elapsed) .. "|r (" .. encounterTable.date:gsub(".*%s", "") .. ")" + info:SetStatusbarText (text1, 10, "gray") + else + info:SetStatusbarText() + end else info:SetStatusbarText() end else info:SetStatusbarText() end - else - info:SetStatusbarText() end + ---@type number local totalDamageWithoutPet = actorObject.total_without_pet + ---@type number local actorTotalDamage = actorObject.total - + ---@type table local actorSpellsSorted = {} + ---@type table local actorSpells = actorObject:GetSpellList() - local bShouldMergePlayerAbilities = Details.merge_player_abilities - local bShouldMergePetAbilities = Details.merge_pet_abilities - wipeSpellCache() - --get time type + --get time local actorCombatTime - if (Details.time_type == 1 or not self.grupo) then - actorCombatTime = self:Tempo() + if (Details.time_type == 1 or not actorObject.grupo) then + actorCombatTime = actorObject:Tempo() elseif (Details.time_type == 2) then actorCombatTime = info.instancia.showing:GetCombatTime() end + --actor spells + ---@type {[string]: number} + local alreadyAdded = {} for spellId, spellTable in pairs(actorSpells) do - local spellName, _, spellIcon = _GetSpellInfo(spellId) + ---@cast spellId number + ---@cast spellTable spelltable + + spellTable.ChartData = nil + + ---@type string + local spellName = _GetSpellInfo(spellId) if (spellName) then - local spellTotal = spellTable.total - local spellPercent = spellTable.total / actorTotalDamage * 100 - local nameString = spellName - - --problem: will show the first ability found when hovering over the spell - if (bShouldMergePlayerAbilities) then - local bAlreadyAdded = false - for i = 1, #actorSpellsSorted do - local thisSpell = actorSpellsSorted[i] - if (thisSpell[4] == nameString) then - bAlreadyAdded = true - thisSpell[2] = thisSpell[2] + spellTotal - end - end - - if (not bAlreadyAdded) then - tinsert(actorSpellsSorted, {spellId, spellTotal, spellPercent, nameString, spellIcon, nil, spellTable.spellschool}) - end - - addToSpellCache(actorObject:GetGUID(), spellName, spellTable) + ---@type number in which index the spell with the same name was stored + local index = alreadyAdded[spellName] + if (index) then + ---@type breakdownspelldata + local bkSpellData = actorSpellsSorted[index] + bkSpellData.spellIds[#bkSpellData.spellIds+1] = spellId + bkSpellData.spellTables[#bkSpellData.spellTables+1] = spellTable + bkSpellData.petNames[#bkSpellData.petNames+1] = "" + bkSpellData.bCanExpand = true else - tinsert(actorSpellsSorted, {spellId, spellTotal, spellPercent, nameString, spellIcon, nil, spellTable.spellschool}) + ---@type breakdownspelldata + local bkSpellData = { + id = spellId, + spellschool = spellTable.spellschool, + bIsExpanded = Details222.BreakdownWindow.IsSpellExpanded(spellId), + bCanExpand = false, + + spellIds = {spellId}, + spellTables = {spellTable}, --sub spell tables to show if the spell is expanded + petNames = {""}, + } + + actorSpellsSorted[#actorSpellsSorted+1] = bkSpellData + alreadyAdded[spellName] = #actorSpellsSorted end end end - --show damage percentille within item level bracket - - --add pets - local actorPets = self.pets - --local class_color = RAID_CLASS_COLORS [self.classe] and RAID_CLASS_COLORS [self.classe].colorStr - local classColor = "FFCCBBBB" - --local class_color = "FFDDDD44" - + --pets spells + local actorPets = actorObject:GetPets() for _, petName in ipairs(actorPets) do + ---@type actor local petActor = combatObject(DETAILS_ATTRIBUTE_DAMAGE, petName) - if (petActor) then + if (petActor) then --PET local spells = petActor:GetSpellList() - for spellId, spellTable in pairs(spells) do --da foreach em cada spellid do container - local spellName, _, spellIcon = _GetSpellInfo(spellId) - --tinsert(ActorSkillsSortTable, {_spellid, _skill.total, _skill.total/ActorTotalDamage*100, nome .. " |TInterface\\AddOns\\Details\\images\\classes_small_alpha:12:12:0:0:128:128:33:64:96:128|t|c" .. class_color .. PetName:gsub((" <.*"), "") .. "|r", icone, PetActor, _skill.spellschool}) + for spellId, spellTable in pairs(spells) do + ---@cast spellId number + ---@cast spellTable spelltable + + spellTable.ChartData = nil + --PET + ---@type string + local spellName = _GetSpellInfo(spellId) if (spellName) then - local spellTotal = spellTable.total - local spellPercent = spellTable.total / actorTotalDamage * 100 - local nameString = spellName .. " (|c" .. classColor .. petName:gsub((" <.*"), "") .. "|r)" + ---@type number in which index the spell with the same name was stored + local index = alreadyAdded[spellName] + if (index) then --PET + ---@type breakdownspelldata + local bkSpellData = actorSpellsSorted[index] + bkSpellData.spellIds[#bkSpellData.spellIds+1] = spellId + bkSpellData.spellTables[#bkSpellData.spellTables+1] = spellTable + bkSpellData.petNames[#bkSpellData.petNames+1] = petName + bkSpellData.bCanExpand = true + else --PET + ---@type breakdownspelldata + local bkSpellData = { + id = spellId, + spellschool = spellTable.spellschool, + expanded = Details222.BreakdownWindow.IsSpellExpanded(spellId), + bCanExpand = false, - if (bShouldMergePetAbilities) then - local bAlreadyAdded = false - for i = 1, #actorSpellsSorted do - local thisPetSpellTable = actorSpellsSorted[i] - if (thisPetSpellTable[1] == spellId) then - bAlreadyAdded = true - thisPetSpellTable[2] = thisPetSpellTable[2] + spellTotal - end - end - - if (not bAlreadyAdded) then - tinsert(actorSpellsSorted, {spellId, spellTotal, spellPercent, nameString, spellIcon, petActor, spellTable.spellschool}) - end - - addToSpellCache(actorObject:GetGUID(), spellName, spellTable) --all pet spells are added to later be combined and shown in the spell details - else - tinsert(actorSpellsSorted, {spellId, spellTotal, spellPercent, nameString, spellIcon, petActor, spellTable.spellschool}) + spellIds = {spellId}, + spellTables = {spellTable}, + petNames = {petName}, + } + actorSpellsSorted[#actorSpellsSorted+1] = bkSpellData + alreadyAdded[spellName] = #actorSpellsSorted end end end end end - _table_sort(actorSpellsSorted, Details.Sort2) + for i = 1, #actorSpellsSorted do + ---@type breakdownspelldata + local bkSpellData = actorSpellsSorted[i] + Details:SumSpellTables(bkSpellData.spellTables, bkSpellData) + end - gump:JI_AtualizaContainerBarras (#actorSpellsSorted + 1) + --table.sort(actorSpellsSorted, Details.Sort2) + table.sort(actorSpellsSorted, function(t1, t2) + return t1.total > t2.total + end) + + actorSpellsSorted.totalValue = actorTotalDamage + actorSpellsSorted.combatTime = actorCombatTime + + --actorSpellsSorted has the spell infomation, need to pass to the summary tab + + --cleanup + table.wipe(alreadyAdded) + + --send to the breakdown window + Details222.BreakdownWindow.SendSpellData(actorSpellsSorted, actorObject, combatObject, instance) + + if 1 then return end + + --gump:JI_AtualizaContainerBarras (#actorSpellsSorted + 1) local max_ = actorSpellsSorted[1] and actorSpellsSorted[1][2] or 0 --dano que a primeiro magia vez - local barra --aura bar @@ -4752,12 +4840,9 @@ function atributo_damage:MontaInfoDamageDone() if (barra.mouse_over) then --atualizar o tooltip if (barra.isAlvo) then - --GameTooltip:Hide() - --GameTooltip:SetOwner(barra, "ANCHOR_TOPRIGHT") if (not barra.minha_tabela:MontaTooltipAlvos (barra, index, instance)) then return end - --GameTooltip:Show() end end @@ -5074,7 +5159,7 @@ local MontaDetalhesBuffProcs = function(actor, row, instance) end - +--this build p the 6 rectangle boxes in the right side of the breakdown window summary tab function atributo_damage:MontaDetalhesDamageDone (spellId, spellLine, instance) local spellTable if (spellLine.other_actor) then @@ -5477,7 +5562,7 @@ function atributo_damage:MontaDetalhesDamageDone (spellId, spellLine, instance) end end - DetailsPlayerDetailsWindow_DetalheInfoBG_bg_end6:Hide() + DetailsBreakdownWindow_DetalheInfoBG_bg_end6:Hide() thatRectangle66:SetShown(true) end @@ -6319,6 +6404,8 @@ end function Details.refresh:r_atributo_damage (este_jogador, shadow) --restaura metas do ator detailsFramework:Mixin(este_jogador, Details222.Mixins.ActorMixin) + detailsFramework:Mixin(este_jogador, damageClassMixin) + setmetatable(este_jogador, Details.atributo_damage) este_jogador.__index = Details.atributo_damage --restaura as metas dos containers diff --git a/classes/class_spelldamage.lua b/classes/class_spelldamage.lua index ce4133af..1218115d 100644 --- a/classes/class_spelldamage.lua +++ b/classes/class_spelldamage.lua @@ -34,10 +34,13 @@ id = id, --spellid successful_casted = 0, --successful casted times (only for enemies) - --normal hits + --min damage made by normal hits n_min = 0, + --max damage made by normal hits n_max = 0, + --amount normal hits n_amt = 0, + --total damage of normal hits n_dmg = 0, --critical hits diff --git a/classes/container_spells.lua b/classes/container_spells.lua index bdc52993..3720a48d 100644 --- a/classes/container_spells.lua +++ b/classes/container_spells.lua @@ -40,7 +40,7 @@ local addonName, Details222 = ... ---get the spellTable for the passed spellId ---@param spellId number ---@return table - function container_habilidades:GetSpell (spellId) + function container_habilidades:GetSpell(spellId) return self._ActorTable[spellId] end diff --git a/core/control.lua b/core/control.lua index a800c3e8..823a1d66 100644 --- a/core/control.lua +++ b/core/control.lua @@ -42,6 +42,14 @@ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --details api functions + ---for a number to the current selected abbreviation + ---@param number number + ---@return string + function Details:Format(number) + return Details.ToKFunctions[Details.ps_abbreviation](nil, number) + end + + --try to find the opponent of last fight, can be called during a fight as well function Details:FindEnemy() diff --git a/core/parser.lua b/core/parser.lua index 741bc729..1abc7730 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -322,8 +322,12 @@ [45284] = 188196, --shaman lightining bolt overloaded [228361] = 228360, --shadow priest void erruption - } + + --all totem + --377461 382133 + --377458 377459 + end local bitfield_debuffs = {} diff --git a/core/util.lua b/core/util.lua index bc763f33..2f224f0a 100644 --- a/core/util.lua +++ b/core/util.lua @@ -518,6 +518,7 @@ local left,num,right = _string_match (n,'^([^%d]*%d)(%d*)(.-)$') return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right end + function _detalhes:comma_value_raw (n) local left,num,right = string.match(n,'^([^%d]*%d)(%d*)(.-)$') return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right @@ -677,6 +678,15 @@ return _detalhes.ToKFunctions [_detalhes.ps_abbreviation] end + --alias + ---transfor an integer into a string separating thousands with a comma + ---@param number number + ---@return string + function Details:CommaValue(number) + return Details:comma_value(number) + end + + ------------------------------------------------------------------------------------------------------------ --numerical system diff --git a/frames/window_playerbreakdown.lua b/frames/window_playerbreakdown.lua index e1e7d87f..16b140ab 100644 --- a/frames/window_playerbreakdown.lua +++ b/frames/window_playerbreakdown.lua @@ -1,29 +1,28 @@ -local _detalhes = _G._detalhes +local _detalhes = _G._detalhes local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" ) local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0") local gump = _detalhes.gump local _ local addonName, Details222 = ... + --lua locals ---local _string_len = string.len -local _math_floor = math.floor local ipairs = ipairs local pairs = pairs local type = type +local unpack = unpack + --api locals local CreateFrame = CreateFrame local GetTime = GetTime local _GetSpellInfo = _detalhes.getspellinfo local _GetCursorPosition = GetCursorPosition -local _unpack = unpack +local GameTooltip = GameTooltip -local atributos = _detalhes.atributos local sub_atributos = _detalhes.sub_atributos - local info = _detalhes.playerDetailWindow -local classe_icones = _G.CLASS_ICON_TCOORDS +local breakdownWindow = info local container3_bars_pointFunc local SummaryWidgets = {} @@ -42,13 +41,13 @@ local containerSettings = { spells = { width = 419, height = 290, - point = {"TOPLEFT", DetailsPlayerDetailsWindow, "TOPLEFT", 2, -76}, + point = {"TOPLEFT", breakdownWindow, "TOPLEFT", 2, -76}, scrollHeight = 264, }, targets = { width = 418, height = 150, - point = {"BOTTOMLEFT", DetailsPlayerDetailsWindow, "BOTTOMLEFT", 2, 6 + PLAYER_DETAILS_STATUSBAR_HEIGHT}, + point = {"BOTTOMLEFT", breakdownWindow, "BOTTOMLEFT", 2, 6 + PLAYER_DETAILS_STATUSBAR_HEIGHT}, }, } @@ -114,6 +113,34 @@ function Details:IsBreakdownWindowOpen() return info.ativo end +function Details222.PlayerBreakdown.StartMoving() + breakdownWindow:StartMoving() + breakdownWindow.bIsMoving = true +end + +function Details222.PlayerBreakdown.StopMoving() + if (breakdownWindow.bIsMoving) then + breakdownWindow:StopMovingOrSizing() + breakdownWindow.bIsMoving = false + end +end + +function Details222.PlayerBreakdown.OnMouseDown(frameClicked, button) + if (button == "LeftButton" and not breakdownWindow.bIsMoving) then + breakdownWindow.latestFrameClicked = frameClicked + Details222.PlayerBreakdown.StartMoving() + + elseif (button == "RightButton" and not breakdownWindow.bIsMoving) then + Details:CloseBreakdownWindow() + end +end + +function Details222.PlayerBreakdown.OnMouseUp(button) + if (button == "LeftButton" and breakdownWindow.bIsMoving) then + Details222.PlayerBreakdown.StopMoving() + end +end + --english alias --window object from Details:GetWindow(n) and playerObject from Details:GetPlayer(playerName, attribute) function Details:OpenPlayerBreakdown(windowObject, playerObject, from_att_change) --windowObject = instanceObject @@ -141,6 +168,46 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDo return end + if (not breakdownWindow.registeredLibWindow) then + local LibWindow = LibStub("LibWindow-1.1") + breakdownWindow.registeredLibWindow = true + if (LibWindow) then + breakdownWindow.libWindowTable = breakdownWindow.libWindowTable or {} + LibWindow.RegisterConfig(breakdownWindow, breakdownWindow.libWindowTable) + LibWindow.RestorePosition(breakdownWindow) + LibWindow.MakeDraggable(breakdownWindow) + LibWindow.SavePosition(breakdownWindow) + else + breakdownWindow:SetScript("OnMouseDown", function(self, button) + Details222.PlayerBreakdown.OnMouseDown(button) + end) + breakdownWindow:SetScript("OnMouseUp", function(self, button) + Details222.PlayerBreakdown.OnMouseUp(button) + end) + end + end + + ---@type function + local onEventFunction = breakdownWindow:GetScript("OnEvent") + + if (not onEventFunction) then + ---this is a workaround of an issue when a frame calls StartMoving() on the parent, many times the child doesn't receive the OnMouseUp event + ---@param breakdownWindow frame + ---@param event string + ---@param button string + breakdownWindow:SetScript("OnEvent", function(breakdownWindow, event, button) + if (breakdownWindow.bIsMoving and breakdownWindow.latestFrameClicked) then + Details222.PlayerBreakdown.StopMoving() + local OnMouseUp = breakdownWindow.latestFrameClicked:GetScript("OnMouseUp") + if (OnMouseUp) then + OnMouseUp(breakdownWindow.latestFrameClicked, button) + end + breakdownWindow.latestFrameClicked = nil + end + end) + breakdownWindow:RegisterEvent("GLOBAL_MOUSE_UP") + end + --_detalhes.info_jogador armazena o jogador que esta sendo mostrado na janela de detalhes if (info.jogador and info.jogador == jogador and self and info.atributo and self.atributo == info.atributo and self.sub_atributo == info.sub_atributo and not refresh) then _detalhes:FechaJanelaInfo() --se clicou na mesma barra ent�o fecha a janela de detalhes @@ -236,14 +303,11 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDo mergePetSpellsLabel:SetAlpha(rightSideBarAlpha) end - --passar os par�metros para dentro da tabela da janela. - info.ativo = true --sinaliza o addon que a janela esta aberta info.atributo = self.atributo --instancia.atributo -> grava o atributo (damage, heal, etc) info.sub_atributo = self.sub_atributo --instancia.sub_atributo -> grava o sub atributo (damage done, dps, damage taken, etc) info.jogador = jogador --de qual jogador (objeto classe_damage) info.instancia = self --salva a refer�ncia da inst�ncia que pediu o info - info.target_text = Loc ["STRING_TARGETS"] .. ":" info.target_member = "total" info.target_persecond = false @@ -276,7 +340,6 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDo end if (avatar and avatar [2]) then - info.avatar:SetTexture(avatar [2]) info.avatar_bg:SetTexture(avatar [4]) if (avatar [5]) then @@ -297,9 +360,7 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDo info.avatar_attribute:Show() info.nome:Hide() info.atributo_nome:Hide() - else - info.avatar:Hide() info.avatar_bg:Hide() info.avatar_nick:Hide() @@ -311,15 +372,9 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDo info.atributo_nome:SetPoint("CENTER", info.nome, "CENTER", 0, 14) - info.no_targets:Hide() - info.no_targets.text:Hide() - gump:TrocaBackgroundInfo (info) - - gump:HidaAllBarrasInfo() - gump:HidaAllBarrasAlvo() - gump:HidaAllDetalheInfo() - - gump:JI_AtualizaContainerBarras (-1) + --need a way to comunicate with the main tab showing spells + --need to send a signal to reset its contents and prepare for a new player + --spellsTab.ResetBars() local classe = jogador.classe @@ -327,29 +382,11 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDo classe = "monster" end - --info.classe_icone:SetTexture("Interface\\AddOns\\Details\\images\\"..classe:lower()) --top left info.classe_icone:SetTexture("Interface\\AddOns\\Details\\images\\classes") --top left info.SetClassIcon (jogador, classe) - if (_detalhes.player_details_window.skin == "WoWClassic") then - if (jogador.grupo and IsInRaid() and not avatar) then - for i = 1, GetNumGroupMembers() do - local playerName, realmName = UnitName ("raid" .. i) - if (realmName and realmName ~= "") then - playerName = playerName .. "-" .. realmName - end - if (playerName == jogador.nome) then - SetPortraitTexture (info.classe_icone, "raid" .. i) - info.classe_icone:SetTexCoord(0, 1, 0, 1) - break - end - end - end - end - Details.FadeHandler.Fader(info, 0) Details:UpdateBreakdownPlayerList() - Details:InitializeAurasTab() Details:InitializeCompareTab() @@ -376,11 +413,9 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDo if (attributeList[info.atributo][info.sub_atributo]) then local tabReplaced, tabIndex = Details:GetBreakdownTabByName(tab.replaces.tabNameToReplace, tabsShown) if (tabReplaced and tabIndex < index) then - tabReplaced:Hide() tabReplaced.frame:Hide() tinsert(tabsReplaced, tabReplaced) - tremove(tabsShown, tabIndex) tinsert(tabsShown, tabIndex, tab) @@ -410,15 +445,20 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDo info.currentTabsInUse = newTabsShown info:ShowTabs() + Details222.BreakdownWindow.CurrentDefaultTab = nil local shownTab for index = 1, #tabsShown do - local tab = tabsShown[index] - if (tab:condition(info.jogador, info.atributo, info.sub_atributo)) then - if (info.selectedTab == tab.tabname) then - tabsShown[index]:Click() - tabsShown[index]:OnShowFunc() - shownTab = tabsShown[index] + local tabButton = tabsShown[index] + if (tabButton:condition(info.jogador, info.atributo, info.sub_atributo)) then + if (tabButton.IsDefaultTab) then + Details222.BreakdownWindow.CurrentDefaultTab = tabButton + end + + if (info.selectedTab == tabButton.tabname) then + tabButton:DoClick() + tabButton:OnShowFunc() + shownTab = tabButton end end end @@ -428,657 +468,98 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDo end end --end of "AbreJanelaInfo()" --- for beta todo: info background need a major rewrite -function gump:TrocaBackgroundInfo() --> spells tab - info.bg3_sec_texture:Hide() - info.bg2_sec_texture:Hide() - info.apoio_icone_esquerdo:Show() - info.apoio_icone_direito:Show() +--alias +function Details:CloseBreakdownWindow(bFromEscape) + return _detalhes:FechaJanelaInfo(bFromEscape) +end - info.report_direita:Hide() - - for i = 1, spellInfoSettings.amount do - info ["right_background" .. i]:Show() - end - - if (info.atributo == 1) then --DANO - - if (info.sub_atributo == 1 or info.sub_atributo == 2) then --damage done / dps - info.bg1_sec_texture:SetTexture("") - info.tipo = 1 - - if (info.sub_atributo == 2) then - info.targets:SetText(Loc ["STRING_TARGETS"] .. " " .. Loc ["STRING_ATTRIBUTE_DAMAGE_DPS"] .. ":") - info.target_persecond = true - else - info.targets:SetText(Loc ["STRING_TARGETS"] .. ":") - end - - elseif (info.sub_atributo == 3) then --damage taken - - --info.bg1_sec_texture:SetTexture([[Interface\AddOns\Details\images\info_window_damagetaken]]) - info.bg1_sec_texture:SetColorTexture(.05, .05, .05, .4) - info.bg3_sec_texture:Show() - info.bg2_sec_texture:Show() - info.tipo = 2 - - for i = 1, spellInfoSettings.amount do - info ["right_background" .. i]:Hide() - end - - info.targets:SetText(Loc ["STRING_TARGETS"] .. ":") - info.no_targets:Show() - info.no_targets.text:Show() - - info.apoio_icone_esquerdo:Hide() - info.apoio_icone_direito:Hide() - info.report_direita:Show() - - elseif (info.sub_atributo == 4) then --friendly fire - --info.bg1_sec_texture:SetTexture([[Interface\AddOns\Details\images\info_window_damagetaken]]) - info.bg1_sec_texture:SetColorTexture(.05, .05, .05, .4) - info.bg3_sec_texture:Show() - info.bg2_sec_texture:Show() - info.tipo = 3 - - for i = 1, spellInfoSettings.amount do - info ["right_background" .. i]:Hide() - end - - info.targets:SetText(Loc ["STRING_SPELLS"] .. ":") - - info.apoio_icone_esquerdo:Hide() - info.apoio_icone_direito:Hide() - info.report_direita:Show() - - elseif (info.sub_atributo == 6) then --enemies - --info.bg1_sec_texture:SetTexture([[Interface\AddOns\Details\images\info_window_damagetaken]]) - info.bg1_sec_texture:SetColorTexture(.05, .05, .05, .4) - info.bg3_sec_texture:Show() - info.bg2_sec_texture:Show() - info.tipo = 3 - - for i = 1, spellInfoSettings.amount do - info ["right_background" .. i]:Hide() - end - - info.targets:SetText(Loc ["STRING_DAMAGE_TAKEN_FROM"]) +function _detalhes:FechaJanelaInfo(fromEscape) + if (info.ativo) then + if (fromEscape) then + Details.FadeHandler.Fader(info, "in") + else + Details.FadeHandler.Fader(info, 1) end + info.ativo = false --sinaliza o addon que a janela esta agora fechada - elseif (info.atributo == 2) then --HEALING - if (info.sub_atributo == 1 or info.sub_atributo == 2 or info.sub_atributo == 3) then --damage done / dps - info.bg1_sec_texture:SetTexture("") - info.tipo = 1 + --_detalhes.info_jogador.detalhes = nil + info.jogador = nil + info.atributo = nil + info.sub_atributo = nil + info.instancia = nil - if (info.sub_atributo == 3) then - info.targets:SetText(Loc ["STRING_OVERHEALED"] .. ":") - info.target_member = "overheal" - info.target_text = Loc ["STRING_OVERHEALED"] .. ":" - elseif (info.sub_atributo == 2) then - info.targets:SetText(Loc ["STRING_TARGETS"] .. " " .. Loc ["STRING_ATTRIBUTE_HEAL_HPS"] .. ":") - info.target_persecond = true - else - info.targets:SetText(Loc ["STRING_TARGETS"] .. ":") - end - - elseif (info.sub_atributo == 4) then --Healing taken - info.bg1_sec_texture:SetColorTexture(.05, .05, .05, .4) - info.bg3_sec_texture:Show() - info.bg2_sec_texture:Show() - info.tipo = 2 - - for i = 1, spellInfoSettings.amount do - info ["right_background" .. i]:Hide() - end - - info.targets:SetText(Loc ["STRING_TARGETS"] .. ":") - info.no_targets:Show() - info.no_targets.text:Show() - - info.apoio_icone_esquerdo:Hide() - info.apoio_icone_direito:Hide() - info.report_direita:Show() - end - - elseif (info.atributo == 3) then --REGEN - info.bg1_sec_texture:SetTexture("") - info.tipo = 2 - info.targets:SetText("Vindo de:") - - elseif (info.atributo == 4) then --MISC - info.bg1_sec_texture:SetTexture("") - info.tipo = 2 - - info.targets:SetText(Loc ["STRING_TARGETS"] .. ":") + info.nome:SetText("") + info.atributo_nome:SetText("") end end -do --close the breakdown window --> spells tab - --self � qualquer coisa que chamar esta fun��o - ------------------------------------------------------------------------------------------------------------------------------ - -- � chamado pelo click no X e pelo reset do historico +---@type {[number]: boolean} +Details222.BreakdownWindow.ExpandedSpells = {} - --alias - function Details:CloseBreakdownWindow(bFromEscape) - return _detalhes:FechaJanelaInfo(bFromEscape) - end - - function _detalhes:FechaJanelaInfo(fromEscape) - if (info.ativo) then --se a janela tiver aberta - --playerDetailWindow:Hide() - if (fromEscape) then - Details.FadeHandler.Fader(info, "in") - else - Details.FadeHandler.Fader(info, 1) - end - info.ativo = false --sinaliza o addon que a janela esta agora fechada - - --_detalhes.info_jogador.detalhes = nil - info.jogador = nil - info.atributo = nil - info.sub_atributo = nil - info.instancia = nil - - info.nome:SetText("") - info.atributo_nome:SetText("") - - gump:JI_AtualizaContainerBarras (-1) --reseta o frame das barras - end - end +---set a spell as expanded or not in the breakdown window +---@param spellID number +---@param bIsExpanded boolean +function Details222.BreakdownWindow.SetSpellAsExpanded(spellID, bIsExpanded) + Details222.BreakdownWindow.ExpandedSpells[spellID] = bIsExpanded end -do --hide bars on the scrollbars of the window --> spells tab - - --esconde todas as barras das skills na janela de info - ------------------------------------------------------------------------------------------------------------------------------ - function gump:HidaAllBarrasInfo() - local barras = _detalhes.playerDetailWindow.barras1 - for index = 1, #barras, 1 do - barras [index]:Hide() - barras [index].textura:SetStatusBarColor(1, 1, 1, 1) - barras [index].on_focus = false - end - end - - --esconde todas as barras dos alvos do jogador - ------------------------------------------------------------------------------------------------------------------------------ - function gump:HidaAllBarrasAlvo() - local barras = _detalhes.playerDetailWindow.barras2 - for index = 1, #barras, 1 do - barras [index]:Hide() - end - end - - --esconde as 5 barras a direita na janela de info - ------------------------------------------------------------------------------------------------------------------------------ - function gump:HidaAllDetalheInfo() - for i = 1, spellInfoSettings.amount do - gump:HidaDetalheInfo (i) - end - for _, barra in ipairs(info.barras3) do - barra:Hide() - end - _detalhes.playerDetailWindow.spell_icone:SetTexture("") - end -end - ---set scripts on each bar of the scrollbars of the window --> spells tab - --seta os scripts da janela de informa��es - local mouse_down_func = function(self, button) - if (button == "LeftButton") then - info:StartMoving() - info.isMoving = true - elseif (button == "RightButton" and not self.isMoving) then - _detalhes:FechaJanelaInfo() - end - end - - local mouse_up_func = function(self, button) - if (info.isMoving) then - info:StopMovingOrSizing() - info.isMoving = false - end - end - - local function seta_scripts (este_gump) --> spells tab - --Janela - este_gump:SetScript("OnMouseDown", mouse_down_func) - este_gump:SetScript("OnMouseUp", mouse_up_func) - - este_gump.container_barras.gump:SetScript("OnMouseDown", mouse_down_func) - este_gump.container_barras.gump:SetScript("OnMouseUp", mouse_up_func) - - este_gump.container_detalhes:SetScript("OnMouseDown", mouse_down_func) - este_gump.container_detalhes:SetScript("OnMouseUp", mouse_up_func) - - este_gump.container_alvos.gump:SetScript("OnMouseDown", mouse_down_func) - este_gump.container_alvos.gump:SetScript("OnMouseUp", mouse_up_func) - - --bot�o fechar - este_gump.close_button:SetScript("OnClick", function(self) - _detalhes:FechaJanelaInfo() - end) - end - ------------------------------------------------------------------------------------------------------------------------------- -function gump:HidaDetalheInfo (index) --> spells tab - local info = _detalhes.playerDetailWindow.grupos_detalhes [index] - info.nome:SetText("") - info.nome2:SetText("") - info.dano:SetText("") - info.dano_porcento:SetText("") - info.dano_media:SetText("") - info.dano_dps:SetText("") - info.bg:Hide() -end - ---cria a barra de detalhes a direita da janela de informa��es ------------------------------------------------------------------------------------------------------------------------------- - -local detalhe_infobg_onenter = function(self) - Details.FadeHandler.Fader(self.overlay, "OUT") - Details.FadeHandler.Fader(self.reportar, "OUT") -end - -local detalhe_infobg_onleave = function(self) - Details.FadeHandler.Fader(self.overlay, "IN") - Details.FadeHandler.Fader(self.reportar, "IN") -end - -local detalhes_inforeport_onenter = function(self) - Details.FadeHandler.Fader(self:GetParent().overlay, "OUT") - Details.FadeHandler.Fader(self, "OUT") -end -local detalhes_inforeport_onleave = function(self) - Details.FadeHandler.Fader(self:GetParent().overlay, "IN") - Details.FadeHandler.Fader(self, "IN") -end - -local getFrameFromDetailInfoBlock = function(self) - return self.bg -end - -function gump:CriaDetalheInfo(index) --> spells tab - local spellInfoBlock = {} - spellInfoBlock.GetFrame = getFrameFromDetailInfoBlock - - spellInfoBlock.bg = CreateFrame("StatusBar", "DetailsPlayerDetailsWindow_DetalheInfoBG" .. index, _detalhes.playerDetailWindow.container_detalhes, "BackdropTemplate") - --spellInfoBlock.bg:SetStatusBarTexture("") --Interface\\AddOns\\Details\\images\\bar_detalhes2 - --bar_detalhes2 bar_background - spellInfoBlock.bg:SetStatusBarTexture("Interface\\AddOns\\Details\\images\\bar_background") --Interface\\AddOns\\Details\\images\\bar_detalhes2 - spellInfoBlock.bg:SetStatusBarColor(1, 1, 1, .84) - spellInfoBlock.bg:SetMinMaxValues(0, 100) - spellInfoBlock.bg:SetValue(100) - spellInfoBlock.bg:SetSize(320, 47) - - spellInfoBlock.nome = spellInfoBlock.bg:CreateFontString(nil, "OVERLAY", "GameFontNormal") - spellInfoBlock.nome2 = spellInfoBlock.bg:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") - spellInfoBlock.dano = spellInfoBlock.bg:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") - spellInfoBlock.dano_porcento = spellInfoBlock.bg:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") - spellInfoBlock.dano_media = spellInfoBlock.bg:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") - spellInfoBlock.dano_dps = spellInfoBlock.bg:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") - - spellInfoBlock.middleStringUp = spellInfoBlock.bg:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") - spellInfoBlock.middleStringDown = spellInfoBlock.bg:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") - spellInfoBlock.middleStringMiddle = spellInfoBlock.bg:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") - - spellInfoBlock.bg.overlay = spellInfoBlock.bg:CreateTexture("DetailsPlayerDetailsWindow_DetalheInfoBG_Overlay" .. index, "ARTWORK") - spellInfoBlock.bg.overlay:SetTexture("Interface\\AddOns\\Details\\images\\overlay_detalhes") - spellInfoBlock.bg.overlay:SetWidth(341) - spellInfoBlock.bg.overlay:SetHeight(61) - spellInfoBlock.bg.overlay:SetPoint("TOPLEFT", spellInfoBlock.bg, "TOPLEFT", -7, 6) - Details.FadeHandler.Fader(spellInfoBlock.bg.overlay, 1) - - spellInfoBlock.bg.reportar = gump:NewDetailsButton (spellInfoBlock.bg, nil, nil, _detalhes.Reportar, _detalhes.playerDetailWindow, 10+index, 16, 16, - "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", nil, "DetailsJanelaInfoReport1") - spellInfoBlock.bg.reportar:SetPoint("BOTTOMLEFT", spellInfoBlock.bg.overlay, "BOTTOMRIGHT", -33, 10) - Details.FadeHandler.Fader(spellInfoBlock.bg.reportar, 1) - - spellInfoBlock.bg:SetScript("OnEnter", detalhe_infobg_onenter) - spellInfoBlock.bg:SetScript("OnLeave", detalhe_infobg_onleave) - - spellInfoBlock.bg.reportar:SetScript("OnEnter", detalhes_inforeport_onenter) - spellInfoBlock.bg.reportar:SetScript("OnLeave", detalhes_inforeport_onleave) - - spellInfoBlock.bg_end = spellInfoBlock.bg:CreateTexture("DetailsPlayerDetailsWindow_DetalheInfoBG_bg_end" .. index, "BACKGROUND") - spellInfoBlock.bg_end:SetHeight(40) - spellInfoBlock.bg_end:SetTexture("Interface\\AddOns\\Details\\images\\bar_detalhes2_end") - - _detalhes.playerDetailWindow.grupos_detalhes[index] = spellInfoBlock -end - -function info:SetDetailInfoConfigs(texture, color, x, y) --> spells tab - for i = 1, spellInfoSettings.amount do - if (texture) then - info.grupos_detalhes[i].bg:SetStatusBarTexture(texture) - end - - if (color) then - local texture = info.grupos_detalhes[i].bg:GetStatusBarTexture() - texture:SetVertexColor(unpack(color)) - end - - if (x or y) then - gump:SetaDetalheInfoAltura(i, x, y) - end - end +---get the state of the expanded for a spell +---@param spellID number +---@return boolean +function Details222.BreakdownWindow.IsSpellExpanded(spellID) + return Details222.BreakdownWindow.ExpandedSpells[spellID] end --determina qual a pocis�o que a barra de detalhes vai ocupar ------------------------------------------------------------------------------------------------------------------------------ --namespace -Details222.BreakdownWindow = {} -function Details222.BreakdownWindow.GetBlockIndex(index) +function Details222.BreakdownWindow.GetBlockIndex(index) --getting the infomation from the new spells tab, this will be depreccated soon return Details.playerDetailWindow.grupos_detalhes[index] end -function gump:SetaDetalheInfoAltura(index, xmod, ymod) - local spellInfoBlock = _detalhes.playerDetailWindow.grupos_detalhes[index] - --local janela = _detalhes.playerDetailWindow.container_detalhes - --local altura = {-10, -63, -118, -173, -228, -279} - --altura = altura[index] - - local background - local yOffset = -74 - ((index-1) * 79.5) - - if (index == 1) then - _detalhes.playerDetailWindow.right_background1:SetPoint("topleft", _detalhes.playerDetailWindow, "topleft", 357 + (xmod or 0), yOffset) - background = _detalhes.playerDetailWindow.right_background1 - - elseif (index == 2) then - _detalhes.playerDetailWindow.right_background2:SetPoint("topleft", _detalhes.playerDetailWindow, "topleft", 357 + (xmod or 0), yOffset) - background = _detalhes.playerDetailWindow.right_background2 - - elseif (index == 3) then - _detalhes.playerDetailWindow.right_background3:SetPoint("topleft", _detalhes.playerDetailWindow, "topleft", 357 + (xmod or 0), yOffset) - background = _detalhes.playerDetailWindow.right_background3 - - elseif (index == 4) then - _detalhes.playerDetailWindow.right_background4:SetPoint("topleft", _detalhes.playerDetailWindow, "topleft", 357 + (xmod or 0), yOffset) - background = _detalhes.playerDetailWindow.right_background4 - - elseif (index == 5) then - _detalhes.playerDetailWindow.right_background5:SetPoint("topleft", _detalhes.playerDetailWindow, "topleft", 357 + (xmod or 0), yOffset) - background = _detalhes.playerDetailWindow.right_background5 - - elseif (index == 6) then - _detalhes.playerDetailWindow.right_background6:SetPoint("topleft", _detalhes.playerDetailWindow, "topleft", 357 + (xmod or 0), yOffset) - background = _detalhes.playerDetailWindow.right_background6 - - end - - background:SetHeight(75) - - --3 textos da esquerda e direita - local yOffset = -3 - local xOffset = 3 - local right = -1 - - spellInfoBlock.nome:SetPoint("TOPLEFT", background, "TOPLEFT", xOffset, yOffset + (-2)) - spellInfoBlock.dano:SetPoint("TOPLEFT", background, "TOPLEFT", xOffset, yOffset + (-24)) - spellInfoBlock.dano_media:SetPoint("TOPLEFT", background, "TOPLEFT", xOffset, yOffset + (-44)) - - spellInfoBlock.nome2:SetPoint("TOPRIGHT", background, "TOPRIGHT", -xOffset + right, yOffset + (-4)) - spellInfoBlock.dano_porcento:SetPoint("TOPRIGHT", background, "TOPRIGHT", -xOffset + right, yOffset + (-24)) - spellInfoBlock.dano_dps:SetPoint("TOPRIGHT", background, "TOPRIGHT", -xOffset + right, yOffset + (-44)) - - spellInfoBlock.middleStringUp:SetPoint("center", background, "center", 0, 0) - spellInfoBlock.middleStringUp:SetPoint("top", background, "top", 0, -7) - - spellInfoBlock.middleStringDown:SetPoint("center", background, "center", 0, 0) - spellInfoBlock.middleStringDown:SetPoint("bottom", background, "bottom", 0, 19) - - spellInfoBlock.middleStringMiddle:SetPoint("center", background, "center", 0, 6) - - spellInfoBlock.bg:SetPoint("TOPLEFT", background, "TOPLEFT", 1, -1) - spellInfoBlock.bg:SetHeight(background:GetHeight() - 2) - spellInfoBlock.bg:SetWidth(background:GetWidth()) - - spellInfoBlock.bg_end:SetPoint("LEFT", spellInfoBlock.bg, "LEFT", spellInfoBlock.bg:GetValue()*2.19, 0) - spellInfoBlock.bg_end:SetHeight(background:GetHeight()-2) - spellInfoBlock.bg_end:SetWidth(6) - spellInfoBlock.bg_end:SetAlpha(.75) - - spellInfoBlock.bg.overlay:SetWidth(background:GetWidth() + 24) - spellInfoBlock.bg.overlay:SetHeight(background:GetHeight() + 16) - - spellInfoBlock.bg:Hide() -end - ---seta o conte�do da barra de detalhes ------------------------------------------------------------------------------------------------------------------------------- -function gump:SetaDetalheInfoTexto(index, data, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) - local spellInfoBlock = _detalhes.playerDetailWindow.grupos_detalhes[index] - - if (data) then - if (type(data) == "table") then - spellInfoBlock.bg:SetValue(data.p) - spellInfoBlock.bg:SetStatusBarColor(data.c[1], data.c[2], data.c[3], data.c[4] or 1) - else - local percentAmount = data - spellInfoBlock.bg:SetValue(percentAmount) - spellInfoBlock.bg:SetStatusBarColor(1, 1, 1, .5) +---receives spell data to show in the summary tab +---@param data table +---@param actorObject actor +---@param combatObject combat +---@param instance instance +function Details222.BreakdownWindow.SendSpellData(data, actorObject, combatObject, instance) + --need to get the tab showing the summary and transmit the data to it + local tab = Details222.BreakdownWindow.CurrentDefaultTab + if (tab) then + --tab is the tab button + if (tab.OnReceiveSpellData) then + tab.OnReceiveSpellData(data, actorObject, combatObject, instance) end - - spellInfoBlock.bg_end:Show() - spellInfoBlock.bg_end:SetPoint("LEFT", spellInfoBlock.bg, "LEFT", (spellInfoBlock.bg:GetValue() * (spellInfoBlock.bg:GetWidth( ) / 100)) - 3, 0) -- 2.19 - spellInfoBlock.bg:Show() - end - - if (spellInfoBlock.IsPet) then - spellInfoBlock.bg.PetIcon:Hide() - spellInfoBlock.bg.PetText:Hide() - spellInfoBlock.bg.PetDps:Hide() - Details.FadeHandler.Fader(spellInfoBlock.bg.overlay, "IN") - spellInfoBlock.IsPet = false - end - - if (arg1) then - spellInfoBlock.nome:SetText(arg1) - end - - if (arg2) then - spellInfoBlock.dano:SetText(arg2) - end - - if (arg3) then - spellInfoBlock.dano_porcento:SetText(arg3) - end - - if (arg4) then - spellInfoBlock.dano_media:SetText(arg4) - end - - if (arg5) then - spellInfoBlock.dano_dps:SetText(arg5) - end - - if (arg6) then - spellInfoBlock.nome2:SetText(arg6) - end - - if (arg7) then - spellInfoBlock.middleStringUp:SetText(arg7) - else - spellInfoBlock.middleStringUp:SetText("") - end - - if (arg8) then - spellInfoBlock.middleStringDown:SetText(arg8) - else - spellInfoBlock.middleStringDown:SetText("") - end - - if (arg9) then - spellInfoBlock.middleStringMiddle:SetText(arg9) - else - spellInfoBlock.middleStringMiddle:SetText("") - end - - spellInfoBlock.nome:Show() - spellInfoBlock.dano:Show() - spellInfoBlock.dano_porcento:Show() - spellInfoBlock.dano_media:Show() - spellInfoBlock.dano_dps:Show() - spellInfoBlock.nome2:Show() - spellInfoBlock.middleStringUp:Show() - spellInfoBlock.middleStringDown:Show() - spellInfoBlock.middleStringDown:Show() - spellInfoBlock.middleStringMiddle:Show() -end - ---cria as 5 caixas de detalhes infos que ser�o usados ------------------------------------------------------------------------------------------------------------------------------- -local function cria_barras_detalhes() - _detalhes.playerDetailWindow.grupos_detalhes = {} - for i = 1, spellInfoSettings.amount do - gump:CriaDetalheInfo (i) - gump:SetaDetalheInfoAltura(i) end end --cria os textos em geral da janela info ------------------------------------------------------------------------------------------------------------------------------- -local function cria_textos (este_gump, SWW) - este_gump.nome = este_gump:CreateFontString(nil, "OVERLAY", "QuestFont_Large") - este_gump.nome:SetPoint("TOPLEFT", este_gump, "TOPLEFT", 105, -54) +function breakdownWindow.CreateTexts(SWW) + breakdownWindow.nome = breakdownWindow:CreateFontString(nil, "OVERLAY", "QuestFont_Large") + breakdownWindow.nome:SetPoint("TOPLEFT", breakdownWindow, "TOPLEFT", 105, -54) - este_gump.atributo_nome = este_gump:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") + breakdownWindow.atributo_nome = breakdownWindow:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") - este_gump.targets = SWW:CreateFontString(nil, "OVERLAY", "QuestFont_Large") - este_gump.targets:SetPoint("TOPLEFT", este_gump, "TOPLEFT", 24, -273) - este_gump.targets:SetText(Loc ["STRING_TARGETS"] .. ":") + breakdownWindow.avatar = breakdownWindow:CreateTexture(nil, "overlay") + breakdownWindow.avatar_bg = breakdownWindow:CreateTexture(nil, "overlay") + breakdownWindow.avatar_attribute = breakdownWindow:CreateFontString(nil, "overlay", "GameFontHighlightSmall") + breakdownWindow.avatar_nick = breakdownWindow:CreateFontString(nil, "overlay", "QuestFont_Large") + breakdownWindow.avatar:SetDrawLayer("overlay", 3) + breakdownWindow.avatar_bg:SetDrawLayer("overlay", 2) + breakdownWindow.avatar_nick:SetDrawLayer("overlay", 4) - este_gump.avatar = este_gump:CreateTexture(nil, "overlay") - este_gump.avatar_bg = este_gump:CreateTexture(nil, "overlay") - este_gump.avatar_attribute = este_gump:CreateFontString(nil, "overlay", "GameFontHighlightSmall") - este_gump.avatar_nick = este_gump:CreateFontString(nil, "overlay", "QuestFont_Large") - este_gump.avatar:SetDrawLayer("overlay", 3) - este_gump.avatar_bg:SetDrawLayer("overlay", 2) - este_gump.avatar_nick:SetDrawLayer("overlay", 4) + breakdownWindow.avatar:SetPoint("TOPLEFT", breakdownWindow, "TOPLEFT", 60, -10) + breakdownWindow.avatar_bg:SetPoint("TOPLEFT", breakdownWindow, "TOPLEFT", 60, -12) + breakdownWindow.avatar_bg:SetSize(275, 60) - este_gump.avatar:SetPoint("TOPLEFT", este_gump, "TOPLEFT", 60, -10) - este_gump.avatar_bg:SetPoint("TOPLEFT", este_gump, "TOPLEFT", 60, -12) - este_gump.avatar_bg:SetSize(275, 60) + breakdownWindow.avatar_nick:SetPoint("TOPLEFT", breakdownWindow, "TOPLEFT", 195, -54) - este_gump.avatar_nick:SetPoint("TOPLEFT", este_gump, "TOPLEFT", 195, -54) - - este_gump.avatar:Hide() - este_gump.avatar_bg:Hide() - este_gump.avatar_nick:Hide() + breakdownWindow.avatar:Hide() + breakdownWindow.avatar_bg:Hide() + breakdownWindow.avatar_nick:Hide() end ---esquerdo superior -local function cria_container_barras (este_gump, SWW) - local container_barras_window = CreateFrame("ScrollFrame", "Details_Info_ContainerBarrasScroll", SWW, "BackdropTemplate") - local container_barras = CreateFrame("Frame", "Details_Info_ContainerBarras", container_barras_window, "BackdropTemplate") - - container_barras:SetAllPoints(container_barras_window) - container_barras:SetWidth(300) - container_barras:SetHeight(150) - container_barras:EnableMouse(true) - container_barras:SetMovable(true) - - container_barras_window:SetWidth(300) - container_barras_window:SetHeight(145) - container_barras_window:SetScrollChild(container_barras) - container_barras_window:SetPoint("TOPLEFT", este_gump, "TOPLEFT", 21, -76) - - container_barras_window:SetScript("OnSizeChanged", function(self) - container_barras:SetSize(self:GetSize()) - end) - - gump:NewScrollBar (container_barras_window, container_barras, 6, -17) - container_barras_window.slider:Altura (117) - container_barras_window.slider:cimaPoint (0, 1) - container_barras_window.slider:baixoPoint (0, -3) - - container_barras_window.ultimo = 0 - - container_barras_window.gump = container_barras - --container_barras_window.slider = slider_gump - este_gump.container_barras = container_barras_window - -end - -function gump:JI_AtualizaContainerBarras (amt) - local container = _detalhes.playerDetailWindow.container_barras - - if (amt >= 9 and container.ultimo ~= amt) then - local tamanho = (CONST_BAR_HEIGHT + 1) * amt - container.gump:SetHeight(tamanho) - container.slider:Update() - container.ultimo = amt - - elseif (amt < 8 and container.slider.ativo) then - container.slider:Update (true) - container.gump:SetHeight(140) - container.scroll_ativo = false - container.ultimo = 0 - end -end - -function gump:JI_AtualizaContainerAlvos (amt) - - local container = _detalhes.playerDetailWindow.container_alvos - - if (amt >= 6 and container.ultimo ~= amt) then - local tamanho = (CONST_TARGET_HEIGHT + 1) * amt - container.gump:SetHeight(tamanho) - container.slider:Update() - container.ultimo = amt - - elseif (amt <= 5 and container.slider.ativo) then - container.slider:Update (true) - container.gump:SetHeight(100) - container.scroll_ativo = false - container.ultimo = 0 - end -end - ---container direita -local function cria_container_detalhes (este_gump, SWW) - local container_detalhes = CreateFrame("Frame", "Details_Info_ContainerDetalhes", SWW, "BackdropTemplate") - - container_detalhes:SetPoint("TOPRIGHT", este_gump, "TOPRIGHT", -74, -76) - container_detalhes:SetWidth(220) - container_detalhes:SetHeight(270) - container_detalhes:EnableMouse(true) - container_detalhes:SetResizable(false) - container_detalhes:SetMovable(true) - - este_gump.container_detalhes = container_detalhes -end - ---esquerdo inferior -local function cria_container_alvos (este_gump, SWW) - local container_alvos_window = CreateFrame("ScrollFrame", "Details_Info_ContainerAlvosScroll", SWW, "BackdropTemplate") - local container_alvos = CreateFrame("Frame", "Details_Info_ContainerAlvos", container_alvos_window, "BackdropTemplate") - - container_alvos:SetAllPoints(container_alvos_window) - container_alvos:SetWidth(300) - container_alvos:SetHeight(100) - container_alvos:EnableMouse(true) - container_alvos:SetMovable(true) - - container_alvos_window:SetWidth(300) - container_alvos_window:SetHeight(100) - container_alvos_window:SetScrollChild(container_alvos) - container_alvos_window:SetPoint("BOTTOMLEFT", este_gump, "BOTTOMLEFT", 20, 6) --56 default - - container_alvos_window:SetScript("OnSizeChanged", function(self) - container_alvos:SetSize(self:GetSize()) - end) - - gump:NewScrollBar (container_alvos_window, container_alvos, 7, 4) - container_alvos_window.slider:Altura (88) - container_alvos_window.slider:cimaPoint (0, 1) - container_alvos_window.slider:baixoPoint (0, -3) - - container_alvos_window.gump = container_alvos - este_gump.container_alvos = container_alvos_window -end local default_icon_change = function(jogador, classe) if (classe ~= "UNKNOW" and classe ~= "UNGROUPPLAYER") then @@ -1095,7 +576,7 @@ local default_icon_change = function(jogador, classe) else if (jogador.enemy) then if (_detalhes.class_coords [_detalhes.faction_against]) then - info.classe_icone:SetTexCoord(_unpack(_detalhes.class_coords [_detalhes.faction_against])) + info.classe_icone:SetTexCoord(unpack(_detalhes.class_coords [_detalhes.faction_against])) if (_detalhes.faction_against == "Horde") then info.nome:SetTextColor(1, 91/255, 91/255, 1) else @@ -1113,17 +594,17 @@ end function _detalhes:InstallPDWSkin(skin_name, func) if (not skin_name) then return false -- sem nome - elseif (_detalhes.playerdetailwindow_skins [skin_name]) then + elseif (_detalhes.playerdetailwindow_skins[skin_name]) then return false -- ja existe end - _detalhes.playerdetailwindow_skins [skin_name] = func + _detalhes.playerdetailwindow_skins[skin_name] = func return true end function _detalhes:ApplyPDWSkin(skin_name) --already built - if (not DetailsPlayerDetailsWindow.Loaded) then + if (not DetailsBreakdownWindow.Loaded) then if (skin_name) then _detalhes.player_details_window.skin = skin_name end @@ -1131,7 +612,7 @@ function _detalhes:ApplyPDWSkin(skin_name) end --hide extra frames - local window = DetailsPlayerDetailsWindow + local window = DetailsBreakdownWindow if (window.extra_frames) then for framename, frame in pairs(window.extra_frames) do frame:Hide() @@ -1169,11 +650,11 @@ function _detalhes:ApplyPDWSkin(skin_name) end function _detalhes:SetPlayerDetailsWindowTexture (texture) - DetailsPlayerDetailsWindow.bg1:SetTexture(texture) + DetailsBreakdownWindow.bg1:SetTexture(texture) end function _detalhes:SetPDWBarConfig (texture) - local window = DetailsPlayerDetailsWindow + local window = DetailsBreakdownWindow if (texture) then _detalhes.player_details_window.bar_texture = texture @@ -1192,10 +673,10 @@ function _detalhes:SetPDWBarConfig (texture) end local default_skin = function()end -_detalhes:InstallPDWSkin ("WoWClassic", {func = default_skin, author = "Details! Team", version = "v1.0", desc = "Default skin."}) +_detalhes:InstallPDWSkin("WoWClassic", {func = default_skin, author = "Details! Team", version = "v1.0", desc = "Default skin."}) --deprecated local elvui_skin = function() - local window = DetailsPlayerDetailsWindow + local window = DetailsBreakdownWindow window.bg1:SetTexture([[Interface\AddOns\Details\images\background]], true) window.bg1:SetAlpha(0.7) window.bg1:SetVertexColor(0.27, 0.27, 0.27) @@ -1206,8 +687,6 @@ local elvui_skin = function() window:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]}) window:SetBackdropColor(1, 1, 1, 0.3) window:SetBackdropBorderColor(0, 0, 0, 1) - window.bg_icone_bg:Hide() - window.bg_icone:Hide() local bgs_alpha = 0.6 window.leftbars1_backgound:SetPoint("topleft", window.container_barras, "topleft", -2, 3) @@ -1281,16 +760,11 @@ local elvui_skin = function() window.container_alvos:SetSize(containerSettings.targets.width, containerSettings.targets.height) --texts - window.targets:SetPoint("topleft", window.container_alvos, "topleft", 3, 18) window.nome:SetPoint("TOPLEFT", window, "TOPLEFT", 105, -48) --report button window.topleft_report:SetPoint("BOTTOMLEFT", window.container_barras, "TOPLEFT", 43, 2) - --icons - window.apoio_icone_direito:SetBlendMode("ADD") - window.apoio_icone_esquerdo:SetBlendMode("ADD") - --no targets texture window.no_targets:SetPoint("BOTTOMLEFT", window, "BOTTOMLEFT", 3, 6) window.no_targets:SetSize(418, 150) @@ -1496,17 +970,20 @@ local elvui_skin = function() window.container_alvos.slider.thumb:SetVertexColor(0.6, 0.6, 0.6, 0.95) --class icon - window.SetClassIcon = function(player, class) - if (player.spellicon) then - window.classe_icone:SetTexture(player.spellicon) + ---set the spell, spec or class icon + ---@param actorObject actor + ---@param class string|nil + window.SetClassIcon = function(actorObject, class) + if (actorObject.spellicon) then + window.classe_icone:SetTexture(actorObject.spellicon) window.classe_icone:SetTexCoord(.1, .9, .1, .9) - elseif (player.spec) then + elseif (actorObject.spec) then window.classe_icone:SetTexture([[Interface\AddOns\Details\images\spec_icons_normal_alpha]]) - window.classe_icone:SetTexCoord(_unpack(_detalhes.class_specs_coords [player.spec])) + window.classe_icone:SetTexCoord(unpack(_detalhes.class_specs_coords [actorObject.spec])) --esta_barra.icone_classe:SetVertexColor(1, 1, 1) else - local coords = CLASS_ICON_TCOORDS [class] + local coords = CLASS_ICON_TCOORDS[class] if (coords) then info.classe_icone:SetTexture([[Interface\Glues\CHARACTERCREATE\UI-CHARACTERCREATE-CLASSES]]) local l, r, t, b = unpack(coords) @@ -1520,7 +997,8 @@ local elvui_skin = function() end end end -_detalhes:InstallPDWSkin ("ElvUI", {func = elvui_skin, author = "Details! Team", version = "v1.0", desc = "Skin compatible with ElvUI addon."}) + + --search key: ~create ~inicio ~start function gump:CriaJanelaInfo() @@ -1540,10 +1018,12 @@ function gump:CriaJanelaInfo() breakdownFrame:SetResizable(false) breakdownFrame:SetMovable(true) - breakdownFrame.SummaryWindowWidgets = CreateFrame("frame", "DetailsPlayerDetailsWindowSummaryWidgets", breakdownFrame, "BackdropTemplate") + --host the textures and fontstring of the default frame of the player breakdown window + breakdownFrame.SummaryWindowWidgets = CreateFrame("frame", "DetailsBreakdownWindowSummaryWidgets", breakdownFrame, "BackdropTemplate") local SWW = breakdownFrame.SummaryWindowWidgets SWW:SetAllPoints() table.insert(SummaryWidgets, SWW) --where SummaryWidgets is declared: at the header of the file, what is the purpose of this table? + --what is the summary window: is the frame where all the widgets for the summary tab are created DetailsFramework:CreateScaleBar(breakdownFrame, Details.player_details_window) breakdownFrame:SetScale(Details.player_details_window.scale) @@ -1563,61 +1043,27 @@ function gump:CriaJanelaInfo() breakdownFrame.close_button:SetPoint("TOPRIGHT", breakdownFrame, "TOPRIGHT", 5, -8) breakdownFrame.close_button:SetText("X") breakdownFrame.close_button:SetFrameLevel(breakdownFrame:GetFrameLevel()+5) + breakdownFrame.close_button:SetScript("OnClick", function(self) + Details:CloseBreakdownWindow() + end) --�cone da magia selecionada para mais detalhes (is this a window thing or tab thing?) --or this is even in use? - breakdownFrame.bg_icone_bg = breakdownFrame:CreateTexture(nil, "ARTWORK") - breakdownFrame.bg_icone_bg:SetPoint("TOPRIGHT", breakdownFrame, "TOPRIGHT", -15, -12) - breakdownFrame.bg_icone_bg:SetTexture("Interface\\AddOns\\Details\\images\\icone_bg_fundo") - breakdownFrame.bg_icone_bg:SetDrawLayer("ARTWORK", -1) - breakdownFrame.bg_icone_bg:Show() - - breakdownFrame.bg_icone = breakdownFrame:CreateTexture(nil, "OVERLAY") - breakdownFrame.bg_icone:SetPoint("TOPRIGHT", breakdownFrame, "TOPRIGHT", -15, -12) - breakdownFrame.bg_icone:SetTexture("Interface\\AddOns\\Details\\images\\icone_bg") - breakdownFrame.bg_icone:Show() --title DetailsFramework:NewLabel(breakdownFrame, breakdownFrame, nil, "title_string", Loc ["STRING_PLAYER_DETAILS"] .. " (|cFFFF8811Under Maintenance|r)", "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255}) breakdownFrame.title_string:SetPoint("center", breakdownFrame, "center") breakdownFrame.title_string:SetPoint("top", breakdownFrame, "top", 0, -18) - --spell icon is still in use? what's the difference from the bg_icone? - breakdownFrame.spell_icone = breakdownFrame:CreateTexture(nil, "ARTWORK") - breakdownFrame.spell_icone:SetPoint("BOTTOMRIGHT", breakdownFrame.bg_icone, "BOTTOMRIGHT", -19, 2) - breakdownFrame.spell_icone:SetWidth(35) - breakdownFrame.spell_icone:SetHeight(34) - breakdownFrame.spell_icone:SetDrawLayer("ARTWORK", 0) - breakdownFrame.spell_icone:Show() - breakdownFrame.spell_icone:SetTexCoord(4/64, 60/64, 4/64, 60/64) - - --coisinhas do lado do icone - is this still in use? - breakdownFrame.apoio_icone_esquerdo = breakdownFrame:CreateTexture(nil, "ARTWORK") - breakdownFrame.apoio_icone_direito = breakdownFrame:CreateTexture(nil, "ARTWORK") - breakdownFrame.apoio_icone_esquerdo:SetTexture("Interface\\PaperDollInfoFrame\\PaperDollSidebarTabs") - breakdownFrame.apoio_icone_direito:SetTexture("Interface\\PaperDollInfoFrame\\PaperDollSidebarTabs") - - local apoio_altura = 13/256 - breakdownFrame.apoio_icone_esquerdo:SetTexCoord(0, 1, 0, apoio_altura) - breakdownFrame.apoio_icone_direito:SetTexCoord(0, 1, apoio_altura+(1/256), apoio_altura+apoio_altura) - - breakdownFrame.apoio_icone_esquerdo:SetPoint("bottomright", breakdownFrame.bg_icone, "bottomleft", 42, 0) - breakdownFrame.apoio_icone_direito:SetPoint("bottomleft", breakdownFrame.bg_icone, "bottomright", -17, 0) - - breakdownFrame.apoio_icone_esquerdo:SetWidth(64) - breakdownFrame.apoio_icone_esquerdo:SetHeight(13) - breakdownFrame.apoio_icone_direito:SetWidth(64) - breakdownFrame.apoio_icone_direito:SetHeight(13) - breakdownFrame.topright_text1 = breakdownFrame:CreateFontString(nil, "overlay", "GameFontNormal") breakdownFrame.topright_text1:SetPoint("bottomright", breakdownFrame, "topright", -18 - (94 * (1-1)), -36) breakdownFrame.topright_text1:SetJustifyH("right") - _detalhes.gump:SetFontSize(breakdownFrame.topright_text1, 10) + DetailsFramework:SetFontSize(breakdownFrame.topright_text1, 10) breakdownFrame.topright_text2 = breakdownFrame:CreateFontString(nil, "overlay", "GameFontNormal") breakdownFrame.topright_text2:SetPoint("bottomright", breakdownFrame, "topright", -18 - (94 * (1-1)), -48) breakdownFrame.topright_text2:SetJustifyH("right") - _detalhes.gump:SetFontSize(breakdownFrame.topright_text2, 10) + DetailsFramework:SetFontSize(breakdownFrame.topright_text2, 10) --what goes in the top right text? - looks like it's not in use function breakdownFrame:SetTopRightTexts(text1, text2, size, color, font) @@ -1626,6 +1072,7 @@ function gump:CriaJanelaInfo() else breakdownFrame.topright_text1:SetText("") end + if (text2) then breakdownFrame.topright_text2:SetText(text2) else @@ -1633,147 +1080,30 @@ function gump:CriaJanelaInfo() end if (size and type(size) == "number") then - _detalhes.gump:SetFontSize(breakdownFrame.topright_text1, size) - _detalhes.gump:SetFontSize(breakdownFrame.topright_text2, size) + DetailsFramework:SetFontSize(breakdownFrame.topright_text1, size) + DetailsFramework:SetFontSize(breakdownFrame.topright_text2, size) end + if (color) then - _detalhes.gump:SetFontColor(breakdownFrame.topright_text1, color) - _detalhes.gump:SetFontColor(breakdownFrame.topright_text2, color) + DetailsFramework:SetFontColor(breakdownFrame.topright_text1, color) + DetailsFramework:SetFontColor(breakdownFrame.topright_text2, color) end + if (font) then - _detalhes.gump:SetFontFace (breakdownFrame.topright_text1, font) - _detalhes.gump:SetFontFace (breakdownFrame.topright_text2, font) + DetailsFramework:SetFontFace (breakdownFrame.topright_text1, font) + DetailsFramework:SetFontFace (breakdownFrame.topright_text2, font) end end - local alpha_bgs = 1 + --create the texts shown on the window + breakdownWindow.CreateTexts(SWW) - local este_gump = breakdownFrame - - -- backgrounds das 5 boxes do lado direito - local right_background_X = 457 - local right_background_Y = {-85, -136, -191, -246, -301} - - for i = 1, spellInfoSettings.amount do - local right_background1 = CreateFrame("frame", "DetailsPlayerDetailsWindow_right_background" .. i, SWW, "BackdropTemplate") - right_background1:EnableMouse(false) - right_background1:SetPoint("topleft", este_gump, "topleft", right_background_X, right_background_Y [i]) - right_background1:SetSize(220, 43) - Details.gump:ApplyStandardBackdrop(right_background1) - este_gump ["right_background" .. i] = right_background1 - - local gradientDown = DetailsFramework:CreateTexture(right_background1, {gradient = "vertical", fromColor = {0, 0, 0, 0.1}, toColor = "transparent"}, 1, 43, "artwork", {0, 1, 0, 1}) - gradientDown:SetPoint("bottoms") - end - - -- fundos especiais de friendly fire e outros - este_gump.bg1_sec_texture = SWW:CreateTexture("DetailsPlayerDetailsWindow_BG1_SEC_Texture", "BORDER") - este_gump.bg1_sec_texture:SetDrawLayer("BORDER", 4) - este_gump.bg1_sec_texture:SetPoint("topleft", este_gump.bg1, "topleft", 450, -86) - este_gump.bg1_sec_texture:SetHeight(462) - este_gump.bg1_sec_texture:SetWidth(264) - - este_gump.bg2_sec_texture = SWW:CreateTexture("DetailsPlayerDetailsWindow_BG2_SEC_Texture", "BORDER") - este_gump.bg2_sec_texture:SetDrawLayer("BORDER", 3) - este_gump.bg2_sec_texture:SetPoint("topleft", este_gump.bg1_sec_texture, "topleft", 8, 0) - este_gump.bg2_sec_texture:SetPoint("bottomright", este_gump.bg1_sec_texture, "bottomright", -30, 0) - este_gump.bg2_sec_texture:SetTexture([[Interface\Glues\CREDITS\Warlords\Shadowmoon_Color_jlo3]]) - este_gump.bg2_sec_texture:SetDesaturated(true) - este_gump.bg2_sec_texture:SetAlpha(0.3) - este_gump.bg2_sec_texture:Hide() - - este_gump.bg3_sec_texture = SWW:CreateTexture("DetailsPlayerDetailsWindow_BG3_SEC_Texture", "BORDER") - este_gump.bg3_sec_texture:SetDrawLayer("BORDER", 2) - este_gump.bg3_sec_texture:SetPoint("topleft", este_gump.bg2_sec_texture, "topleft", 0, 0) - este_gump.bg3_sec_texture:SetPoint("bottomright", este_gump.bg2_sec_texture, "bottomright", 0, 0) - este_gump.bg3_sec_texture:Hide() - - este_gump.no_targets = SWW:CreateTexture("DetailsPlayerDetailsWindow_no_targets", "overlay") - este_gump.no_targets:SetPoint("BOTTOMLEFT", este_gump, "BOTTOMLEFT", 20, 6) - este_gump.no_targets:SetSize(301, 100) - este_gump.no_targets:SetTexture([[Interface\QUESTFRAME\UI-QUESTLOG-EMPTY-TOPLEFT]]) - este_gump.no_targets:SetTexCoord(0.015625, 1, 0.01171875, 0.390625) - este_gump.no_targets:SetDesaturated(true) - este_gump.no_targets:SetAlpha(.7) - este_gump.no_targets.text = SWW:CreateFontString(nil, "overlay", "GameFontNormal") - este_gump.no_targets.text:SetPoint("center", este_gump.no_targets, "center") - este_gump.no_targets.text:SetText(Loc ["STRING_NO_TARGET_BOX"]) - este_gump.no_targets.text:SetTextColor(1, 1, 1, .4) - este_gump.no_targets:Hide() - - --cria os textos da janela - cria_textos (este_gump, SWW) - - --cria o frama que vai abrigar as barras das habilidades - cria_container_barras (este_gump, SWW) - - --cria o container que vai abrirgar as 5 barras de detalhes - cria_container_detalhes (este_gump, SWW) - - --cria o container onde vai abrigar os alvos do jogador - cria_container_alvos (este_gump, SWW) - - local leftbars1_backgound = CreateFrame("frame", "DetailsPlayerDetailsWindow_Left_SpellsBackground", SWW, "BackdropTemplate") - leftbars1_backgound:EnableMouse(false) - leftbars1_backgound:SetSize(303, 149) - leftbars1_backgound:SetAlpha(alpha_bgs) - leftbars1_backgound:SetFrameLevel(SWW:GetFrameLevel()) - Details.gump:ApplyStandardBackdrop(leftbars1_backgound) - este_gump.leftbars1_backgound = leftbars1_backgound - - local leftbars2_backgound = CreateFrame("frame", "DetailsPlayerDetailsWindow_Left_TargetBackground", SWW, "BackdropTemplate") - leftbars2_backgound:EnableMouse(false) - leftbars2_backgound:SetSize(303, 122) - leftbars2_backgound:SetAlpha(alpha_bgs) - leftbars2_backgound:SetFrameLevel(SWW:GetFrameLevel()) - Details.gump:ApplyStandardBackdrop(leftbars2_backgound) - este_gump.leftbars2_backgound = leftbars2_backgound - - leftbars1_backgound:SetPoint("topleft", este_gump.container_barras, "topleft", -3, 3) - leftbars1_backgound:SetPoint("bottomright", este_gump.container_barras, "bottomright", 3, -3) - leftbars2_backgound:SetPoint("topleft", este_gump.container_alvos, "topleft", -3, 23) - leftbars2_backgound:SetPoint("bottomright", este_gump.container_alvos, "bottomright", 3, 0) - - --cria as 5 barras de detalhes a direita da janela - cria_barras_detalhes() - - --seta os scripts dos frames da janela - seta_scripts (este_gump) - - --vai armazenar os objetos das barras de habilidade - este_gump.barras1 = {} - - --vai armazenar os objetos das barras de alvos - este_gump.barras2 = {} - - --vai armazenar os objetos das barras da caixa especial da direita - este_gump.barras3 = {} - - este_gump.SetClassIcon = default_icon_change - - --bot�o de reportar da caixa da esquerda, onde fica as barras principais - este_gump.report_esquerda = gump:NewDetailsButton (SWW, este_gump, nil, _detalhes.Reportar, este_gump, 1, 16, 16, - "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", nil, "DetailsJanelaInfoReport2") - este_gump.report_esquerda:SetPoint("BOTTOMLEFT", este_gump.container_barras, "TOPLEFT", 33, 3) - este_gump.report_esquerda:SetFrameLevel(este_gump:GetFrameLevel()+2) - este_gump.topleft_report = este_gump.report_esquerda - - --bot�o de reportar da caixa dos alvos - este_gump.report_alvos = gump:NewDetailsButton (SWW, este_gump, nil, _detalhes.Reportar, este_gump, 3, 16, 16, - "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", nil, "DetailsJanelaInfoReport3") - este_gump.report_alvos:SetPoint("BOTTOMRIGHT", este_gump.container_alvos, "TOPRIGHT", -2, -1) - este_gump.report_alvos:SetFrameLevel(3) --solved inactive problem - - --bot�o de reportar da caixa da direita, onde est�o os 5 quadrados - este_gump.report_direita = gump:NewDetailsButton (SWW, este_gump, nil, _detalhes.Reportar, este_gump, 2, 16, 16, - "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", nil, "DetailsJanelaInfoReport4") - este_gump.report_direita:SetPoint("TOPRIGHT", este_gump, "TOPRIGHT", -10, -70) - este_gump.report_direita:Show() + breakdownFrame.SetClassIcon = default_icon_change --statusbar - local statusBar = CreateFrame("frame", nil, este_gump, "BackdropTemplate") - statusBar:SetPoint("bottomleft", este_gump, "bottomleft") - statusBar:SetPoint("bottomright", este_gump, "bottomright") + local statusBar = CreateFrame("frame", nil, breakdownFrame, "BackdropTemplate") + statusBar:SetPoint("bottomleft", breakdownFrame, "bottomleft") + statusBar:SetPoint("bottomright", breakdownFrame, "bottomright") statusBar:SetHeight(PLAYER_DETAILS_STATUSBAR_HEIGHT) DetailsFramework:ApplyStandardBackdrop(statusBar) statusBar:SetAlpha(PLAYER_DETAILS_STATUSBAR_ALPHA) @@ -1781,9 +1111,9 @@ function gump:CriaJanelaInfo() statusBar.Text = DetailsFramework:CreateLabel(statusBar) statusBar.Text:SetPoint("left", 2, 0) - function este_gump:SetStatusbarText (text, fontSize, fontColor) + function breakdownFrame:SetStatusbarText(text, fontSize, fontColor) if (not text) then - este_gump:SetStatusbarText ("Details! Damage Meter | Use '/details stats' for statistics", 10, "gray") + breakdownFrame:SetStatusbarText("Details! Damage Meter | Use '/details stats' for statistics", 10, "gray") return end statusBar.Text.text = text @@ -1792,113 +1122,82 @@ function gump:CriaJanelaInfo() end --set default text - este_gump:SetStatusbarText() + breakdownFrame:SetStatusbarText() --apply default skin - _detalhes:ApplyPDWSkin() + --_detalhes:ApplyPDWSkin() -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---tabs +--tabs ~tabs + function breakdownFrame:ShowTabs() + local tabsShown = 0 + local secondRowIndex = 1 + local breakLine = 6 --the tab it'll start the second line - --tabs: - --tab default + local tablePool = Details:GetBreakdownTabsInUse() - local iconTableSummary = { - texture = [[Interface\AddOns\Details\images\icons]], - coords = {238/512, 255/512, 0, 18/512}, - width = 16, - height = 16, - } + for index = 1, #tablePool do + local tab = tablePool[index] - _detalhes:CreatePlayerDetailsTab("Summary", Loc ["STRING_SPELLS"], --[1] tab name [2] localized name - function(tabOBject, playerObject) --[3] condition - if (playerObject) then - return true - else - return false - end - end, - nil, --[4] fill function - function() --[5] onclick - for _, tab in ipairs(Details:GetBreakdownTabsInUse()) do - tab.frame:Hide() - end - end, - nil, --[6] oncreate - iconTableSummary --[7] icon table - ) + if (tab:condition(info.jogador, info.atributo, info.sub_atributo) and not tab.replaced) then + --test if can show the tutorial for the comparison tab + if (tab.tabname == "Compare") then + --_detalhes:SetTutorialCVar ("DETAILS_INFO_TUTORIAL1", false) + if (not _detalhes:GetTutorialCVar("DETAILS_INFO_TUTORIAL1")) then + _detalhes:SetTutorialCVar ("DETAILS_INFO_TUTORIAL1", true) - -- ~tab ~tabs - function este_gump:ShowTabs() - local tabsShown = 0 - local secondRowIndex = 1 - local breakLine = 6 --th tab it'll start the second line - - local tablePool = Details:GetBreakdownTabsInUse() - - for index = 1, #tablePool do - local tab = tablePool[index] - - if (tab:condition(info.jogador, info.atributo, info.sub_atributo) and not tab.replaced) then - --test if can show the tutorial for the comparison tab - if (tab.tabname == "Compare") then - --_detalhes:SetTutorialCVar ("DETAILS_INFO_TUTORIAL1", false) - if (not _detalhes:GetTutorialCVar("DETAILS_INFO_TUTORIAL1")) then - _detalhes:SetTutorialCVar ("DETAILS_INFO_TUTORIAL1", true) - - local alert = CreateFrame("frame", "DetailsInfoPopUp1", info, "DetailsHelpBoxTemplate") - 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:Show() - end + local alert = CreateFrame("frame", "DetailsInfoPopUp1", info, "DetailsHelpBoxTemplate") + 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:Show() end + end - tab:Show() - tabsShown = tabsShown + 1 + tab:Show() + tabsShown = tabsShown + 1 - tab:ClearAllPoints() + tab:ClearAllPoints() - --get the button width - local buttonTemplate = gump:GetTemplate("button", "DETAILS_TAB_BUTTON_TEMPLATE") - local buttonWidth = buttonTemplate.width + 1 + --get the button width + local buttonTemplate = gump:GetTemplate("button", "DETAILS_TAB_BUTTON_TEMPLATE") + local buttonWidth = buttonTemplate.width + 1 - --pixelutil might not be compatible with classic wow - if (PixelUtil) then - PixelUtil.SetSize(tab, buttonTemplate.width, buttonTemplate.height) - if (tabsShown >= breakLine) then --next row of icons - PixelUtil.SetPoint(tab, "bottomright", info, "topright", -514 + (buttonWidth * (secondRowIndex)), -50) - secondRowIndex = secondRowIndex + 1 - else - PixelUtil.SetPoint(tab, "bottomright", info, "topright", -514 + (buttonWidth * tabsShown), -72) - end + --pixelutil might not be compatible with classic wow + if (PixelUtil) then + PixelUtil.SetSize(tab, buttonTemplate.width, buttonTemplate.height) + if (tabsShown >= breakLine) then --next row of icons + PixelUtil.SetPoint(tab, "bottomright", info, "topright", -514 + (buttonWidth * (secondRowIndex)), -50) + secondRowIndex = secondRowIndex + 1 else - tab:SetSize(buttonTemplate.width, buttonTemplate.height) - if (tabsShown >= breakLine) then --next row of icons - tab:SetPoint("bottomright", info, "topright", -514 + (buttonWidth * (secondRowIndex)), -50) - secondRowIndex = secondRowIndex + 1 - else - tab:SetPoint("bottomright", info, "topright", -514 + (buttonWidth * tabsShown), -72) - end + PixelUtil.SetPoint(tab, "bottomright", info, "topright", -514 + (buttonWidth * tabsShown), -72) end - - tab:SetAlpha(0.8) else - tab.frame:Hide() - tab:Hide() + tab:SetSize(buttonTemplate.width, buttonTemplate.height) + if (tabsShown >= breakLine) then --next row of icons + tab:SetPoint("bottomright", info, "topright", -514 + (buttonWidth * (secondRowIndex)), -50) + secondRowIndex = secondRowIndex + 1 + else + tab:SetPoint("bottomright", info, "topright", -514 + (buttonWidth * tabsShown), -72) + end end - end - if (tabsShown < 2) then - tablePool[1]:SetPoint("BOTTOMLEFT", info.container_barras, "TOPLEFT", 490 - (94 * (1-0)), 1) + tab:SetAlpha(0.8) + else + tab.frame:Hide() + tab:Hide() end - - --selected by default - tablePool[1]:Click() end - este_gump:SetScript("OnHide", function(self) + if (tabsShown < 2) then + tablePool[1]:SetPoint("BOTTOMLEFT", info.container_barras, "TOPLEFT", 490 - (94 * (1-0)), 1) + end + + --selected by default + tablePool[1]:Click() + end + breakdownFrame:SetScript("OnHide", function(self) _detalhes:FechaJanelaInfo() for _, tab in ipairs(_detalhes.player_details_tabs) do tab:Hide() @@ -1906,42 +1205,52 @@ function gump:CriaJanelaInfo() end end) - este_gump.tipo = 1 --tipo da janela // 1 = janela normal - - return este_gump - + breakdownFrame.tipo = 1 --tipo da janela // 1 = janela normal + return breakdownFrame end info.selectedTab = "Summary" -function _detalhes:CreatePlayerDetailsTab (tabname, localized_name, condition, fillfunction, onclick, oncreate, iconSettings, replace) - if (not tabname) then - tabname = "unnamed" +function _detalhes:CreatePlayerDetailsTab(tabName, locName, conditionFunc, fillFunc, tabOnClickFunc, onCreateFunc, iconSettings, replace, bIsDefaultTab) --~tab + if (not tabName) then + tabName = "unnamed" end --create a button for the tab - local newTabButton = gump:CreateButton(info, onclick, 20, 20, nil, nil, nil, nil, nil, "DetailsPlayerBreakdownWindowTab" .. tabname) + --tabOnClickFunc + local newTabButton = gump:CreateButton(info, function()end, 20, 20, nil, nil, nil, nil, nil, breakdownWindow:GetName() .. "TabButton" .. tabName .. math.random(1, 1000)) newTabButton:SetTemplate("DETAILS_TAB_BUTTON_TEMPLATE") - if (tabname == "Summary") then + if (tabName == "Summary") then newTabButton:SetTemplate("DETAILS_TAB_BUTTONSELECTED_TEMPLATE") end - newTabButton:SetText(localized_name) + + newTabButton.IsDefaultTab = bIsDefaultTab + + newTabButton:SetText(locName) newTabButton:SetFrameStrata("HIGH") newTabButton:SetFrameLevel(info:GetFrameLevel()+1) newTabButton:Hide() - newTabButton.condition = condition - newTabButton.tabname = tabname - newTabButton.localized_name = localized_name - newTabButton.onclick = onclick - newTabButton.fillfunction = fillfunction + newTabButton.condition = conditionFunc + newTabButton.tabname = tabName + newTabButton.localized_name = locName + newTabButton.onclick = tabOnClickFunc + newTabButton.fillfunction = fillFunc newTabButton.last_actor = {} - newTabButton.frame = CreateFrame("frame", "DetailsPDWTabFrame" .. tabname, UIParent,"BackdropTemplate") - newTabButton.frame:SetParent(info) - newTabButton.frame:SetFrameStrata("HIGH") - newTabButton.frame:SetFrameLevel(info:GetFrameLevel()+5) - newTabButton.frame:EnableMouse(true) + ---@type tabframe + local tabFrame = CreateFrame("frame", breakdownWindow:GetName() .. "TabFrame" .. tabName .. math.random(1, 1000), UIParent, "BackdropTemplate") + DetailsFramework:ApplyStandardBackdrop(tabFrame) + newTabButton.tabFrame = tabFrame + newTabButton.frame = tabFrame + + tabFrame:SetParent(info) + tabFrame:SetFrameStrata("HIGH") + tabFrame:SetFrameLevel(info:GetFrameLevel()+5) + tabFrame:EnableMouse(true) + tabFrame:SetPoint("topleft", breakdownWindow, "topleft", 0, -70) + tabFrame:SetPoint("bottomright", breakdownWindow, "bottomright", 0, 20) + tabFrame:Hide() if (iconSettings) then local texture = iconSettings.texture @@ -1958,80 +1267,63 @@ function _detalhes:CreatePlayerDetailsTab (tabname, localized_name, condition, f end if (newTabButton.fillfunction) then - newTabButton.frame:SetScript("OnShow", function() + tabFrame:SetScript("OnShow", function() if (newTabButton.last_actor == info.jogador) then return end newTabButton.last_actor = info.jogador - newTabButton:fillfunction (info.jogador, info.instancia.showing) + newTabButton:fillfunction(info.jogador, info.instancia.showing) end) end - if (oncreate) then - oncreate (newTabButton, newTabButton.frame) + if (onCreateFunc) then + onCreateFunc(newTabButton, tabFrame) end - newTabButton.frame:SetBackdrop({ - edgeFile = [[Interface\Buttons\WHITE8X8]], - edgeSize = 1, - bgFile = [[Interface\AddOns\Details\images\background]], - tileSize = 64, - tile = true, - insets = {left = 0, right = 0, top = 0, bottom = 0}} - ) - - newTabButton.frame:SetBackdropColor(0, 0, 0, 0.3) - newTabButton.frame:SetBackdropBorderColor(.3, .3, .3, 0) - - newTabButton.frame:SetPoint("TOPLEFT", info.container_barras, "TOPLEFT", 0, 2) - --newTabButton.frame:SetPoint("bottomright", info, "bottomright", -3, 3) --issue with: Action[SetPoint] failed because[SetPoint would result in anchor family connection]: attempted from: DetailsPlayerDetailsWindow:SetPoint. - newTabButton.frame:SetSize(569, 274) - - newTabButton.frame:Hide() - newTabButton.replaces = replace - _detalhes.player_details_tabs [#_detalhes.player_details_tabs+1] = newTabButton + _detalhes.player_details_tabs[#_detalhes.player_details_tabs+1] = newTabButton - if (not onclick) then - --hide all tabs - newTabButton.OnShowFunc = function(self) - self = self.MyObject or self + local onTabClickCallback = function(self) + self = self.MyObject or self - for _, tab in ipairs(Details:GetBreakdownTabsInUse()) do - tab.frame:Hide() - tab:SetTemplate("DETAILS_TAB_BUTTON_TEMPLATE") - end - - self:SetTemplate("DETAILS_TAB_BUTTONSELECTED_TEMPLATE") - self.frame:Show() - info.selectedTab = self.tabname + for _, tab in ipairs(Details:GetBreakdownTabsInUse()) do + tab.frame:Hide() + tab:SetTemplate("DETAILS_TAB_BUTTON_TEMPLATE") end + self:SetTemplate("DETAILS_TAB_BUTTONSELECTED_TEMPLATE") + info.selectedTab = self.tabname + end + + if (not tabOnClickFunc) then + newTabButton.OnShowFunc = function(self) + --hide all tab frames, reset the template on all tabs + --then set the template on this tab and set as selected tab + onTabClickCallback(self) + --show the tab frame + tabFrame:Show() + end newTabButton:SetScript("OnClick", newTabButton.OnShowFunc) else --custom newTabButton.OnShowFunc = function(self) - self = self.MyObject or self - - for _, tab in ipairs(Details:GetBreakdownTabsInUse()) do - tab.frame:Hide() - tab:SetTemplate("DETAILS_TAB_BUTTON_TEMPLATE") - end - - self:SetTemplate("DETAILS_TAB_BUTTONSELECTED_TEMPLATE") - - info.selectedTab = self.tabname + --hide all tab frames, reset the template on all tabs + --then set the template on this tab and set as selected tab + onTabClickCallback(self) --run onclick func - local result, errorText = pcall(self.onclick) + local result, errorText = pcall(tabOnClickFunc, newTabButton, tabFrame) if (not result) then - print(errorText) + print("error on running tabOnClick function:", errorText) end end - newTabButton:SetScript("OnClick", newTabButton.OnShowFunc) end + function newTabButton:DoClick() + self:GetScript("OnClick")(self) + end + newTabButton:SetScript("PostClick", function(self) CurrentTab = self.tabname or self.MyObject.tabname @@ -2046,755 +1338,5 @@ function _detalhes:CreatePlayerDetailsTab (tabname, localized_name, condition, f end end) - return newTabButton, newTabButton.frame -end - -function _detalhes.playerDetailWindow:monta_relatorio (botao) - local atributo = info.atributo - local sub_atributo = info.sub_atributo - local player = info.jogador - local instancia = info.instancia - - local amt = _detalhes.report_lines - - if (not player) then - _detalhes:Msg("Player not found.") - return - end - - local report_lines - - if (botao == 1) then --bot�o da esquerda - - - if (atributo == 1 and sub_atributo == 4) then --friendly fire - report_lines = {"Details!: " .. player.nome .. " " .. Loc ["STRING_ATTRIBUTE_DAMAGE_FRIENDLYFIRE"] .. ":"} - - elseif (atributo == 1 and sub_atributo == 3) then --damage taken - report_lines = {"Details!: " .. player.nome .. " " .. Loc ["STRING_ATTRIBUTE_DAMAGE_TAKEN"] .. ":"} - - else - -- report_lines = {"Details! " .. Loc ["STRING_ACTORFRAME_SPELLSOF"] .. " " .. player.nome .. " (" .. _detalhes.sub_atributos [atributo].lista [sub_atributo] .. ")"} - report_lines = {"Details!: " .. player.nome .. " - " .. _detalhes.sub_atributos [atributo].lista [sub_atributo] .. ""} - - end - - for index, barra in ipairs(info.barras1) do - if (barra:IsShown()) then - local spellid = barra.show - if (atributo == 1 and sub_atributo == 4) then --friendly fire - report_lines [#report_lines+1] = barra.lineText1:GetText() .. ": " .. barra.lineText4:GetText() - - elseif (type(spellid) == "number" and spellid > 10) then - local link = GetSpellLink(spellid) - report_lines [#report_lines+1] = index .. ". " .. link .. ": " .. barra.lineText4:GetText() - else - local spellname = barra.lineText1:GetText():gsub((".*%."), "") - spellname = spellname:gsub("|c%x%x%x%x%x%x%x%x", "") - spellname = spellname:gsub("|r", "") - report_lines [#report_lines+1] = index .. ". " .. spellname .. ": " .. barra.lineText4:GetText() - end - end - if (index == amt) then - break - end - end - - elseif (botao == 3) then --bot�o dos alvos - - if (atributo == 1 and sub_atributo == 3) then - print(Loc ["STRING_ACTORFRAME_NOTHING"]) - return - end - - report_lines = {"Details! " .. Loc ["STRING_ACTORFRAME_REPORTTARGETS"] .. " " .. _detalhes.sub_atributos [1].lista [1] .. " " .. Loc ["STRING_ACTORFRAME_REPORTOF"] .. " " .. player.nome} - - for index, barra in ipairs(info.barras2) do - if (barra:IsShown()) then - report_lines [#report_lines+1] = barra.lineText1:GetText().." -> ".. barra.lineText4:GetText() - end - if (index == amt) then - break - end - end - - elseif (botao == 2) then --bot�o da direita - - --diferentes tipos de amostragem na caixa da direita - --dano --damage done --dps --heal - if ((atributo == 1 and (sub_atributo == 1 or sub_atributo == 2)) or (atributo == 2)) then - if (not player.detalhes) then - print(Loc ["STRING_ACTORFRAME_NOTHING"]) - return - end - local nome = _GetSpellInfo(player.detalhes) - report_lines = {"Details! " .. Loc ["STRING_ACTORFRAME_REPORTTO"] .. " " .. _detalhes.sub_atributos [atributo].lista [sub_atributo] .. " " .. Loc ["STRING_ACTORFRAME_REPORTOF"] .. " " .. player.nome, - Loc ["STRING_ACTORFRAME_SPELLDETAILS"] .. ": " .. nome} - - for i = 1, 5 do - - --pega os dados dos quadrados --Aqui mostra o resumo de todos os quadrados... - local caixa = info.grupos_detalhes [i] - if (caixa.bg:IsShown()) then - - local linha = "" - - local nome2 = caixa.nome2:GetText() --golpes - if (nome2 and nome2 ~= "") then - if (i == 1) then - linha = linha..nome2.." / " - else - linha = linha..caixa.nome:GetText().." "..nome2.." / " - end - end - - local dano = caixa.dano:GetText() --dano - if (dano and dano ~= "") then - linha = linha..dano.." / " - end - - local media = caixa.dano_media:GetText() --media - if (media and media ~= "") then - linha = linha..media.." / " - end - - local dano_dps = caixa.dano_dps:GetText() - if (dano_dps and dano_dps ~= "") then - linha = linha..dano_dps.." / " - end - - local dano_porcento = caixa.dano_porcento:GetText() - if (dano_porcento and dano_porcento ~= "") then - linha = linha..dano_porcento.." " - end - - report_lines [#report_lines+1] = linha - - end - - if (i == amt) then - break - end - end - - --dano --damage tanken (mostra as magias que o alvo usou) - elseif ( (atributo == 1 and sub_atributo == 3) or atributo == 3) then - if (player.detalhes) then - report_lines = {"Details! " .. Loc ["STRING_ACTORFRAME_REPORTTO"] .. " " .. _detalhes.sub_atributos [1].lista [1] .. " " .. Loc ["STRING_ACTORFRAME_REPORTOF"] .. " " .. player.detalhes.. " " .. Loc ["STRING_ACTORFRAME_REPORTAT"] .. " " .. player.nome} - for index, barra in ipairs(info.barras3) do - if (barra:IsShown()) then - report_lines [#report_lines+1] = barra.lineText1:GetText().." ....... ".. barra.lineText4:GetText() - end - if (index == amt) then - break - end - end - else - report_lines = {} - end - end - - elseif (botao >= 11) then --primeira caixa dos detalhes - botao = botao - 10 - - local nome - if (type(spellid) == "string") then - --is a pet - else - nome = _GetSpellInfo(player.detalhes) - local spelllink = GetSpellLink(player.detalhes) - if (spelllink) then - nome = spelllink - end - end - - if (not nome) then - nome = "" - end - report_lines = {"Details! " .. Loc ["STRING_ACTORFRAME_REPORTTO"] .. " " .. _detalhes.sub_atributos [atributo].lista [sub_atributo].. " " .. Loc ["STRING_ACTORFRAME_REPORTOF"] .. " " .. player.nome, - Loc ["STRING_ACTORFRAME_SPELLDETAILS"] .. ": " .. nome} - - local caixa = info.grupos_detalhes [botao] - - local linha = "" - local nome2 = caixa.nome2:GetText() --golpes - if (nome2 and nome2 ~= "") then - if (i == 1) then - linha = linha..nome2.." / " - else - linha = linha..caixa.nome:GetText().." "..nome2.." / " - end - end - - local dano = caixa.dano:GetText() --dano - if (dano and dano ~= "") then - linha = linha..dano.." / " - end - - local media = caixa.dano_media:GetText() --media - if (media and media ~= "") then - linha = linha..media.." / " - end - - local dano_dps = caixa.dano_dps:GetText() - if (dano_dps and dano_dps ~= "") then - linha = linha..dano_dps.." / " - end - - local dano_porcento = caixa.dano_porcento:GetText() - if (dano_porcento and dano_porcento ~= "") then - linha = linha..dano_porcento.." " - end - - --remove a cor da school - linha = linha:gsub("|c%x?%x?%x?%x?%x?%x?%x?%x?", "") - linha = linha:gsub("|r", "") - - report_lines [#report_lines+1] = linha - - end - - return instancia:envia_relatorio (report_lines) -end - -local row_backdrop = {bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", - insets = {left = 0, right = 0, top = 0, bottom = 0}} -local row_backdrop_onleave = {bgFile = "", edgeFile = "", tile = true, tileSize = 16, edgeSize = 32, - insets = {left = 1, right = 1, top = 0, bottom = 1}} - -local row_on_enter = function(self) - if (info.fading_in or info.faded) then - return - end - - self.mouse_over = true - - for index, block in pairs(_detalhes.playerDetailWindow.grupos_detalhes) do - detalhe_infobg_onleave (block.bg) - end - - --aumenta o tamanho da barra - self:SetHeight(CONST_BAR_HEIGHT + 1) - --poe a barra com alfa 1 ao inv�s de 0.9 - self:SetAlpha(1) - - --troca a cor da barra enquanto o mouse estiver em cima dela - self:SetBackdrop(row_backdrop) - self:SetBackdropColor(0.8, 0.8, 0.8, 0.3) - - if (self.isAlvo) then --monta o tooltip do alvo - --talvez devesse escurecer a janela no fundo... pois o tooltip � transparente e pode confundir - GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT") - - if (self.spellid == "enemies") then --damage taken enemies - if (not self.minha_tabela or not self.minha_tabela:MontaTooltipDamageTaken (self, self._index, info.instancia)) then -- > poderia ser aprimerado para uma tailcall - return - end - GameTooltip:Show() - self:SetHeight(CONST_TARGET_HEIGHT + 1) - return - end - - if (not self.minha_tabela or not self.minha_tabela:MontaTooltipAlvos (self, self._index, info.instancia)) then -- > poderia ser aprimerado para uma tailcall - return - end - - elseif (self.isMain) then - if (IsShiftKeyDown()) then - if (type(self.show) == "number") then - GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT") - GameTooltip:AddLine(Loc ["ABILITY_ID"] .. ": " .. self.show) - GameTooltip:Show() - end - end - - if (self.show == 98021) then - GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT") - GameTooltip:AddLine(Loc ["STRING_SPIRIT_LINK_TOTEM_DESC"]) - GameTooltip:Show() - end - - --da zoom no icone - self.icone:SetWidth(CONST_BAR_HEIGHT + 2) - self.icone:SetHeight(CONST_BAR_HEIGHT + 2) - --poe a alfa do icone em 1.0 - self.icone:SetAlpha(1) - - --mostrar temporariamente o conteudo da barra nas caixas de detalhes - if (not info.mostrando) then --n�o esta mostrando nada na direita - info.mostrando = self --agora o mostrando � igual a esta barra - info.mostrando_mouse_over = true --o conteudo da direta esta sendo mostrado pq o mouse esta passando por cima do bagulho e n�o pq foi clicado - info.showing = self._index --diz o index da barra que esta sendo mostrado na direita - - info.jogador.detalhes = self.show --minha tabela = jogador = jogador.detales = spellid ou nome que esta sendo mostrado na direita - info.jogador:MontaDetalhes (self.show, self, info.instancia) --passa a spellid ou nome e a barra - end - elseif (self.isDetalhe and type(self.show) == "number") then - GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT") - Details:GameTooltipSetSpellByID(self.show) - GameTooltip:Show() - end -end - -local row_on_leave = function(self) - if (self.fading_in or self.faded or not self:IsShown() or self.hidden) then - return - end - - self.mouse_over = false - - --diminui o tamanho da barra - self:SetHeight(CONST_BAR_HEIGHT) - --volta com o alfa antigo da barra que era de 0.9 - self:SetAlpha(0.9) - - --volto o background ao normal - self:SetBackdrop(row_backdrop_onleave) - self:SetBackdropBorderColor(0, 0, 0, 0) - self:SetBackdropColor(0, 0, 0, 0) - - GameTooltip:Hide() - - GameCooltip:Hide() - - if (self.isMain) then - --retira o zoom no icone - self.icone:SetWidth(CONST_BAR_HEIGHT) - self.icone:SetHeight(CONST_BAR_HEIGHT) - --volta com a alfa antiga da barra - self.icone:SetAlpha(1) - - --remover o conte�do que estava sendo mostrado na direita - if (info.mostrando_mouse_over) then - info.mostrando = nil - info.mostrando_mouse_over = false - info.showing = nil - - info.jogador.detalhes = nil - gump:HidaAllDetalheInfo() - end - - elseif (self.isAlvo) then - self:SetHeight(CONST_TARGET_HEIGHT) - elseif (self.isDetalhe) then - self:SetHeight(16) - end -end - -local row_on_mousedown = function(self, button) - if (self.fading_in) then - return - end - - self.mouse_down = GetTime() - local x, y = _GetCursorPosition() - self.x = _math_floor(x) - self.y = _math_floor(y) - - if (button == "RightButton" and not info.isMoving) then - _detalhes:FechaJanelaInfo() - - elseif (not info.isMoving and button == "LeftButton" and not self.isDetalhe) then - info:StartMoving() - info.isMoving = true - end -end - -local row_on_mouseup = function(self, button) - if (self.fading_in) then - return - end - - if (info.isMoving and button == "LeftButton" and not self.isDetalhe) then - info:StopMovingOrSizing() - info.isMoving = false - end - - local x, y = _GetCursorPosition() - x = _math_floor(x) - y = _math_floor(y) - if ((self.mouse_down+0.4 > GetTime() and (x == self.x and y == self.y)) or (x == self.x and y == self.y)) then - --setar os textos - - if (self.isMain) then --se n�o for uma barra de alvo - - local barra_antiga = info.mostrando - if (barra_antiga and not info.mostrando_mouse_over) then - - barra_antiga.textura:SetStatusBarColor(1, 1, 1, 1) --volta a textura normal - barra_antiga.on_focus = false --n�o esta mais no foco - - --clicou na mesma barra - if (barra_antiga == self) then --> - info.mostrando_mouse_over = true - return - - --clicou em outra barra - else --clicou em outra barra e trocou o foco - barra_antiga:SetAlpha(.9) --volta a alfa antiga - - info.mostrando = self - info.showing = i - - info.jogador.detalhes = self.show - info.jogador:MontaDetalhes (self.show, self) - - self:SetAlpha(1) - self.textura:SetStatusBarColor(129/255, 125/255, 69/255, 1) - self.on_focus = true - return - end - end - - --nao tinha barras pressionadas - info.mostrando_mouse_over = false - self:SetAlpha(1) - self.textura:SetStatusBarColor(129/255, 125/255, 69/255, 1) - self.on_focus = true - end - end -end - -local function SetBarraScripts (esta_barra, instancia, i) - esta_barra._index = i - - esta_barra:SetScript("OnEnter", row_on_enter) - esta_barra:SetScript("OnLeave", row_on_leave) - - esta_barra:SetScript("OnMouseDown", row_on_mousedown) - esta_barra:SetScript("OnMouseUp", row_on_mouseup) -end - -local function CriaTexturaBarra(newLine) - newLine.textura = CreateFrame("StatusBar", nil, newLine, "BackdropTemplate") - newLine.textura:SetFrameLevel(newLine:GetFrameLevel()-1) - newLine.textura:SetAllPoints(newLine) - newLine.textura:SetAlpha(0.5) - newLine.textura:Show() - - local textureObject = newLine.textura:CreateTexture(nil, "artwork") - local texturePath = SharedMedia:Fetch("statusbar", _detalhes.player_details_window.bar_texture) - textureObject:SetTexture(texturePath) - newLine.textura:SetStatusBarTexture(textureObject) - newLine.textura:SetStatusBarColor(.5, .5, .5, 1) - --newLine.textura:SetColorFill(.5, .5, .5, 1) --(r, g, b, a) --only in 10.0? - newLine.textura:SetMinMaxValues(0, 100) - - local backgroundTexture = newLine.textura:CreateTexture(nil, "background") - backgroundTexture:SetAllPoints() - backgroundTexture:SetColorTexture(.5, .5, .5, 0.18) - newLine.textura.bg = backgroundTexture - - if (newLine.targets) then - newLine.targets:SetParent(newLine.textura) - newLine.targets:SetFrameLevel(newLine.textura:GetFrameLevel()+2) - end - - --create the left text - newLine.lineText1 = newLine:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") - newLine.lineText1:SetPoint("LEFT", newLine.icone, "RIGHT", 2, 0) - newLine.lineText1:SetJustifyH("LEFT") - newLine.lineText1:SetTextColor(1,1,1,1) - newLine.lineText1:SetNonSpaceWrap(true) - newLine.lineText1:SetWordWrap(false) - - --create the rigth text - newLine.lineText4 = newLine:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") - if (newLine.targets) then - newLine.lineText4:SetPoint("RIGHT", newLine.targets, "LEFT", -2, 0) - else - newLine.lineText4:SetPoint("RIGHT", newLine, "RIGHT", -2, 0) - end - newLine.lineText4:SetJustifyH("RIGHT") - newLine.lineText4:SetTextColor(1,1,1,1) -end - -local miniframe_func_on_enter = function(self) - local barra = self:GetParent() - if (barra.show and type(barra.show) == "number") then - local spellname = _GetSpellInfo(barra.show) - if (spellname) then - GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT") - _detalhes:GameTooltipSetSpellByID (barra.show) - GameTooltip:Show() - end - end - barra:GetScript("OnEnter")(barra) -end - -local miniframe_func_on_leave = function(self) - GameTooltip:Hide() - self:GetParent():GetScript("OnLeave")(self:GetParent()) -end - -local target_on_enter = function(self) - local barra = self:GetParent():GetParent() - - if (barra.show and type(barra.show) == "number") then - local actor = barra.other_actor or info.jogador - local spell = actor.spells and actor.spells:PegaHabilidade (barra.show) - if (spell) then - - local ActorTargetsSortTable = {} - local ActorTargetsContainer - local total = 0 - - if (spell.isReflection) then - ActorTargetsContainer = spell.extra - else - local attribute, sub_attribute = info.instancia:GetDisplay() - if (attribute == 1 or attribute == 3) then - ActorTargetsContainer = spell.targets - else - if (sub_attribute == 3) then --overheal - ActorTargetsContainer = spell.targets_overheal - elseif (sub_attribute == 6) then --absorbs - ActorTargetsContainer = spell.targets_absorbs - else - ActorTargetsContainer = spell.targets - end - end - end - - --add and sort - for target_name, amount in pairs(ActorTargetsContainer) do - ActorTargetsSortTable [#ActorTargetsSortTable+1] = {target_name, amount or 0} - total = total + (amount or 0) - end - table.sort (ActorTargetsSortTable, _detalhes.Sort2) - - local spellname = _GetSpellInfo(barra.show) - - GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT") - GameTooltip:AddLine(barra.index .. ". " .. spellname) - GameTooltip:AddLine(info.target_text) - GameTooltip:AddLine(" ") - - --get time type - local meu_tempo - if (_detalhes.time_type == 1 or not actor.grupo) then - meu_tempo = actor:Tempo() - elseif (_detalhes.time_type == 2) then - meu_tempo = info.instancia.showing:GetCombatTime() - end - - local SelectedToKFunction = _detalhes.ToKFunctions [_detalhes.ps_abbreviation] - - if (spell.isReflection) then - _detalhes:FormatCooltipForSpells() - GameCooltip:SetOwner(self, "bottomright", "top", 4, -2) - - _detalhes:AddTooltipSpellHeaderText ("Spells Reflected", {1, 0.9, 0.0, 1}, 1, select(3, _GetSpellInfo(spell.id)), 0.1, 0.9, 0.1, 0.9) --localize-me - _detalhes:AddTooltipHeaderStatusbar (1, 1, 1, 0.4) - - GameCooltip:AddIcon(select(3, _GetSpellInfo(spell.id)), 1, 1, 16, 16, .1, .9, .1, .9) - _detalhes:AddTooltipHeaderStatusbar (1, 1, 1, 0.5) - - local topDamage = ActorTargetsSortTable[1] and ActorTargetsSortTable[1][2] - - for index, target in ipairs(ActorTargetsSortTable) do - if (target [2] > 0) then - local spellId = target[1] - local damageDone = target[2] - local spellName, _, spellIcon = _GetSpellInfo(spellId) - GameCooltip:AddLine(spellName, SelectedToKFunction (_, damageDone) .. " (" .. floor(damageDone / topDamage * 100) .. "%)") - GameCooltip:AddIcon(spellIcon, 1, 1, 16, 16, .1, .9, .1, .9) - _detalhes:AddTooltipBackgroundStatusbar (false, damageDone / topDamage * 100) - end - end - - GameCooltip:Show() - - self.texture:SetAlpha(1) - self:SetAlpha(1) - barra:GetScript("OnEnter")(barra) - return - else - for index, target in ipairs(ActorTargetsSortTable) do - if (target [2] > 0) then - local class = _detalhes:GetClass(target [1]) - if (class and _detalhes.class_coords [class]) then - local cords = _detalhes.class_coords [class] - if (info.target_persecond) then - GameTooltip:AddDoubleLine (index .. ". |TInterface\\AddOns\\Details\\images\\classes_small_alpha:14:14:0:0:128:128:"..cords[1]*128 ..":"..cords[2]*128 ..":"..cords[3]*128 ..":"..cords[4]*128 .."|t " .. target [1], _detalhes:comma_value ( _math_floor(target [2] / meu_tempo) ), 1, 1, 1, 1, 1, 1) - else - GameTooltip:AddDoubleLine (index .. ". |TInterface\\AddOns\\Details\\images\\classes_small_alpha:14:14:0:0:128:128:"..cords[1]*128 ..":"..cords[2]*128 ..":"..cords[3]*128 ..":"..cords[4]*128 .."|t " .. target [1], SelectedToKFunction (_, target [2]), 1, 1, 1, 1, 1, 1) - end - else - if (info.target_persecond) then - GameTooltip:AddDoubleLine (index .. ". " .. target [1], _detalhes:comma_value ( _math_floor(target [2] / meu_tempo)), 1, 1, 1, 1, 1, 1) - else - GameTooltip:AddDoubleLine (index .. ". " .. target [1], SelectedToKFunction (_, target [2]), 1, 1, 1, 1, 1, 1) - end - end - end - end - end - - GameTooltip:Show() - else - GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT") - GameTooltip:AddLine(barra.index .. ". " .. barra.show) - GameTooltip:AddLine(info.target_text) - GameTooltip:AddLine(Loc ["STRING_NO_TARGET"], 1, 1, 1) - GameTooltip:AddLine(Loc ["STRING_MORE_INFO"], 1, 1, 1) - GameTooltip:Show() - end - else - GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT") - GameTooltip:AddLine(barra.index .. ". " .. barra.show) - GameTooltip:AddLine(info.target_text) - GameTooltip:AddLine(Loc ["STRING_NO_TARGET"], 1, 1, 1) - GameTooltip:AddLine(Loc ["STRING_MORE_INFO"], 1, 1, 1) - GameTooltip:Show() - end - - self.texture:SetAlpha(1) - self:SetAlpha(1) - barra:GetScript("OnEnter")(barra) -end - -local target_on_leave = function(self) - GameTooltip:Hide() - GameCooltip:Hide() - self:GetParent():GetParent():GetScript("OnLeave")(self:GetParent():GetParent()) - self.texture:SetAlpha(.7) - self:SetAlpha(.7) -end - -function gump:CriaNovaBarraInfo1(instancia, index) - if (_detalhes.playerDetailWindow.barras1[index]) then - return - end - - local parentFrame = info.container_barras.gump - - local newLine = CreateFrame("Button", "Details_infobox1_bar_" .. index, parentFrame, "BackdropTemplate") - newLine:SetHeight(CONST_BAR_HEIGHT) - newLine.index = index - - local y = (index-1) * (CONST_BAR_HEIGHT + 1) - y = y * -1 - - newLine:SetPoint("LEFT", parentFrame, "LEFT", CONST_BAR_HEIGHT, 0) - newLine:SetPoint("RIGHT", parentFrame, "RIGHT") - newLine:SetPoint("TOP", parentFrame, "TOP", 0, y) - newLine:SetFrameLevel(parentFrame:GetFrameLevel() + 1) - newLine:SetAlpha(1) - newLine:EnableMouse(true) - newLine:RegisterForClicks("LeftButtonDown","RightButtonUp") - newLine.isMain = true - - --create a square frame which is placed at the right side of the line to show which targets for damaged by the spell - newLine.targets = CreateFrame("frame", "$parentTargets", newLine, "BackdropTemplate") - newLine.targets:SetPoint("right", newLine, "right", 0, 0) - newLine.targets:SetSize(CONST_BAR_HEIGHT-1, CONST_BAR_HEIGHT-1) - newLine.targets:SetAlpha(.7) - newLine.targets:SetScript("OnEnter", target_on_enter) - newLine.targets:SetScript("OnLeave", target_on_leave) - newLine.targets.texture = newLine.targets:CreateTexture(nil, "overlay") - newLine.targets.texture:SetTexture([[Interface\MINIMAP\TRACKING\Target]]) - newLine.targets.texture:SetAllPoints() - newLine.targets.texture:SetDesaturated(true) - newLine.targets.texture:SetAlpha(1) - - --create the icon to show the spell icon - newLine.icone = newLine:CreateTexture(nil, "OVERLAY") - newLine.icone:SetWidth(CONST_BAR_HEIGHT-2) - newLine.icone:SetHeight(CONST_BAR_HEIGHT-2) - newLine.icone:SetPoint("RIGHT", newLine, "LEFT", 0, 0) - newLine.icone:SetAlpha(1) - --frame which will show the spell tooltip - newLine.miniframe = CreateFrame("frame", nil, newLine, "BackdropTemplate") - newLine.miniframe:SetSize(CONST_BAR_HEIGHT * 2, CONST_BAR_HEIGHT-2) - newLine.miniframe:SetPoint("right", newLine, "left", CONST_BAR_HEIGHT, 0) - newLine.miniframe:SetScript("OnEnter", miniframe_func_on_enter) - newLine.miniframe:SetScript("OnLeave", miniframe_func_on_leave) - - CriaTexturaBarra(newLine) - SetBarraScripts (newLine, instancia, index) - - info.barras1[index] = newLine - newLine.textura:SetStatusBarColor(1, 1, 1, 1) - newLine.on_focus = false - - return newLine -end - -function gump:CriaNovaBarraInfo2(instancia, index) - if (_detalhes.playerDetailWindow.barras2 [index]) then - print("erro a barra "..index.." ja existe na janela de detalhes...") - return - end - - local janela = info.container_alvos.gump - - local esta_barra = CreateFrame("Button", "Details_infobox2_bar_"..index, info.container_alvos.gump, "BackdropTemplate") - esta_barra:SetHeight(CONST_TARGET_HEIGHT) - - local y = (index-1) * (CONST_TARGET_HEIGHT + 1) - y = y*-1 --baixo - - esta_barra:SetPoint("LEFT", janela, "LEFT", CONST_TARGET_HEIGHT, 0) - esta_barra:SetPoint("RIGHT", janela, "RIGHT", 0, 0) - esta_barra:SetPoint("TOP", janela, "TOP", 0, y) - esta_barra:SetFrameLevel(janela:GetFrameLevel() + 1) - - esta_barra:EnableMouse(true) - esta_barra:RegisterForClicks ("LeftButtonDown","RightButtonUp") - - --icone - esta_barra.icone = esta_barra:CreateTexture(nil, "OVERLAY") - esta_barra.icone:SetWidth(CONST_TARGET_HEIGHT) - esta_barra.icone:SetHeight(CONST_TARGET_HEIGHT) - esta_barra.icone:SetPoint("RIGHT", esta_barra, "LEFT", 0, 0) - - CriaTexturaBarra(esta_barra) - - esta_barra:SetAlpha(ALPHA_BLEND_AMOUNT) - esta_barra.icone:SetAlpha(1) - - esta_barra.isAlvo = true - - SetBarraScripts(esta_barra, instancia, index) - - info.barras2 [index] = esta_barra --barra adicionada - - return esta_barra -end - -function gump:CriaNovaBarraInfo3 (instancia, index) - if (_detalhes.playerDetailWindow.barras3 [index]) then - print("erro a barra "..index.." ja existe na janela de detalhes...") - return - end - - local janela = info.container_detalhes - - local esta_barra = CreateFrame("Button", "Details_infobox3_bar_"..index, janela, "BackdropTemplate") - esta_barra:SetHeight(16) - - local y = (index-1) * 17 - y = y*-1 - container3_bars_pointFunc (esta_barra, index) - esta_barra:EnableMouse(true) - - --icone - esta_barra.icone = esta_barra:CreateTexture(nil, "OVERLAY") - esta_barra.icone:SetWidth(14) - esta_barra.icone:SetHeight(14) - esta_barra.icone:SetPoint("LEFT", esta_barra, "LEFT", 0, 0) - - CriaTexturaBarra(esta_barra) - - esta_barra:SetAlpha(0.9) - esta_barra.icone:SetAlpha(1) - - esta_barra.isDetalhe = true - - SetBarraScripts (esta_barra, instancia, index) - - info.barras3 [index] = esta_barra --barra adicionada - - return esta_barra -end + return newTabButton, tabFrame +end \ No newline at end of file diff --git a/frames/window_playerbreakdown_list.lua b/frames/window_playerbreakdown_list.lua index 6b46d39d..448420e8 100644 --- a/frames/window_playerbreakdown_list.lua +++ b/frames/window_playerbreakdown_list.lua @@ -30,7 +30,7 @@ } function breakdownWindowPlayerList.CreatePlayerListFrame() - local f = _G.DetailsPlayerDetailsWindow + local f = _G.DetailsBreakdownWindow local refreshPlayerList = function(self, data, offset, totalLines) --update the scroll diff --git a/frames/window_playerbreakdown_spells.lua b/frames/window_playerbreakdown_spells.lua new file mode 100644 index 00000000..e7e387d9 --- /dev/null +++ b/frames/window_playerbreakdown_spells.lua @@ -0,0 +1,1907 @@ + +local addonName, Details222 = ... +local spellsTab = {} +local breakdownWindow = Details.BreakdownWindow +local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" ) +local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0") +local unpack = unpack +local GetTime = GetTime +local GetCursorPosition = GetCursorPosition +local CreateFrame = CreateFrame +local GetSpellLink = GetSpellLink +local _GetSpellInfo = Details.GetSpellInfo +local GameTooltip = GameTooltip +local IsShiftKeyDown = IsShiftKeyDown +local DF = DetailsFramework + +--Expose the object to the global namespace +DetailsSpellBreakdownTab = spellsTab + +local iconTableSummary = { + texture = [[Interface\AddOns\Details\images\icons]], + coords = {238/512, 255/512, 0, 18/512}, + width = 16, + height = 16, +} + +local spellBlockContainerSettings = { + amount = 6, --amount of block the container have + lineAmount = 3, --amount of line each block have +} + +local spellBreakdownSettings = {} + +local row_backdrop = {bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", + insets = {left = 0, right = 0, top = 0, bottom = 0}} +local row_backdrop_onleave = {bgFile = "", edgeFile = "", tile = true, tileSize = 16, edgeSize = 32, + insets = {left = 1, right = 1, top = 0, bottom = 1}} + +local CONST_BAR_HEIGHT = 20 +local CONST_TARGET_HEIGHT = 18 + +local CONST_SPELLSCROLL_WIDTH = 435 +local CONST_SPELLSCROLL_HEIGHT = 311 +local CONST_SPELLSCROLL_AMTLINES = 14 +local CONST_SPELLSCROLL_LINEHEIGHT = 20 + +Details.SpellGroups = { + [193473] = 15407, --mind flay +} + +function spellsTab.GetActor() + return spellsTab.currentActor +end + +function spellsTab.GetCombat() + return spellsTab.combatObject +end + +function spellsTab.GetInstance() + return spellsTab.instance +end + +---return the breakdownspellscrollframe object, there's only one of this in the breakdown window +---@return breakdownspellscrollframe +function spellsTab.GetSpellScrollContainer() + return spellsTab.TabFrame.SpellScrollFrame +end + +---return the breakdownspellblockcontainer object, there's only one of this in the breakdown window +---@return breakdownspellblockcontainer +function spellsTab.GetSpellBlockContainer() + return spellsTab.TabFrame.SpellBlockContainer +end + +---@type {name: string, width: number, label: string, align: string, enabled: boolean}[] +local columnInfo = { + {name = "icon", width = 22, label = "", align = "center", enabled = true,}, + {name = "target", width = 22, label = "", align = "center", enabled = true}, + {name = "rank", label = "#", width = 16, align = "center", enabled = true}, + {name = "expand", label = "^", width = 16, align = "center", enabled = true}, + {name = "name", label = "spell name", width = 246, align = "left", enabled = true}, + {name = "amount", label = "total", width = 50, align = "left", enabled = true}, + {name = "persecond", label = "ps", width = 50, align = "left", enabled = false}, + {name = "percent", label = "%", width = 50, align = "left", enabled = true}, + {name = "casts", label = "casts", width = 40, align = "left", enabled = false}, + {name = "critpercent", label = "crit %", width = 40, align = "left", enabled = false}, + {name = "hits", label = "hits", width = 40, align = "left", enabled = false}, + {name = "castavg", label = "cast avg", width = 50, align = "left", enabled = false}, + {name = "uptime", label = "uptime", width = 45, align = "left", enabled = false}, +} + +--store the current spellbar selected, this is used to lock the spellblock container to the spellbar selected +spellsTab.selectedSpellBar = nil + +---selected a breakdownspellbar, locking into the bar +---when a breakdownspellbar is selected, all the other breakdownspellbar has it's hover over disabled +---@param spellBar breakdownspellbar +function spellsTab.SelectSpellBar(spellBar) + --if already has a spellbar selected, unselect it + if (spellsTab.HasSelectedSpellBar()) then --unselect and stop the function if the bar selected is the same as the one being selected + if (spellsTab.GetSelectedSpellBar() == spellBar) then + spellsTab.UnSelectSpellBar() + return + else + spellsTab.UnSelectSpellBar() + end + end + + --it is only selecting the bar is the mouse down elapsed 0.4 seconds or more + + --as the spell block container get an update when hovering over + --update the spell block container for the breakdownspellbar just selected + --this is necessary since a previous breakdownspellbar could have been selected and prevented this breakdownspellbar to update on hover over + ---@type function + local onEnterScript = spellBar:GetScript("OnEnter") + if (onEnterScript) then + onEnterScript(spellBar) + end + + --set the new breakdownspellbar as selected + spellsTab.selectedSpellBar = spellBar + spellsTab.selectedSpellBar.overlayTexture:Show() +end + +---deselect the breakdownspellbar +function spellsTab.UnSelectSpellBar() + if (spellsTab.selectedSpellBar) then + spellsTab.selectedSpellBar.overlayTexture:Hide() + end + spellsTab.selectedSpellBar = nil +end + +---get the spellbar currently selected +---@return breakdownspellbar +function spellsTab.GetSelectedSpellBar() + return spellsTab.selectedSpellBar +end + +---return true if there's a spell bar selected +---@return boolean +function spellsTab.HasSelectedSpellBar() + return spellsTab.selectedSpellBar ~= nil +end + +function spellsTab.OnShownTab() + --unselect any selected breakdownspellbar + spellsTab.UnSelectSpellBar() + --reset the spell blocks + spellsTab.GetSpellBlockContainer():ClearBlocks() +end + + +function spellsTab.BuildHeaderTable() + local headerTable = {} + for i = 1, #columnInfo do + local columnData = columnInfo[i] + if (columnData.enabled) then + headerTable[#headerTable+1] = { + text = columnData.label, + width = columnData.width, + name = columnData.name, + --align = column.align, + } + end + end + return headerTable +end + +--called when the tab is getting created +function spellsTab.OnCreateTabCallback(tabButton, tabFrame) + spellBreakdownSettings = Details.breakdown_spell_tab + + --create the scrollbar to show the spells in the breakdown window + ---@type breakdownspellscrollframe + local spellScrollContainer = spellsTab.CreateSpellScrollContainer(tabFrame) --finished + + --create the 6 spell blocks in the right side of the breakdown window + --these blocks show the spell info like normal hits, critical hits, average, etc + ---@type breakdownspellblockcontainer + local spellBlockContainer = spellsTab.CreateSpellBlockContainer(tabFrame) + spellsTab.SpellBlockContainer = spellBlockContainer + spellBlockContainer:SetPoint("topleft", spellScrollContainer, "topright", 26, 0) + + --create the targets container + spellsTab.CreateTargetContainer(tabFrame) + + --craete special backgrounds (still needed?) + spellsTab.CreateSpecialBackgrounds(tabFrame) + + --create the report buttons for each container + spellsTab.CreateReportButtons(tabFrame) + + --these bars table are kinda deprecated now: + + --store the spell bars for the spell container + tabFrame.barras1 = {} + --store the target bars for the target container + tabFrame.barras2 = {} + --store the special bars shown in the right side of the breakdown window, this is only shown when spellBlocks aren't in use + tabFrame.barras3 = {} + + spellsTab.TabFrame = tabFrame +end + +function spellsTab.TrocaBackgroundInfo(tabFrame) --> spells tab | to be refactored | called fom OpenJanelaInfo function + tabFrame.bg3_sec_texture:Hide() + tabFrame.bg2_sec_texture:Hide() + tabFrame.report_direita:Hide() + + if (breakdownWindow.atributo == 1) then --damage + if (breakdownWindow.sub_atributo == 1 or breakdownWindow.sub_atributo == 2) then --damage done / dps + tabFrame.bg1_sec_texture:SetTexture("") + tabFrame.tipo = 1 + + if (breakdownWindow.sub_atributo == 2) then + tabFrame.targets:SetText(Loc ["STRING_TARGETS"] .. " " .. Loc ["STRING_ATTRIBUTE_DAMAGE_DPS"] .. ":") + tabFrame.target_persecond = true + else + tabFrame.targets:SetText(Loc ["STRING_TARGETS"] .. ":") + end + + elseif (breakdownWindow.sub_atributo == 3) then --damage taken + tabFrame.bg1_sec_texture:SetColorTexture(.05, .05, .05, .4) + tabFrame.bg3_sec_texture:Show() + tabFrame.bg2_sec_texture:Show() + tabFrame.tipo = 2 + + for i = 1, spellBlockContainerSettings.amount do + tabFrame["right_background" .. i]:Hide() + end + + tabFrame.targets:SetText(Loc ["STRING_TARGETS"] .. ":") + tabFrame.no_targets:Show() + tabFrame.no_targets.text:Show() + tabFrame.report_direita:Show() + + elseif (breakdownWindow.sub_atributo == 4) then --friendly fire + tabFrame.bg1_sec_texture:SetColorTexture(.05, .05, .05, .4) + tabFrame.bg3_sec_texture:Show() + tabFrame.bg2_sec_texture:Show() + tabFrame.tipo = 3 + + for i = 1, spellBlockContainerSettings.amount do + tabFrame["right_background" .. i]:Hide() + end + + tabFrame.targets:SetText(Loc ["STRING_SPELLS"] .. ":") + tabFrame.report_direita:Show() + + elseif (breakdownWindow.sub_atributo == 6) then --enemies + tabFrame.bg1_sec_texture:SetColorTexture(.05, .05, .05, .4) + tabFrame.bg3_sec_texture:Show() + tabFrame.bg2_sec_texture:Show() + tabFrame.tipo = 3 + + for i = 1, spellBlockContainerSettings.amount do + tabFrame["right_background" .. i]:Hide() + end + + tabFrame.targets:SetText(Loc ["STRING_DAMAGE_TAKEN_FROM"]) + end + + elseif (breakdownWindow.atributo == 2) then --healing + if (breakdownWindow.sub_atributo == 1 or breakdownWindow.sub_atributo == 2 or breakdownWindow.sub_atributo == 3) then --damage done / dps + tabFrame.bg1_sec_texture:SetTexture("") + tabFrame.tipo = 1 + + if (breakdownWindow.sub_atributo == 3) then + tabFrame.targets:SetText(Loc ["STRING_OVERHEALED"] .. ":") + tabFrame.target_member = "overheal" + tabFrame.target_text = Loc ["STRING_OVERHEALED"] .. ":" + + elseif (breakdownWindow.sub_atributo == 2) then + tabFrame.targets:SetText(Loc ["STRING_TARGETS"] .. " " .. Loc ["STRING_ATTRIBUTE_HEAL_HPS"] .. ":") + tabFrame.target_persecond = true + + else + tabFrame.targets:SetText(Loc ["STRING_TARGETS"] .. ":") + end + + elseif (breakdownWindow.sub_atributo == 4) then --Healing taken + tabFrame.bg1_sec_texture:SetColorTexture(.05, .05, .05, .4) + tabFrame.bg3_sec_texture:Show() + tabFrame.bg2_sec_texture:Show() + tabFrame.tipo = 2 + + for i = 1, spellBlockContainerSettings.amount do + tabFrame ["right_background" .. i]:Hide() + end + + tabFrame.targets:SetText(Loc ["STRING_TARGETS"] .. ":") + tabFrame.no_targets:Show() + tabFrame.no_targets.text:Show() + tabFrame.report_direita:Show() + end + + elseif (breakdownWindow.atributo == 3) then --energy + tabFrame.bg1_sec_texture:SetTexture("") + tabFrame.tipo = 2 + tabFrame.targets:SetText("Vindo de:") + + elseif (breakdownWindow.atributo == 4) then --utility + tabFrame.bg1_sec_texture:SetTexture("") + tabFrame.tipo = 2 + + tabFrame.targets:SetText(Loc ["STRING_TARGETS"] .. ":") + end +end + +do --hide bars functions + --hide all the bars of the skills in the window info + function spellsTab.HidaAllBarrasInfo() + local allBars = _detalhes.playerDetailWindow.barras1 + for index = 1, #allBars, 1 do + allBars[index]:Hide() + allBars[index].textura:SetStatusBarColor(1, 1, 1, 1) + allBars[index].on_focus = false + end + end + + --hide all the bars of the player's targets + function spellsTab.HidaAllBarrasAlvo() + local allBars = _detalhes.playerDetailWindow.barras2 + for index = 1, #allBars, 1 do + allBars[index]:Hide() + end + end + + --hide the 5 bars on the right side of the window + function spellsTab.HidaAllDetalheInfo() --there's a call from the breakdown file yet + for i = 1, spellBlockContainerSettings.amount do + spellsTab.HidaDetalheInfo(i) + end + + --breakdownWindow.barras3 will not exists anymore soon + --for _, thisBar in ipairs(breakdownWindow.barras3) do + -- thisBar:Hide() + --end + --_detalhes.playerDetailWindow.spell_icone:SetTexture("") + end + + function spellsTab.ResetBars() + spellsTab.HidaAllBarrasInfo() + spellsTab.HidaAllBarrasAlvo() + spellsTab.HidaAllDetalheInfo() + end + + function spellsTab.HidaDetalheInfo(index) --> spells tab this is getting called from class damage and heal + local info = _detalhes.playerDetailWindow.grupos_detalhes[index] + info.nome:SetText("") + info.nome2:SetText("") + info.dano:SetText("") + info.dano_porcento:SetText("") + info.dano_media:SetText("") + info.dano_dps:SetText("") + info.bg:Hide() + end +end + +--bar scripts +local onMouseDownCallback = function(self, button) + local hostFrame = breakdownWindow + + if (button == "LeftButton") then + hostFrame:StartMoving() + hostFrame.isMoving = true + + elseif (button == "RightButton" and not self.isMoving) then + Details:CloseBreakdownWindow() + end +end + +local onMouseUpCallback = function(self, button) + local hostFrame = breakdownWindow + + if (hostFrame.isMoving) then + hostFrame:StopMovingOrSizing() + hostFrame.isMoving = false + end +end + +function spellsTab.ApplyScripts() + local hostFrame = breakdownWindow --cannot be breakdown window, it should be the frame of the tab + hostFrame.SpellScrollFrame.gump:SetScript("OnMouseDown", onMouseDownCallback) + hostFrame.SpellScrollFrame.gump:SetScript("OnMouseUp", onMouseUpCallback) + + hostFrame.container_detalhes:SetScript("OnMouseDown", onMouseDownCallback) + hostFrame.container_detalhes:SetScript("OnMouseUp", onMouseUpCallback) + + hostFrame.container_alvos.gump:SetScript("OnMouseDown", onMouseDownCallback) + hostFrame.container_alvos.gump:SetScript("OnMouseUp", onMouseUpCallback) +end + +function spellsTab.CreateReportButtons(tabFrame) + --spell list report button + tabFrame.report_esquerda = Details.gump:NewDetailsButton(tabFrame, tabFrame, nil, _detalhes.Reportar, tabFrame, 1, 16, 16, "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", nil, "DetailsJanelaInfoReport2") + tabFrame.report_esquerda:SetPoint("bottomleft", tabFrame.SpellScrollFrame, "TOPLEFT", 33, 3) + tabFrame.report_esquerda:SetFrameLevel(tabFrame:GetFrameLevel()+2) + tabFrame.topleft_report = tabFrame.report_esquerda + + --targets report button + tabFrame.report_alvos = Details.gump:NewDetailsButton(tabFrame, tabFrame, nil, _detalhes.Reportar, tabFrame, 3, 16, 16, "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", nil, "DetailsJanelaInfoReport3") + tabFrame.report_alvos:SetPoint("bottomright", tabFrame.container_alvos, "TOPRIGHT", -2, -1) + tabFrame.report_alvos:SetFrameLevel(3) --solved inactive problem + + --special barras in the right report button + tabFrame.report_direita = Details.gump:NewDetailsButton(tabFrame, tabFrame, nil, _detalhes.Reportar, tabFrame, 2, 16, 16, "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", nil, "DetailsJanelaInfoReport4") + tabFrame.report_direita:SetPoint("TOPRIGHT", tabFrame, "TOPRIGHT", -10, -70) + tabFrame.report_direita:Show() +end + +---------------------------------------------------------------------- +--> scripts + +--create a details bar on the right side of the window +local onEnterSpellBlock = function(spellBlock) --info background is the 6 bars in the right side of the window? + Details.FadeHandler.Fader(spellBlock.overlay, "OUT") + Details.FadeHandler.Fader(spellBlock.reportButton, "OUT") +end + +local onLeaveSpellBlock = function(spellBlock) + Details.FadeHandler.Fader(spellBlock.overlay, "IN") + Details.FadeHandler.Fader(spellBlock.reportButton, "IN") +end + +local onEnterInfoReport = function(self) + Details.FadeHandler.Fader(self:GetParent().overlay, "OUT") + Details.FadeHandler.Fader(self, "OUT") +end + +local onLeaveInfoReport = function(self) + Details.FadeHandler.Fader(self:GetParent().overlay, "IN") + Details.FadeHandler.Fader(self, "IN") +end + +---run this function when the mouse hover over a breakdownspellbar +---@param spellBar breakdownspellbar +local onEnterBreakdownSpellBar = function(spellBar) --parei aqui: precisa por nomes nas funções e formatar as linhas das funcções + --all values from spellBar are cached values + + --check if there's a spellbar selected, if there's one, ignore the mouseover + if (spellsTab.HasSelectedSpellBar()) then + return + end + + ---@type instance + local instance = spellsTab.GetInstance() + + ---@type number, number + local mainAttribute, subAttribute = instance:GetDisplay() + + ---@type breakdownspellblockcontainer + local spellBlockContainer = spellsTab.GetSpellBlockContainer() + spellBlockContainer:ClearBlocks() + + ---@type number + local spellId = spellBar.spellId + + ---@type number + local elapsedTime = spellBar.combatTime --this should be actorObject:Tempo() + + ---@type spelltable + local spellTable = spellBar.spellTable + + if (IsShiftKeyDown()) then + if (type(spellId) == "number") then + GameCooltip:Preset(2) + GameCooltip:SetOwner(spellBar, "ANCHOR_TOPRIGHT") + GameCooltip:AddLine(Loc ["ABILITY_ID"] .. ": " .. spellBar.spellId) + GameCooltip:Show() + end + end + + if (spellId == 98021) then --spirit link totem + GameTooltip:SetOwner(spellBar, "ANCHOR_TOPLEFT") + GameTooltip:AddLine(Loc ["STRING_SPIRIT_LINK_TOTEM_DESC"]) + GameTooltip:Show() + end + + if (mainAttribute == DETAILS_ATTRIBUTE_DAMAGE and subAttribute == DETAILS_SUBATTRIBUTE_DAMAGEDONE) then + ---@type number + local blockIndex = 1 + + ---@type number + local totalHits = spellTable.counter + + --damage section showing damage done sub section + --get the first spell block to use as summary + ---@type breakdownspellblock + local summaryBlock = spellBlockContainer:GetBlock(blockIndex) + summaryBlock:Show() + blockIndex = blockIndex + 1 + + do --update the texts in the summary block + local blockLine1, blockLine2, blockLine3 = summaryBlock:GetLines() + + blockLine1.leftText:SetText(Loc ["STRING_CAST"] .. ": " .. spellBar.amountCasts) --total amount of casts + blockLine1.rightText:SetText(Loc ["STRING_HITS"]..": " .. totalHits) --hits and uptime + + blockLine2.leftText:SetText(Loc ["STRING_DAMAGE"]..": " .. Details:Format(spellTable.total)) --total damage + blockLine2.rightText:SetText(Details:GetSpellSchoolFormatedName(spellTable.spellschool)) --spell school + + blockLine3.leftText:SetText(Loc ["STRING_AVERAGE"] .. ": " .. Details:Format(spellBar.average)) --average damage + blockLine3.rightText:SetText(Loc ["STRING_DPS"] .. ": " .. Details:CommaValue(spellBar.perSecond)) --dps + end + + --check if there's normal hits and build the block + ---@type number + local normalHitsAmt = spellTable.n_amt + + --problem: spellTable is in facts bkSpellTable, fuck! + if (not normalHitsAmt) then + print(spellTable.spellTables, spellTable.petNames) + dumpt(spellTable) + return + end + + if (normalHitsAmt > 0) then + ---@type breakdownspellblock + local normalHitsBlock = spellBlockContainer:GetBlock(blockIndex) + normalHitsBlock:Show() + blockIndex = blockIndex + 1 + + local percent = normalHitsAmt / math.max(totalHits, 0.0001) * 100 + normalHitsBlock:SetValue(percent) + normalHitsBlock.sparkTexture:SetPoint("left", normalHitsBlock, "left", percent / 100 * normalHitsBlock:GetWidth() + spellBreakdownSettings.blockspell_spark_offset, 0) + normalHitsBlock:SetStatusBarColor(1, 1, 1, .5) + + local blockLine1, blockLine2, blockLine3 = normalHitsBlock:GetLines() + blockLine1.leftText:SetText(Loc ["STRING_NORMAL_HITS"]) + blockLine1.rightText:SetText(normalHitsAmt .. " [|cFFC0C0C0" .. string.format("%.1f", normalHitsAmt / math.max(totalHits, 0.0001) * 100) .. "%|r]") + + blockLine2.leftText:SetText(Loc ["STRING_MINIMUM_SHORT"] .. ": " .. Details:CommaValue(spellTable.n_min)) + blockLine2.rightText:SetText(Loc ["STRING_MAXIMUM_SHORT"] .. ": " .. Details:CommaValue(spellTable.n_max)) + + local normalAverage = spellTable.n_dmg / math.max(normalHitsAmt, 0.0001) + blockLine3.leftText:SetText(Loc ["STRING_AVERAGE"] .. ": " .. Details:CommaValue(normalAverage)) + + local tempo = (elapsedTime * spellTable.n_dmg) / math.max(spellTable.total, 0.001) + local normalAveragePercent = spellBar.average / normalAverage * 100 + local normalTempoPercent = normalAveragePercent * tempo / 100 + blockLine3.rightText:SetText(Loc ["STRING_DPS"] .. ": " .. Details:CommaValue(spellTable.n_dmg / normalTempoPercent)) + end + + ---@type number + local criticalHitsAmt = spellTable.c_amt + if (criticalHitsAmt > 0) then + ---@type breakdownspellblock + local critHitsBlock = spellBlockContainer:GetBlock(blockIndex) + critHitsBlock:Show() + blockIndex = blockIndex + 1 + + local percent = criticalHitsAmt / math.max(totalHits, 0.0001) * 100 + critHitsBlock:SetValue(percent) + critHitsBlock.sparkTexture:SetPoint("left", critHitsBlock, "left", percent / 100 * critHitsBlock:GetWidth() + spellBreakdownSettings.blockspell_spark_offset, 0) + critHitsBlock:SetStatusBarColor(1, 1, 1, .5) + + local blockLine1, blockLine2, blockLine3 = critHitsBlock:GetLines() + blockLine1.leftText:SetText(Loc ["STRING_CRITICAL_HITS"]) + blockLine1.rightText:SetText(criticalHitsAmt .. " [|cFFC0C0C0" .. string.format("%.1f", criticalHitsAmt / math.max(totalHits, 0.0001) * 100) .. "%|r]") + + blockLine2.leftText:SetText(Loc ["STRING_MINIMUM_SHORT"] .. ": " .. Details:CommaValue(spellTable.c_min)) + blockLine2.rightText:SetText(Loc ["STRING_MAXIMUM_SHORT"] .. ": " .. Details:CommaValue(spellTable.c_max)) + + local critAverage = spellTable.c_dmg / math.max(criticalHitsAmt, 0.0001) + blockLine3.leftText:SetText(Loc ["STRING_AVERAGE"] .. ": " .. Details:CommaValue(critAverage)) + + local tempo = (elapsedTime * spellTable.c_dmg) / math.max(spellTable.total, 0.001) + local critAveragePercent = spellBar.average / critAverage * 100 + local critTempoPercent = critAveragePercent * tempo / 100 + blockLine3.rightText:SetText(Loc ["STRING_DPS"] .. ": " .. Details:CommaValue(spellTable.c_dmg / critTempoPercent)) + end + end + + --effects on entering the bar line + spellBar:SetHeight(CONST_SPELLSCROLL_LINEHEIGHT + 1) + spellBar:SetAlpha(1) + spellBar.spellIcon:SetSize(CONST_SPELLSCROLL_LINEHEIGHT + 2, CONST_SPELLSCROLL_LINEHEIGHT + 2) + spellBar.spellIcon:SetAlpha(1) +end + +---run this function when the mouse leaves a breakdownspellbar +---@param spellBar breakdownspellbar +local onLeaveBreakdownSpellBar = function(spellBar) + --diminui o tamanho da barra + spellBar:SetHeight(CONST_SPELLSCROLL_LINEHEIGHT) + --volta com o alfa antigo da barra que era de 0.9 + spellBar:SetAlpha(0.9) + + --volto o background ao normal + spellBar:SetBackdrop(row_backdrop_onleave) + spellBar:SetBackdropBorderColor(0, 0, 0, 0) + spellBar:SetBackdropColor(0, 0, 0, 0) + + GameTooltip:Hide() + GameCooltip:Hide() + + if (spellBar.isMain) then + --retira o zoom no icone + spellBar.spellIcon:SetSize(CONST_SPELLSCROLL_LINEHEIGHT, CONST_SPELLSCROLL_LINEHEIGHT) + spellBar.spellIcon:SetAlpha(1) + + --remover o conte�do que estava sendo mostrado na direita + if (breakdownWindow.mostrando_mouse_over) then + breakdownWindow.mostrando = nil + breakdownWindow.mostrando_mouse_over = false + breakdownWindow.showing = nil + breakdownWindow.jogador.detalhes = nil + spellsTab.HidaAllDetalheInfo() + end + + elseif (spellBar.isAlvo) then + spellBar:SetHeight(CONST_TARGET_HEIGHT) + + elseif (spellBar.isDetalhe) then + spellBar:SetHeight(16) + end +end + +---on mouse down a breakdownspellbar in the breakdown window +---@param spellBar breakdownspellbar +---@param button string +local onMouseDownBreakdownSpellBar = function(spellBar, button) + local x, y = _G.GetCursorPosition() + spellBar.cursorPosX = math.floor(x) + spellBar.cursorPosY = math.floor(y) + Details222.PlayerBreakdown.OnMouseDown(spellBar, button) +end + +---on mouse up a breakdownspellbar in the breakdown window +---@param spellBar breakdownspellbar +---@param button string +local onMouseUpBreakdownSpellBar = function(spellBar, button) + if (spellBar.onMouseUpTime == GetTime()) then + return + end + + spellBar.onMouseUpTime = GetTime() + + ---@type number, number + local x, y = _G.GetCursorPosition() + x = math.floor(x) + y = math.floor(y) + + ---@type boolean + local bIsMouseInTheSamePosition = (x == spellBar.cursorPosX) and (y == spellBar.cursorPosY) + + --if the mouse is in the same position, then the user clicked the bar + --clicking the bar activate the lock mechanism + if (bIsMouseInTheSamePosition) then + spellsTab.SelectSpellBar(spellBar) + end +end + + +local onEnterSpellIconFrame = function(self) + local line = self:GetParent() + if (line.spellId and type(line.spellId) == "number") then + local spellName = _GetSpellInfo(line.spellId) + if (spellName) then + GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT") + Details:GameTooltipSetSpellByID(line.spellId) + GameTooltip:Show() + end + end + line:GetScript("OnEnter")(line) +end + +local onLeaveSpellIconFrame = function(self) + GameTooltip:Hide() + self:GetParent():GetScript("OnLeave")(self:GetParent()) +end + +-------------------------------------------------------------------------------------------------------------------------------------------- + +local spellBlockMixin = { + ---get one of the three lines containing fontstrings to show data + ---line 1 is the top line, line 2 is the middle line and line 3 is the bottom line + ---@param self breakdownspellblock + ---@param lineIndex number + ---@return breakdownspellblockline + GetLine = function(self, lineIndex) + ---@type breakdownspellblockline + local line = self.Lines[lineIndex] + return line + end, + + ---return all lines in the spell block, all spell block have 3 lines + ---@param self breakdownspellblock + ---@return breakdownspellblockline, breakdownspellblockline, breakdownspellblockline + GetLines = function(self) + return unpack(self.Lines) + end, +} + +---create a spell block into the spellcontainer +---@param spellBlockContainer breakdownspellblockcontainer +---@param index number +---@return breakdownspellblock +function spellsTab.CreateSpellBlock(spellBlockContainer, index) --~breakdownspellblock ~create ~spellblocks + ---@type breakdownspellblock + local spellBlock = CreateFrame("statusbar", "$parentBlock" .. index, spellBlockContainer, "BackdropTemplate") + DetailsFramework:Mixin(spellBlock, spellBlockMixin) + local t = spellBlock:CreateTexture(nil, "artwork") + t:SetColorTexture(1, 1, 1, 1) + spellBlock:SetStatusBarTexture(t) --debug + --spellBlock:SetStatusBarTexture("Interface\\AddOns\\Details\\images\\bar_background") + spellBlock:SetStatusBarColor(1, 1, 1, .84) + spellBlock:SetMinMaxValues(0, 100) + spellBlock:SetValue(100) + spellBlock:SetScript("OnEnter", onEnterSpellBlock) + spellBlock:SetScript("OnLeave", onLeaveSpellBlock) + + --create the lines which will host the texts + spellBlock.Lines = {} + for i = 1, spellBlockContainerSettings.lineAmount do + ---@type breakdownspellblockline + local line = CreateFrame("frame", "$parentLine" .. i, spellBlock) + --DetailsFramework:ApplyStandardBackdrop(line) + spellBlock.Lines[i] = line + + line.leftText = line:CreateFontString("$parentLeftText", "overlay", "GameFontHighlightSmall") + line.centerText = line:CreateFontString("$parentLeftText", "overlay", "GameFontHighlightSmall") + line.rightText = line:CreateFontString("$parentLeftText", "overlay", "GameFontHighlightSmall") + + line.leftText:SetPoint("left", line, "left", 2, 0) + line.leftText:SetJustifyH("left") + line.centerText:SetPoint("center", line, "center", 0, 0) + line.centerText:SetJustifyH("center") + line.rightText:SetPoint("right", line, "right", -2, 0) + line.rightText:SetJustifyH("right") + end + + --overlay texture which fade in and out when the spell block is hovered over + --is only possible to hover over a spell block when the spellbar is selected + spellBlock.overlay = spellBlock:CreateTexture("$parentOverlay", "artwork") + spellBlock.overlay:SetTexture("Interface\\AddOns\\Details\\images\\overlay_detalhes") + spellBlock.overlay:SetColorTexture(1, 0, 0, 1) + spellBlock.overlay:SetAllPoints() + Details.FadeHandler.Fader(spellBlock.overlay, 1) --hide + + --report button, also only shown when the spell block is hovered over + spellBlock.reportButton = Details.gump:NewDetailsButton(spellBlock, nil, nil, Details.Reportar, Details.playerDetailWindow, 10 + index, 16, 16, + "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", nil, "DetailsJanelaInfoReport1") + Details.FadeHandler.Fader(spellBlock.reportButton, 1) --hide + spellBlock.reportButton:SetScript("OnEnter", onEnterInfoReport) + spellBlock.reportButton:SetScript("OnLeave", onLeaveInfoReport) + + --spark texture + spellBlock.sparkTexture = spellBlock:CreateTexture("$parentOverlaySparkTexture", "overlay") + spellBlock.sparkTexture:SetTexture("Interface\\AddOns\\Details\\images\\bar_detalhes2_end") + spellBlock.sparkTexture:SetBlendMode("ADD") + + local gradientDown = DetailsFramework:CreateTexture(spellBlock, {gradient = "vertical", fromColor = {0, 0, 0, 0.1}, toColor = "transparent"}, 1, 43, "background", {0, 1, 0, 1}) + gradientDown:SetPoint("bottoms") + spellBlock.gradientTexture = gradientDown + + return spellBlock +end + +local spellBlockContainerMixin = { + ---refresh all the spellblocks in the container ~UpdateBlocks + ---this function adjust the frame properties, does not update the data shown on them + ---@param self breakdownspellblockcontainer + UpdateBlocks = function(self) --~update + ---@type number, number + local width, height = spellBreakdownSettings.blockcontainer_width, spellBreakdownSettings.blockcontainer_height + local blockHeight = spellBreakdownSettings.blockspell_height + self:SetSize(width, height) + + for i = 1, #self.SpellBlocks do + ---@type breakdownspellblock + local spellBlock = self.SpellBlocks[i] + + spellBlock:SetSize(width - 2, blockHeight) + spellBlock:SetPoint("topleft", self, "topleft", 1, (blockHeight * (i - 1) - i) * -1 - (i*2)) + spellBlock.sparkTexture:SetSize(spellBreakdownSettings.blockspell_spark_width, blockHeight) + spellBlock.sparkTexture:SetShown(spellBreakdownSettings.blockspell_spark_show) + spellBlock.sparkTexture:SetVertexColor(unpack(spellBreakdownSettings.blockspell_spark_color)) + spellBlock.reportButton:SetPoint("bottomright", spellBlock.overlay, "bottomright", -2, 2) + spellBlock.gradientTexture:SetHeight(blockHeight) + + --update the lines + local previousLine + for o = 1, spellBlockContainerSettings.lineAmount do + ---@type breakdownspellblockline + local line = spellBlock.Lines[o] + line:SetSize(width - 2, spellBreakdownSettings.blockspellline_height) + if (previousLine) then + line:SetPoint("topleft", previousLine, "bottomleft", 0, -2) + else + line:SetPoint("topleft", spellBlock, "topleft", 1, -2) + end + previousLine = line + end + end + end, + + ---@param self breakdownspellblockcontainer + ClearBlocks = function(self) + for i = 1, #self.SpellBlocks do + ---@type breakdownspellblock + local spellBlock = self.SpellBlocks[i] + spellBlock:Hide() + + --clear the text shown in their lines + for o = 1, 3 do + spellBlock.Lines[o].leftText:SetText("") + spellBlock.Lines[o].centerText:SetText("") + spellBlock.Lines[o].rightText:SetText("") + end + end + end, + + ---get a breakdownspellblock from the container + ---@param self breakdownspellblockcontainer + ---@param index number + ---@return breakdownspellblock + GetBlock = function(self, index) + return self.SpellBlocks[index] + end, +} + +---create the spell blocks which shows the critical hits, normal hits, etc +---@param tabFrame tabframe +---@return breakdownspellblockcontainer +function spellsTab.CreateSpellBlockContainer(tabFrame) + --create the container which will hold the spell blocks + ---@type breakdownspellblockcontainer + local spellBlockContainer = CreateFrame("Frame", "$parentSpellBlockContainer", tabFrame, "BackdropTemplate") + spellBlockContainer:EnableMouse(true) + spellBlockContainer:SetResizable(false) + spellBlockContainer:SetMovable(true) + DetailsFramework:Mixin(spellBlockContainer, spellBlockContainerMixin) + DetailsFramework:ApplyStandardBackdrop(spellBlockContainer) + tabFrame.SpellBlockContainer = spellBlockContainer + + spellBlockContainer.SpellBlocks = {} + + for i = 1, spellBlockContainerSettings.amount do + ---@type breakdownspellblock + local spellBlock = spellsTab.CreateSpellBlock(spellBlockContainer, i) + table.insert(spellBlockContainer.SpellBlocks, spellBlock) + --size and point are set on ~UpdateBlocks + end + + spellBlockContainer:UpdateBlocks() + + return spellBlockContainer +end + +function spellsTab.CreateTargetContainer(tabFrame) + local container_alvos_window = CreateFrame("ScrollFrame", "Details_Info_ContainerAlvosScroll", tabFrame, "BackdropTemplate") + local container_alvos = CreateFrame("Frame", "Details_Info_ContainerAlvos", container_alvos_window, "BackdropTemplate") + + container_alvos:SetAllPoints(container_alvos_window) + container_alvos:SetSize(300, 100) + container_alvos:EnableMouse(true) + container_alvos:SetMovable(true) + + container_alvos_window:SetSize(300, 100) + container_alvos_window:SetScrollChild(container_alvos) + container_alvos_window:SetPoint("bottomleft", tabFrame, "bottomleft", 20, 6) --56 default + + container_alvos_window:SetScript("OnSizeChanged", function(self) + container_alvos:SetSize(self:GetSize()) + end) + + _detalhes.gump:NewScrollBar(container_alvos_window, container_alvos, 7, 4) + container_alvos_window.slider:Altura(88) + container_alvos_window.slider:cimaPoint(0, 1) + container_alvos_window.slider:baixoPoint(0, -3) + + container_alvos_window.gump = container_alvos + tabFrame.container_alvos = container_alvos_window + + tabFrame.targets = tabFrame:CreateFontString(nil, "OVERLAY", "QuestFont_Large") + tabFrame.targets:SetPoint("TOPLEFT", tabFrame, "TOPLEFT", 24, -273) + tabFrame.targets:SetText(Loc ["STRING_TARGETS"] .. ":") +end + +--logistics: class_damage build the list of spells, send it to window_playerbreakdown, which gets the current summary tab and send the data for it +--in this tab, the data is sent to the refresh function + +local onClickExpandButton = function(expandButton, button) + ---@type breakdownspellbar + local spellBar = expandButton:GetParent() + ---@type table + local scrolFrame = spellBar:GetParent() + ---@type boolean + local bIsSpellExpaded = expandButton.bIsSpellExpaded + + --check if the one of the expanded bars was a selected spellbar and deselect + --get the current selected spellbar + ---@type breakdownspellbar + local selectedSpellBar = spellsTab.GetSelectedSpellBar() + + if (bIsSpellExpaded) then --it's already expended, it'll close the expanded spellbars + --check if the selected spellbar is one of the expanded spellbars and deselect it + for i = 1, #spellBar.ExpandedChildren do + ---@type breakdownspellbar + local expandedSpellBar = spellBar.ExpandedChildren[i] + if (expandedSpellBar == selectedSpellBar) then + --deselect the spellbar + spellsTab.UnSelectSpellBar() + break + end + end + else + spellsTab.UnSelectSpellBar() + end + + --todo: check is any other bar has expanded state true, and close the expand (or not) + + --toggle this spell expand mode + Details222.BreakdownWindow.SetSpellAsExpanded(expandButton.spellId, not bIsSpellExpaded) + --refresh the scrollFrame + scrolFrame:Refresh() +end + +---update a line using the data passed +---@param spellBar breakdownspellbar +---@param index number spell position (from best to wrost) +---@param actorName string +---@param combatObject combat +---@param scrollFrame table +---@param headerTable table +---@param bkSpellData breakdownspelldata +---@param bkSpellStableIndex number +---@param totalValue number +---@param maxValue number +---@param bIsMainLine boolean if true this is the line which has all the values of the spell merged +local updateSpellBar = function(spellBar, index, actorName, combatObject, scrollFrame, headerTable, bkSpellData, bkSpellStableIndex, totalValue, maxValue, bIsMainLine) + --scrollFrame is defined as a table which is false, scrollFrame is a frame + + local textIndex = 1 + for headerIndex = 1, #headerTable do + ---@type number + local spellId + ---@type number + local value + ---@type spelltable + local spellTable + + local petName = "" + + spellBar.bkSpellData = bkSpellData + + if (bIsMainLine) then + spellTable = bkSpellData + value = bkSpellData.total + spellId = bkSpellData.id + petName = bkSpellData.petNames[bkSpellStableIndex] + else + spellTable = bkSpellData.spellTables[bkSpellStableIndex] + value = spellTable.total + spellId = spellTable.id + petName = bkSpellData.petNames[bkSpellStableIndex] + spellBar.bIsExpandedSpell = true + end + + spellBar.spellId = spellId + + ---@cast spellTable spelltable + spellBar.spellTable = spellTable + + ---@type number + local amtCasts = combatObject:GetSpellCastAmount(actorName, spellId) + spellBar.amountCasts = amtCasts + ---@type number + local uptime = combatObject:GetSpellUptime(actorName, spellId) + ---@type number + local combatTime = combatObject:GetCombatTime() + ---@type string, number, string + local spellName, _, spellIcon = Details.GetSpellInfo(spellId) + + if (petName ~= "") then + spellName = spellName .. " (" .. petName .. ")" + end + + spellBar.spellId = spellId + spellBar.spellIconFrame.spellId = spellId + + --statusbar size by percent, statusbar color by school + spellBar.statusBar:SetValue(value / maxValue * 100) + local r, g, b = Details:GetSpellSchoolColor(spellTable.spellschool or 1) + spellBar.statusBar:SetStatusBarColor(r, g, b, 1) + + spellBar.average = value / spellTable.counter + spellBar.combatTime = combatTime + + ---@type fontstring + local text = spellBar.InLineTexts[textIndex] + local header = headerTable[headerIndex] + + if (header.name == "icon") then --ok + spellBar.spellIcon:Show() + spellBar.spellIcon:SetTexture(spellIcon) + spellBar:AddFrameToHeaderAlignment(spellBar.spellIconFrame) + + elseif (header.name == "target") then --the tab does not have knownledge about the targets of the spell, it must be passed over + ---@type breakdowntargetframe + local targetsSquareFrame = spellBar.targetsSquareFrame + targetsSquareFrame:Show() + targetsSquareFrame.spellId = spellId + targetsSquareFrame.bkSpellData = spellTable + targetsSquareFrame.spellTable = spellTable + targetsSquareFrame.bIsMainLine = bIsMainLine + spellBar:AddFrameToHeaderAlignment(targetsSquareFrame) + + elseif (header.name == "rank") then --ok + text:SetText(index) + spellBar:AddFrameToHeaderAlignment(text) + spellBar.rank = index + textIndex = textIndex + 1 + + elseif (header.name == "expand") then + text:SetText("") + spellBar:AddFrameToHeaderAlignment(spellBar.expandButton) + textIndex = textIndex + 1 + + if (bkSpellData.bCanExpand and bIsMainLine) then + spellBar.expandButton:Show() + local bIsSpellExpaded = Details222.BreakdownWindow.IsSpellExpanded(spellId) + + spellBar.expandButton.spellId = spellId + spellBar.expandButton.bIsSpellExpaded = bIsSpellExpaded + spellBar.expandButton:SetScript("OnClick", onClickExpandButton) + + --update the texture taking the state of the expanded value + spellBar.expandButton.texture:SetTexture(bIsSpellExpaded and [[Interface\BUTTONS\Arrow-Up-Down]] or [[Interface\BUTTONS\Arrow-Down-Down]]) + end + + elseif (header.name == "name") then --ok + text:SetText(spellName) + spellBar.name = spellName + spellBar:AddFrameToHeaderAlignment(text) + textIndex = textIndex + 1 + + elseif (header.name == "amount") then --ok + text:SetText(Details:Format(value)) + spellBar:AddFrameToHeaderAlignment(text) + textIndex = textIndex + 1 + + elseif (header.name == "persecond") then --ok + spellBar.perSecond = value / combatTime + + ---@type string + local perSecondFormatted = Details:Format(spellBar.perSecond) + text:SetText(perSecondFormatted) + + spellBar:AddFrameToHeaderAlignment(text) + textIndex = textIndex + 1 + + elseif (header.name == "percent") then --ok + spellBar.percent = value / totalValue * 100 + ---@type string + local percentFormatted = string.format("%.1f", spellBar.percent) .. "%" + text:SetText(percentFormatted) + + spellBar:AddFrameToHeaderAlignment(text) + textIndex = textIndex + 1 + + elseif (header.name == "casts") then --the tab doesn't have information about the amount of casts + text:SetText(amtCasts) + spellBar:AddFrameToHeaderAlignment(text) + textIndex = textIndex + 1 + + elseif (header.name == "critpercent") then --the tab does not have this information + text:SetText(string.format("%.1f", spellTable.c_amt / (spellTable.counter) * 100) .. "%") + spellBar:AddFrameToHeaderAlignment(text) + textIndex = textIndex + 1 + + elseif (header.name == "hits") then --ok + text:SetText(spellTable.counter) + spellBar:AddFrameToHeaderAlignment(text) + textIndex = textIndex + 1 + + elseif (header.name == "castavg") then --ok + spellBar.castAverage = value / amtCasts + text:SetText(Details:Format(spellBar.castAverage)) + spellBar:AddFrameToHeaderAlignment(text) + textIndex = textIndex + 1 + + elseif (header.name == "uptime") then --need to get the uptime of the spell with the biggest uptime + text:SetText(string.format("%.1f", uptime / combatTime * 100) .. "%") + spellBar:AddFrameToHeaderAlignment(text) + textIndex = textIndex + 1 + end + end + + spellBar:AlignWithHeader(scrollFrame.Header, "left") +end + +---get a spell bar from the scroll box, if it doesn't exist, return nil +---@param scrollFrame table +---@param lineIndex number +---@return breakdownspellbar +local getSpellBar = function(scrollFrame, lineIndex) + ---@type breakdownspellbar + local spellBar = scrollFrame:GetLine(lineIndex) + + spellBar.bIsExpandedSpell = false + + table.wipe(spellBar.ExpandedChildren) + + --reset header alignment + spellBar:ResetFramesToHeaderAlignment() + + --reset columns, hiding them + spellBar.spellIcon:Hide() + spellBar.expandButton:Hide() + spellBar.targetsSquareFrame:Hide() + for inLineIndex = 1, #spellBar.InLineTexts do + spellBar.InLineTexts[inLineIndex]:SetText("") + end + + return spellBar +end + +---refresh the data shown in the spells scroll box +---@param scrollFrame table +---@param scrollData breakdownscrolldata +---@param offset number +---@param totalLines number +local refreshFunc = function(scrollFrame, scrollData, offset, totalLines) --~refresh spells + ---@type number + local maxValue = scrollData[1] and scrollData[1].total + ---@type number + local totalValue = scrollData.totalValue + + ---@type actor + local actorObject = spellsTab.GetActor() + ---@type string + local actorName = actorObject:Name() + + ---@type combat + local combatObject = spellsTab.GetCombat() + ---@type instance + local instanceObject = spellsTab.GetInstance() + + local headerTable = spellsTab.BuildHeaderTable() + scrollFrame.Header:SetHeaderTable(headerTable) + + local lineIndex = 1 + for i = 1, totalLines do + local index = i + offset + + ---@type breakdownspelldata + local bkSpellData = scrollData[index] + + if (bkSpellData) then + --before getting a line, check if the data for the line is a expanded line and if the spell is expanded + local expandedIndex = bkSpellData.expandedIndex + local spellId = bkSpellData.id + local value = math.floor(bkSpellData.total) + + ---@type number[] + local spellIds = bkSpellData.spellIds --array with spellIds + ---@type spelltable[] + local spellTables = bkSpellData.spellTables --array with spellTables + ---@type number + local spellTablesAmount = #spellTables + ---@type string[] + local petNames = bkSpellData.petNames --array with pet names + ---@type boolean + + ---called mainSpellBar because it is the line that shows the sum of all spells merged (if any) + ---@type breakdownspellbar + local mainSpellBar = getSpellBar(scrollFrame, lineIndex) + do + --main line of the spell, where the sum of all spells merged is shown + if (mainSpellBar) then + lineIndex = lineIndex + 1 + local bIsMainLine = true + updateSpellBar(mainSpellBar, index, actorName, combatObject, scrollFrame, headerTable, bkSpellData, 1, totalValue, maxValue, bIsMainLine) + end + end + + --then it adds the lines for each spell merged, but it cannot use the bkSpellData, it needs the spellTable + if (bkSpellData.bIsExpanded and spellTablesAmount > 1) then + ---@type number spellTableIndex is the same counter as bkSpellStableIndex + for spellTableIndex = 1, spellTablesAmount do + ---@type breakdownspellbar + local spellBar = getSpellBar(scrollFrame, lineIndex) + if (spellBar) then + lineIndex = lineIndex + 1 + ---@type string + local petName = petNames[spellTableIndex] + ---@type string + local nameToUse = petName ~= "" and petName or actorName + local bIsMainLine = false + updateSpellBar(spellBar, index, nameToUse, combatObject, scrollFrame, headerTable, bkSpellData, spellTableIndex, totalValue, maxValue, bIsMainLine) + mainSpellBar.ExpandedChildren[#mainSpellBar.ExpandedChildren + 1] = spellBar + end + end + end + + if (lineIndex > totalLines) then + break + end + end + end +end + +---creates a scrollframe which show breakdownspellbar to show the spells used by an actor +---@param tabFrame tabframe +---@return breakdownspellscrollframe +function spellsTab.CreateSpellScrollContainer(tabFrame) + --replace this with a framework scrollframe + local scrollFrame = DF:CreateScrollBox(tabFrame, "$parentSpellScroll", refreshFunc, {}, CONST_SPELLSCROLL_WIDTH, CONST_SPELLSCROLL_HEIGHT, CONST_SPELLSCROLL_AMTLINES, CONST_SPELLSCROLL_LINEHEIGHT) + DF:ReskinSlider(scrollFrame) + DF:ApplyStandardBackdrop(scrollFrame) + scrollFrame:SetPoint("topleft", tabFrame, "topleft", 5, -5) --need to set the points + scrollFrame:EnableMouse(true) + scrollFrame:SetMovable(true) + tabFrame.SpellScrollFrame = scrollFrame + + function scrollFrame:RefreshMe(data) + self:SetData(data) + self:Refresh() + end + + --~header + local headerOptions = { + padding = 2, + header_height = 14, + } + + local headerTable = spellsTab.BuildHeaderTable() + + scrollFrame.Header = DetailsFramework:CreateHeader(scrollFrame, headerTable, headerOptions) + scrollFrame.Header:SetPoint("topleft", scrollFrame, "topleft", 0, 0) + + --create the scroll lines + for i = 1, CONST_SPELLSCROLL_AMTLINES do + scrollFrame:CreateLine(spellsTab.CreateSpellBar) + end + + return scrollFrame +end + +--special backgrounds -- fundos especiais de friendly fire e outros +function spellsTab.CreateSpecialBackgrounds(tabFrame) + tabFrame.no_targets = tabFrame:CreateTexture("DetailsBreakdownWindow_no_targets", "overlay") + tabFrame.no_targets:SetPoint("bottomleft", tabFrame, "bottomleft", 20, 6) + tabFrame.no_targets:SetSize(301, 100) + tabFrame.no_targets:SetTexture([[Interface\QUESTFRAME\UI-QUESTLOG-EMPTY-TOPLEFT]]) + tabFrame.no_targets:SetTexCoord(0.015625, 1, 0.01171875, 0.390625) + tabFrame.no_targets:SetDesaturated(true) + tabFrame.no_targets:SetAlpha(.7) + tabFrame.no_targets.text = tabFrame:CreateFontString(nil, "overlay", "GameFontNormal") + tabFrame.no_targets.text:SetPoint("center", tabFrame.no_targets, "center") + tabFrame.no_targets.text:SetText(Loc ["STRING_NO_TARGET_BOX"]) + tabFrame.no_targets.text:SetTextColor(1, 1, 1, .4) + tabFrame.no_targets:Hide() +end + +---on enter function for the spell target frame +---@param targetFrame breakdowntargetframe +local onEnterSpellTarget = function(targetFrame) + --the spell target frame is created in the statusbar which is placed above the line frame + local lineBar = targetFrame:GetParent():GetParent() + local spellId = targetFrame.spellId + + ---@type actor + local actorObject = Details:GetPlayerObjectFromBreakdownWindow() + + local targets + if (targetFrame.bIsMainLine) then + ---@type breakdownspelldata + local bkSpellData = targetFrame.bkSpellData + targets = actorObject:BuildSpellTargetFromBreakdownSpellData(bkSpellData) + else + local spellTable = targetFrame.spellTable + targets = actorObject:BuildSpellTargetFromSpellTable(spellTable) + end + + ---@type number the top value of targets + local topValue = targets[1] and targets[1][2] or 0 + + local cooltip = GameCooltip + cooltip:Preset(2) + + for targetIndex, targetTable in ipairs(targets) do + local targetName = targetTable[1] + local value = targetTable[2] + cooltip:AddLine(targetIndex .. ". " .. targetName, Details:Format(value)) + GameCooltip:AddIcon([[Interface\MINIMAP\TRACKING\Target]], 1, 1, 14, 14) + Details:AddTooltipBackgroundStatusbar(false, value / topValue * 100) + end + + cooltip:SetOwner(targetFrame) + cooltip:Show() + + if true then return end + + do + if (spellId and type(spellId) == "number") then + ---@type actor + local actorObject = lineBar.other_actor or breakdownWindow.jogador + local spellTable = actorObject.spells and actorObject.spells:GetSpell(spellId) + + if (spellTable) then + local spellsSortedResult = {} + local targetContainer + local total = 0 + + if (spellTable.isReflection) then + targetContainer = spellTable.extra + else + local attribute, subAttribute = breakdownWindow.instancia:GetDisplay() + if (attribute == 1 or attribute == 3) then + targetContainer = spellTable.targets + else + if (subAttribute == 3) then --overheal + targetContainer = spellTable.targets_overheal + + elseif (subAttribute == 6) then --absorbs + targetContainer = spellTable.targets_absorbs + + else + targetContainer = spellTable.targets + end + end + end + + --add and sort + for targetName, amount in pairs(targetContainer) do + if (amount > 0) then + spellsSortedResult[#spellsSortedResult+1] = {targetName, amount} + total = total + amount + end + end + table.sort(spellsSortedResult, Details.Sort2) + + local spellName, _, spellIcon = _GetSpellInfo(spellId) + + GameTooltip:SetOwner(targetFrame, "ANCHOR_TOPRIGHT") + GameTooltip:AddLine(lineBar.index .. ". " .. spellName) + GameTooltip:AddLine(Loc ["STRING_TARGETS"] .. ":") + GameTooltip:AddLine(" ") + + --get time type + local timeElapsed + if (Details.time_type == 1 or not actorObject.grupo) then + timeElapsed = actorObject:Tempo() + elseif (Details.time_type == 2) then + timeElapsed = breakdownWindow.instancia.showing:GetCombatTime() + end + + local abbreviationFunction = Details.ToKFunctions[Details.ps_abbreviation] + + if (spellTable.isReflection) then + Details:FormatCooltipForSpells() + GameCooltip:SetOwner(targetFrame, "bottomright", "top", 4, -2) + + Details:AddTooltipSpellHeaderText("Spells Reflected", {1, 0.9, 0.0, 1}, 1, select(3, _GetSpellInfo(spellTable.id)), 0.1, 0.9, 0.1, 0.9) --localize-me + Details:AddTooltipHeaderStatusbar(1, 1, 1, 0.4) + + GameCooltip:AddIcon(select(3, _GetSpellInfo(spellTable.id)), 1, 1, 16, 16, .1, .9, .1, .9) + Details:AddTooltipHeaderStatusbar(1, 1, 1, 0.5) + + local topAmount = spellsSortedResult[1] and spellsSortedResult[1][2] + + for index, targetTable in ipairs(spellsSortedResult) do + local targetName = targetTable[1] + local amount = targetTable[2] + + GameCooltip:AddLine(spellName, abbreviationFunction(_, amount) .. " (" .. math.floor(amount / topAmount * 100) .. "%)") + GameCooltip:AddIcon(spellIcon, 1, 1, 16, 16, .1, .9, .1, .9) + Details:AddTooltipBackgroundStatusbar(false, amount / topAmount * 100) + end + + GameCooltip:Show() + + targetFrame.texture:SetAlpha(1) + targetFrame:SetAlpha(1) + lineBar:GetScript("OnEnter")(lineBar) + return + else + for index, targetTable in ipairs(spellsSortedResult) do + local targetName = targetTable[1] + local amount = targetTable[2] + + local class = Details:GetClass(targetName) + if (class and Details.class_coords[class]) then + local cords = Details.class_coords[class] + if (breakdownWindow.target_persecond) then + GameTooltip:AddDoubleLine(index .. ". |TInterface\\AddOns\\Details\\images\\classes_small_alpha:14:14:0:0:128:128:"..cords[1]*128 ..":"..cords[2]*128 ..":"..cords[3]*128 ..":"..cords[4]*128 .."|t " .. targetName, Details:comma_value(math.floor(amount / timeElapsed)), 1, 1, 1, 1, 1, 1) + else + GameTooltip:AddDoubleLine(index .. ". |TInterface\\AddOns\\Details\\images\\classes_small_alpha:14:14:0:0:128:128:"..cords[1]*128 ..":"..cords[2]*128 ..":"..cords[3]*128 ..":"..cords[4]*128 .."|t " .. targetName, abbreviationFunction(_, amount), 1, 1, 1, 1, 1, 1) + end + else + if (breakdownWindow.target_persecond) then + GameTooltip:AddDoubleLine(index .. ". " .. targetName, Details:comma_value(math.floor(amount / timeElapsed)), 1, 1, 1, 1, 1, 1) + else + GameTooltip:AddDoubleLine(index .. ". " .. targetName, abbreviationFunction(_, amount), 1, 1, 1, 1, 1, 1) + end + end + end + end + + GameTooltip:Show() + else + GameTooltip:SetOwner(targetFrame, "ANCHOR_TOPRIGHT") + GameTooltip:AddLine(lineBar.index .. ". " .. lineBar.spellId) + GameTooltip:AddLine(breakdownWindow.target_text) + GameTooltip:AddLine(Loc ["STRING_NO_TARGET"], 1, 1, 1) + GameTooltip:AddLine(Loc ["STRING_MORE_INFO"], 1, 1, 1) + GameTooltip:Show() + end + else + GameTooltip:SetOwner(targetFrame, "ANCHOR_TOPRIGHT") + GameTooltip:AddLine(lineBar.index .. ". " .. lineBar.spellId) + GameTooltip:AddLine(breakdownWindow.target_text) + GameTooltip:AddLine(Loc ["STRING_NO_TARGET"], 1, 1, 1) + GameTooltip:AddLine(Loc ["STRING_MORE_INFO"], 1, 1, 1) + GameTooltip:Show() + end + + targetFrame.texture:SetAlpha(.7) + targetFrame:SetAlpha(1) + lineBar:GetScript("OnEnter")(lineBar) + end +end + +local onLeaveSpellTarget = function(self) + GameTooltip:Hide() + GameCooltip:Hide() + self:GetParent():GetParent():GetScript("OnLeave")(self:GetParent():GetParent()) + self.texture:SetAlpha(.7) + self:SetAlpha(.7) +end + +---create a spellbar within the spell scroll +---@param self breakdownspellscrollframe +---@param index number +---@return breakdownspellbar +function spellsTab.CreateSpellBar(self, index) --~spellbar ~spellline ~spell ~create ~createline + ---@type breakdownspellbar + local spellBar = CreateFrame("button", self:GetName() .. "SpellBar" .. index, self, "BackdropTemplate") + spellBar:SetHeight(CONST_SPELLSCROLL_LINEHEIGHT) + spellBar.index = index + local y = (index-1) * CONST_SPELLSCROLL_LINEHEIGHT * -1 + (1 * -index) - 15 + spellBar:SetPoint("topleft", self, "topleft", 0, y) + spellBar:SetPoint("topright", self, "topright", 0, y) + spellBar:SetFrameLevel(self:GetFrameLevel() + 1) + spellBar:EnableMouse(true) + spellBar:RegisterForClicks("LeftButtonDown", "RightButtonUp") + spellBar:SetScript("OnEnter", onEnterBreakdownSpellBar) + spellBar:SetScript("OnLeave", onLeaveBreakdownSpellBar) + spellBar:SetScript("OnMouseDown", onMouseDownBreakdownSpellBar) + spellBar:SetScript("OnMouseUp", onMouseUpBreakdownSpellBar) + spellBar.onMouseUpTime = 0 + spellBar.ExpandedChildren = {} + + DF:Mixin(spellBar, DF.HeaderFunctions) + + ---@type statusbar + local statusBar = CreateFrame("StatusBar", "$parentStatusBar", spellBar, "BackdropTemplate") + statusBar:SetFrameLevel(spellBar:GetFrameLevel()-1) + statusBar:SetAllPoints() + statusBar:SetAlpha(0.5) + statusBar:SetMinMaxValues(0, 100) + statusBar:SetValue(50) + spellBar.statusBar = statusBar + + ---@type texture + local statusBarTexture = statusBar:CreateTexture("$parentTexture", "artwork") + statusBarTexture:SetTexture(SharedMedia:Fetch("statusbar", "Details Hyanda")) + statusBar:SetStatusBarTexture(statusBarTexture) + statusBar:SetStatusBarColor(1, 1, 1, 1) + + ---create the overlay texture to use when the spellbar is selected + ---@type texture + local statusBarOverlayTexture = statusBar:CreateTexture("$parentTextureOverlay", "overlay", nil, 7) + statusBarOverlayTexture:SetTexture([[Interface/AddOns/Details/images/overlay_indicator_1]]) + statusBarOverlayTexture:SetVertexColor(1, 1, 1, 0.2) + statusBarOverlayTexture:SetAllPoints() + statusBarOverlayTexture:Hide() + spellBar.overlayTexture = statusBarOverlayTexture + statusBar.overlayTexture = statusBarOverlayTexture + + ---@type texture + local hightlightTexture = statusBar:CreateTexture("$parentTextureHighlight", "highlight") + hightlightTexture:SetColorTexture(1, 1, 1, 0.2) + hightlightTexture:SetAllPoints() + statusBar.highlightTexture = hightlightTexture + + ---@type texture + local backgroundTexture = statusBar:CreateTexture("$parentTextureBackground", "background") + backgroundTexture:SetAllPoints() + backgroundTexture:SetColorTexture(.1, .1, .1, 0.38) + statusBar.backgroundTexture = backgroundTexture + + --button to expand the bar when there's spells merged + ---@type breakdownexpandbutton + local expandButton = CreateFrame("button", "$parentExpandButton", spellBar, "BackdropTemplate") + expandButton:SetSize(CONST_BAR_HEIGHT, CONST_BAR_HEIGHT) + expandButton:RegisterForClicks("LeftButtonDown") + spellBar.expandButton = expandButton + + ---@type texture + local expandButtonTexture = expandButton:CreateTexture("$parentTexture", "artwork") + expandButtonTexture:SetPoint("center", expandButton, "center", 0, 0) + expandButtonTexture:SetSize(CONST_BAR_HEIGHT-2, CONST_BAR_HEIGHT-2) + expandButton.texture = expandButtonTexture + + --frame which will show the spell tooltip + ---@type frame + local spellIconFrame = CreateFrame("frame", "$parentIconFrame", spellBar, "BackdropTemplate") + spellIconFrame:SetSize(CONST_BAR_HEIGHT - 2, CONST_BAR_HEIGHT - 2) + spellIconFrame:SetScript("OnEnter", onEnterSpellIconFrame) + spellIconFrame:SetScript("OnLeave", onLeaveSpellIconFrame) + spellBar.spellIconFrame = spellIconFrame + + --create the icon to show the spell texture + ---@type texture + local spellIcon = spellIconFrame:CreateTexture("$parentTexture", "overlay") + spellIcon:SetAllPoints() + spellIcon:SetTexCoord(.1, .9, .1, .9) + spellBar.spellIcon = spellIcon + + --create a square frame which is placed at the right side of the line to show which targets for damaged by the spell + ---@type breakdowntargetframe + local targetsSquareFrame = CreateFrame("frame", "$parentTargetsFrame", statusBar, "BackdropTemplate") + targetsSquareFrame:SetSize(CONST_SPELLSCROLL_LINEHEIGHT, CONST_SPELLSCROLL_LINEHEIGHT) + targetsSquareFrame:SetAlpha(.7) + targetsSquareFrame:SetScript("OnEnter", onEnterSpellTarget) + targetsSquareFrame:SetScript("OnLeave", onLeaveSpellTarget) + targetsSquareFrame:SetFrameLevel(statusBar:GetFrameLevel()+2) + spellBar.targetsSquareFrame = targetsSquareFrame + + ---@type texture + local targetTexture = targetsSquareFrame:CreateTexture("$parentTexture", "overlay") + targetTexture:SetTexture([[Interface\MINIMAP\TRACKING\Target]]) + targetTexture:SetAllPoints() + targetTexture:SetDesaturated(true) + spellBar.targetsSquareTexture = targetTexture + targetsSquareFrame.texture = targetTexture + + spellBar:AddFrameToHeaderAlignment(spellIconFrame) + spellBar:AddFrameToHeaderAlignment(targetsSquareFrame) + + --create texts + ---@type fontstring[] + spellBar.InLineTexts = {} + + for i = 1, 16 do + ---@type fontstring + local fontString = spellBar:CreateFontString("$parentFontString" .. i, "overlay", "GameFontHighlightSmall") + fontString:SetJustifyH("left") + fontString:SetTextColor(1, 1, 1, 1) + fontString:SetNonSpaceWrap(true) + fontString:SetWordWrap(false) + spellBar["lineText" .. i] = fontString + spellBar.InLineTexts[i] = fontString + fontString:SetTextColor(1, 1, 1, 1) + spellBar:AddFrameToHeaderAlignment(fontString) + end + + spellBar:AlignWithHeader(self.Header, "left") + + spellBar.on_focus = false + + return spellBar +end + + +--[=[ +function gump:CriaNovaBarraInfo2(instance, index) --not used on this file, used on class damage, heal, etc + if (_detalhes.playerDetailWindow.barras2[index]) then + return + end + + local janela = info.container_alvos.gump + + local newBar = CreateFrame("Button", "Details_infobox2_bar_" .. index, info.container_alvos.gump, "BackdropTemplate") + newBar:SetHeight(CONST_TARGET_HEIGHT) + + local y = (index-1) * (CONST_TARGET_HEIGHT + 1) + y = y* - 1 + + newBar:SetPoint("LEFT", janela, "LEFT", CONST_TARGET_HEIGHT, 0) + newBar:SetPoint("RIGHT", janela, "RIGHT", 0, 0) + newBar:SetPoint("TOP", janela, "TOP", 0, y) + newBar:SetFrameLevel(janela:GetFrameLevel() + 1) + newBar:EnableMouse(true) + newBar:RegisterForClicks("LeftButtonDown","RightButtonUp") + + --icon + newBar.icone = newBar:CreateTexture(nil, "OVERLAY") + newBar.icone:SetWidth(CONST_TARGET_HEIGHT) + newBar.icone:SetHeight(CONST_TARGET_HEIGHT) + newBar.icone:SetPoint("RIGHT", newBar, "LEFT", 0, 0) + + CriaTexturaBarra(newBar) + + newBar:SetAlpha(ALPHA_BLEND_AMOUNT) + newBar.icone:SetAlpha(1) + + newBar.isAlvo = true + + SetBarraScripts(newBar, instance, index) + + info.barras2[index] = newBar --barra adicionada + + return newBar +end + +function gump:CriaNovaBarraInfo3(instance, index) --not used on this file, used on class damage, heal, etc + if (_detalhes.playerDetailWindow.barras3[index]) then + return + end + + local janela = info.container_detalhes + + local newBar = CreateFrame("button", "Details_infobox3_bar_" .. index, janela, "BackdropTemplate") + newBar:SetHeight(16) + + local y = (index-1) * 17 + y = y*-1 + + container3_bars_pointFunc(newBar, index) --what this fun does? + newBar:EnableMouse(true) + + --icon + newBar.icone = newBar:CreateTexture(nil, "OVERLAY") + newBar.icone:SetWidth(14) + newBar.icone:SetHeight(14) + newBar.icone:SetPoint("LEFT", newBar, "LEFT", 0, 0) + + CriaTexturaBarra(newBar) + + newBar:SetAlpha(0.9) + newBar.icone:SetAlpha(1) + + newBar.isDetalhe = true + + SetBarraScripts(newBar, instance, index) + + info.barras3[index] = newBar + + return newBar +end +--]=] + +----------------------------------------------------------------------------------------------------------------------- +--> report data + +function spellsTab.monta_relatorio(botao) + ---@type attributeid + local mainSection = breakdownWindow.atributo + ---@type attributeid + local subSection = breakdownWindow.sub_atributo + ---@type actor + local player = breakdownWindow.jogador + ---@type instance + local instance = breakdownWindow.instancia + ---@type number + local amt = _detalhes.report_lines + + local tabFrame = spellsTab.TabFrame + + if (not player) then + _detalhes:Msg("Player not found.") + return + end + + local report_lines + + if (botao == 1) then --spell data + if (mainSection == 1 and subSection == 4) then --friendly fire + report_lines = {"Details!: " .. player.nome .. " " .. Loc ["STRING_ATTRIBUTE_DAMAGE_FRIENDLYFIRE"] .. ":"} + + elseif (mainSection == 1 and subSection == 3) then --damage taken + report_lines = {"Details!: " .. player.nome .. " " .. Loc ["STRING_ATTRIBUTE_DAMAGE_TAKEN"] .. ":"} + + else + report_lines = {"Details!: " .. player.nome .. " - " .. _detalhes.sub_atributos [mainSection].lista [subSection] .. ""} + end + + for index, barra in ipairs(tabFrame.barras1) do + if (barra:IsShown()) then + local spellid = barra.show + if (mainSection == 1 and subSection == 4) then --friendly fire + report_lines [#report_lines+1] = barra.lineText1:GetText() .. ": " .. barra.lineText4:GetText() + + elseif (type(spellid) == "number" and spellid > 10) then + local link = GetSpellLink(spellid) + report_lines [#report_lines+1] = index .. ". " .. link .. ": " .. barra.lineText4:GetText() + else + local spellname = barra.lineText1:GetText():gsub((".*%."), "") + spellname = spellname:gsub("|c%x%x%x%x%x%x%x%x", "") + spellname = spellname:gsub("|r", "") + report_lines [#report_lines+1] = index .. ". " .. spellname .. ": " .. barra.lineText4:GetText() + end + end + + if (index == amt) then + break + end + end + + elseif (botao == 3) then --targets + if (mainSection == 1 and subSection == 3) then + print(Loc ["STRING_ACTORFRAME_NOTHING"]) + return + end + + report_lines = {"Details! " .. Loc ["STRING_ACTORFRAME_REPORTTARGETS"] .. " " .. _detalhes.sub_atributos [1].lista [1] .. " " .. Loc ["STRING_ACTORFRAME_REPORTOF"] .. " " .. player.nome} + + for index, barra in ipairs(tabFrame.barras2) do + if (barra:IsShown()) then + report_lines[#report_lines+1] = barra.lineText1:GetText().. " -> " .. barra.lineText4:GetText() + end + if (index == amt) then + break + end + end + + elseif (botao == 2) then --spell blocks + --dano --damage done --dps --heal + if ((mainSection == 1 and (subSection == 1 or subSection == 2)) or (mainSection == 2)) then + if (not player.detalhes) then + print(Loc ["STRING_ACTORFRAME_NOTHING"]) + return + end + + local nome = _GetSpellInfo(player.detalhes) + + report_lines = {"Details! " .. Loc ["STRING_ACTORFRAME_REPORTTO"] .. " " .. _detalhes.sub_atributos [mainSection].lista [subSection] .. " " .. Loc ["STRING_ACTORFRAME_REPORTOF"] .. " " .. player.nome, + Loc ["STRING_ACTORFRAME_SPELLDETAILS"] .. ": " .. nome} + + for i = 1, 5 do + local caixa = _detalhes.playerDetailWindow.grupos_detalhes[i] + if (caixa.bg:IsShown()) then + + local linha = "" + + local nome2 = caixa.nome2:GetText() --golpes + if (nome2 and nome2 ~= "") then + if (i == 1) then + linha = linha..nome2 .. " / " + else + linha = linha .. caixa.nome:GetText() .. " " .. nome2 .. " / " + end + end + + local dano = caixa.dano:GetText() --dano + if (dano and dano ~= "") then + linha = linha .. dano .. " / " + end + + local media = caixa.dano_media:GetText() --media + if (media and media ~= "") then + linha = linha..media .. " / " + end + + local dano_dps = caixa.dano_dps:GetText() + if (dano_dps and dano_dps ~= "") then + linha = linha..dano_dps.." / " + end + + local dano_porcento = caixa.dano_porcento:GetText() + if (dano_porcento and dano_porcento ~= "") then + linha = linha..dano_porcento.." " + end + + report_lines [#report_lines+1] = linha + end + + if (i == amt) then + break + end + end + + --dano --damage tanken + elseif ( (mainSection == 1 and subSection == 3) or mainSection == 3) then + if (player.detalhes) then + report_lines = {"Details! " .. Loc ["STRING_ACTORFRAME_REPORTTO"] .. " " .. _detalhes.sub_atributos [1].lista [1] .. " " .. Loc ["STRING_ACTORFRAME_REPORTOF"] .. " " .. player.detalhes.. " " .. Loc ["STRING_ACTORFRAME_REPORTAT"] .. " " .. player.nome} + for index, barra in ipairs(tabFrame.barras3) do + if (barra:IsShown()) then + report_lines [#report_lines+1] = barra.lineText1:GetText() .. " ....... " .. barra.lineText4:GetText() + end + if (index == amt) then + break + end + end + else + report_lines = {} + end + end + + elseif (botao >= 11) then --primeira caixa dos detalhes + botao = botao - 10 + + local nome + if (type(spellid) == "string") then --unknown spellid value + --is a pet + else + nome = _GetSpellInfo(player.detalhes) + local spelllink = GetSpellLink(player.detalhes) + if (spelllink) then + nome = spelllink + end + end + + if (not nome) then + nome = "" + end + + report_lines = {"Details! " .. Loc ["STRING_ACTORFRAME_REPORTTO"] .. " " .. _detalhes.sub_atributos [mainSection].lista [subSection].. " " .. Loc ["STRING_ACTORFRAME_REPORTOF"] .. " " .. player.nome, + Loc ["STRING_ACTORFRAME_SPELLDETAILS"] .. ": " .. nome} + + local caixa = _detalhes.playerDetailWindow.grupos_detalhes[botao] + + local linha = "" + local nome2 = caixa.nome2:GetText() --golpes + if (nome2 and nome2 ~= "") then + if (botao == 1) then + linha = linha .. nome2 .. " / " + else + linha = linha .. caixa.nome:GetText() .. " " .. nome2 .. " / " + end + end + + local dano = caixa.dano:GetText() --dano + if (dano and dano ~= "") then + linha = linha..dano.." / " + end + + local media = caixa.dano_media:GetText() --media + if (media and media ~= "") then + linha = linha..media.." / " + end + + local dano_dps = caixa.dano_dps:GetText() + if (dano_dps and dano_dps ~= "") then + linha = linha..dano_dps.." / " + end + + local dano_porcento = caixa.dano_porcento:GetText() + if (dano_porcento and dano_porcento ~= "") then + linha = linha..dano_porcento.." " + end + + --remove a cor da school + linha = linha:gsub("|c%x?%x?%x?%x?%x?%x?%x?%x?", "") + linha = linha:gsub("|r", "") + + report_lines [#report_lines+1] = linha + end + + return instance:envia_relatorio(report_lines) +end + +----------------------------------------------------------------------------------------------------------------------- +--> create the new tab +function Details.InitializeSpellBreakdownTab() + local tabButton, tabFrame = Details:CreatePlayerDetailsTab( + "Summary", --[1] tab name + Loc ["STRING_SPELLS"], --[2] localized name + function(tabOBject, playerObject) --[3] condition + if (playerObject) then + return true + else + return false + end + end, + + function() --[4] fill function + --spellsTab.JI_AtualizaContainerBarras(-1) --not in use anymore + spellsTab.TabFrame.no_targets:Hide() --this is nil + spellsTab.TabFrame.no_targets.text:Hide() + + spellsTab.OnShownTab() + --spellsTab.TrocaBackgroundInfo(spellsTab.TabFrame) + end, + + function(tabButton, tabFrame) --[5] onclick + tabFrame:Show() + end, + + spellsTab.OnCreateTabCallback, --[6] oncreate + iconTableSummary, --[7] icon table + nil, --[8] replace tab + true --[9] is default tab + ) + + spellsTab.TabButton = tabButton + spellsTab.TabFrame = tabFrame + + ---on receive data from a class + ---@param data table + ---@param actorObject actor + ---@param combatObject combat + ---@param instance instance + function tabButton.OnReceiveSpellData(data, actorObject, combatObject, instance) + spellsTab.currentActor = actorObject + spellsTab.combatObject = combatObject + spellsTab.instance = instance + spellsTab.TabFrame.SpellScrollFrame:RefreshMe(data) + end +end + diff --git a/functions/mixin.lua b/functions/mixin.lua index ebf43b46..42a07392 100644 --- a/functions/mixin.lua +++ b/functions/mixin.lua @@ -4,7 +4,6 @@ local detailsFramework = _G.DetailsFramework local openRaidLib = LibStub:GetLibrary("LibOpenRaid-1.0", true) local addonName, Details222 = ... - Details222.Mixins.ActorMixin = { ---return a spellContainer from an actor ---@param actor actor @@ -39,4 +38,138 @@ Details222.Mixins.ActorMixin = { return spellTable end end, -} \ No newline at end of file + + ---return a table containing pet names + ---@param actor actor + ---@return table + GetPets = function(actor) + return actor.pets + end, + + ---return a table containing spellTables + ---@param actor actor + ---@return table + GetSpellList = function(actor) + return actor.spells._ActorTable + end, + + ---this function sums all the targets of all spellTables conteining on a 'breakdownspelldata' + ---@param actor actor + ---@param bkSpellData breakdownspelldata + ---@param targetTableName string + ---@return table + BuildSpellTargetFromBreakdownSpellData = function(actor, bkSpellData, targetTableName) + targetTableName = targetTableName or "targets" + + local spellTables = bkSpellData.spellTables + + ---@type table store the index of the target name in the result table + local cacheIndex = {} + ---@type table store the result which is returned by this function + local result = {} + + for i = 1, #spellTables do + ---@type spelltable + local spellTable = spellTables[i] + ---@type table + local targets = spellTable[targetTableName] + + for targetName, value in pairs(targets) do + local index = cacheIndex[targetName] + if (index) then + result[index][2] = result[index][2] + value + else + result[#result+1] = {targetName, value} + cacheIndex[targetName] = #result + end + end + end + + table.sort(result, function(t1, t2) + return t1[2] > t2[2] + end) + + return result + end, + + ---this function receives a target table name and return a table containing the targets and the damage done in order of bigger to lower value + ---@param actor actor + ---@param spellTable spelltable + ---@param targetTableName string + ---@return table + BuildSpellTargetFromSpellTable = function(actor, spellTable, targetTableName) + targetTableName = targetTableName or "targets" + + ---@type table[] store the result which is returned by this function + local result = {} + + ---@type table + local targets = spellTable[targetTableName] + + for targetName, value in pairs(targets) do + ---@cast targetName string + ---@cast value number + result[#result+1] = {targetName, value} + end + + table.sort(result, function(t1, t2) + return t1[2] > t2[2] + end) + + return result + end, + + + +} + +--need to transfer the function bellow to another file + +--this are the fields from spellTable that can be summed +local spellTable_FieldsToSum = { + ["counter"] = true, + ["total"] = true, + ["c_amt"] = true, + ["c_min"] = true, + ["c_max"] = true, + ["c_dmg"] = true, + ["n_amt"] = true, + ["n_dmg"] = true, + ["n_min"] = true, + ["n_max"] = true, + ["successful_casted"] = true, + ["g_amt"] = true, + ["g_dmg"] = true, + ["r_amt"] = true, + ["r_dmg"] = true, + ["b_amt"] = true, + ["b_dmg"] = true, + ["a_amt"] = true, + ["a_dmg"] = true, +} + +---get the array of spelltables and sum each spellTable with the first spellTable found or on targetTable +---only sum the keys found in the spellTable_FieldsToSum table +---@param spellTables table[] +---@param targetTable table +function Details:SumSpellTables(spellTables, targetTable) + local amtSpellTables = #spellTables + + if (amtSpellTables == 0) then + return + end + + targetTable = targetTable or spellTables[1] + + for i = 1, amtSpellTables do + ---@type spelltable + local spellTable = spellTables[i] + if (spellTable) then + for key, value in pairs(spellTable) do + if (spellTable_FieldsToSum[key]) then + targetTable[key] = (targetTable[key] or 0) + value + end + end + end + end +end \ No newline at end of file diff --git a/functions/profiles.lua b/functions/profiles.lua index 3ad287bd..81d9e161 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -1407,6 +1407,18 @@ local default_global_data = { }, }, + --breakdown spell tab + breakdown_spell_tab = { + blockcontainer_width = 430, + blockcontainer_height = 270, + blockspell_height = 50, + blockspellline_height = 13, + blockspell_spark_offset = -2, + blockspell_spark_width = 2, + blockspell_spark_show = true, + blockspell_spark_color = {1, 1, 1, 0.7}, + }, + --profile by spec profile_by_spec = {}, diff --git a/images/overlay_indicator_1.blp b/images/overlay_indicator_1.blp new file mode 100644 index 0000000000000000000000000000000000000000..df711c37408a5ba5fee1b43fe6dc17ab0108a94e GIT binary patch literal 23044 zcmdU13vg4{nLhF>;+0+*3sgcDX%@pK#lbXqV=_%FWtyD~gdn>Xafl(dne0qM35JY2 zCQZOG*>1NbgK4m5aXsbf7Tk4ASmbHg2-7C<&Q51dTd>@n*~Yj~$R@iZCOl+gTW7!j z934Hb?3Hb7OM5-Cbad}M_q*Tu&pH41pa1HqXPsX+Fve1h1_Q$fJ3b#s!|R)P72{Qc z*9(kY!s`}ZX&Z1ryv>dSG`vucs?!?$YN(lWd>nnVGuC*JHiLbC(+A(b`1;j?=4XEJ zPg#q)3l0`%pZ(UO7YnRG3_s0DJHPJHkMRAYKe_Lh?-g86VSj!m^-{rdx*=?TC*PR+ z3T+%IH3R2OZAlD$i5zrwHSxD3K(JXIba{(nvEs$aHZKNt9AnZQ$h zsvcFZIBQpM_nPwlshR+hFy?XBO+uJj9j z-!T7+;78%D`););Kl48l=lpk0yiDi%^%VrmU(S=~8#ez%hWM&io>zBiRt;VD!@vXL z`?BEoqH*cKV7bdA&ll(7-zvO_PwTusflt+I-}tbo=e2MCv%tr(5zk*Q$qn)^dB4G! zxNha01>$&Bk3Ba_lrx@|=c{_HKfPZZ&#J8N-$H%rItp)qE`*KklKY(-eja5{>O6&? zmCdE*V&CyB64(3VUrIcdKFP}`YYgIg?=7nQ5#8rc{z2N0xpv<>RNiyRC+vIRKjiyo zzyG-?FJ36^KJcVGU*Y~%%gX}K2iH!E;{t2!;@$E0HRAg>&&cbm<5%YXU>{vae|>gY z;=5mW{PI`i`Re|LuK(c^!AI~5U0FNW1rD7~r|DzcwH5sMz`@KGXYDm)qS{t!{T-9)FdW@(nz{$73^|x7*7ynF)UeM)+N3vw4j7%XIgD zFJ%qmv)~W(6%%)kp`yV2a}Hy6c6z$v$nU9Yt$t(ECRLtlzV!9CyIrlzvGLVB-?yZ9 zNsp)8XfLaD5_j}R{DHpoY3EO{7v!(FxVUhrBCvzM%PpNpwe<8kGZbGv;O~uHiQ|v1 z?|I^h9B`M_k+pBG-@{m?(^(?fW0Jr0^u+LIVm4|&(C69_sOKN^Kcl}^Xme)34;i_? zhwXhN{sZrFvfuPM$;$ts`w91g|D%F`Wxq6jm6RsVerf#is zbGf?x;BJr)^EZ7hMJIpJ(h@v;^!AM5znfDXevbnxCOP?kG5Po}`d2u>Bk><;zhUd0 zdVh)f3$EQEuJ7Z$WWRaYIjv;7OASj57n^9lSpU4T53(l%HdUTP|43A+uTR*o-EP+k z@mHbknSag-{<`bQc4^D+tZMDM+g~jT_(%7XApU&(0zYKwJbhs1%pX3r)R1j38_euC z(3{22yIhJd$)75*(feEQ5IrB`Ez|WtpIzIb?J=D(U21n*S$DnJtOiI6+Pk{Cv{WI| z*B`-u5%GWFd$3Sl3`JJxTzR$z{zT{ukKCSjk{I^*;e;?vM%P^N|Z(G@VbU1Z? z3FY5y>TY-2jFJ3Pf2+oXA7#I)fOq};GTCL(|2sN5$aeW|{;J>e@L7n6l7F&axU1_` zd&J{wviFDh-z5}3__ro4|Bkzb;NQwd;y;o6!ClRf(GuSh;?G`IRw<(;A-zBS_8X}; zoyEltL`y0HuW_3kYrg#&=B~GdL6@LlS`zGqY(EG&| zfj#^f6hDnmb7ssiD88uwVEPxacNzmi;{rDVUfk^MmLPk+3M1|TSYX}>PlF%d1f4*RXpW*Aaa6<=h( ziJX7P|8OHvD($=*-?8wvi6nJ=31 zq4yi$UngAeL$QizRiUOVZ|5OZ&+CBH0FroKlw1o6}gZp&| zPCb9B|I_(Y11m(duqa9S=g_OP3H}@02v@Bo{wd;;Z2X@N@h`1(H2%f?;NN8TZ+(5# zUpVmx?x6U0ZS?(SLrcr&ub2%|@jH-c5ECy^#)0?AwpV?9(te#z*shxte-Gvxgsbut zKg3@m*GGuIj*fx?5iQxopCx|;dfzUiB__GP48gA`)8F3|m(}{R6Wm>2(O)=7^EJXH z5qh8ECDpqWpUOTI-U$BB*u1uDTbv7R2>l8^tRNyop)kGN#J1OD%lKON0~lH^Bh zh2meuml8gNs}Qe}EBw^{2v;S-eud(s>&yHIDE{G!0O8Aq;8*rXdb=8eUzL^pPFGpz zeF%R3xNj*beu|eMT%yza3CoWVdLQAE;zDpoil5?5NRJ5RM^JvpNclPF|9buhlbe5@ z)ch9-{*MRqBjWQvo%V}xRgN!PDt=3+!w9{f4EZTSaZ>-M{FFVs8H)d!h&LfUC0g$% zG(SS-N43o*#lO*H>4e@-mi&knS|~q)xbyS7a(zBEB|1MM5MCiw<0pE*j(>`{pbpae z5d6wM+u{EpT)0V<)%nv^rg#(fKLUy}l2@3B51!Q%EmSys96zJA@VHh1a)kq5KrZkI?%8RhmYy}Ny{&FFH~n~6KxsJ*wpULCFXN8nHKzihMQ zpKLdo`ClXWUjqI`yd@d(Q$)mN`(E&e1^)5!FB%K~CVM=UdLLR}L`x_?rEu@enYB+X zL9B!nKl#^4Pl=9KDKUumDb}k(FT;GDh*s6p8b9ZhpHg41OqA@G)~BY5pLl#rz28wF zq9wce#vacVOVZ^>KrkU%;)UWLAUy)P9?FlPd`{^7P=3^C_bZ}>h`9KX?@jqBitl9L zAK|J9{%f@`|E35_l^>_tUiJ0Ud@uAqMN0(#r1!_qzv6qe_L=B@^4IDqKV=u+%GdB! zeow82a8)orCHOo91ivCue}7Y2hT>Fu-{xO2;25kJrtt{js*v87_M13=llX(Xl*3=7 zXo)YI;(a4L4>A4x>DK2Rq}KT!`0KIx5pRqkKSJ_f1pXb!57Ir4Qk?|+ui-CH#Kn*G zJ@AkG6q#W`_JeR$67Y|R%RTTv(f%E8yb$p!%1;r|l0$PXowXX$Q=;|0IRWeYWWP|H zLN7t^??ANb48H{XwIV;o5RsoE^V6n^pLqPy_~S;r1ksYYyEB9N5fJ=pMUU_&C_h51 z@Js$&u4dj1#o3Q|NqI~@e*YMrhoESo8+9Z#|0+Kv3Hd)B;y?Czh_UcLRrW3NQ((Vj zyU&^)H#NAECO?G~f6=#BOT9_9ON!I)`OKluPl*UuO}akP_x}jJL`~u&{}=9DPARyf z{D_s!*2F�l^QwkEeOG*Xa2SdLBZmb;^%e*?i9JtkU?uwTkg!SfI+o4+>eN2|$pv!VF6 zZV~Ykm-6>%{s?EMO`G1glkIB9Odn@8%ls5&qtxGCFDZ?VS1B_75BpVzObUPWJOt%O z?4#!)epn>+rp%8}ys7so)knC9zJ6*igiD;JX45COYc_v=XL(e9gnS-i{OhAJ_p_h< znqAfI(0tL9mG#$(U-BnQOV>ZI%46pH5Z}h1wFS}AJ}d+(e)zW#l?5ld&~lOcH-_W zeww!vzKHerPzC)R5*>&s2xQw6+_YLCHV8oh}Bp#Mp97df>@ zME}zoy%iK6swC_e`7PkDje0&k9$x)^vUiH#wHfvqUNSr(;>{&ZO<4+ZJiJl+p&7~E z0k4wK-Np(VJ*&Xyb0hF5gCE6veHT1(Hcs-`=hAm z)8paM?|oXg;cU=eY^HnWZwi{=CN?%boy!pkvz!AK?8bp(CHc(wY1A zk(LuDV#b@X^e-Rp@Ov&cJ^b*)t0lS=fe-LP<6)Hj0raS4E1_dY4tA9r0q=lBN56+t z)%s#-*q@2RSLA#Ebo@}edp1_&YV5>a3SwR~AJKR`ZvF&1_7RQeC4V@OrTi_z2YBmQ zIXi+G{|Y@Hh~4uPpK|{M=6hhrjQ?B%#uxIR2s_QGG~d(jg^U|Np~IX?{XNDX*)#!s zA%8?XuQ@sX2xfd5?P9qEtI^+^A!ZA|!J--NDwa{ZCC3-CwU!C#C&5{5VWcoe*WMvS-0AK8yN zy+QgTq4=ueqma|yi(-Fd{8jB&_7JZu{1xO!6ZYMP=YSvioS5*(%BPNR?FHx^vVV#0 zw!jye4;BxPen0sml)p{r)(L;aVJvAna1Z{7SPu&NBmKZ9;(wuhDgE{1m3xBoJ)z5C z3*av~jDR;$f5aO0M{Xm+HYoZJ>^qbXrtrwUmQ@{e?s>bJ3{`x^hab1(fw~2A)kVku{!oE z_T~I@4&&uhb((6=c8ve@`z5NZ+PlNBkG;emfqgEvS-!EDesxrAA$&FL6zgNR@;k3s zZq#WOb-tKSQ~~d*zBaav6|e_UU%4@V*$DLsbnG_a1H61yg?{`O;}7Q@65T>J|6H04 z@G@fX33SYF>AY$Myl=4EY(N{b270i*OV?NRD}1Uf`X>@37P1*E9Ud9!*Nm^siuGsw z?5;MPi}8T&CvCL)d^G=Zq&LiB_pvm1NISdIY#Cn}As!;oIkCPY??>U$;k(f8zDfS< zD-s>~i?tfyDfc04F9Kbe7_R{DekZTtr+6RAi^cV0>Zjia*~Sa1T91nS3svFHE}N0Y z6UFbRe(i0<7d|iJhxzaLm%OUALc4!fcs(zKm!fOy_#+L_7nnZn>inHuK|K=uqR~rF zu+`XW`1?S23;5D(peJVjlIZw@^{wS1zNG4F^#0XTk@Gp{ZQrBkog}(Dz*lYryj0Rd z)Q9U^pMHprkGcN``AmKvPow*>Up}R&`a||kUuevlkM&i$pF4QkmU6%v-17P{^)2Kx zc)Bm80s6XZ^!joey;m$W|4DS54}L0tuPdfLLYLZ$=QqpIf3=bD0UdKvyb$$WmgwmB zlGbi9p!Mv$QndfhuGyQ9AAj#8pH299%31I1&379YEMQJn!_Kol+Hbets8iPu_P2uB z%ow!a#kQHLsi|eWj{g?zPv;;1S=&iIi`erSc6NQS;p_s`SIG{u-?A@vcC{3N&$^pJ zEeFsZUu>XoRxgtyLZi2(=bt`R*szs1dY5gk`^OKD-+bxL^1E|} zXXZmsZuzed9>@hBhkGv{degUk@0~l}-JO2R;Aev@@Iu%2z5Dn7_``MfMK!Ze&A6P8 ze7e7R&hdWZ&8=QCfvVP@58(sFdw zK1k$)NTfuekVDwzgAX%F6PaibuN>a}%W7Z!_x0iZ?tZT4!_#{1=XXDAt!rKDy4St# z|5{I8UfVo-wfS3Kk3awW$7{uk6$cI+_*GuVk00NH&>;bT zg{-Zut*EF_a@MR_Yu2neeE6`E$BrG_uwlcTIdhbpJ$v@Lb?c5EJ*p%hImlN^aw4bm zBTAA58Ihfm6ow*EFeNEAg{KNiQbDTeNKAo26eB%<{`~FRx9bm*-nVbxvSrI0xp3ja zojZ3ra?hSUOO`Bg-MgnGA34ZZN^&Bn^CL=<1sRc@k`#s_Q7|PbHif4ON>V|psTgTYfk6}_ zJ!Z@pZ0pENmo818KHZVy$B#dG@}wirojW&W$`nUVnl$O`*|Uy3efspoi4z?;ZQ8U8 z7cMyR#EBE*#*K3%ZGGj+6-VM)qeqW+Bz^z-_3KJLdGdr_He$pGCHwa6OYggN>z0y_ z9zDW^h7KL7WdHvCSFc`u_wHRKA3S(K)EYEskdl1lAYUoTiJZ=lC`lG%M0QG27>Y!} zl%&`co+>Cw1*xWDq%j2sN!Xu$yfE+6r%!*A*QZaP8X6i(N=g!t-t+VG>5q+#jROAm z;ll^QU~zG=k_80?guCYEW+hu&TkGoTii(PqEG#Unsi|pcX;G4o9ONq{Ig!)(5hclj zjL1$&3PX`7n35Em!czq$sUX#)vPxnK45AomtbOLp8O2D`g7~TZsDanbP&W|Wb7Gy+rN>Uh#M8TA#*c6^BC`kpWCY4nZQ(%yUrP0vTsZ$|; zm)Ey%-v}?gdiAp55{b5L+j8Z4@#2Mmzkm7ig#knN?%kDa-@ZL=`TF&1C2=zxxJ#EV zN>U44{oT8FO7f9|e5E8OaymbvBw3IV*(ph3C=vxzl44VMs-Pqlq?%M#Nlbx36eEq% zh}GY}e^(Mun=oO5BL@x~c=_^W#Yl6VBJ4Plki}KWkz9QUdX5}BcI^H8_Z@lu{CRq% zBe|x~f0d-nr%s)srz_c}O&hLUO-)Toe*OBDF-gy!J(Xv~Gu|C(=*i2Gl&M$G@Xo)Ysv<{Knp{>Q8l^Pk#NV*WGcKkA7&|AM~Ml=pR%qkZt`#k_LtTO+{0oe^bF& zw)JmGzlwws!HmjQ(K?3yS;f7fe^&R%jQ%-Q3W+I#B5m%_hih|_MpTcqUQI+A6(S;h zN20<-o$E*>{ph$HiTIx-0FFe?$6^6TBIicD?MRj$AaivjixlXpj*R%GRwC46kYu8C z-4A`ZUh!2QZsQ_k$;1T3NF%>TK59%#Ak^o6%8|&V5%xP0K`GPqj%1kt!e&RJ*JW9O zBT+W80Kt)5xDi@AGRC)RB^}?U`@YbJ>m8r!!|lEpsWZ}g#YiK+$5)L>355E{^&N?% zpC05$#Q!V-a3tQ#VgX08pnzosj-*eq0Kt(gQeedH$e79La(LWOa^Y=>fe`Nt%*t3jNoS zp>J0!slJ`#;s4?PslVi)zCHZ^kJkrT+=%$E*Obhx?+gDA|2M~u_;02NeN@s%Mf}h9 z`lg8g5&tddMf^8YMEsBVpRRoo|7{GAgZfyjd))t8Y$Or)zh;eW?~f7wAMxLOAmYFE z`jm+0U*;Pme#ZR`(sSX^Kd4|J^be{QU;~p3?{ArOL7{(B!C2_uR4slI)1;WjQpmK^*4 zo0Ve!f4fD>_WhCF7c`$Nv8|@s;iQVVm%b{ZFjLNn~dKlhnSkK0+H;*GGi^ zXZ!hP_<#KWi}n2+e7+g}AO0WyALAeM0TMC(u~8q182^|xa!?;`b&vaB4H0qwYu1SQ zAL}D25&wT=zCj}X|H!QIGwK7)wrJCca_Z`O$TZ+#@I45_-_#} zOYuKF-;e$A?8!a}-5)RX53&EhX~0TLOWB2(UHeQ2MIzh!aI1Uh-?Y&)qkl{K-q1g* zxHt6ArurtquGiJo)%ErDYNE{OpHrn`{foAEtbb8gNA+D>TU$|4p(e`A`j>Q3i}jB- z&LI)&A9bjc?eT58?~C>CcAravsU8fXcf_P|gV_JytW;1?!2i@VH#e)5T3cJ|>gtM$ ziVP!BSXfw7Q`6GYq9h+V$X7~oBB%2sN|FT`k)4vo#lmSL`AU|Q zlr%In@Zd>Fo!?+CEA~H+{m;`hZw~5P!vACcPkY7@{%@v;{Xb*>&-B16+t2qS{zv?` zpcnDqOcC)v;(x^drlzK3g!G<+>*K8YvH!EhMiQCPchSBv{}b~+$+u(tV|_fvKQaDE z*S@&_wJ|`9e=I(vMC^ZVzCq$=T;D{oWBe22pPU{4r02q+f6#~Kp?^@dK(_a{4EpMdKTvb(t#9hU`p?}UD{qz5B=q68^^2 Date: Mon, 10 Apr 2023 14:34:16 -0300 Subject: [PATCH 02/22] 'n_curado' 'n_dmg' 'c_curado' and 'c_dmg' renamed to 'n_total' and 'c_total' --- API.lua | 8 +- API.txt | 8 +- Definitions.lua | 27 ++-- boot.lua | 2 +- classes/class_custom.lua | 28 ++-- classes/class_damage.lua | 14 +- classes/class_heal.lua | 145 +++++++++++++++-- classes/class_spelldamage.lua | 8 +- classes/class_spellhealing.lua | 86 +++++----- frames/window_playerbreakdown_spells.lua | 195 ++++++++++++++++++----- functions/api2.lua | 8 +- functions/mixin.lua | 4 +- 12 files changed, 382 insertions(+), 151 deletions(-) diff --git a/API.lua b/API.lua index ecaeaa6d..b2c4ad0e 100644 --- a/API.lua +++ b/API.lua @@ -382,11 +382,11 @@ spell.successful_casted = how many times this spell has been casted successfully spell.n_min = minimal damage made on a normal hit. spell.n_max = max damage made on a normal hit. spell.n_amt = amount of normal hits. -spell.n_dmg = total amount made doing only normal hits. +spell.n_total = total amount made doing only normal hits. spell.c_min = minimal damage made on a critical hit. spell.c_max = max damage made on a critical hit. spell.c_amt = how many times this spell got a critical hit. -spell.c_dmg = total amount made doing only normal hits. +spell.c_total = total amount made doing only normal hits. spell.g_amt = how many glancing blows this spell has. spell.g_dmg = total damage made by glancing blows. spell.r_amt = total of times this spell got resisted by the target. @@ -438,11 +438,11 @@ spell.overheal = amount of overheal made by this spell. spell.n_min = minimal heal made on a normal hit. spell.n_max = max heal made on a normal hit. spell.n_amt = amount of normal hits. -spell.n_curado = total amount made doing only normal hits (weird name I know). +spell.n_total = total amount made doing only normal hits (weird name I know). spell.c_min = minimal heal made on a critical hit. spell.c_max = max heal made on a critical hit. spell.c_amt = how many times this spell got a critical hit. -spell.c_curado = total amount made doing only normal hits. +spell.c_total = total amount made doing only normal hits. spell.targets = hash table containing {["targetname"] = total healing done by this spell on this target} spell.targets_overheal = hash table containing {["targetname"] = total overhealing by this spell on this target} diff --git a/API.txt b/API.txt index dcad0775..b685f0dc 100644 --- a/API.txt +++ b/API.txt @@ -385,11 +385,11 @@ spell.successful_casted = how many times this spell has been casted successfully spell.n_min = minimal damage made on a normal hit. spell.n_max = max damage made on a normal hit. spell.n_amt = amount of normal hits. -spell.n_dmg = total amount made doing only normal hits. +spell.n_total = total amount made doing only normal hits. spell.c_min = minimal damage made on a critical hit. spell.c_max = max damage made on a critical hit. spell.c_amt = how many times this spell got a critical hit. -spell.c_dmg = total amount made doing only normal hits. +spell.c_total = total amount made doing only normal hits. spell.g_amt = how many glancing blows this spell has. spell.g_dmg = total damage made by glancing blows. spell.r_amt = total of times this spell got resisted by the target. @@ -442,11 +442,11 @@ spell.overheal = amount of overheal made by this spell. spell.n_min = minimal heal made on a normal hit. spell.n_max = max heal made on a normal hit. spell.n_amt = amount of normal hits. -spell.n_curado = total amount made doing only normal hits (weird name I know). +spell.n_total = total amount made doing only normal hits (weird name I know). spell.c_min = minimal heal made on a critical hit. spell.c_max = max heal made on a critical hit. spell.c_amt = how many times this spell got a critical hit. -spell.c_curado = total amount made doing only normal hits. +spell.c_total = total amount made doing only normal hits. spell.targets = hash table containing {["targetname"] = total healing done by this spell on this target} spell.targets_overheal = hash table containing {["targetname"] = total overhealing by this spell on this target} diff --git a/Definitions.lua b/Definitions.lua index 68f50813..ea52f6df 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -314,15 +314,17 @@ ---@field total number ---@field spellschool number ---@field counter number amount of hits ----@field c_amt number critical hits ----@field c_min number ----@field c_max number ----@field c_dmg number ----@field n_amt number normal hits ----@field n_dmg number total damage made by normal hits ----@field n_min number min damage made by normal hits ----@field n_max number max damage made by normal hits +---@field c_amt number critical hits by a damage or heal spell +---@field c_min number min damage or healing done by critical hits of the spell +---@field c_max number min damage or healing done by critical hits of the spell +---@field c_total number total damage or heal made by critical hits of the spell +---@field n_amt number normal hits by a damage or heal spell +---@field n_min number min damage or healing done by normal hits of the spell +---@field n_max number min damage or healing done by normal hits of the spell +---@field n_total number total damage or heal made by normal hits of the spell ---@field targets table store the [target name] = total value +---@field targets_overheal table +---@field targets_absorbs table ---@field id number --spellid ---@field successful_casted number successful casted times (only for enemies) ---@field g_amt number glacing hits @@ -333,6 +335,11 @@ ---@field b_dmg number ---@field a_amt number --absorved ---@field a_dmg number +---@field totalabsorb number healing absorbed +---@field absorbed number damage absorbed by shield | healing absorbed by buff or debuff +---@field overheal number +---@field totaldenied number + ---@class actor : table ---@field GetSpellContainer fun(actor: actor, containerType: string) @@ -449,9 +456,9 @@ ---@field c_amt number critical hits ---@field c_min number ---@field c_max number ----@field c_dmg number +---@field c_total number ---@field n_amt number normal hits ----@field n_dmg number total damage made by normal hits +---@field n_total number total damage made by normal hits ---@field n_min number min damage made by normal hits ---@field n_max number max damage made by normal hits ---@field successful_casted number successful casted times (only for enemies) diff --git a/boot.lua b/boot.lua index abc1b925..ee11d730 100644 --- a/boot.lua +++ b/boot.lua @@ -15,7 +15,7 @@ _detalhes.dont_open_news = true _detalhes.game_version = version _detalhes.userversion = version .. " " .. _detalhes.build_counter - _detalhes.realversion = 148 --core version, this is used to check API version for scripts and plugins (see alias below) + _detalhes.realversion = 149 --core version, this is used to check API version for scripts and plugins (see alias below) _detalhes.APIVersion = _detalhes.realversion --core version _detalhes.version = _detalhes.userversion .. " (core " .. _detalhes.realversion .. ")" --simple stirng to show to players diff --git a/classes/class_custom.lua b/classes/class_custom.lua index 006193e4..4e69681b 100644 --- a/classes/class_custom.lua +++ b/classes/class_custom.lua @@ -1820,7 +1820,7 @@ local role = DetailsFramework.UnitGroupRolesAssigned("player") - if (spell.n_dmg) then + if (spell.n_total) then local spellschool, schooltext = spell.spellschool, "" if (spellschool) then @@ -1885,12 +1885,12 @@ GC:AddLine("Normal Hits: ", spell.n_amt .. " (" ..floor( spell.n_amt/total_hits*100) .. "%)") GC:AddStatusBar (100, 1, R, G, B, A) - local n_average = spell.n_dmg / spell.n_amt - local T = (combat_time*spell.n_dmg)/spell.total + local n_average = spell.n_total / spell.n_amt + local T = (combat_time*spell.n_total)/spell.total local P = average/n_average*100 T = P*T/100 - GC:AddLine("Average / E-Dps: ", _detalhes:ToK (n_average) .. " / " .. format("%.1f",spell.n_dmg / T )) + GC:AddLine("Average / E-Dps: ", _detalhes:ToK (n_average) .. " / " .. format("%.1f",spell.n_total / T )) GC:AddStatusBar (100, 1, R, G, B, A) --GC:AddLine(" ") @@ -1899,11 +1899,11 @@ GC:AddStatusBar (100, 1, R, G, B, A) if (spell.c_amt > 0) then - local c_average = spell.c_dmg/spell.c_amt - local T = (combat_time*spell.c_dmg)/spell.total + local c_average = spell.c_total/spell.c_amt + local T = (combat_time*spell.c_total)/spell.total local P = average/c_average*100 T = P*T/100 - local crit_dps = spell.c_dmg / T + local crit_dps = spell.c_total / T GC:AddLine("Average / E-Dps: ", _detalhes:ToK (c_average) .. " / " .. _detalhes:comma_value (crit_dps)) else @@ -1913,7 +1913,7 @@ GC:AddStatusBar (100, 1, R, G, B, A) - elseif (spell.n_curado) then + elseif (spell.n_total) then local spellschool, schooltext = spell.spellschool, "" if (spellschool) then @@ -1945,12 +1945,12 @@ GC:AddLine("Normal Hits: ", spell.n_amt .. " (" ..floor( spell.n_amt/total_hits*100) .. "%)") GC:AddStatusBar (100, 1, R, G, B, A) - local n_average = spell.n_curado / spell.n_amt - local T = (combat_time*spell.n_curado)/spell.total + local n_average = spell.n_total / spell.n_amt + local T = (combat_time*spell.n_total)/spell.total local P = average/n_average*100 T = P*T/100 - GC:AddLine("Average / E-Dps: ", _detalhes:ToK (n_average) .. " / " .. format("%.1f",spell.n_curado / T )) + GC:AddLine("Average / E-Dps: ", _detalhes:ToK (n_average) .. " / " .. format("%.1f",spell.n_total / T )) GC:AddStatusBar (100, 1, R, G, B, A) --GC:AddLine(" ") @@ -1959,11 +1959,11 @@ GC:AddStatusBar (100, 1, R, G, B, A) if (spell.c_amt > 0) then - local c_average = spell.c_curado/spell.c_amt - local T = (combat_time*spell.c_curado)/spell.total + local c_average = spell.c_total/spell.c_amt + local T = (combat_time*spell.c_total)/spell.total local P = average/c_average*100 T = P*T/100 - local crit_dps = spell.c_curado / T + local crit_dps = spell.c_total / T GC:AddLine("Average / E-Hps: ", _detalhes:ToK (c_average) .. " / " .. _detalhes:comma_value (crit_dps)) else diff --git a/classes/class_damage.lua b/classes/class_damage.lua index d52b38e2..5f5f501c 100644 --- a/classes/class_damage.lua +++ b/classes/class_damage.lua @@ -4520,7 +4520,7 @@ function atributo_damage:MontaInfoDamageDone() --I guess this fills the list of ---@type number local totalDamageWithoutPet = actorObject.total_without_pet ---@type number - local actorTotalDamage = actorObject.total + local actorTotal = actorObject.total ---@type table local actorSpellsSorted = {} ---@type table @@ -4537,7 +4537,7 @@ function atributo_damage:MontaInfoDamageDone() --I guess this fills the list of end --actor spells - ---@type {[string]: number} + ---@type table local alreadyAdded = {} for spellId, spellTable in pairs(actorSpells) do ---@cast spellId number @@ -4632,7 +4632,7 @@ function atributo_damage:MontaInfoDamageDone() --I guess this fills the list of return t1.total > t2.total end) - actorSpellsSorted.totalValue = actorTotalDamage + actorSpellsSorted.totalValue = actorTotal actorSpellsSorted.combatTime = actorCombatTime --actorSpellsSorted has the spell infomation, need to pass to the summary tab @@ -5283,7 +5283,7 @@ function atributo_damage:MontaDetalhesDamageDone (spellId, spellLine, instance) --NORMAL local normal_hits = spellTable.n_amt if (normal_hits > 0) then - local normal_dmg = spellTable.n_dmg + local normal_dmg = spellTable.n_total local media_normal = normal_dmg/normal_hits local T = (meu_tempo*normal_dmg)/ max(spellTable.total, 0.001) local P = media/media_normal*100 @@ -5306,11 +5306,11 @@ function atributo_damage:MontaDetalhesDamageDone (spellId, spellLine, instance) --CRITICO if (spellTable.c_amt > 0) then - local media_critico = spellTable.c_dmg/spellTable.c_amt - local T = (meu_tempo*spellTable.c_dmg)/spellTable.total + local media_critico = spellTable.c_total/spellTable.c_amt + local T = (meu_tempo*spellTable.c_total)/spellTable.total local P = media/max(media_critico, 0.0001)*100 T = P*T/100 - local crit_dps = spellTable.c_dmg/T + local crit_dps = spellTable.c_total/T if (not crit_dps) then crit_dps = 0 end diff --git a/classes/class_heal.lua b/classes/class_heal.lua index 864f411c..9dd79480 100644 --- a/classes/class_heal.lua +++ b/classes/class_heal.lua @@ -122,11 +122,6 @@ end --tooltip function - -local function RefreshNpcHealingTakenBar(tabela, barra, instancia) - atributo_damage:UpdateNpcHealingTaken(tabela, tabela.minha_barra, barra.colocacao, instancia) -end - local on_switch_NHT_show = function(instance) --npc healing taken instance:TrocaTabela(instance, true, 1, 8) return true @@ -1868,8 +1863,138 @@ function atributo_heal:MontaInfoOverHealing() end function atributo_heal:MontaInfoHealingDone() + ---@type actor + local actorObject = self + ---@type instance + local instance = info.instancia + ---@type combat + local combatObject = instance:GetCombat() + ---@type string + local playerName = actorObject:Name() - --pegar as habilidade de dar sort no heal + ---@type number + local actorTotal = actorObject.total + ---@type table + local actorSpellsSorted = {} + ---@type table + local actorSpells = actorObject:GetSpellList() + + --get time + local actorCombatTime + if (Details.time_type == 1 or not actorObject.grupo) then + actorCombatTime = actorObject:Tempo() + elseif (Details.time_type == 2) then + actorCombatTime = info.instancia.showing:GetCombatTime() + end + + --actor spells + ---@type table + local alreadyAdded = {} + for spellId, spellTable in pairs(actorSpells) do + ---@cast spellId number + ---@cast spellTable spelltable + + spellTable.ChartData = nil + + ---@type string + local spellName = _GetSpellInfo(spellId) + if (spellName) then + ---@type number in which index the spell with the same name was stored + local index = alreadyAdded[spellName] + if (index) then + ---@type breakdownspelldata + local bkSpellData = actorSpellsSorted[index] + bkSpellData.spellIds[#bkSpellData.spellIds+1] = spellId + bkSpellData.spellTables[#bkSpellData.spellTables+1] = spellTable + bkSpellData.petNames[#bkSpellData.petNames+1] = "" + bkSpellData.bCanExpand = true + else + ---@type breakdownspelldata + local bkSpellData = { + id = spellId, + spellschool = spellTable.spellschool, + bIsExpanded = Details222.BreakdownWindow.IsSpellExpanded(spellId), + bCanExpand = false, + + spellIds = {spellId}, + spellTables = {spellTable}, --sub spell tables to show if the spell is expanded + petNames = {""}, + } + + actorSpellsSorted[#actorSpellsSorted+1] = bkSpellData + alreadyAdded[spellName] = #actorSpellsSorted + end + end + end + + --pets spells + local actorPets = actorObject:GetPets() + for _, petName in ipairs(actorPets) do + ---@type actor + local petActor = combatObject(DETAILS_ATTRIBUTE_HEAL, petName) + if (petActor) then --PET + local spells = petActor:GetSpellList() + for spellId, spellTable in pairs(spells) do + ---@cast spellId number + ---@cast spellTable spelltable + + spellTable.ChartData = nil + --PET + ---@type string + local spellName = _GetSpellInfo(spellId) + if (spellName) then + ---@type number in which index the spell with the same name was stored + local index = alreadyAdded[spellName] + if (index) then --PET + ---@type breakdownspelldata + local bkSpellData = actorSpellsSorted[index] + bkSpellData.spellIds[#bkSpellData.spellIds+1] = spellId + bkSpellData.spellTables[#bkSpellData.spellTables+1] = spellTable + bkSpellData.petNames[#bkSpellData.petNames+1] = petName + bkSpellData.bCanExpand = true + else --PET + ---@type breakdownspelldata + local bkSpellData = { + id = spellId, + spellschool = spellTable.spellschool, + expanded = Details222.BreakdownWindow.IsSpellExpanded(spellId), + bCanExpand = false, + + spellIds = {spellId}, + spellTables = {spellTable}, + petNames = {petName}, + } + actorSpellsSorted[#actorSpellsSorted+1] = bkSpellData + alreadyAdded[spellName] = #actorSpellsSorted + end + end + end + end + end + + for i = 1, #actorSpellsSorted do + ---@type breakdownspelldata + local bkSpellData = actorSpellsSorted[i] + Details:SumSpellTables(bkSpellData.spellTables, bkSpellData) + end + + --table.sort(actorSpellsSorted, Details.Sort2) + table.sort(actorSpellsSorted, function(t1, t2) + return t1.total > t2.total + end) + + actorSpellsSorted.totalValue = actorTotal + actorSpellsSorted.combatTime = actorCombatTime + + --actorSpellsSorted has the spell infomation, need to pass to the summary tab + + --cleanup + table.wipe(alreadyAdded) + + --send to the breakdown window + Details222.BreakdownWindow.SendSpellData(actorSpellsSorted, actorObject, combatObject, instance) + + if 1 then return end local instancia = info.instancia local total = self.total @@ -2306,7 +2431,7 @@ function atributo_heal:MontaDetalhesHealingDone (spellid, barra) --NORMAL local normal_hits = esta_magia.n_amt if (normal_hits > 0) then - local normal_curado = esta_magia.n_curado + local normal_curado = esta_magia.n_total local media_normal = normal_curado/normal_hits media_normal = max(media_normal, 0.000001) @@ -2337,11 +2462,11 @@ function atributo_heal:MontaDetalhesHealingDone (spellid, barra) --CRITICO if (esta_magia.c_amt > 0) then - local media_critico = esta_magia.c_curado/esta_magia.c_amt - local T = (meu_tempo*esta_magia.c_curado)/esta_magia.total + local media_critico = esta_magia.c_total/esta_magia.c_amt + local T = (meu_tempo*esta_magia.c_total)/esta_magia.total local P = media/max(media_critico, 0.0001)*100 T = P*T/100 - local crit_hps = esta_magia.c_curado/T + local crit_hps = esta_magia.c_total/T if (not crit_hps) then crit_hps = 0 end diff --git a/classes/class_spelldamage.lua b/classes/class_spelldamage.lua index 1218115d..1fc50ba3 100644 --- a/classes/class_spelldamage.lua +++ b/classes/class_spelldamage.lua @@ -41,13 +41,13 @@ --amount normal hits n_amt = 0, --total damage of normal hits - n_dmg = 0, + n_total = 0, --critical hits c_min = 0, c_max = 0, c_amt = 0, - c_dmg = 0, + c_total = 0, --glacing hits g_amt = 0, @@ -117,7 +117,7 @@ self.g_amt = self.g_amt+1 --amount � o total de dano elseif (critical) then - self.c_dmg = self.c_dmg+amount --amount � o total de dano + self.c_total = self.c_total+amount --amount � o total de dano self.c_amt = self.c_amt+1 --amount � o total de dano if (amount > self.c_max) then self.c_max = amount @@ -127,7 +127,7 @@ end else - self.n_dmg = self.n_dmg+amount + self.n_total = self.n_total+amount self.n_amt = self.n_amt+1 if (amount > self.n_max) then self.n_max = amount diff --git a/classes/class_spellhealing.lua b/classes/class_spellhealing.lua index 6a1c43bd..f0939aa0 100644 --- a/classes/class_spellhealing.lua +++ b/classes/class_spellhealing.lua @@ -1,96 +1,86 @@ --- heal ability file - local _detalhes = _G._detalhes + local Details = _G._detalhes local _ local addonName, Details222 = ... + local healingAbility = Details.habilidade_cura ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ---constants - - local alvo_da_habilidade = _detalhes.alvo_da_habilidade - local habilidade_cura = _detalhes.habilidade_cura - local container_combatentes = _detalhes.container_combatentes - local container_heal_target = _detalhes.container_type.CONTAINER_HEALTARGET_CLASS - local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC - ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ---internals - - function habilidade_cura:NovaTabela (id, link) - - local _newHealSpell = { - + function healingAbility:NovaTabela(id) + ---@type spelltable + local spellTable = { + --spellId id = id, + --total amount of hits counter = 0, - - --totals - total = 0, + + --healing done total (healing done by normal hits + healing done by critical hits) + total = 0, + --absorbs total totalabsorb = 0, absorbed = 0, + --overheal total overheal = 0, + --heal denied totaldenied = 0, - --normal hits - n_min = 0, - n_max = 0, - n_amt = 0, - n_curado = 0, - - --critical hits - c_min = 0, - c_max = 0, - c_amt = 0, - c_curado = 0, + --healing done by normal hits + n_amt = 0, --amount of hits + n_min = 0, --min healing done by normal hits (non critical) + n_max = 0, --max healing done by normal hits (non critical) + n_total = 0, --total healing done by normal hits (non critical) + + --healing done by critical hits + c_amt = 0, --amount of hits + c_min = 0, --min healing done by critical hits + c_max = 0, --max healing done by critical hits + c_total = 0, --total healing done by critical hits --targets containers targets = {}, targets_overheal = {}, targets_absorbs = {} } - - return _newHealSpell + + return spellTable end - function habilidade_cura:Add (serial, nome, flag, amount, extraSpellID, absorbed, critical, overhealing, is_shield) - + function healingAbility:Add(serial, nome, flag, amount, extraSpellID, absorbed, critical, overhealing, bIsShield) amount = amount or 0 self.targets [nome] = (self.targets [nome] or 0) + amount if (absorbed == "SPELL_HEAL_ABSORBED") then self.counter = self.counter + 1 self.totaldenied = self.totaldenied + amount - + local healerName = critical - + --create the denied table spells, on the fly if (not self.heal_denied) then self.heal_denied = {} self.heal_denied_healers = {} end - + self.heal_denied [extraSpellID] = (self.heal_denied [extraSpellID] or 0) + amount self.heal_denied_healers [healerName] = (self.heal_denied_healers [healerName] or 0) + amount else - self.total = self.total + amount self.counter = self.counter + 1 - + if (absorbed and absorbed > 0) then self.absorbed = self.absorbed + absorbed end - + if (overhealing and overhealing > 0) then self.overheal = self.overheal + overhealing self.targets_overheal [nome] = (self.targets_overheal [nome] or 0) + overhealing end - - if (is_shield) then + + if (bIsShield) then self.totalabsorb = self.totalabsorb + amount self.targets_absorbs [nome] = (self.targets_absorbs [nome] or 0) + amount end - + if (critical) then - self.c_curado = self.c_curado+amount --amount � o total de dano + self.c_total = self.c_total+amount --amount � o total de dano self.c_amt = self.c_amt+1 --amount � o total de dano if (amount > self.c_max) then self.c_max = amount @@ -99,7 +89,7 @@ self.c_min = amount end else - self.n_curado = self.n_curado+amount + self.n_total = self.n_total+amount self.n_amt = self.n_amt+1 if (amount > self.n_max) then self.n_max = amount @@ -108,8 +98,6 @@ self.n_min = amount end end - end - end diff --git a/frames/window_playerbreakdown_spells.lua b/frames/window_playerbreakdown_spells.lua index e7e387d9..82e94f5b 100644 --- a/frames/window_playerbreakdown_spells.lua +++ b/frames/window_playerbreakdown_spells.lua @@ -72,7 +72,7 @@ function spellsTab.GetSpellBlockContainer() return spellsTab.TabFrame.SpellBlockContainer end ----@type {name: string, width: number, label: string, align: string, enabled: boolean}[] +---@type {name: string, width: number, label: string, align: string, enabled: boolean, attribute: number|nil}[] local columnInfo = { {name = "icon", width = 22, label = "", align = "center", enabled = true,}, {name = "target", width = 22, label = "", align = "center", enabled = true}, @@ -80,15 +80,50 @@ local columnInfo = { {name = "expand", label = "^", width = 16, align = "center", enabled = true}, {name = "name", label = "spell name", width = 246, align = "left", enabled = true}, {name = "amount", label = "total", width = 50, align = "left", enabled = true}, - {name = "persecond", label = "ps", width = 50, align = "left", enabled = false}, + {name = "persecond", label = "ps", width = 50, align = "left", enabled = true}, {name = "percent", label = "%", width = 50, align = "left", enabled = true}, - {name = "casts", label = "casts", width = 40, align = "left", enabled = false}, - {name = "critpercent", label = "crit %", width = 40, align = "left", enabled = false}, - {name = "hits", label = "hits", width = 40, align = "left", enabled = false}, - {name = "castavg", label = "cast avg", width = 50, align = "left", enabled = false}, - {name = "uptime", label = "uptime", width = 45, align = "left", enabled = false}, + {name = "casts", label = "casts", width = 40, align = "left", enabled = true}, + {name = "critpercent", label = "crit %", width = 40, align = "left", enabled = true}, + {name = "hits", label = "hits", width = 40, align = "left", enabled = true}, + {name = "castavg", label = "cast avg", width = 50, align = "left", enabled = true}, + {name = "uptime", label = "uptime", width = 45, align = "left", enabled = true}, + {name = "overheal", label = "overheal", width = 45, align = "left", enabled = true, attribute = DETAILS_ATTRIBUTE_HEAL}, + {name = "absorbed", label = "absorbed", width = 45, align = "left", enabled = true, attribute = DETAILS_ATTRIBUTE_HEAL}, } +function spellsTab.BuildHeaderTable() + ---@type {name: string, width: number, label: string, align: string, enabled: boolean}[] + local headerTable = {} + + ---@type instance + local instance = spellsTab.GetInstance() + + ---@type number, number + local mainAttribute, subAttribute = instance:GetDisplay() + + for i = 1, #columnInfo do + local columnData = columnInfo[i] + if (columnData.enabled) then + local bCanAdd = true + if (columnData.attribute) then + if (columnData.attribute ~= mainAttribute) then + bCanAdd = false + end + end + + if (bCanAdd) then + headerTable[#headerTable+1] = { + text = columnData.label, + width = columnData.width, + name = columnData.name, + --align = column.align, + } + end + end + end + return headerTable +end + --store the current spellbar selected, this is used to lock the spellblock container to the spellbar selected spellsTab.selectedSpellBar = nil @@ -149,23 +184,6 @@ function spellsTab.OnShownTab() spellsTab.GetSpellBlockContainer():ClearBlocks() end - -function spellsTab.BuildHeaderTable() - local headerTable = {} - for i = 1, #columnInfo do - local columnData = columnInfo[i] - if (columnData.enabled) then - headerTable[#headerTable+1] = { - text = columnData.label, - width = columnData.width, - name = columnData.name, - --align = column.align, - } - end - end - return headerTable -end - --called when the tab is getting created function spellsTab.OnCreateTabCallback(tabButton, tabFrame) spellBreakdownSettings = Details.breakdown_spell_tab @@ -307,7 +325,7 @@ function spellsTab.TrocaBackgroundInfo(tabFrame) --> spells tab | to be refactor end end -do --hide bars functions +do --hide bars functions - to be refactored --hide all the bars of the skills in the window info function spellsTab.HidaAllBarrasInfo() local allBars = _detalhes.playerDetailWindow.barras1 @@ -477,7 +495,9 @@ local onEnterBreakdownSpellBar = function(spellBar) --parei aqui: precisa por no GameTooltip:Show() end - if (mainAttribute == DETAILS_ATTRIBUTE_DAMAGE and subAttribute == DETAILS_SUBATTRIBUTE_DAMAGEDONE) then + if (mainAttribute == DETAILS_ATTRIBUTE_DAMAGE) then --this should run within the damage class + local bShowDamageDone = subAttribute == DETAILS_SUBATTRIBUTE_DAMAGEDONE or subAttribute == DETAILS_SUBATTRIBUTE_DPS + ---@type number local blockIndex = 1 @@ -508,13 +528,6 @@ local onEnterBreakdownSpellBar = function(spellBar) --parei aqui: precisa por no ---@type number local normalHitsAmt = spellTable.n_amt - --problem: spellTable is in facts bkSpellTable, fuck! - if (not normalHitsAmt) then - print(spellTable.spellTables, spellTable.petNames) - dumpt(spellTable) - return - end - if (normalHitsAmt > 0) then ---@type breakdownspellblock local normalHitsBlock = spellBlockContainer:GetBlock(blockIndex) @@ -533,13 +546,13 @@ local onEnterBreakdownSpellBar = function(spellBar) --parei aqui: precisa por no blockLine2.leftText:SetText(Loc ["STRING_MINIMUM_SHORT"] .. ": " .. Details:CommaValue(spellTable.n_min)) blockLine2.rightText:SetText(Loc ["STRING_MAXIMUM_SHORT"] .. ": " .. Details:CommaValue(spellTable.n_max)) - local normalAverage = spellTable.n_dmg / math.max(normalHitsAmt, 0.0001) + local normalAverage = spellTable.n_total / math.max(normalHitsAmt, 0.0001) blockLine3.leftText:SetText(Loc ["STRING_AVERAGE"] .. ": " .. Details:CommaValue(normalAverage)) - local tempo = (elapsedTime * spellTable.n_dmg) / math.max(spellTable.total, 0.001) + local tempo = (elapsedTime * spellTable.n_total) / math.max(spellTable.total, 0.001) local normalAveragePercent = spellBar.average / normalAverage * 100 local normalTempoPercent = normalAveragePercent * tempo / 100 - blockLine3.rightText:SetText(Loc ["STRING_DPS"] .. ": " .. Details:CommaValue(spellTable.n_dmg / normalTempoPercent)) + blockLine3.rightText:SetText(Loc ["STRING_DPS"] .. ": " .. Details:CommaValue(spellTable.n_total / normalTempoPercent)) end ---@type number @@ -562,13 +575,100 @@ local onEnterBreakdownSpellBar = function(spellBar) --parei aqui: precisa por no blockLine2.leftText:SetText(Loc ["STRING_MINIMUM_SHORT"] .. ": " .. Details:CommaValue(spellTable.c_min)) blockLine2.rightText:SetText(Loc ["STRING_MAXIMUM_SHORT"] .. ": " .. Details:CommaValue(spellTable.c_max)) - local critAverage = spellTable.c_dmg / math.max(criticalHitsAmt, 0.0001) + local critAverage = spellTable.c_total / math.max(criticalHitsAmt, 0.0001) blockLine3.leftText:SetText(Loc ["STRING_AVERAGE"] .. ": " .. Details:CommaValue(critAverage)) - local tempo = (elapsedTime * spellTable.c_dmg) / math.max(spellTable.total, 0.001) + local tempo = (elapsedTime * spellTable.c_total) / math.max(spellTable.total, 0.001) local critAveragePercent = spellBar.average / critAverage * 100 local critTempoPercent = critAveragePercent * tempo / 100 - blockLine3.rightText:SetText(Loc ["STRING_DPS"] .. ": " .. Details:CommaValue(spellTable.c_dmg / critTempoPercent)) + blockLine3.rightText:SetText(Loc ["STRING_DPS"] .. ": " .. Details:CommaValue(spellTable.c_total / critTempoPercent)) + end + + elseif (mainAttribute == DETAILS_ATTRIBUTE_HEAL) then --this should run within the heal class + ---@type number + local blockIndex = 1 + + ---@type number + local totalHits = spellTable.counter + + --damage section showing damage done sub section + --get the first spell block to use as summary + ---@type breakdownspellblock + local summaryBlock = spellBlockContainer:GetBlock(blockIndex) + summaryBlock:Show() + blockIndex = blockIndex + 1 + + do --update the texts in the summary block + local blockLine1, blockLine2, blockLine3 = summaryBlock:GetLines() + + blockLine1.leftText:SetText(Loc ["STRING_CAST"] .. ": " .. spellBar.amountCasts) --total amount of casts + blockLine1.rightText:SetText(Loc ["STRING_HITS"]..": " .. totalHits) --hits and uptime + + blockLine2.leftText:SetText(Loc ["STRING_DAMAGE"]..": " .. Details:Format(spellTable.total)) --total damage + blockLine2.rightText:SetText(Details:GetSpellSchoolFormatedName(spellTable.spellschool)) --spell school + + blockLine3.leftText:SetText(Loc ["STRING_AVERAGE"] .. ": " .. Details:Format(spellBar.average)) --average damage + blockLine3.rightText:SetText(Loc ["STRING_DPS"] .. ": " .. Details:CommaValue(spellBar.perSecond)) --dps + end + + --check if there's normal hits and build the block + ---@type number + local normalHitsAmt = spellTable.n_amt + + if (normalHitsAmt > 0) then + ---@type breakdownspellblock + local normalHitsBlock = spellBlockContainer:GetBlock(blockIndex) + normalHitsBlock:Show() + blockIndex = blockIndex + 1 + + local percent = normalHitsAmt / math.max(totalHits, 0.0001) * 100 + normalHitsBlock:SetValue(percent) + normalHitsBlock.sparkTexture:SetPoint("left", normalHitsBlock, "left", percent / 100 * normalHitsBlock:GetWidth() + spellBreakdownSettings.blockspell_spark_offset, 0) + normalHitsBlock:SetStatusBarColor(1, 1, 1, .5) + + local blockLine1, blockLine2, blockLine3 = normalHitsBlock:GetLines() + blockLine1.leftText:SetText(Loc ["STRING_NORMAL_HITS"]) + blockLine1.rightText:SetText(normalHitsAmt .. " [|cFFC0C0C0" .. string.format("%.1f", normalHitsAmt / math.max(totalHits, 0.0001) * 100) .. "%|r]") + + blockLine2.leftText:SetText(Loc ["STRING_MINIMUM_SHORT"] .. ": " .. Details:CommaValue(spellTable.n_min)) + blockLine2.rightText:SetText(Loc ["STRING_MAXIMUM_SHORT"] .. ": " .. Details:CommaValue(spellTable.n_max)) + + local normalAverage = spellTable.n_total / math.max(normalHitsAmt, 0.0001) + blockLine3.leftText:SetText(Loc ["STRING_AVERAGE"] .. ": " .. Details:CommaValue(normalAverage)) + + local tempo = (elapsedTime * spellTable.n_total) / math.max(spellTable.total, 0.001) + local normalAveragePercent = spellBar.average / normalAverage * 100 + local normalTempoPercent = normalAveragePercent * tempo / 100 + blockLine3.rightText:SetText(Loc ["STRING_DPS"] .. ": " .. Details:CommaValue(spellTable.n_total / normalTempoPercent)) + end + + ---@type number + local criticalHitsAmt = spellTable.c_amt + if (criticalHitsAmt > 0) then + ---@type breakdownspellblock + local critHitsBlock = spellBlockContainer:GetBlock(blockIndex) + critHitsBlock:Show() + blockIndex = blockIndex + 1 + + local percent = criticalHitsAmt / math.max(totalHits, 0.0001) * 100 + critHitsBlock:SetValue(percent) + critHitsBlock.sparkTexture:SetPoint("left", critHitsBlock, "left", percent / 100 * critHitsBlock:GetWidth() + spellBreakdownSettings.blockspell_spark_offset, 0) + critHitsBlock:SetStatusBarColor(1, 1, 1, .5) + + local blockLine1, blockLine2, blockLine3 = critHitsBlock:GetLines() + blockLine1.leftText:SetText(Loc ["STRING_CRITICAL_HITS"]) + blockLine1.rightText:SetText(criticalHitsAmt .. " [|cFFC0C0C0" .. string.format("%.1f", criticalHitsAmt / math.max(totalHits, 0.0001) * 100) .. "%|r]") + + blockLine2.leftText:SetText(Loc ["STRING_MINIMUM_SHORT"] .. ": " .. Details:CommaValue(spellTable.c_min)) + blockLine2.rightText:SetText(Loc ["STRING_MAXIMUM_SHORT"] .. ": " .. Details:CommaValue(spellTable.c_max)) + + local critAverage = spellTable.c_total / math.max(criticalHitsAmt, 0.0001) + blockLine3.leftText:SetText(Loc ["STRING_AVERAGE"] .. ": " .. Details:CommaValue(critAverage)) + + local tempo = (elapsedTime * spellTable.c_total) / math.max(spellTable.total, 0.001) + local critAveragePercent = spellBar.average / critAverage * 100 + local critTempoPercent = critAveragePercent * tempo / 100 + blockLine3.rightText:SetText(Loc ["STRING_DPS"] .. ": " .. Details:CommaValue(spellTable.c_total / critTempoPercent)) end end @@ -1071,12 +1171,12 @@ local updateSpellBar = function(spellBar, index, actorName, combatObject, scroll spellBar:AddFrameToHeaderAlignment(text) textIndex = textIndex + 1 - elseif (header.name == "hits") then --ok + elseif (header.name == "hits") then text:SetText(spellTable.counter) spellBar:AddFrameToHeaderAlignment(text) textIndex = textIndex + 1 - elseif (header.name == "castavg") then --ok + elseif (header.name == "castavg") then spellBar.castAverage = value / amtCasts text:SetText(Details:Format(spellBar.castAverage)) spellBar:AddFrameToHeaderAlignment(text) @@ -1086,6 +1186,17 @@ local updateSpellBar = function(spellBar, index, actorName, combatObject, scroll text:SetText(string.format("%.1f", uptime / combatTime * 100) .. "%") spellBar:AddFrameToHeaderAlignment(text) textIndex = textIndex + 1 + + elseif (header.name == "overheal") then + text:SetText(Details:Format(spellTable.overheal or 0)) + spellBar:AddFrameToHeaderAlignment(text) + textIndex = textIndex + 1 + + elseif (header.name == "absorbed") then + text:SetText(Details:Format(spellTable.absorbed or 0)) + spellBar:AddFrameToHeaderAlignment(text) + textIndex = textIndex + 1 + end end @@ -1227,7 +1338,7 @@ function spellsTab.CreateSpellScrollContainer(tabFrame) header_height = 14, } - local headerTable = spellsTab.BuildHeaderTable() + local headerTable = {} scrollFrame.Header = DetailsFramework:CreateHeader(scrollFrame, headerTable, headerOptions) scrollFrame.Header:SetPoint("topleft", scrollFrame, "topleft", 0, 0) diff --git a/functions/api2.lua b/functions/api2.lua index d0174682..a3ead385 100644 --- a/functions/api2.lua +++ b/functions/api2.lua @@ -964,11 +964,11 @@ function Details.UnitDamageSpellInfo (unitId, spellId, isLiteral, segment) spellInfo.regularMin = spellObject.n_min spellInfo.regularMax = spellObject.n_max spellInfo.regularHits = spellObject.n_amt - spellInfo.regularDamage = spellObject.n_dmg + spellInfo.regularDamage = spellObject.n_total spellInfo.criticalMin = spellObject.c_min spellInfo.criticalMax = spellObject.c_max spellInfo.criticalHits = spellObject.c_amt - spellInfo.criticalDamage = spellObject.c_dmg + spellInfo.criticalDamage = spellObject.c_total end return spellInfo @@ -1695,11 +1695,11 @@ function Details.UnitHealingSpellInfo (unitId, spellId, isLiteral, segment) spellInfo.regularMin = spellObject.n_min spellInfo.regularMax = spellObject.n_max spellInfo.regularHits = spellObject.n_amt - spellInfo.regularHealing = spellObject.n_dmg + spellInfo.regularHealing = spellObject.n_total spellInfo.criticalMin = spellObject.c_min spellInfo.criticalMax = spellObject.c_max spellInfo.criticalHits = spellObject.c_amt - spellInfo.criticalHealing = spellObject.c_dmg + spellInfo.criticalHealing = spellObject.c_total end return spellInfo diff --git a/functions/mixin.lua b/functions/mixin.lua index 42a07392..cc3f4937 100644 --- a/functions/mixin.lua +++ b/functions/mixin.lua @@ -132,9 +132,9 @@ local spellTable_FieldsToSum = { ["c_amt"] = true, ["c_min"] = true, ["c_max"] = true, - ["c_dmg"] = true, + ["c_total"] = true, ["n_amt"] = true, - ["n_dmg"] = true, + ["n_total"] = true, ["n_min"] = true, ["n_max"] = true, ["successful_casted"] = true, From b946da73bb111e4ea2b7efa84e88dd0def398436 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Tue, 11 Apr 2023 22:03:32 -0300 Subject: [PATCH 03/22] Major cleanup on breakdown main file --- Definitions.lua | 8 +- Libs/DF/panel.lua | 143 ++- classes/class_custom.lua | 2 +- classes/class_damage.lua | 264 ++--- classes/class_instance.lua | 16 +- classes/container_segments.lua | 4 +- core/parser.lua | 4 +- frames/window_main.lua | 35 +- frames/window_playerbreakdown.lua | 1143 ++++++---------------- frames/window_playerbreakdown_list.lua | 6 +- frames/window_playerbreakdown_spells.lua | 276 +++--- functions/macros.lua | 4 +- functions/mixin.lua | 4 + functions/profiles.lua | 3 - startup.lua | 2 +- 15 files changed, 700 insertions(+), 1214 deletions(-) diff --git a/Definitions.lua b/Definitions.lua index ea52f6df..8a122757 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -103,7 +103,7 @@ ---@field SetAttribute fun(self: frame, name: string, value: any) ---@field SetScript fun(self: frame, event: string, handler: function) ---@field GetScript fun(self: frame, event: string) : function ----@field SetFrameStrata fun(self: frame, strata: framestrata|string) +---@field SetFrameStrata fun(self: frame, strata: framestrata|"background"|"low"|"medium"|"high"|"dialog"|"fullscreen"|"fullscreen_dialog"|"tooltip") ---@field SetFrameLevel fun(self: frame, level: number) ---@field SetClampedToScreen fun(self: frame, clamped: boolean) ---@field SetClampRectInsets fun(self: frame, left: number, right: number, top: number, bottom: number) @@ -116,6 +116,9 @@ ---@field SetToplevel fun(self: frame, toplevel: boolean) ---@field SetPropagateKeyboardInput fun(self: frame, propagate: boolean) ---@field SetPropagateGamepadInput fun(self: frame, propagate: boolean) +---@field StartMoving fun(self: frame) +---@field StartSizing fun(self: frame, point: string) +---@field StopMovingOrSizing fun(self: frame) ---@field GetAttribute fun(self: frame, name: string) : any ---@field GetFrameLevel fun(self: frame) : number ---@field GetFrameStrata fun(self: frame) : framestrata|string @@ -150,7 +153,7 @@ ---@field GetFontString fun(self: button) : fontstring ---@field SetButtonState fun(self: button, state: string, enable: boolean) ---@field GetButtonState fun(self: button, state: string) : boolean ----@field RegisterForClicks fun(self: button, button1: string|nil, button2: string|nil) +---@field RegisterForClicks fun(self: button, button1: nil|"AnyUp"|"AnyDown"|"LeftButtonDown"|"LeftButtonUp"|"MiddleButtonUp"|"MiddleButtonDown"|"RightButtonDown"|"RightButtonUp"|"Button4Up"|"Button4Down"|"Button5Up"|"Button5Down", button2: nil|"AnyUp"|"AnyDown"|"LeftButtonDown"|"LeftButtonUp"|"MiddleButtonUp"|"MiddleButtonDown"|"RightButtonDown"|"RightButtonUp"|"Button4Up"|"Button4Down"|"Button5Up"|"Button5Down") ---@class fontstring : uiobject ---@field SetDrawLayer fun(self: fontstring, layer: "background"|"border"|"artwork"|"overlay"|"highlight", subLayer: number|nil) @@ -326,6 +329,7 @@ ---@field targets_overheal table ---@field targets_absorbs table ---@field id number --spellid +---@field is_shield boolean --true if the spell is a shield ---@field successful_casted number successful casted times (only for enemies) ---@field g_amt number glacing hits ---@field g_dmg number diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index 8fdb8a94..2fa11c1b 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -5054,7 +5054,7 @@ local default_icon_row_options = { } function detailsFramework:CreateIconRow (parent, name, options) - local f = CreateFrame("frame", name, parent, "BackdropTemplate") + local f = _G.CreateFrame("frame", name, parent, "BackdropTemplate") f.IconPool = {} f.NextIcon = 1 f.AuraCache = {} @@ -5077,19 +5077,46 @@ end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --~header +--definitions +---@class headerframe: frame +---@field GetColumnWidth fun(self: headerframe, columnId: number) +---@field SetHeaderTable fun(self: headerframe, newTable) +---@field GetSelectedColumn fun(self: headerframe) +---@field Refresh fun(self: headerframe) +---@field UpdateSortArrow fun(self: headerframe, columnHeader: headercolumnframe, defaultShown: boolean, defaultOrder: string) +---@field UpdateColumnHeader fun(self: headerframe, columnHeader: headercolumnframe, headerIndex) +---@field ResetColumnHeaderBackdrop fun(self: headerframe, columnHeader: headercolumnframe) +---@field SetBackdropColorForSelectedColumnHeader fun(self: headerframe, columnHeader: headercolumnframe) +---@field ClearColumnHeader fun(self: headerframe, columnHeader: headercolumnframe) +---@field GetNextHeader fun(self: headerframe) : headercolumnframe +---@field columnHeadersCreated headercolumnframe[] +---@field HeaderTable table +---@field NextHeader number +---@field HeaderWidth number +---@field HeaderHeight number +---@field columnSelected number + +---@class headercolumnframe: frame +---@field Icon texture +---@field Text fontstring +---@field Arrow texture +---@field Separator texture +---@field resizerButton button + + --mixed functions detailsFramework.HeaderFunctions = { AddFrameToHeaderAlignment = function(self, frame) self.FramesToAlign = self.FramesToAlign or {} - tinsert(self.FramesToAlign, frame) + _G.tinsert(self.FramesToAlign, frame) end, ResetFramesToHeaderAlignment = function(self) - wipe(self.FramesToAlign) + _G.wipe(self.FramesToAlign) end, SetFramesToHeaderAlignment = function(self, ...) - wipe(self.FramesToAlign) + _G.wipe(self.FramesToAlign) self.FramesToAlign = {...} end, @@ -5097,9 +5124,9 @@ detailsFramework.HeaderFunctions = { return self.FramesToAlign or {} end, - --@self: an object like a line - --@headerFrame: the main header frame - --@anchor: which side the columnHeaders are attach + ---@param self uiobject + ---@param headerFrame headerframe + ---@param anchor string AlignWithHeader = function(self, headerFrame, anchor) local columnHeaderFrames = headerFrame.columnHeadersCreated anchor = anchor or "topleft" @@ -5108,6 +5135,7 @@ detailsFramework.HeaderFunctions = { local frame = self.FramesToAlign[i] frame:ClearAllPoints() + ---@type headercolumnframe local columnHeader = columnHeaderFrames[i] if (columnHeader) then local offset = 0 @@ -5124,10 +5152,12 @@ detailsFramework.HeaderFunctions = { end end, - --@self: column header button + ---comment + ---@param self button + ---@param buttonClicked string OnClick = function(self, buttonClicked) - --get the header main frame + ---@type headerframe local headerFrame = self:GetParent() --if this header does not have a clickable header, just ignore @@ -5136,6 +5166,7 @@ detailsFramework.HeaderFunctions = { end --get the latest column header selected + ---@type headercolumnframe local previousColumnHeader = headerFrame.columnHeadersCreated[headerFrame.columnSelected] previousColumnHeader.Arrow:Hide() headerFrame:ResetColumnHeaderBackdrop(previousColumnHeader) @@ -5159,13 +5190,37 @@ detailsFramework.HeaderFunctions = { end end end, + + ---comment + ---@param self button + ---@param buttonClicked string + OnMouseDown = function(self, buttonClicked) + if (buttonClicked == "LeftButton") then + + end + end, + + ---comment + ---@param self button + ---@param buttonClicked string + OnMouseUp = function(self, buttonClicked) + if (buttonClicked == "LeftButton") then + + end + end, } + detailsFramework.HeaderCoreFunctions = { + ---@param self headerframe + ---@param columnId number + ---@return number GetColumnWidth = function(self, columnId) return self.HeaderTable[columnId].width end, + ---@param self headerframe + ---@param newTable table SetHeaderTable = function(self, newTable) self.columnHeadersCreated = self.columnHeadersCreated or {} self.HeaderTable = newTable @@ -5176,12 +5231,14 @@ detailsFramework.HeaderCoreFunctions = { end, --return which header is current selected and the the order ASC DESC + ---@param self headerframe GetSelectedColumn = function(self) return self.columnSelected, self.columnHeadersCreated[self.columnSelected or 1].order end, --clean up and rebuild the header following the header options --@self: main header frame + ---@param self headerframe Refresh = function(self) --refresh background frame self:SetBackdrop(self.options.backdrop) @@ -5263,7 +5320,10 @@ detailsFramework.HeaderCoreFunctions = { self:SetSize(self.HeaderWidth, self.HeaderHeight) end, - --@self: main header frame + ---@param self headerframe + ---@param columnHeader headercolumnframe + ---@param defaultShown boolean + ---@param defaultOrder string UpdateSortArrow = function(self, columnHeader, defaultShown, defaultOrder) local options = self.options local order = defaultOrder or columnHeader.order @@ -5292,7 +5352,9 @@ detailsFramework.HeaderCoreFunctions = { end end, - --@self: main header frame + ---@param self headerframe + ---@param columnHeader headercolumnframe + ---@param headerIndex number UpdateColumnHeader = function(self, columnHeader, headerIndex) local headerData = self.HeaderTable[headerIndex] @@ -5378,21 +5440,24 @@ detailsFramework.HeaderCoreFunctions = { columnHeader.InUse = true end, - --reset column header backdrop - --@self: main header frame + ---reset column header backdrop + ---@param self headerframe + ---@param columnHeader headercolumnframe ResetColumnHeaderBackdrop = function(self, columnHeader) columnHeader:SetBackdrop(self.options.header_backdrop) columnHeader:SetBackdropColor(unpack(self.options.header_backdrop_color)) columnHeader:SetBackdropBorderColor(unpack(self.options.header_backdrop_border_color)) end, - --@self: main header frame + ---@param self headerframe + ---@param columnHeader headercolumnframe SetBackdropColorForSelectedColumnHeader = function(self, columnHeader) columnHeader:SetBackdropColor(unpack(self.options.header_backdrop_color_selected)) end, - --clear the column header - --@self: main header frame + ---clear the column header + ---@param self headerframe + ---@param columnHeader headercolumnframe ClearColumnHeader = function(self, columnHeader) columnHeader:SetSize(self.options.header_width, self.options.header_height) self:ResetColumnHeaderBackdrop(columnHeader) @@ -5405,16 +5470,27 @@ detailsFramework.HeaderCoreFunctions = { columnHeader.Text:Hide() end, - --get the next column header, create one if doesn't exists - --@self: main header frame + ---get the next column header, create one if doesn't exists + ---@param self headerframe GetNextHeader = function(self) local nextHeader = self.NextHeader local columnHeader = self.columnHeadersCreated[nextHeader] if (not columnHeader) then --create a new column header + ---@type headercolumnframe local newHeader = CreateFrame("button", "$parentHeaderIndex" .. nextHeader, self, "BackdropTemplate") newHeader:SetScript("OnClick", detailsFramework.HeaderFunctions.OnClick) + newHeader:SetMovable(true) + newHeader:SetResizable(true) + + newHeader:SetScript("OnMouseDown", function() + print(11) + end) + + newHeader:SetScript("OnMouseUp", function() + print(22) --doesn't work either + end) --header icon detailsFramework:CreateImage(newHeader, "", self.options.header_height, self.options.header_height, "ARTWORK", nil, "Icon", "$parentIcon") @@ -5425,6 +5501,33 @@ detailsFramework.HeaderCoreFunctions = { --header selected and order icon detailsFramework:CreateImage(newHeader, self.options.arrow_up_texture, 12, 12, "ARTWORK", nil, "Arrow", "$parentArrow") + ---rezise button + ---@type button + local resizerButton = _G.CreateFrame("button", "$parentResizer", newHeader) + resizerButton:SetWidth(4) + resizerButton:SetFrameLevel(newHeader:GetFrameLevel()+2) + resizerButton:SetPoint("topright", newHeader, "topright", -1, 0) + resizerButton:SetPoint("bottomright", newHeader, "bottomright", -1, 0) + resizerButton:EnableMouse(true) + resizerButton:RegisterForClicks("LeftButtonDown", "LeftButtonUp") + newHeader.resizerButton = resizerButton + + resizerButton:SetScript("OnMouseDown", function() + newHeader.bIsRezising = true + print(1) + --newHeader:StartSizing("right") + end) + + resizerButton:SetScript("OnMouseUp", function() + newHeader.bIsRezising = false + print(2) + --newHeader:StopMovingOrSizing() + end) + + resizerButton.texture = resizerButton:CreateTexture(nil, "overlay") + resizerButton.texture:SetAllPoints() + resizerButton.texture:SetColorTexture(1, 1, 1, 1) + newHeader.Arrow:SetPoint("right", newHeader, "right", -1, 0) newHeader.Separator:Hide() @@ -5480,8 +5583,10 @@ local default_header_options = { line_separator_gap_align = false, } +---@return headerframe function detailsFramework:CreateHeader(parent, headerTable, options, frameName) - local newHeader = CreateFrame("frame", frameName or "$parentHeaderLine", parent, "BackdropTemplate") + ---@type headerframe + local newHeader = _G.CreateFrame("frame", frameName or "$parentHeaderLine", parent, "BackdropTemplate") detailsFramework:Mixin(newHeader, detailsFramework.OptionsFunctions) detailsFramework:Mixin(newHeader, detailsFramework.HeaderCoreFunctions) diff --git a/classes/class_custom.lua b/classes/class_custom.lua index 4e69681b..d47f1b9f 100644 --- a/classes/class_custom.lua +++ b/classes/class_custom.lua @@ -1748,7 +1748,7 @@ desc = Loc ["STRING_CUSTOM_MYSPELLS_DESC"], source = false, target = false, - script_version = 8, + script_version = 9, script = [[ --get the parameters passed local combat, instance_container, instance = ... diff --git a/classes/class_damage.lua b/classes/class_damage.lua index 5f5f501c..9e8b045b 100644 --- a/classes/class_damage.lua +++ b/classes/class_damage.lua @@ -5424,146 +5424,150 @@ function atributo_damage:MontaDetalhesDamageDone (spellId, spellLine, instance) local spellTable = spellTable local blockId = 6 - local thatRectangle66 = Details222.BreakdownWindow.GetBlockIndex(blockId) - thatRectangle66 = thatRectangle66:GetFrame() - --hide all textures created - if (thatRectangle66.ChartTextures) then - for i = 1, #thatRectangle66.ChartTextures do - thatRectangle66.ChartTextures[i]:Hide() - end - end + if false then --debug the stuff for the chart damage done in the 6th spellblock + --GetBlockIndex doesn't exists anymore + local thatRectangle66 = Details222.BreakdownWindow.GetBlockIndex(blockId) + thatRectangle66 = thatRectangle66:GetFrame() - local chartData = Details222.TimeCapture.GetChartDataFromSpell(spellTable) - if (chartData and instance) then - local width, height = thatRectangle66:GetSize() - --reset which texture is the next to be used - thatRectangle66.nextChartTextureId = 1 - - local amountOfTimeStamps = 12 - - if (not thatRectangle66.timeStamps) then - thatRectangle66.timeStamps = {} - for i = 1, amountOfTimeStamps do - thatRectangle66.timeStamps[i] = thatRectangle66:CreateFontString(nil, "overlay", "GameFontNormal") - thatRectangle66.timeStamps[i]:SetPoint("topleft", thatRectangle66, "topleft", 2 + (i - 1) * (width / amountOfTimeStamps), -2) - DetailsFramework:SetFontSize(thatRectangle66.timeStamps[i], 9) + --hide all textures created + if (thatRectangle66.ChartTextures) then + for i = 1, #thatRectangle66.ChartTextures do + thatRectangle66.ChartTextures[i]:Hide() end end - if (not thatRectangle66.bloodLustIndicators) then - thatRectangle66.bloodLustIndicators = {} - for i = 1, 5 do - local thisIndicator = thatRectangle66:CreateTexture(nil, "artwork", nil, 4) - thisIndicator:SetColorTexture(0.0980392, 0.0980392, 0.439216) - thatRectangle66.bloodLustIndicators[#thatRectangle66.bloodLustIndicators+1] = thisIndicator - end - end + local chartData = Details222.TimeCapture.GetChartDataFromSpell(spellTable) + if (chartData and instance) then + local width, height = thatRectangle66:GetSize() + --reset which texture is the next to be used + thatRectangle66.nextChartTextureId = 1 - for i = 1, #thatRectangle66.bloodLustIndicators do - thatRectangle66.bloodLustIndicators[i]:Hide() - end + local amountOfTimeStamps = 12 - if (not thatRectangle66.ChartTextures) then - thatRectangle66.ChartTextures = {} - function thatRectangle66:GetChartTexture() - local thisTexture = thatRectangle66.ChartTextures[thatRectangle66.nextChartTextureId] - if (not thisTexture) then - thisTexture = thatRectangle66:CreateTexture(nil, "artwork", nil, 5) - thisTexture:SetColorTexture(1, 1, 1, 0.65) - thatRectangle66.ChartTextures[thatRectangle66.nextChartTextureId] = thisTexture + if (not thatRectangle66.timeStamps) then + thatRectangle66.timeStamps = {} + for i = 1, amountOfTimeStamps do + thatRectangle66.timeStamps[i] = thatRectangle66:CreateFontString(nil, "overlay", "GameFontNormal") + thatRectangle66.timeStamps[i]:SetPoint("topleft", thatRectangle66, "topleft", 2 + (i - 1) * (width / amountOfTimeStamps), -2) + DetailsFramework:SetFontSize(thatRectangle66.timeStamps[i], 9) end - thatRectangle66.nextChartTextureId = thatRectangle66.nextChartTextureId + 1 - - return thisTexture end - end - --elapsed combat time - local combatObject = instance:GetShowingCombat() - local combatTime = math.floor(combatObject:GetCombatTime()) - thatRectangle66.timeStamps[1]:SetText(DetailsFramework:IntegerToTimer(0)) - for i = 2, #thatRectangle66.timeStamps do - local timePerSegment = combatTime / #thatRectangle66.timeStamps - thatRectangle66.timeStamps[i]:SetText(DetailsFramework:IntegerToTimer(i * timePerSegment)) - end - --compute the width oif each texture - local textureWidth = width / combatTime - --compute the max height of a texture can have - local maxValue = 0 - local numData = 0 - - --need to put the data in order FIRST - --each damage then need to be parsed - - local dataInOrder = {} - - local CONST_INDEX_TIMESTAMP = 1 - local CONST_INDEX_DAMAGEDONE = 2 - local CONST_INDEX_EVENTDAMAGE = 3 - - for timeStamp, value in pairs(chartData) do - dataInOrder[#dataInOrder+1] = {timeStamp, value} - dataInOrder[#dataInOrder+1] = {timeStamp, value} - dataInOrder[#dataInOrder+1] = {timeStamp, value} - numData = numData + 1 - end - - table.sort(dataInOrder, function(t1, t2) return t1[CONST_INDEX_TIMESTAMP] < t2[CONST_INDEX_TIMESTAMP] end) - local damageDoneByTime = dataInOrder - - --parser the damage done - local currentTotalDamage = 0 - - for i = 1, #damageDoneByTime do - local damageEvent = damageDoneByTime[i] - - local atTime = damageEvent[CONST_INDEX_TIMESTAMP] - local totalDamageUntilHere = damageEvent[CONST_INDEX_DAMAGEDONE] --raw damage - - local spellDamage = totalDamageUntilHere - currentTotalDamage - currentTotalDamage = currentTotalDamage + spellDamage - - damageEvent[CONST_INDEX_EVENTDAMAGE] = spellDamage - - maxValue = math.max(spellDamage, maxValue) - end - - --build the chart - for i = 1, #damageDoneByTime do - --for timeStamp, value in pairs(chartData) do --as it is pairs the data is scattered - local damageEvent = damageDoneByTime[i] - local timeStamp = damageEvent[CONST_INDEX_TIMESTAMP] - local damageDone = damageEvent[CONST_INDEX_EVENTDAMAGE] - - local thisTexture = thatRectangle66:GetChartTexture() - thisTexture:SetWidth(textureWidth) - - local texturePosition = textureWidth * timeStamp - - thisTexture:SetPoint("bottomleft", thatRectangle66, "bottomleft", 1 + texturePosition, 1) - - local percentFromPeak = damageDone / maxValue --normalized - thisTexture:SetHeight(math.min(percentFromPeak * height, height - 15)) - thisTexture:Show() - - --print("DEBUG", 7 , "Peak:", percentFromPeak, "position:", texturePosition, "damage done:", damageDone) --debug - end - - --show bloodlust indicators, member .bloodlust is not guarantted - if (combatObject.bloodlust) then - --bloodlust not being added into the combat object, probably a bug on Parser - local bloodlustDuration = 40 - for i = 1, #combatObject.bloodlust do - thatRectangle66.bloodLustIndicators[i]:Show() - thatRectangle66.bloodLustIndicators[i]:SetAlpha(0.46) - thatRectangle66.bloodLustIndicators[i]:SetSize(bloodlustDuration / combatTime * width, height - 2) - thatRectangle66.bloodLustIndicators[i]:SetPoint("bottomleft", thatRectangle66, "bottomleft", 0, 0) + if (not thatRectangle66.bloodLustIndicators) then + thatRectangle66.bloodLustIndicators = {} + for i = 1, 5 do + local thisIndicator = thatRectangle66:CreateTexture(nil, "artwork", nil, 4) + thisIndicator:SetColorTexture(0.0980392, 0.0980392, 0.439216) + thatRectangle66.bloodLustIndicators[#thatRectangle66.bloodLustIndicators+1] = thisIndicator + end end - end - DetailsBreakdownWindow_DetalheInfoBG_bg_end6:Hide() - thatRectangle66:SetShown(true) + for i = 1, #thatRectangle66.bloodLustIndicators do + thatRectangle66.bloodLustIndicators[i]:Hide() + end + + if (not thatRectangle66.ChartTextures) then + thatRectangle66.ChartTextures = {} + function thatRectangle66:GetChartTexture() + local thisTexture = thatRectangle66.ChartTextures[thatRectangle66.nextChartTextureId] + if (not thisTexture) then + thisTexture = thatRectangle66:CreateTexture(nil, "artwork", nil, 5) + thisTexture:SetColorTexture(1, 1, 1, 0.65) + thatRectangle66.ChartTextures[thatRectangle66.nextChartTextureId] = thisTexture + end + thatRectangle66.nextChartTextureId = thatRectangle66.nextChartTextureId + 1 + + return thisTexture + end + end + + --elapsed combat time + local combatObject = instance:GetShowingCombat() + local combatTime = math.floor(combatObject:GetCombatTime()) + thatRectangle66.timeStamps[1]:SetText(DetailsFramework:IntegerToTimer(0)) + for i = 2, #thatRectangle66.timeStamps do + local timePerSegment = combatTime / #thatRectangle66.timeStamps + thatRectangle66.timeStamps[i]:SetText(DetailsFramework:IntegerToTimer(i * timePerSegment)) + end + --compute the width oif each texture + local textureWidth = width / combatTime + --compute the max height of a texture can have + local maxValue = 0 + local numData = 0 + + --need to put the data in order FIRST + --each damage then need to be parsed + + local dataInOrder = {} + + local CONST_INDEX_TIMESTAMP = 1 + local CONST_INDEX_DAMAGEDONE = 2 + local CONST_INDEX_EVENTDAMAGE = 3 + + for timeStamp, value in pairs(chartData) do + dataInOrder[#dataInOrder+1] = {timeStamp, value} + dataInOrder[#dataInOrder+1] = {timeStamp, value} + dataInOrder[#dataInOrder+1] = {timeStamp, value} + numData = numData + 1 + end + + table.sort(dataInOrder, function(t1, t2) return t1[CONST_INDEX_TIMESTAMP] < t2[CONST_INDEX_TIMESTAMP] end) + local damageDoneByTime = dataInOrder + + --parser the damage done + local currentTotalDamage = 0 + + for i = 1, #damageDoneByTime do + local damageEvent = damageDoneByTime[i] + + local atTime = damageEvent[CONST_INDEX_TIMESTAMP] + local totalDamageUntilHere = damageEvent[CONST_INDEX_DAMAGEDONE] --raw damage + + local spellDamage = totalDamageUntilHere - currentTotalDamage + currentTotalDamage = currentTotalDamage + spellDamage + + damageEvent[CONST_INDEX_EVENTDAMAGE] = spellDamage + + maxValue = math.max(spellDamage, maxValue) + end + + --build the chart + for i = 1, #damageDoneByTime do + --for timeStamp, value in pairs(chartData) do --as it is pairs the data is scattered + local damageEvent = damageDoneByTime[i] + local timeStamp = damageEvent[CONST_INDEX_TIMESTAMP] + local damageDone = damageEvent[CONST_INDEX_EVENTDAMAGE] + + local thisTexture = thatRectangle66:GetChartTexture() + thisTexture:SetWidth(textureWidth) + + local texturePosition = textureWidth * timeStamp + + thisTexture:SetPoint("bottomleft", thatRectangle66, "bottomleft", 1 + texturePosition, 1) + + local percentFromPeak = damageDone / maxValue --normalized + thisTexture:SetHeight(math.min(percentFromPeak * height, height - 15)) + thisTexture:Show() + + --print("DEBUG", 7 , "Peak:", percentFromPeak, "position:", texturePosition, "damage done:", damageDone) --debug + end + + --show bloodlust indicators, member .bloodlust is not guarantted + if (combatObject.bloodlust) then + --bloodlust not being added into the combat object, probably a bug on Parser + local bloodlustDuration = 40 + for i = 1, #combatObject.bloodlust do + thatRectangle66.bloodLustIndicators[i]:Show() + thatRectangle66.bloodLustIndicators[i]:SetAlpha(0.46) + thatRectangle66.bloodLustIndicators[i]:SetSize(bloodlustDuration / combatTime * width, height - 2) + thatRectangle66.bloodLustIndicators[i]:SetPoint("bottomleft", thatRectangle66, "bottomleft", 0, 0) + end + end + + DetailsBreakdownWindow_DetalheInfoBG_bg_end6:Hide() + thatRectangle66:SetShown(true) + end end _table_sort(data, Details.Sort1) @@ -5573,9 +5577,8 @@ function atributo_damage:MontaDetalhesDamageDone (spellId, spellLine, instance) end for i = #data+2, 5 do - gump:HidaDetalheInfo (i) + gump:HidaDetalheInfo(i) end - end function Details:BuildPlayerDetailsSpellChart() @@ -5662,7 +5665,6 @@ function Details:BuildPlayerDetailsSpellChart() end function atributo_damage:MontaTooltipDamageTaken (thisLine, index) - local aggressor = info.instancia.showing [1]:PegarCombatente (_, thisLine.nome_inimigo) local container = aggressor.spells._ActorTable local habilidades = {} diff --git a/classes/class_instance.lua b/classes/class_instance.lua index e9a83eaa..197923ce 100644 --- a/classes/class_instance.lua +++ b/classes/class_instance.lua @@ -332,7 +332,7 @@ local instanceMixins = { --update player breakdown window if opened if (not bForceRefresh) then if (Details:IsBreakdownWindowOpen()) then - return Details:GetPlayerObjectFromBreakdownWindow():MontaInfo() + return Details:GetActorObjectFromBreakdownWindow():MontaInfo() end end end @@ -519,9 +519,9 @@ local instanceMixins = { Details:CloseBreakdownWindow() else ---@type actor - local actorObject = Details:GetPlayerObjectFromBreakdownWindow() + local actorObject = Details:GetActorObjectFromBreakdownWindow() if (actorObject) then - Details:OpenPlayerBreakdown(instance, actorObject, true) + Details:OpenBreakdownWindow(instance, actorObject, true) else Details:CloseBreakdownWindow() end @@ -2832,13 +2832,13 @@ function _detalhes:TrocaTabela(instance, segmentId, attributeId, subAttributeId, if (Details.playerDetailWindow:IsShown() and instance == Details.playerDetailWindow.instancia) then if (not instance.showing or instance.atributo > 4) then - Details:FechaJanelaInfo() + Details:CloseBreakdownWindow() else - local actor = instance.showing (instance.atributo, Details.playerDetailWindow.jogador.nome) - if (actor) then - instance:AbreJanelaInfo (actor, true) + local actorObject = instance.showing (instance.atributo, Details.playerDetailWindow.jogador.nome) + if (actorObject) then + Details:OpenBreakdownWindow(instance, actorObject, true) else - Details:FechaJanelaInfo() + Details:CloseBreakdownWindow() end end end diff --git a/classes/container_segments.lua b/classes/container_segments.lua index f38e9caf..b04b6648 100644 --- a/classes/container_segments.lua +++ b/classes/container_segments.lua @@ -451,7 +451,7 @@ function segmentClass:resetar_overall() -- _detalhes.schedule_remove_overall = true --else --fecha a janela de informa��es do jogador - Details:FechaJanelaInfo() + Details:CloseBreakdownWindow() Details.tabela_overall = combatClass:NovaTabela() @@ -498,7 +498,7 @@ function segmentClass:resetar() --_detalhes.schedule_remove_overall = nil --fecha a janela de informa��es do jogador - Details:FechaJanelaInfo() + Details:CloseBreakdownWindow() --empty temporary tables Details.atributo_damage:ClearTempTables() diff --git a/core/parser.lua b/core/parser.lua index 1abc7730..003f18f9 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -5827,10 +5827,10 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 _detalhes.logoff_saving_data = true --close info window - if (_detalhes.FechaJanelaInfo) then + if (_detalhes.CloseBreakdownWindow) then tinsert(_detalhes_global.exit_log, "1 - Closing Janela Info.") currentStep = "Fecha Janela Info" - xpcall(_detalhes.FechaJanelaInfo, saver_error) + xpcall(_detalhes.CloseBreakdownWindow, saver_error) end --do not save window pos diff --git a/frames/window_main.lua b/frames/window_main.lua index 4e4db787..b27d6355 100644 --- a/frames/window_main.lua +++ b/frames/window_main.lua @@ -1950,19 +1950,22 @@ local lineScript_Onmousedown = function(self, button) end local lineScript_Onmouseup = function(self, button) - local is_shift_down = _IsShiftKeyDown() - local is_control_down = _IsControlKeyDown() + local bIsShiftDown = _IsShiftKeyDown() + local bIsControlDown = _IsControlKeyDown() - if (self._instance.baseframe.isMoving) then - move_janela(self._instance.baseframe, false, self._instance) - self._instance:SaveMainWindowPosition() + ---@type instance + local instanceObject = self._instance - if (self._instance:MontaTooltip(self, self.row_id)) then + if (instanceObject.baseframe.isMoving) then + move_janela(instanceObject.baseframe, false, instanceObject) + instanceObject:SaveMainWindowPosition() + + if (instanceObject:MontaTooltip(self, self.row_id)) then GameCooltip:Show (self, 1) end end - self._instance:HandleTextsOnMouseClick (self, "up") + instanceObject:HandleTextsOnMouseClick (self, "up") local x, y = _GetCursorPosition() x = floor(x) @@ -1970,14 +1973,14 @@ local lineScript_Onmouseup = function(self, button) if (self.mouse_down and (self.mouse_down+0.4 > GetTime() and (x == self.x and y == self.y)) or (x == self.x and y == self.y)) then if (self.button == "LeftButton" or self.button == "MiddleButton") then - if (self._instance.atributo == 5 or is_shift_down) then + if (instanceObject.atributo == 5 or bIsShiftDown) then --report - if (self._instance.atributo == 5 and is_shift_down) then - local custom = self._instance:GetCustomObject() + if (instanceObject.atributo == 5 and bIsShiftDown) then + local custom = instanceObject:GetCustomObject() if (custom and custom.on_shift_click) then - local func = loadstring (custom.on_shift_click) + local func = loadstring(custom.on_shift_click) if (func) then - local successful, errortext = pcall(func, self, self.minha_tabela, self._instance) + local successful, errortext = pcall(func, self, self.minha_tabela, instanceObject) if (not successful) then Details:Msg("error occurred custom script shift+click:", errortext) end @@ -1986,18 +1989,18 @@ local lineScript_Onmouseup = function(self, button) end end - if (Details.row_singleclick_overwrite [self._instance.atributo] and type(Details.row_singleclick_overwrite [self._instance.atributo][self._instance.sub_atributo]) == "function") then - return Details.row_singleclick_overwrite [self._instance.atributo][self._instance.sub_atributo] (_, self.minha_tabela, self._instance, is_shift_down, is_control_down) + if (Details.row_singleclick_overwrite [instanceObject.atributo] and type(Details.row_singleclick_overwrite [instanceObject.atributo][instanceObject.sub_atributo]) == "function") then + return Details.row_singleclick_overwrite [instanceObject.atributo][instanceObject.sub_atributo] (_, self.minha_tabela, instanceObject, bIsShiftDown, bIsControlDown) end - return Details:ReportSingleLine (self._instance, self) + return Details:ReportSingleLine (instanceObject, self) end if (not self.minha_tabela) then return Details:Msg("this bar is waiting update.") end - self._instance:AbreJanelaInfo (self.minha_tabela, nil, nil, is_shift_down, is_control_down) + Details:OpenBreakdownWindow(instanceObject, self.minha_tabela, nil, nil, bIsShiftDown, bIsControlDown) end end end diff --git a/frames/window_playerbreakdown.lua b/frames/window_playerbreakdown.lua index 16b140ab..f4b35708 100644 --- a/frames/window_playerbreakdown.lua +++ b/frames/window_playerbreakdown.lua @@ -1,9 +1,9 @@ -local _detalhes = _G._detalhes -local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" ) -local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0") +local Details = _G.Details +local Loc = _G.LibStub("AceLocale-3.0"):GetLocale ( "Details" ) +local SharedMedia = _G.LibStub:GetLibrary("LibSharedMedia-3.0") -local gump = _detalhes.gump +local gump = Details.gump local _ local addonName, Details222 = ... @@ -11,72 +11,34 @@ local addonName, Details222 = ... local ipairs = ipairs local pairs = pairs local type = type -local unpack = unpack +local unpack = _G.unpack --api locals -local CreateFrame = CreateFrame -local GetTime = GetTime -local _GetSpellInfo = _detalhes.getspellinfo -local _GetCursorPosition = GetCursorPosition -local GameTooltip = GameTooltip - -local sub_atributos = _detalhes.sub_atributos -local info = _detalhes.playerDetailWindow -local breakdownWindow = info -local container3_bars_pointFunc +local CreateFrame = _G.CreateFrame +local subAttributes = Details.sub_atributos +local breakdownWindow = Details.playerDetailWindow local SummaryWidgets = {} local CurrentTab = "Summary" -local CONST_BAR_HEIGHT = 20 -local CONST_TARGET_HEIGHT = 18 - local PLAYER_DETAILS_WINDOW_WIDTH = 890 local PLAYER_DETAILS_WINDOW_HEIGHT = 574 - local PLAYER_DETAILS_STATUSBAR_HEIGHT = 20 local PLAYER_DETAILS_STATUSBAR_ALPHA = 1 -local containerSettings = { - spells = { - width = 419, - height = 290, - point = {"TOPLEFT", breakdownWindow, "TOPLEFT", 2, -76}, - scrollHeight = 264, - }, - targets = { - width = 418, - height = 150, - point = {"BOTTOMLEFT", breakdownWindow, "BOTTOMLEFT", 2, 6 + PLAYER_DETAILS_STATUSBAR_HEIGHT}, - }, -} - -local spellInfoSettings = { - width = 430, - amount = 6, -} - -_detalhes.player_details_tabs = {} -info.currentTabsInUse = {} +Details.player_details_tabs = {} +breakdownWindow.currentTabsInUse = {} ------------------------------------------------------------------------------------------------------------------------------ --self = instancia --jogador = classe_damage ou classe_heal -do - local gradientStartColor = Details222.ColorScheme.GetColorFor("gradient-background") - local gradientUp = DetailsFramework:CreateTexture(info, {gradient = "vertical", fromColor = "transparent", toColor = gradientStartColor}, 1, 300, "artwork", {0, 1, 0, 1}) - gradientUp:SetPoint("tops", 1, 1) - local gradientDown = DetailsFramework:CreateTexture(info, {gradient = "vertical", fromColor = gradientStartColor, toColor = "transparent"}, 1, 50, "artwork", {0, 1, 0, 1}) - gradientDown:SetPoint("bottoms") -end - function Details:GetBreakdownTabsInUse() - return info.currentTabsInUse + return breakdownWindow.currentTabsInUse end function Details:GetBreakdownTabByName(tabName, tablePool) - tablePool = tablePool or _detalhes.player_details_tabs + tablePool = tablePool or Details.player_details_tabs for index = 1, #tablePool do local tab = tablePool[index] if (tab.tabname == tabName) then @@ -87,22 +49,22 @@ end --return the combat being used to show the data in the opened breakdown window function Details:GetCombatFromBreakdownWindow() - return info.instancia and info.instancia.showing + return breakdownWindow.instancia and breakdownWindow.instancia.showing end --return the window that requested to open the player breakdown window function Details:GetActiveWindowFromBreakdownWindow() - return info.instancia + return breakdownWindow.instancia end --return if the breakdown window is showing damage or heal function Details:GetDisplayTypeFromBreakdownWindow() - return info.atributo, info.sub_atributo + return breakdownWindow.atributo, breakdownWindow.sub_atributo end --return the actor object in use by the breakdown window -function Details:GetPlayerObjectFromBreakdownWindow() - return info.jogador +function Details:GetActorObjectFromBreakdownWindow() + return breakdownWindow.jogador end function Details:GetBreakdownWindow() @@ -110,282 +72,160 @@ function Details:GetBreakdownWindow() end function Details:IsBreakdownWindowOpen() - return info.ativo + return breakdownWindow.ativo end -function Details222.PlayerBreakdown.StartMoving() - breakdownWindow:StartMoving() - breakdownWindow.bIsMoving = true -end - -function Details222.PlayerBreakdown.StopMoving() - if (breakdownWindow.bIsMoving) then - breakdownWindow:StopMovingOrSizing() - breakdownWindow.bIsMoving = false - end -end - -function Details222.PlayerBreakdown.OnMouseDown(frameClicked, button) - if (button == "LeftButton" and not breakdownWindow.bIsMoving) then - breakdownWindow.latestFrameClicked = frameClicked - Details222.PlayerBreakdown.StartMoving() - - elseif (button == "RightButton" and not breakdownWindow.bIsMoving) then - Details:CloseBreakdownWindow() - end -end - -function Details222.PlayerBreakdown.OnMouseUp(button) - if (button == "LeftButton" and breakdownWindow.bIsMoving) then - Details222.PlayerBreakdown.StopMoving() - end -end - ---english alias ---window object from Details:GetWindow(n) and playerObject from Details:GetPlayer(playerName, attribute) -function Details:OpenPlayerBreakdown(windowObject, playerObject, from_att_change) --windowObject = instanceObject - windowObject:AbreJanelaInfo(playerObject, from_att_change) -end - -function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDown, ControlKeyDown) +---open the breakdown window +---@param self details +---@param instanceObject instance +---@param actorObject actor +---@param bFromAttributeChange boolean|nil +---@param bIsRefresh boolean|nil +---@param bIsShiftKeyDown boolean|nil +---@param bIsControlKeyDown boolean|nil +function Details:OpenBreakdownWindow(instanceObject, actorObject, bFromAttributeChange, bIsRefresh, bIsShiftKeyDown, bIsControlKeyDown) --create the player list frame in the left side of the window Details.PlayerBreakdown.CreatePlayerListFrame() - if (not _detalhes.row_singleclick_overwrite [self.atributo] or not _detalhes.row_singleclick_overwrite [self.atributo][self.sub_atributo]) then - _detalhes:FechaJanelaInfo() + if (not Details.row_singleclick_overwrite[instanceObject.atributo] or not Details.row_singleclick_overwrite[instanceObject.atributo][instanceObject.sub_atributo]) then + Details:CloseBreakdownWindow() return - elseif (type(_detalhes.row_singleclick_overwrite [self.atributo][self.sub_atributo]) == "function") then - if (from_att_change) then - _detalhes:FechaJanelaInfo() + elseif (type(Details.row_singleclick_overwrite[instanceObject.atributo][instanceObject.sub_atributo]) == "function") then + if (bFromAttributeChange) then + Details:CloseBreakdownWindow() return end - return _detalhes.row_singleclick_overwrite [self.atributo][self.sub_atributo] (_, jogador, self, ShiftKeyDown, ControlKeyDown) + return Details.row_singleclick_overwrite[instanceObject.atributo][instanceObject.sub_atributo](_, actorObject, instanceObject, bIsShiftKeyDown, bIsControlKeyDown) end - if (self.modo == _detalhes._detalhes_props["MODO_RAID"]) then - _detalhes:FechaJanelaInfo() + if (instanceObject:GetMode() == DETAILS_MODE_RAID) then + Details:CloseBreakdownWindow() return end - if (not breakdownWindow.registeredLibWindow) then - local LibWindow = LibStub("LibWindow-1.1") - breakdownWindow.registeredLibWindow = true - if (LibWindow) then - breakdownWindow.libWindowTable = breakdownWindow.libWindowTable or {} - LibWindow.RegisterConfig(breakdownWindow, breakdownWindow.libWindowTable) - LibWindow.RestorePosition(breakdownWindow) - LibWindow.MakeDraggable(breakdownWindow) - LibWindow.SavePosition(breakdownWindow) - else - breakdownWindow:SetScript("OnMouseDown", function(self, button) - Details222.PlayerBreakdown.OnMouseDown(button) - end) - breakdownWindow:SetScript("OnMouseUp", function(self, button) - Details222.PlayerBreakdown.OnMouseUp(button) - end) - end - end - - ---@type function - local onEventFunction = breakdownWindow:GetScript("OnEvent") - - if (not onEventFunction) then - ---this is a workaround of an issue when a frame calls StartMoving() on the parent, many times the child doesn't receive the OnMouseUp event - ---@param breakdownWindow frame - ---@param event string - ---@param button string - breakdownWindow:SetScript("OnEvent", function(breakdownWindow, event, button) - if (breakdownWindow.bIsMoving and breakdownWindow.latestFrameClicked) then - Details222.PlayerBreakdown.StopMoving() - local OnMouseUp = breakdownWindow.latestFrameClicked:GetScript("OnMouseUp") - if (OnMouseUp) then - OnMouseUp(breakdownWindow.latestFrameClicked, button) - end - breakdownWindow.latestFrameClicked = nil - end - end) - breakdownWindow:RegisterEvent("GLOBAL_MOUSE_UP") - end - - --_detalhes.info_jogador armazena o jogador que esta sendo mostrado na janela de detalhes - if (info.jogador and info.jogador == jogador and self and info.atributo and self.atributo == info.atributo and self.sub_atributo == info.sub_atributo and not refresh) then - _detalhes:FechaJanelaInfo() --se clicou na mesma barra ent�o fecha a janela de detalhes + --Details.info_jogador armazena o jogador que esta sendo mostrado na janela de detalhes + if (breakdownWindow.jogador and breakdownWindow.jogador == actorObject and instanceObject and breakdownWindow.atributo and instanceObject.atributo == breakdownWindow.atributo and instanceObject.sub_atributo == breakdownWindow.sub_atributo and not bIsRefresh) then + Details:CloseBreakdownWindow() --se clicou na mesma barra ent�o fecha a janela de detalhes return - elseif (not jogador) then - _detalhes:FechaJanelaInfo() + + elseif (not actorObject) then + Details:CloseBreakdownWindow() return end - if (info.barras1) then - for index, barra in ipairs(info.barras1) do - barra.other_actor = nil - end - end - - if (info.barras2) then - for index, barra in ipairs(info.barras2) do - barra.icone:SetTexture("") - barra.icone:SetTexCoord(0, 1, 0, 1) - end - end - - if (not info.bHasInitialized) then - local infoNumPoints = info:GetNumPoints() + if (not breakdownWindow.bHasInitialized) then + local infoNumPoints = breakdownWindow:GetNumPoints() for i = 1, infoNumPoints do - local point1, anchorObject, point2, x, y = info:GetPoint(i) + local point1, anchorObject, point2, x, y = breakdownWindow:GetPoint(i) if (not anchorObject) then - info:ClearAllPoints() + breakdownWindow:ClearAllPoints() end end - info:SetUserPlaced(false) - info:SetDontSavePosition(true) + breakdownWindow:SetUserPlaced(false) + breakdownWindow:SetDontSavePosition(true) local okay, errorText = pcall(function() - info:SetPoint("center", _G.UIParent, "center", 0, 0) + breakdownWindow:SetPoint("center", _G.UIParent, "center", 0, 0) end) if (not okay) then - info:ClearAllPoints() - info:SetPoint("center", _G.UIParent, "center", 0, 0) + breakdownWindow:ClearAllPoints() + breakdownWindow:SetPoint("center", _G.UIParent, "center", 0, 0) end - info.bHasInitialized = true + breakdownWindow.bHasInitialized = true end - if (not info.RightSideBar) then - info.RightSideBar = CreateFrame("frame", nil, info, "BackdropTemplate") - info.RightSideBar:SetWidth(20) - info.RightSideBar:SetPoint("topleft", info, "topright", 1, 0) - info.RightSideBar:SetPoint("bottomleft", info, "bottomright", 1, 0) - local rightSideBarAlpha = 0.75 - - DetailsFramework:ApplyStandardBackdrop(info.RightSideBar) - - local toggleMergePlayerSpells = function() - Details.merge_player_abilities = not Details.merge_player_abilities - local playerObject = Details:GetPlayerObjectFromBreakdownWindow() - local instanceObject = Details:GetActiveWindowFromBreakdownWindow() - Details:OpenPlayerBreakdown(instanceObject, playerObject) --toggle - Details:OpenPlayerBreakdown(instanceObject, playerObject) - end - local mergePlayerSpellsCheckbox = DetailsFramework:CreateSwitch(info, toggleMergePlayerSpells, Details.merge_player_abilities, _, _, _, _, _, _, _, _, _, _, DetailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE")) - mergePlayerSpellsCheckbox:SetAsCheckBox() - mergePlayerSpellsCheckbox:SetPoint("bottom", info.RightSideBar, "bottom", 0, 2) - - local mergePlayerSpellsLabel = info.RightSideBar:CreateFontString(nil, "overlay", "GameFontNormal") - mergePlayerSpellsLabel:SetText("Merge Player Spells") - DetailsFramework:SetFontRotation(mergePlayerSpellsLabel, 90) - mergePlayerSpellsLabel:SetPoint("center", mergePlayerSpellsCheckbox.widget, "center", -6, mergePlayerSpellsCheckbox:GetHeight()/2 + mergePlayerSpellsLabel:GetStringWidth() / 2) - - -- - - local toggleMergePetSpells = function() - Details.merge_pet_abilities = not Details.merge_pet_abilities - local playerObject = Details:GetPlayerObjectFromBreakdownWindow() - local instanceObject = Details:GetActiveWindowFromBreakdownWindow() - Details:OpenPlayerBreakdown(instanceObject, playerObject) --toggle - Details:OpenPlayerBreakdown(instanceObject, playerObject) - end - local mergePetSpellsCheckbox = DetailsFramework:CreateSwitch(info, toggleMergePetSpells, Details.merge_pet_abilities, _, _, _, _, _, _, _, _, _, _, DetailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE")) - mergePetSpellsCheckbox:SetAsCheckBox(true) - mergePetSpellsCheckbox:SetPoint("bottom", info.RightSideBar, "bottom", 0, 160) - - local mergePetSpellsLabel = info.RightSideBar:CreateFontString(nil, "overlay", "GameFontNormal") - mergePetSpellsLabel:SetText("Merge Pet Spells") - DetailsFramework:SetFontRotation(mergePetSpellsLabel, 90) - mergePetSpellsLabel:SetPoint("center", mergePetSpellsCheckbox.widget, "center", -6, mergePetSpellsCheckbox:GetHeight()/2 + mergePetSpellsLabel:GetStringWidth() / 2) - - mergePlayerSpellsCheckbox:SetAlpha(rightSideBarAlpha) - mergePlayerSpellsLabel:SetAlpha(rightSideBarAlpha) - mergePetSpellsCheckbox:SetAlpha(rightSideBarAlpha) - mergePetSpellsLabel:SetAlpha(rightSideBarAlpha) + if (not breakdownWindow.RightSideBar) then + breakdownWindow:CreateRightSideBar() end - info.ativo = true --sinaliza o addon que a janela esta aberta - info.atributo = self.atributo --instancia.atributo -> grava o atributo (damage, heal, etc) - info.sub_atributo = self.sub_atributo --instancia.sub_atributo -> grava o sub atributo (damage done, dps, damage taken, etc) - info.jogador = jogador --de qual jogador (objeto classe_damage) - info.instancia = self --salva a refer�ncia da inst�ncia que pediu o info - info.target_text = Loc ["STRING_TARGETS"] .. ":" - info.target_member = "total" - info.target_persecond = false + breakdownWindow.ativo = true --sinaliza o addon que a janela esta aberta + breakdownWindow.atributo = instanceObject.atributo --instancia.atributo -> grava o atributo (damage, heal, etc) + breakdownWindow.sub_atributo = instanceObject.sub_atributo --instancia.sub_atributo -> grava o sub atributo (damage done, dps, damage taken, etc) + breakdownWindow.jogador = actorObject --de qual jogador (objeto classe_damage) + breakdownWindow.instancia = instanceObject --salva a refer�ncia da inst�ncia que pediu o breakdownWindow + breakdownWindow.target_text = Loc ["STRING_TARGETS"] .. ":" + breakdownWindow.target_member = "total" + breakdownWindow.target_persecond = false - info.mostrando = nil + breakdownWindow.mostrando = nil - local nome = info.jogador.nome --nome do jogador - local atributo_nome = sub_atributos[info.atributo].lista [info.sub_atributo] .. " " .. Loc ["STRING_ACTORFRAME_REPORTOF"] --// nome do atributo // precisa ser o sub atributo correto??? + local nome = breakdownWindow.jogador.nome --nome do jogador + local atributo_nome = subAttributes[breakdownWindow.atributo].lista [breakdownWindow.sub_atributo] .. " " .. Loc ["STRING_ACTORFRAME_REPORTOF"] --// nome do atributo // precisa ser o sub atributo correto??? --removendo o nome da realm do jogador if (nome:find("-")) then nome = nome:gsub(("-.*"), "") end - if (info.instancia.atributo == 1 and info.instancia.sub_atributo == 6) then --enemy - atributo_nome = sub_atributos [info.atributo].lista [1] .. " " .. Loc ["STRING_ACTORFRAME_REPORTOF"] + if (breakdownWindow.instancia.atributo == 1 and breakdownWindow.instancia.sub_atributo == 6) then --enemy + atributo_nome = subAttributes [breakdownWindow.atributo].lista [1] .. " " .. Loc ["STRING_ACTORFRAME_REPORTOF"] end - info.nome:SetText(nome) - info.atributo_nome:SetText(atributo_nome) + breakdownWindow.actorName:SetText(nome) --found it + breakdownWindow.attributeName:SetText(atributo_nome) - local serial = jogador.serial + local serial = actorObject.serial local avatar if (serial ~= "") then avatar = NickTag:GetNicknameTable (serial) end if (avatar and avatar [1]) then - info.nome:SetText((not _detalhes.ignore_nicktag and avatar [1]) or nome) + breakdownWindow.actorName:SetText((not Details.ignore_nicktag and avatar [1]) or nome) end if (avatar and avatar [2]) then - info.avatar:SetTexture(avatar [2]) - info.avatar_bg:SetTexture(avatar [4]) + breakdownWindow.avatar:SetTexture(avatar [2]) + breakdownWindow.avatar_bg:SetTexture(avatar [4]) if (avatar [5]) then - info.avatar_bg:SetTexCoord(unpack(avatar [5])) + breakdownWindow.avatar_bg:SetTexCoord(unpack(avatar [5])) end if (avatar [6]) then - info.avatar_bg:SetVertexColor(unpack(avatar [6])) + breakdownWindow.avatar_bg:SetVertexColor(unpack(avatar [6])) end - info.avatar_nick:SetText(avatar [1] or nome) - info.avatar_attribute:SetText(atributo_nome) + breakdownWindow.avatar_nick:SetText(avatar [1] or nome) + breakdownWindow.avatar_attribute:SetText(atributo_nome) - info.avatar_attribute:SetPoint("CENTER", info.avatar_nick, "CENTER", 0, 14) - info.avatar:Show() - info.avatar_bg:Show() - info.avatar_bg:SetAlpha(.65) - info.avatar_nick:Show() - info.avatar_attribute:Show() - info.nome:Hide() - info.atributo_nome:Hide() + breakdownWindow.avatar_attribute:SetPoint("CENTER", breakdownWindow.avatar_nick, "CENTER", 0, 14) + breakdownWindow.avatar:Show() + breakdownWindow.avatar_bg:Show() + breakdownWindow.avatar_bg:SetAlpha(.65) + breakdownWindow.avatar_nick:Show() + breakdownWindow.avatar_attribute:Show() + breakdownWindow.actorName:Hide() + breakdownWindow.attributeName:Hide() else - info.avatar:Hide() - info.avatar_bg:Hide() - info.avatar_nick:Hide() - info.avatar_attribute:Hide() + breakdownWindow.avatar:Hide() + breakdownWindow.avatar_bg:Hide() + breakdownWindow.avatar_nick:Hide() + breakdownWindow.avatar_attribute:Hide() - info.nome:Show() - info.atributo_nome:Show() + breakdownWindow.actorName:Show() + breakdownWindow.attributeName:Show() end - info.atributo_nome:SetPoint("CENTER", info.nome, "CENTER", 0, 14) + breakdownWindow.attributeName:SetPoint("CENTER", breakdownWindow.actorName, "CENTER", 0, 14) --need a way to comunicate with the main tab showing spells --need to send a signal to reset its contents and prepare for a new player - --spellsTab.ResetBars() + --spellsTab.ResetBars() --to be implemented - local classe = jogador.classe + ---@type string + local actorClass = actorObject.classe - if (not classe) then - classe = "monster" + if (not actorClass) then + actorClass = "monster" end - info.classe_icone:SetTexture("Interface\\AddOns\\Details\\images\\classes") --top left - info.SetClassIcon (jogador, classe) + breakdownWindow.classIcon:SetTexture("Interface\\AddOns\\Details\\images\\classes") --top left + breakdownWindow.SetClassIcon(actorObject, actorClass) - Details.FadeHandler.Fader(info, 0) + Details.FadeHandler.Fader(breakdownWindow, 0) Details:UpdateBreakdownPlayerList() Details:InitializeAurasTab() Details:InitializeCompareTab() @@ -395,10 +235,10 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDo local tabsReplaced = {} local tabReplacedAmount = 0 - table.wipe(info.currentTabsInUse) + table.wipe(breakdownWindow.currentTabsInUse) - for index = 1, #_detalhes.player_details_tabs do - local tab = _detalhes.player_details_tabs[index] + for index = 1, #Details.player_details_tabs do + local tab = Details.player_details_tabs[index] tab.replaced = nil tabsShown[#tabsShown+1] = tab end @@ -409,8 +249,8 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDo if (tab.replaces) then local attributeList = tab.replaces.attributes - if (attributeList[info.atributo]) then - if (attributeList[info.atributo][info.sub_atributo]) then + if (attributeList[breakdownWindow.atributo]) then + if (attributeList[breakdownWindow.atributo][breakdownWindow.sub_atributo]) then local tabReplaced, tabIndex = Details:GetBreakdownTabByName(tab.replaces.tabNameToReplace, tabsShown) if (tabReplaced and tabIndex < index) then tabReplaced:Hide() @@ -419,8 +259,8 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDo tremove(tabsShown, tabIndex) tinsert(tabsShown, tabIndex, tab) - if (tabReplaced.tabname == info.selectedTab) then - info.selectedTab = tab.tabname + if (tabReplaced.tabname == breakdownWindow.selectedTab) then + breakdownWindow.selectedTab = tab.tabname end tabReplaced.replaced = true @@ -442,20 +282,20 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDo end tabsShown = newTabsShown - info.currentTabsInUse = newTabsShown + breakdownWindow.currentTabsInUse = newTabsShown - info:ShowTabs() + breakdownWindow:ShowTabs() Details222.BreakdownWindow.CurrentDefaultTab = nil local shownTab for index = 1, #tabsShown do local tabButton = tabsShown[index] - if (tabButton:condition(info.jogador, info.atributo, info.sub_atributo)) then + if (tabButton:condition(breakdownWindow.jogador, breakdownWindow.atributo, breakdownWindow.sub_atributo)) then if (tabButton.IsDefaultTab) then Details222.BreakdownWindow.CurrentDefaultTab = tabButton end - if (info.selectedTab == tabButton.tabname) then + if (breakdownWindow.selectedTab == tabButton.tabname) then tabButton:DoClick() tabButton:OnShowFunc() shownTab = tabButton @@ -466,34 +306,78 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDo if (shownTab) then shownTab:Click() end -end --end of "AbreJanelaInfo()" - - ---alias -function Details:CloseBreakdownWindow(bFromEscape) - return _detalhes:FechaJanelaInfo(bFromEscape) end -function _detalhes:FechaJanelaInfo(fromEscape) - if (info.ativo) then +function Details:CloseBreakdownWindow(fromEscape) + if (breakdownWindow.ativo) then if (fromEscape) then - Details.FadeHandler.Fader(info, "in") + Details.FadeHandler.Fader(breakdownWindow, "in") else - Details.FadeHandler.Fader(info, 1) + Details.FadeHandler.Fader(breakdownWindow, 1) end - info.ativo = false --sinaliza o addon que a janela esta agora fechada + breakdownWindow.ativo = false --sinaliza o addon que a janela esta agora fechada - --_detalhes.info_jogador.detalhes = nil - info.jogador = nil - info.atributo = nil - info.sub_atributo = nil - info.instancia = nil + --Details.info_jogador.detalhes = nil + breakdownWindow.jogador = nil + breakdownWindow.atributo = nil + breakdownWindow.sub_atributo = nil + breakdownWindow.instancia = nil - info.nome:SetText("") - info.atributo_nome:SetText("") + breakdownWindow.actorName:SetText("") + breakdownWindow.attributeName:SetText("") end end +function breakdownWindow:CreateRightSideBar() + breakdownWindow.RightSideBar = CreateFrame("frame", nil, breakdownWindow, "BackdropTemplate") + breakdownWindow.RightSideBar:SetWidth(20) + breakdownWindow.RightSideBar:SetPoint("topleft", breakdownWindow, "topright", 1, 0) + breakdownWindow.RightSideBar:SetPoint("bottomleft", breakdownWindow, "bottomright", 1, 0) + local rightSideBarAlpha = 0.75 + + DetailsFramework:ApplyStandardBackdrop(breakdownWindow.RightSideBar) + + local toggleMergePlayerSpells = function() + Details.merge_player_abilities = not Details.merge_player_abilities + local playerObject = Details:GetActorObjectFromBreakdownWindow() + local instanceObject = Details:GetActiveWindowFromBreakdownWindow() + Details:OpenBreakdownWindow(instanceObject, playerObject) --toggle + Details:OpenBreakdownWindow(instanceObject, playerObject) + end + + local mergePlayerSpellsCheckbox = DetailsFramework:CreateSwitch(breakdownWindow, toggleMergePlayerSpells, Details.merge_player_abilities, _, _, _, _, _, _, _, _, _, _, DetailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE")) + mergePlayerSpellsCheckbox:SetAsCheckBox() + mergePlayerSpellsCheckbox:SetPoint("bottom", breakdownWindow.RightSideBar, "bottom", 0, 2) + + local mergePlayerSpellsLabel = breakdownWindow.RightSideBar:CreateFontString(nil, "overlay", "GameFontNormal") + mergePlayerSpellsLabel:SetText("Merge Player Spells") + DetailsFramework:SetFontRotation(mergePlayerSpellsLabel, 90) + mergePlayerSpellsLabel:SetPoint("center", mergePlayerSpellsCheckbox.widget, "center", -6, mergePlayerSpellsCheckbox:GetHeight()/2 + mergePlayerSpellsLabel:GetStringWidth() / 2) + + -- + + local toggleMergePetSpells = function() + Details.merge_pet_abilities = not Details.merge_pet_abilities + local playerObject = Details:GetActorObjectFromBreakdownWindow() + local instanceObject = Details:GetActiveWindowFromBreakdownWindow() + Details:OpenBreakdownWindow(instanceObject, playerObject) --toggle + Details:OpenBreakdownWindow(instanceObject, playerObject) + end + local mergePetSpellsCheckbox = DetailsFramework:CreateSwitch(breakdownWindow, toggleMergePetSpells, Details.merge_pet_abilities, _, _, _, _, _, _, _, _, _, _, DetailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE")) + mergePetSpellsCheckbox:SetAsCheckBox(true) + mergePetSpellsCheckbox:SetPoint("bottom", breakdownWindow.RightSideBar, "bottom", 0, 160) + + local mergePetSpellsLabel = breakdownWindow.RightSideBar:CreateFontString(nil, "overlay", "GameFontNormal") + mergePetSpellsLabel:SetText("Merge Pet Spells") + DetailsFramework:SetFontRotation(mergePetSpellsLabel, 90) + mergePetSpellsLabel:SetPoint("center", mergePetSpellsCheckbox.widget, "center", -6, mergePetSpellsCheckbox:GetHeight()/2 + mergePetSpellsLabel:GetStringWidth() / 2) + + mergePlayerSpellsCheckbox:SetAlpha(rightSideBarAlpha) + mergePlayerSpellsLabel:SetAlpha(rightSideBarAlpha) + mergePetSpellsCheckbox:SetAlpha(rightSideBarAlpha) + mergePetSpellsLabel:SetAlpha(rightSideBarAlpha) +end + ---@type {[number]: boolean} Details222.BreakdownWindow.ExpandedSpells = {} @@ -511,12 +395,6 @@ function Details222.BreakdownWindow.IsSpellExpanded(spellID) return Details222.BreakdownWindow.ExpandedSpells[spellID] end ---determina qual a pocis�o que a barra de detalhes vai ocupar ------------------------------------------------------------------------------------------------------------------------------- ---namespace -function Details222.BreakdownWindow.GetBlockIndex(index) --getting the infomation from the new spells tab, this will be depreccated soon - return Details.playerDetailWindow.grupos_detalhes[index] -end ---receives spell data to show in the summary tab ---@param data table @@ -534,576 +412,129 @@ function Details222.BreakdownWindow.SendSpellData(data, actorObject, combatObjec end end ---cria os textos em geral da janela info -function breakdownWindow.CreateTexts(SWW) - breakdownWindow.nome = breakdownWindow:CreateFontString(nil, "OVERLAY", "QuestFont_Large") - breakdownWindow.nome:SetPoint("TOPLEFT", breakdownWindow, "TOPLEFT", 105, -54) - - breakdownWindow.atributo_nome = breakdownWindow:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") - - breakdownWindow.avatar = breakdownWindow:CreateTexture(nil, "overlay") - breakdownWindow.avatar_bg = breakdownWindow:CreateTexture(nil, "overlay") - breakdownWindow.avatar_attribute = breakdownWindow:CreateFontString(nil, "overlay", "GameFontHighlightSmall") - breakdownWindow.avatar_nick = breakdownWindow:CreateFontString(nil, "overlay", "QuestFont_Large") - breakdownWindow.avatar:SetDrawLayer("overlay", 3) - breakdownWindow.avatar_bg:SetDrawLayer("overlay", 2) - breakdownWindow.avatar_nick:SetDrawLayer("overlay", 4) - - breakdownWindow.avatar:SetPoint("TOPLEFT", breakdownWindow, "TOPLEFT", 60, -10) - breakdownWindow.avatar_bg:SetPoint("TOPLEFT", breakdownWindow, "TOPLEFT", 60, -12) - breakdownWindow.avatar_bg:SetSize(275, 60) - - breakdownWindow.avatar_nick:SetPoint("TOPLEFT", breakdownWindow, "TOPLEFT", 195, -54) - - breakdownWindow.avatar:Hide() - breakdownWindow.avatar_bg:Hide() - breakdownWindow.avatar_nick:Hide() -end - - -local default_icon_change = function(jogador, classe) +function breakdownWindow.SetClassIcon(jogador, classe) if (classe ~= "UNKNOW" and classe ~= "UNGROUPPLAYER") then - info.classe_icone:SetTexCoord(_detalhes.class_coords [classe][1], _detalhes.class_coords [classe][2], _detalhes.class_coords [classe][3], _detalhes.class_coords [classe][4]) + 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 (_detalhes.faction_against == "Horde") then - info.nome:SetTextColor(1, 91/255, 91/255, 1) + if (Details.faction_against == "Horde") then + breakdownWindow.actorName:SetTextColor(1, 91/255, 91/255, 1) else - info.nome:SetTextColor(151/255, 215/255, 1, 1) + breakdownWindow.actorName:SetTextColor(151/255, 215/255, 1, 1) end else - info.nome:SetTextColor(1, 1, 1, 1) + breakdownWindow.actorName:SetTextColor(1, 1, 1, 1) end else if (jogador.enemy) then - if (_detalhes.class_coords [_detalhes.faction_against]) then - info.classe_icone:SetTexCoord(unpack(_detalhes.class_coords [_detalhes.faction_against])) - if (_detalhes.faction_against == "Horde") then - info.nome:SetTextColor(1, 91/255, 91/255, 1) + 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 - info.nome:SetTextColor(151/255, 215/255, 1, 1) + breakdownWindow.actorName:SetTextColor(151/255, 215/255, 1, 1) end else - info.nome:SetTextColor(1, 1, 1, 1) + breakdownWindow.actorName:SetTextColor(1, 1, 1, 1) end else - info.classe_icone:SetTexCoord(_detalhes.class_coords ["MONSTER"][1], _detalhes.class_coords ["MONSTER"][2], _detalhes.class_coords ["MONSTER"][3], _detalhes.class_coords ["MONSTER"][4]) + breakdownWindow.classIcon:SetTexCoord(Details.class_coords ["MONSTER"][1], Details.class_coords ["MONSTER"][2], Details.class_coords ["MONSTER"][3], Details.class_coords ["MONSTER"][4]) end end end -function _detalhes:InstallPDWSkin(skin_name, func) - if (not skin_name) then - return false -- sem nome - elseif (_detalhes.playerdetailwindow_skins[skin_name]) then - return false -- ja existe - end - - _detalhes.playerdetailwindow_skins[skin_name] = func - return true +function Details:SetBreakdownWindowBackgroundTexture(texture) + breakdownWindow.backgroundTexture:SetTexture(texture) end -function _detalhes:ApplyPDWSkin(skin_name) ---already built - if (not DetailsBreakdownWindow.Loaded) then - if (skin_name) then - _detalhes.player_details_window.skin = skin_name - end - return - end - ---hide extra frames - local window = DetailsBreakdownWindow - if (window.extra_frames) then - for framename, frame in pairs(window.extra_frames) do - frame:Hide() - end - end - ---apply default first - local default_skin = _detalhes.playerdetailwindow_skins["WoWClassic"] - pcall(default_skin.func) - ---than do the change - if (not skin_name) then - skin_name = _detalhes.player_details_window.skin - end - - local skin = _detalhes.playerdetailwindow_skins [skin_name] - if (skin) then - local successful, errortext = pcall(skin.func) - if (not successful) then - _detalhes:Msg("error occurred on skin call():", errortext) - local former_skin = _detalhes.playerdetailwindow_skins [_detalhes.player_details_window.skin] - pcall(former_skin.func) - else - _detalhes.player_details_window.skin = skin_name - end - else - _detalhes:Msg("skin not found.") - end - - if (info and info:IsShown() and info.jogador and info.jogador.classe) then - info.SetClassIcon (info.jogador, info.jogador.classe) - end - - _detalhes:ApplyRPSkin (skin_name) -end - -function _detalhes:SetPlayerDetailsWindowTexture (texture) - DetailsBreakdownWindow.bg1:SetTexture(texture) -end - -function _detalhes:SetPDWBarConfig (texture) - local window = DetailsBreakdownWindow - - if (texture) then - _detalhes.player_details_window.bar_texture = texture - local texture = SharedMedia:Fetch ("statusbar", texture) - - for _, bar in ipairs(window.barras1) do - bar.textura:SetStatusBarTexture(texture) - end - for _, bar in ipairs(window.barras2) do - bar.textura:SetStatusBarTexture(texture) - end - for _, bar in ipairs(window.barras3) do - bar.textura:SetStatusBarTexture(texture) - end - end -end - -local default_skin = function()end -_detalhes:InstallPDWSkin("WoWClassic", {func = default_skin, author = "Details! Team", version = "v1.0", desc = "Default skin."}) --deprecated - -local elvui_skin = function() - local window = DetailsBreakdownWindow - window.bg1:SetTexture([[Interface\AddOns\Details\images\background]], true) - window.bg1:SetAlpha(0.7) - window.bg1:SetVertexColor(0.27, 0.27, 0.27) - window.bg1:SetVertTile(true) - window.bg1:SetHorizTile(true) - window.bg1:SetSize(PLAYER_DETAILS_WINDOW_WIDTH, PLAYER_DETAILS_WINDOW_HEIGHT) - - window:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]}) - window:SetBackdropColor(1, 1, 1, 0.3) - window:SetBackdropBorderColor(0, 0, 0, 1) - local bgs_alpha = 0.6 - - window.leftbars1_backgound:SetPoint("topleft", window.container_barras, "topleft", -2, 3) - window.leftbars1_backgound:SetPoint("bottomright", window.container_barras, "bottomright", 3, -3) - window.leftbars2_backgound:SetPoint("topleft", window.container_alvos, "topleft", -2, 23) - window.leftbars2_backgound:SetPoint("bottomright", window.container_alvos, "bottomright", 4, 0) - - window.leftbars1_backgound:SetAlpha(bgs_alpha) - window.leftbars2_backgound:SetAlpha(bgs_alpha) - - window.right_background1:SetAlpha(bgs_alpha) - window.right_background2:SetAlpha(bgs_alpha) - window.right_background3:SetAlpha(bgs_alpha) - window.right_background4:SetAlpha(bgs_alpha) - window.right_background5:SetAlpha(bgs_alpha) - - window.close_button:GetNormalTexture():SetDesaturated(true) - - local titlebar = window.extra_frames ["ElvUITitleBar"] - if (not titlebar) then - titlebar = CreateFrame("frame", nil, window, "BackdropTemplate") - 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) - window.extra_frames ["ElvUITitleBar"] = titlebar - - local name_bg_texture = window:CreateTexture(nil, "background") - name_bg_texture:SetTexture([[Interface\PetBattles\_PetBattleHorizTile]], true) - name_bg_texture:SetHorizTile(true) - name_bg_texture:SetTexCoord(0, 1, 126/256, 19/256) - name_bg_texture:SetPoint("topleft", window, "topleft", 2, -22) - --name_bg_texture:SetPoint("topright", window, "topright", -2, -22) - name_bg_texture:SetPoint("bottomright", window, "bottomright") - name_bg_texture:SetHeight(54) - name_bg_texture:SetVertexColor(0, 0, 0, 0.2) - window.extra_frames ["ElvUINameTexture"] = name_bg_texture - else - titlebar:Show() - window.extra_frames ["ElvUINameTexture"]:Show() - end - - window.title_string:ClearAllPoints() - window.title_string:SetPoint("center", window, "center") - window.title_string:SetPoint("top", window, "top", 0, -7) - window.title_string:SetParent(titlebar) - window.title_string:SetTextColor(.8, .8, .8, 1) - - window.classe_icone:SetParent(titlebar) - window.classe_icone:SetDrawLayer("overlay") - window.classe_icone:SetPoint("TOPLEFT", window, "TOPLEFT", 2, -25) - window.classe_icone:SetWidth(49) - window.classe_icone:SetHeight(49) - window.classe_icone:SetAlpha(1) - - window.close_button:SetWidth(20) - window.close_button:SetHeight(20) - window.close_button:SetPoint("TOPRIGHT", window, "TOPRIGHT", 0, -3) - - - window.avatar:SetParent(titlebar) - - --bar container - window.container_barras:SetPoint(unpack(containerSettings.spells.point)) - window.container_barras:SetSize(containerSettings.spells.width, containerSettings.spells.height) - - --target container - window.container_alvos:SetPoint(unpack(containerSettings.targets.point)) - window.container_alvos:SetSize(containerSettings.targets.width, containerSettings.targets.height) - - --texts - window.nome:SetPoint("TOPLEFT", window, "TOPLEFT", 105, -48) - - --report button - window.topleft_report:SetPoint("BOTTOMLEFT", window.container_barras, "TOPLEFT", 43, 2) - - --no targets texture - window.no_targets:SetPoint("BOTTOMLEFT", window, "BOTTOMLEFT", 3, 6) - window.no_targets:SetSize(418, 150) - window.no_targets:SetAlpha(0.4) - - --right panel textures - window.bg2_sec_texture:SetPoint("topleft", window.bg1_sec_texture, "topleft", 7, 0) - window.bg2_sec_texture:SetPoint("bottomright", window.bg1_sec_texture, "bottomright", -30, 0) - window.bg2_sec_texture:SetTexture([[Interface\Glues\CREDITS\Warlords\Shadowmoon_Color_jlo3]]) - window.bg2_sec_texture:SetDesaturated(true) - window.bg2_sec_texture:SetAlpha(0) - - window.bg3_sec_texture:SetPoint("topleft", window.bg2_sec_texture, "topleft", 0, 0) - window.bg3_sec_texture:SetPoint("bottomright", window.bg2_sec_texture, "bottomright", 0, 0) - window.bg3_sec_texture:SetTexture(0, 0, 0, 0.3) - - --the 5 spell details blocks - not working - for i, infoblock in ipairs(_detalhes.playerDetailWindow.grupos_detalhes) do - infoblock.bg:SetSize(330, 47) - end - local xLocation = {-85, -136, -191, -246, -301} - local heightTable = {50, 50, 50, 50, 50, 48} - - for i = 1, spellInfoSettings.amount do - window ["right_background" .. i]:SetPoint("topleft", window, "topleft", 351, xLocation [i]) - window ["right_background" .. i]:SetSize(spellInfoSettings.width, heightTable [i]) - - end - - --seta configs dos 5 blocos da direita - info:SetDetailInfoConfigs("Interface\\AddOns\\Details\\images\\bar_background_dark", {1, 1, 1, 0.35}, -6 + 100, 0) - - window.bg1_sec_texture:SetPoint("topleft", window.bg1, "topleft", 446, -86) - window.bg1_sec_texture:SetWidth(337) - window.bg1_sec_texture:SetHeight(362) - - --container 3 bars - local x_start = 56 - local y_start = -10 - - local janela = window.container_detalhes - - container3_bars_pointFunc = function(barra, index) - local y = (index-1) * 17 - y = y*-1 - - barra:SetPoint("LEFT", info.bg1_sec_texture, "LEFT", 0, 0) - barra:SetPoint("RIGHT", info.bg1_sec_texture, "RIGHT", 0, 0) - - --barra:SetPoint("LEFT", janela, "LEFT", x_start, 0) - --barra:SetPoint("RIGHT", janela, "RIGHT", 62, 0) - barra:SetPoint("TOP", janela, "TOP", 0, y+y_start) - end - - for index, barra in ipairs(window.barras3) do - local y = (index-1) * 17 - y = y*-1 - barra:SetPoint("LEFT", janela, "LEFT", x_start, 0) - barra:SetPoint("RIGHT", janela, "RIGHT", 62, 0) - barra:SetPoint("TOP", janela, "TOP", 0, y+y_start) - end - - --scrollbar - do - --get textures - local normalTexture = window.container_barras.cima:GetNormalTexture() - local pushedTexture = window.container_barras.cima:GetPushedTexture() - local disabledTexture = window.container_barras.cima:GetDisabledTexture() - - --set the new textures - normalTexture:SetTexture([[Interface\Buttons\Arrow-Up-Up]]) - pushedTexture:SetTexture([[Interface\Buttons\Arrow-Up-Down]]) - disabledTexture:SetTexture([[Interface\Buttons\Arrow-Up-Disabled]]) - - normalTexture:SetPoint("topleft", window.container_barras.cima, "topleft", 1, 0) - normalTexture:SetPoint("bottomright", window.container_barras.cima, "bottomright", 1, 0) - pushedTexture:SetPoint("topleft", window.container_barras.cima, "topleft", 1, 0) - pushedTexture:SetPoint("bottomright", window.container_barras.cima, "bottomright", 1, 0) - disabledTexture:SetPoint("topleft", window.container_barras.cima, "topleft", 1, 0) - disabledTexture:SetPoint("bottomright", window.container_barras.cima, "bottomright", 1, 0) - - disabledTexture:SetAlpha(0.5) - - window.container_barras.cima:SetSize(16, 16) - window.container_barras.cima:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]}) - window.container_barras.cima:SetBackdropColor(0, 0, 0, 0.3) - window.container_barras.cima:SetBackdropBorderColor(0, 0, 0, 1) - end - - do - --get textures - local normalTexture = window.container_barras.baixo:GetNormalTexture() - local pushedTexture = window.container_barras.baixo:GetPushedTexture() - local disabledTexture = window.container_barras.baixo:GetDisabledTexture() - - --set the new textures - normalTexture:SetTexture([[Interface\Buttons\Arrow-Down-Up]]) - pushedTexture:SetTexture([[Interface\Buttons\Arrow-Down-Down]]) - disabledTexture:SetTexture([[Interface\Buttons\Arrow-Down-Disabled]]) - - normalTexture:SetPoint("topleft", window.container_barras.baixo, "topleft", 1, -4) - normalTexture:SetPoint("bottomright", window.container_barras.baixo, "bottomright", 1, -4) - - pushedTexture:SetPoint("topleft", window.container_barras.baixo, "topleft", 1, -4) - pushedTexture:SetPoint("bottomright", window.container_barras.baixo, "bottomright", 1, -4) - - disabledTexture:SetPoint("topleft", window.container_barras.baixo, "topleft", 1, -4) - disabledTexture:SetPoint("bottomright", window.container_barras.baixo, "bottomright", 1, -4) - - disabledTexture:SetAlpha(0.5) - - window.container_barras.baixo:SetSize(16, 16) - window.container_barras.baixo:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]}) - window.container_barras.baixo:SetBackdropColor(0, 0, 0, 0.3) - window.container_barras.baixo:SetBackdropBorderColor(0, 0, 0, 1) - end - - window.container_barras.slider:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]}) - window.container_barras.slider:SetBackdropColor(0, 0, 0, 0.35) - window.container_barras.slider:SetBackdropBorderColor(0, 0, 0, 1) - - window.container_barras.slider:Altura (containerSettings.spells.scrollHeight) - window.container_barras.slider:cimaPoint (0, 13) - window.container_barras.slider:baixoPoint (0, -13) - - window.container_barras.slider.thumb:SetTexture([[Interface\AddOns\Details\images\icons2]]) - window.container_barras.slider.thumb:SetTexCoord(482/512, 492/512, 104/512, 120/512) - window.container_barras.slider.thumb:SetSize(12, 12) - window.container_barras.slider.thumb:SetVertexColor(0.6, 0.6, 0.6, 0.95) - - -- - - - do - local f = window.container_alvos - - --get textures - local normalTexture = f.cima:GetNormalTexture() - local pushedTexture = f.cima:GetPushedTexture() - local disabledTexture = f.cima:GetDisabledTexture() - - --set the new textures - normalTexture:SetTexture([[Interface\Buttons\Arrow-Up-Up]]) - pushedTexture:SetTexture([[Interface\Buttons\Arrow-Up-Down]]) - disabledTexture:SetTexture([[Interface\Buttons\Arrow-Up-Disabled]]) - - normalTexture:SetPoint("topleft", f.cima, "topleft", 1, 0) - normalTexture:SetPoint("bottomright", f.cima, "bottomright", 1, 0) - pushedTexture:SetPoint("topleft", f.cima, "topleft", 1, 0) - pushedTexture:SetPoint("bottomright", f.cima, "bottomright", 1, 0) - disabledTexture:SetPoint("topleft", f.cima, "topleft", 1, 0) - disabledTexture:SetPoint("bottomright", f.cima, "bottomright", 1, 0) - - disabledTexture:SetAlpha(0.5) - - f.cima:SetSize(16, 16) - f.cima:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]}) - f.cima:SetBackdropColor(0, 0, 0, 0.3) - f.cima:SetBackdropBorderColor(0, 0, 0, 1) - end - - do - local f = window.container_alvos - - --get textures - local normalTexture = f.baixo:GetNormalTexture() - local pushedTexture = f.baixo:GetPushedTexture() - local disabledTexture = f.baixo:GetDisabledTexture() - - --set the new textures - normalTexture:SetTexture([[Interface\Buttons\Arrow-Down-Up]]) - pushedTexture:SetTexture([[Interface\Buttons\Arrow-Down-Down]]) - disabledTexture:SetTexture([[Interface\Buttons\Arrow-Down-Disabled]]) - - normalTexture:SetPoint("topleft", f.baixo, "topleft", 1, -4) - normalTexture:SetPoint("bottomright", f.baixo, "bottomright", 1, -4) - - pushedTexture:SetPoint("topleft", f.baixo, "topleft", 1, -4) - pushedTexture:SetPoint("bottomright", f.baixo, "bottomright", 1, -4) - - disabledTexture:SetPoint("topleft", f.baixo, "topleft", 1, -4) - disabledTexture:SetPoint("bottomright", f.baixo, "bottomright", 1, -4) - - disabledTexture:SetAlpha(0.5) - - f.baixo:SetSize(16, 16) - f.baixo:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]}) - f.baixo:SetBackdropColor(0, 0, 0, 0.3) - f.baixo:SetBackdropBorderColor(0, 0, 0, 1) - end - - window.container_alvos.slider:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]}) - window.container_alvos.slider:SetBackdropColor(0, 0, 0, 0.35) - window.container_alvos.slider:SetBackdropBorderColor(0, 0, 0, 1) - - window.container_alvos.slider:Altura (137) - window.container_alvos.slider:cimaPoint (0, 13) - window.container_alvos.slider:baixoPoint (0, -13) - - window.container_alvos.slider.thumb:SetTexture([[Interface\AddOns\Details\images\icons2]]) - window.container_alvos.slider.thumb:SetTexCoord(482/512, 492/512, 104/512, 120/512) - window.container_alvos.slider.thumb:SetSize(12, 12) - window.container_alvos.slider.thumb:SetVertexColor(0.6, 0.6, 0.6, 0.95) - - --class icon - ---set the spell, spec or class icon - ---@param actorObject actor - ---@param class string|nil - window.SetClassIcon = function(actorObject, class) - if (actorObject.spellicon) then - window.classe_icone:SetTexture(actorObject.spellicon) - window.classe_icone:SetTexCoord(.1, .9, .1, .9) - - elseif (actorObject.spec) then - window.classe_icone:SetTexture([[Interface\AddOns\Details\images\spec_icons_normal_alpha]]) - window.classe_icone:SetTexCoord(unpack(_detalhes.class_specs_coords [actorObject.spec])) - --esta_barra.icone_classe:SetVertexColor(1, 1, 1) - else - local coords = CLASS_ICON_TCOORDS[class] - if (coords) then - info.classe_icone:SetTexture([[Interface\Glues\CHARACTERCREATE\UI-CHARACTERCREATE-CLASSES]]) - local l, r, t, b = unpack(coords) - info.classe_icone:SetTexCoord(l+0.01953125, r-0.01953125, t+0.01953125, b-0.01953125) - else - - local c = _detalhes.class_coords ["MONSTER"] - info.classe_icone:SetTexture("Interface\\AddOns\\Details\\images\\classes") - info.classe_icone:SetTexCoord(c[1], c[2], c[3], c[4]) - end - end - end -end - - - --search key: ~create ~inicio ~start -function gump:CriaJanelaInfo() - local breakdownFrame = info - table.insert(UISpecialFrames, breakdownFrame:GetName()) - breakdownFrame.extra_frames = {} - breakdownFrame.Loaded = true - Details.playerDetailWindow = breakdownFrame +function Details:CreateBreakdownWindow() + table.insert(UISpecialFrames, breakdownWindow:GetName()) + breakdownWindow.extra_frames = {} + breakdownWindow.Loaded = true + Details.playerDetailWindow = breakdownWindow - --stopped: started the skin merge with the window creation - - breakdownFrame:SetWidth(PLAYER_DETAILS_WINDOW_WIDTH) - breakdownFrame:SetHeight(PLAYER_DETAILS_WINDOW_HEIGHT) - breakdownFrame:SetFrameStrata("HIGH") - breakdownFrame:SetToplevel(true) - breakdownFrame:EnableMouse(true) - breakdownFrame:SetResizable(false) - breakdownFrame:SetMovable(true) + breakdownWindow:SetWidth(PLAYER_DETAILS_WINDOW_WIDTH) + breakdownWindow:SetHeight(PLAYER_DETAILS_WINDOW_HEIGHT) + breakdownWindow:SetFrameStrata("HIGH") + breakdownWindow:SetToplevel(true) + breakdownWindow:EnableMouse(true) + breakdownWindow:SetResizable(true) + breakdownWindow:SetMovable(true) --host the textures and fontstring of the default frame of the player breakdown window - breakdownFrame.SummaryWindowWidgets = CreateFrame("frame", "DetailsBreakdownWindowSummaryWidgets", breakdownFrame, "BackdropTemplate") - local SWW = breakdownFrame.SummaryWindowWidgets + --what is the summary window: is the frame where all the widgets for the summary tab are created + breakdownWindow.SummaryWindowWidgets = CreateFrame("frame", "DetailsBreakdownWindowSummaryWidgets", breakdownWindow, "BackdropTemplate") + local SWW = breakdownWindow.SummaryWindowWidgets SWW:SetAllPoints() table.insert(SummaryWidgets, SWW) --where SummaryWidgets is declared: at the header of the file, what is the purpose of this table? - --what is the summary window: is the frame where all the widgets for the summary tab are created + breakdownWindow.SummaryWindowWidgets:Hide() - DetailsFramework:CreateScaleBar(breakdownFrame, Details.player_details_window) - breakdownFrame:SetScale(Details.player_details_window.scale) + DetailsFramework:CreateScaleBar(breakdownWindow, Details.player_details_window) + breakdownWindow:SetScale(Details.player_details_window.scale) --class icon - breakdownFrame.classe_icone = breakdownFrame:CreateTexture(nil, "BACKGROUND", nil, 1) - breakdownFrame.classe_icone:SetPoint("TOPLEFT", breakdownFrame, "TOPLEFT", 4, 0) - breakdownFrame.classe_icone:SetSize(64, 64) + breakdownWindow.classIcon = breakdownWindow:CreateTexture(nil, "BACKGROUND", nil, 1) + breakdownWindow.classIcon:SetPoint("topleft", breakdownWindow, "topleft", 4, 0) + breakdownWindow.classIcon:SetSize(64, 64) - --background topleft? - breakdownFrame.bg1 = breakdownFrame:CreateTexture("DetailsPSWBackground", "BORDER", nil, 1) - breakdownFrame.bg1:SetPoint("TOPLEFT", breakdownFrame, "TOPLEFT", 0, 0) + --background + breakdownWindow.backgroundTexture = breakdownWindow:CreateTexture("$parent", "background", nil, -3) + breakdownWindow.backgroundTexture:SetAllPoints() --close button - breakdownFrame.close_button = CreateFrame("Button", nil, breakdownFrame, "UIPanelCloseButton") - breakdownFrame.close_button:SetSize(32, 32) - breakdownFrame.close_button:SetPoint("TOPRIGHT", breakdownFrame, "TOPRIGHT", 5, -8) - breakdownFrame.close_button:SetText("X") - breakdownFrame.close_button:SetFrameLevel(breakdownFrame:GetFrameLevel()+5) - breakdownFrame.close_button:SetScript("OnClick", function(self) + breakdownWindow.closeButton = CreateFrame("Button", nil, breakdownWindow, "UIPanelCloseButton") + breakdownWindow.closeButton:SetSize(32, 32) + breakdownWindow.closeButton:SetPoint("TOPRIGHT", breakdownWindow, "TOPRIGHT", 5, -8) + breakdownWindow.closeButton:SetText("X") + breakdownWindow.closeButton:SetFrameLevel(breakdownWindow:GetFrameLevel()+5) + breakdownWindow.closeButton:SetScript("OnClick", function(self) Details:CloseBreakdownWindow() end) - --�cone da magia selecionada para mais detalhes (is this a window thing or tab thing?) - --or this is even in use? - --title - DetailsFramework:NewLabel(breakdownFrame, breakdownFrame, nil, "title_string", Loc ["STRING_PLAYER_DETAILS"] .. " (|cFFFF8811Under Maintenance|r)", "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255}) - breakdownFrame.title_string:SetPoint("center", breakdownFrame, "center") - breakdownFrame.title_string:SetPoint("top", breakdownFrame, "top", 0, -18) - - breakdownFrame.topright_text1 = breakdownFrame:CreateFontString(nil, "overlay", "GameFontNormal") - breakdownFrame.topright_text1:SetPoint("bottomright", breakdownFrame, "topright", -18 - (94 * (1-1)), -36) - breakdownFrame.topright_text1:SetJustifyH("right") - DetailsFramework:SetFontSize(breakdownFrame.topright_text1, 10) - - breakdownFrame.topright_text2 = breakdownFrame:CreateFontString(nil, "overlay", "GameFontNormal") - breakdownFrame.topright_text2:SetPoint("bottomright", breakdownFrame, "topright", -18 - (94 * (1-1)), -48) - breakdownFrame.topright_text2:SetJustifyH("right") - DetailsFramework:SetFontSize(breakdownFrame.topright_text2, 10) - - --what goes in the top right text? - looks like it's not in use - function breakdownFrame:SetTopRightTexts(text1, text2, size, color, font) - if (text1) then - breakdownFrame.topright_text1:SetText(text1) - else - breakdownFrame.topright_text1:SetText("") - end - - if (text2) then - breakdownFrame.topright_text2:SetText(text2) - else - breakdownFrame.topright_text2:SetText("") - end - - if (size and type(size) == "number") then - DetailsFramework:SetFontSize(breakdownFrame.topright_text1, size) - DetailsFramework:SetFontSize(breakdownFrame.topright_text2, size) - end - - if (color) then - DetailsFramework:SetFontColor(breakdownFrame.topright_text1, color) - DetailsFramework:SetFontColor(breakdownFrame.topright_text2, color) - end - - if (font) then - DetailsFramework:SetFontFace (breakdownFrame.topright_text1, font) - DetailsFramework:SetFontFace (breakdownFrame.topright_text2, font) - end - end + DetailsFramework:NewLabel(breakdownWindow, breakdownWindow, nil, "titleText", Loc ["STRING_PLAYER_DETAILS"] .. " (|cFFFF8811Under Maintenance|r)", "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255}) + breakdownWindow.titleText:SetPoint("center", breakdownWindow, "center") + breakdownWindow.titleText:SetPoint("top", breakdownWindow, "top", 0, -18) --create the texts shown on the window - breakdownWindow.CreateTexts(SWW) + do + breakdownWindow.actorName = breakdownWindow:CreateFontString(nil, "OVERLAY", "QuestFont_Large") + breakdownWindow.actorName:SetPoint("TOPLEFT", breakdownWindow, "TOPLEFT", 105, -54) - breakdownFrame.SetClassIcon = default_icon_change + breakdownWindow.attributeName = breakdownWindow:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") + + breakdownWindow.avatar = breakdownWindow:CreateTexture(nil, "overlay") + breakdownWindow.avatar_bg = breakdownWindow:CreateTexture(nil, "overlay") + breakdownWindow.avatar_attribute = breakdownWindow:CreateFontString(nil, "overlay", "GameFontHighlightSmall") + breakdownWindow.avatar_nick = breakdownWindow:CreateFontString(nil, "overlay", "QuestFont_Large") + breakdownWindow.avatar:SetDrawLayer("overlay", 3) + breakdownWindow.avatar_bg:SetDrawLayer("overlay", 2) + breakdownWindow.avatar_nick:SetDrawLayer("overlay", 4) + + breakdownWindow.avatar:SetPoint("TOPLEFT", breakdownWindow, "TOPLEFT", 60, -10) + breakdownWindow.avatar_bg:SetPoint("TOPLEFT", breakdownWindow, "TOPLEFT", 60, -12) + breakdownWindow.avatar_bg:SetSize(275, 60) + + breakdownWindow.avatar_nick:SetPoint("TOPLEFT", breakdownWindow, "TOPLEFT", 195, -54) + + breakdownWindow.avatar:Hide() + breakdownWindow.avatar_bg:Hide() + breakdownWindow.avatar_nick:Hide() + end + + --create the gradients in the top and bottom side of the breakdown window + do + local gradientStartColor = Details222.ColorScheme.GetColorFor("gradient-background") + local gradientUp = DetailsFramework:CreateTexture(breakdownWindow, {gradient = "vertical", fromColor = "transparent", toColor = gradientStartColor}, 1, 300, "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, breakdownFrame, "BackdropTemplate") - statusBar:SetPoint("bottomleft", breakdownFrame, "bottomleft") - statusBar:SetPoint("bottomright", breakdownFrame, "bottomright") + local statusBar = CreateFrame("frame", nil, breakdownWindow, "BackdropTemplate") + statusBar:SetPoint("bottomleft", breakdownWindow, "bottomleft") + statusBar:SetPoint("bottomright", breakdownWindow, "bottomright") statusBar:SetHeight(PLAYER_DETAILS_STATUSBAR_HEIGHT) DetailsFramework:ApplyStandardBackdrop(statusBar) statusBar:SetAlpha(PLAYER_DETAILS_STATUSBAR_ALPHA) @@ -1111,9 +542,9 @@ function gump:CriaJanelaInfo() statusBar.Text = DetailsFramework:CreateLabel(statusBar) statusBar.Text:SetPoint("left", 2, 0) - function breakdownFrame:SetStatusbarText(text, fontSize, fontColor) + function breakdownWindow:SetStatusbarText(text, fontSize, fontColor) if (not text) then - breakdownFrame:SetStatusbarText("Details! Damage Meter | Use '/details stats' for statistics", 10, "gray") + breakdownWindow:SetStatusbarText("Details! Damage Meter | Use '/details stats' for statistics", 10, "gray") return end statusBar.Text.text = text @@ -1122,14 +553,11 @@ function gump:CriaJanelaInfo() end --set default text - breakdownFrame:SetStatusbarText() - - --apply default skin - --_detalhes:ApplyPDWSkin() + breakdownWindow:SetStatusbarText() -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --tabs ~tabs - function breakdownFrame:ShowTabs() + function breakdownWindow:ShowTabs() local tabsShown = 0 local secondRowIndex = 1 local breakLine = 6 --the tab it'll start the second line @@ -1139,14 +567,14 @@ function gump:CriaJanelaInfo() for index = 1, #tablePool do local tab = tablePool[index] - if (tab:condition(info.jogador, info.atributo, info.sub_atributo) and not tab.replaced) then + if (tab:condition(breakdownWindow.jogador, breakdownWindow.atributo, breakdownWindow.sub_atributo) and not tab.replaced) then --test if can show the tutorial for the comparison tab if (tab.tabname == "Compare") then - --_detalhes:SetTutorialCVar ("DETAILS_INFO_TUTORIAL1", false) - if (not _detalhes:GetTutorialCVar("DETAILS_INFO_TUTORIAL1")) then - _detalhes:SetTutorialCVar ("DETAILS_INFO_TUTORIAL1", true) + --Details:SetTutorialCVar ("DETAILS_INFO_TUTORIAL1", false) + if (not Details:GetTutorialCVar("DETAILS_INFO_TUTORIAL1")) then + Details:SetTutorialCVar ("DETAILS_INFO_TUTORIAL1", true) - local alert = CreateFrame("frame", "DetailsInfoPopUp1", info, "DetailsHelpBoxTemplate") + local alert = CreateFrame("frame", "DetailsInfoPopUp1", breakdownWindow, "DetailsHelpBoxTemplate") alert.ArrowUP:Show() alert.ArrowGlowUP:Show() alert.Text:SetText(Loc ["STRING_INFO_TUTORIAL_COMPARISON1"]) @@ -1168,18 +596,18 @@ function gump:CriaJanelaInfo() if (PixelUtil) then PixelUtil.SetSize(tab, buttonTemplate.width, buttonTemplate.height) if (tabsShown >= breakLine) then --next row of icons - PixelUtil.SetPoint(tab, "bottomright", info, "topright", -514 + (buttonWidth * (secondRowIndex)), -50) + PixelUtil.SetPoint(tab, "bottomright", breakdownWindow, "topright", -514 + (buttonWidth * (secondRowIndex)), -50) secondRowIndex = secondRowIndex + 1 else - PixelUtil.SetPoint(tab, "bottomright", info, "topright", -514 + (buttonWidth * tabsShown), -72) + PixelUtil.SetPoint(tab, "bottomright", breakdownWindow, "topright", -514 + (buttonWidth * tabsShown), -72) end else tab:SetSize(buttonTemplate.width, buttonTemplate.height) if (tabsShown >= breakLine) then --next row of icons - tab:SetPoint("bottomright", info, "topright", -514 + (buttonWidth * (secondRowIndex)), -50) + tab:SetPoint("bottomright", breakdownWindow, "topright", -514 + (buttonWidth * (secondRowIndex)), -50) secondRowIndex = secondRowIndex + 1 else - tab:SetPoint("bottomright", info, "topright", -514 + (buttonWidth * tabsShown), -72) + tab:SetPoint("bottomright", breakdownWindow, "topright", -514 + (buttonWidth * tabsShown), -72) end end @@ -1191,34 +619,34 @@ function gump:CriaJanelaInfo() end if (tabsShown < 2) then - tablePool[1]:SetPoint("BOTTOMLEFT", info.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 - breakdownFrame:SetScript("OnHide", function(self) - _detalhes:FechaJanelaInfo() - for _, tab in ipairs(_detalhes.player_details_tabs) do + breakdownWindow:SetScript("OnHide", function(self) + Details:CloseBreakdownWindow() + for _, tab in ipairs(Details.player_details_tabs) do tab:Hide() tab.frame:Hide() end end) - breakdownFrame.tipo = 1 --tipo da janela // 1 = janela normal - return breakdownFrame + breakdownWindow.tipo = 1 --tipo da janela // 1 = janela normal + return breakdownWindow end -info.selectedTab = "Summary" +breakdownWindow.selectedTab = "Summary" -function _detalhes:CreatePlayerDetailsTab(tabName, locName, conditionFunc, fillFunc, tabOnClickFunc, onCreateFunc, iconSettings, replace, bIsDefaultTab) --~tab +function Details:CreatePlayerDetailsTab(tabName, locName, conditionFunc, fillFunc, tabOnClickFunc, onCreateFunc, iconSettings, replace, bIsDefaultTab) --~tab if (not tabName) then tabName = "unnamed" end --create a button for the tab --tabOnClickFunc - local newTabButton = gump:CreateButton(info, function()end, 20, 20, nil, nil, nil, nil, nil, breakdownWindow:GetName() .. "TabButton" .. tabName .. math.random(1, 1000)) + local newTabButton = gump:CreateButton(breakdownWindow, function()end, 20, 20, nil, nil, nil, nil, nil, breakdownWindow:GetName() .. "TabButton" .. tabName .. math.random(1, 1000)) newTabButton:SetTemplate("DETAILS_TAB_BUTTON_TEMPLATE") if (tabName == "Summary") then newTabButton:SetTemplate("DETAILS_TAB_BUTTONSELECTED_TEMPLATE") @@ -1228,7 +656,7 @@ function _detalhes:CreatePlayerDetailsTab(tabName, locName, conditionFunc, fillF newTabButton:SetText(locName) newTabButton:SetFrameStrata("HIGH") - newTabButton:SetFrameLevel(info:GetFrameLevel()+1) + newTabButton:SetFrameLevel(breakdownWindow:GetFrameLevel()+1) newTabButton:Hide() newTabButton.condition = conditionFunc @@ -1240,13 +668,12 @@ function _detalhes:CreatePlayerDetailsTab(tabName, locName, conditionFunc, fillF ---@type tabframe local tabFrame = CreateFrame("frame", breakdownWindow:GetName() .. "TabFrame" .. tabName .. math.random(1, 1000), UIParent, "BackdropTemplate") - DetailsFramework:ApplyStandardBackdrop(tabFrame) newTabButton.tabFrame = tabFrame newTabButton.frame = tabFrame - tabFrame:SetParent(info) + tabFrame:SetParent(breakdownWindow) tabFrame:SetFrameStrata("HIGH") - tabFrame:SetFrameLevel(info:GetFrameLevel()+5) + tabFrame:SetFrameLevel(breakdownWindow:GetFrameLevel()+5) tabFrame:EnableMouse(true) tabFrame:SetPoint("topleft", breakdownWindow, "topleft", 0, -70) tabFrame:SetPoint("bottomright", breakdownWindow, "bottomright", 0, 20) @@ -1268,11 +695,11 @@ function _detalhes:CreatePlayerDetailsTab(tabName, locName, conditionFunc, fillF if (newTabButton.fillfunction) then tabFrame:SetScript("OnShow", function() - if (newTabButton.last_actor == info.jogador) then + if (newTabButton.last_actor == breakdownWindow.jogador) then return end - newTabButton.last_actor = info.jogador - newTabButton:fillfunction(info.jogador, info.instancia.showing) + newTabButton.last_actor = breakdownWindow.jogador + newTabButton:fillfunction(breakdownWindow.jogador, breakdownWindow.instancia.showing) end) end @@ -1281,7 +708,7 @@ function _detalhes:CreatePlayerDetailsTab(tabName, locName, conditionFunc, fillF end newTabButton.replaces = replace - _detalhes.player_details_tabs[#_detalhes.player_details_tabs+1] = newTabButton + Details.player_details_tabs[#Details.player_details_tabs+1] = newTabButton local onTabClickCallback = function(self) self = self.MyObject or self @@ -1292,7 +719,7 @@ function _detalhes:CreatePlayerDetailsTab(tabName, locName, conditionFunc, fillF end self:SetTemplate("DETAILS_TAB_BUTTONSELECTED_TEMPLATE") - info.selectedTab = self.tabname + breakdownWindow.selectedTab = self.tabname end if (not tabOnClickFunc) then diff --git a/frames/window_playerbreakdown_list.lua b/frames/window_playerbreakdown_list.lua index 448420e8..8f3d6da5 100644 --- a/frames/window_playerbreakdown_list.lua +++ b/frames/window_playerbreakdown_list.lua @@ -57,8 +57,8 @@ end local lineOnClick = function(self) - if (self.playerObject ~= Details:GetPlayerObjectFromBreakdownWindow()) then - Details:OpenPlayerBreakdown(Details:GetActiveWindowFromBreakdownWindow(), self.playerObject) + if (self.playerObject ~= Details:GetActorObjectFromBreakdownWindow()) then + Details:OpenBreakdownWindow(Details:GetActiveWindowFromBreakdownWindow(), self.playerObject) f.playerScrollBox:Refresh() end end @@ -80,7 +80,7 @@ end local updatePlayerLine = function(self, topResult, encounterId, difficultyId) --~update - local playerSelected = Details:GetPlayerObjectFromBreakdownWindow() + local playerSelected = Details:GetActorObjectFromBreakdownWindow() if (playerSelected and playerSelected == self.playerObject) then self:SetBackdropColor(unpack(scrollbox_line_backdrop_color_selected)) self.isSelected = true diff --git a/frames/window_playerbreakdown_spells.lua b/frames/window_playerbreakdown_spells.lua index 82e94f5b..12995095 100644 --- a/frames/window_playerbreakdown_spells.lua +++ b/frames/window_playerbreakdown_spells.lua @@ -31,11 +31,6 @@ local spellBlockContainerSettings = { local spellBreakdownSettings = {} -local row_backdrop = {bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", - insets = {left = 0, right = 0, top = 0, bottom = 0}} -local row_backdrop_onleave = {bgFile = "", edgeFile = "", tile = true, tileSize = 16, edgeSize = 32, - insets = {left = 1, right = 1, top = 0, bottom = 1}} - local CONST_BAR_HEIGHT = 20 local CONST_TARGET_HEIGHT = 18 @@ -82,13 +77,13 @@ local columnInfo = { {name = "amount", label = "total", width = 50, align = "left", enabled = true}, {name = "persecond", label = "ps", width = 50, align = "left", enabled = true}, {name = "percent", label = "%", width = 50, align = "left", enabled = true}, - {name = "casts", label = "casts", width = 40, align = "left", enabled = true}, - {name = "critpercent", label = "crit %", width = 40, align = "left", enabled = true}, - {name = "hits", label = "hits", width = 40, align = "left", enabled = true}, - {name = "castavg", label = "cast avg", width = 50, align = "left", enabled = true}, - {name = "uptime", label = "uptime", width = 45, align = "left", enabled = true}, - {name = "overheal", label = "overheal", width = 45, align = "left", enabled = true, attribute = DETAILS_ATTRIBUTE_HEAL}, - {name = "absorbed", label = "absorbed", width = 45, align = "left", enabled = true, attribute = DETAILS_ATTRIBUTE_HEAL}, + {name = "casts", label = "casts", width = 40, align = "left", enabled = false}, + {name = "critpercent", label = "crit %", width = 40, align = "left", enabled = false}, + {name = "hits", label = "hits", width = 40, align = "left", enabled = false}, + {name = "castavg", label = "cast avg", width = 50, align = "left", enabled = false}, + {name = "uptime", label = "uptime", width = 45, align = "left", enabled = false}, + {name = "overheal", label = "overheal", width = 45, align = "left", enabled = false, attribute = DETAILS_ATTRIBUTE_HEAL}, + {name = "absorbed", label = "absorbed", width = 45, align = "left", enabled = false, attribute = DETAILS_ATTRIBUTE_HEAL}, } function spellsTab.BuildHeaderTable() @@ -187,6 +182,7 @@ end --called when the tab is getting created function spellsTab.OnCreateTabCallback(tabButton, tabFrame) spellBreakdownSettings = Details.breakdown_spell_tab + DetailsFramework:ApplyStandardBackdrop(tabFrame) --create the scrollbar to show the spells in the breakdown window ---@type breakdownspellscrollframe @@ -209,13 +205,10 @@ function spellsTab.OnCreateTabCallback(tabButton, tabFrame) spellsTab.CreateReportButtons(tabFrame) --these bars table are kinda deprecated now: - --store the spell bars for the spell container - tabFrame.barras1 = {} - --store the target bars for the target container - tabFrame.barras2 = {} + tabFrame.barras1 = {} --deprecated --store the special bars shown in the right side of the breakdown window, this is only shown when spellBlocks aren't in use - tabFrame.barras3 = {} + tabFrame.barras3 = {} --deprecated spellsTab.TabFrame = tabFrame end @@ -332,15 +325,6 @@ do --hide bars functions - to be refactored for index = 1, #allBars, 1 do allBars[index]:Hide() allBars[index].textura:SetStatusBarColor(1, 1, 1, 1) - allBars[index].on_focus = false - end - end - - --hide all the bars of the player's targets - function spellsTab.HidaAllBarrasAlvo() - local allBars = _detalhes.playerDetailWindow.barras2 - for index = 1, #allBars, 1 do - allBars[index]:Hide() end end @@ -604,11 +588,11 @@ local onEnterBreakdownSpellBar = function(spellBar) --parei aqui: precisa por no blockLine1.leftText:SetText(Loc ["STRING_CAST"] .. ": " .. spellBar.amountCasts) --total amount of casts blockLine1.rightText:SetText(Loc ["STRING_HITS"]..": " .. totalHits) --hits and uptime - blockLine2.leftText:SetText(Loc ["STRING_DAMAGE"]..": " .. Details:Format(spellTable.total)) --total damage + blockLine2.leftText:SetText(Loc ["STRING_HEAL"]..": " .. Details:Format(spellTable.total)) --total damage blockLine2.rightText:SetText(Details:GetSpellSchoolFormatedName(spellTable.spellschool)) --spell school blockLine3.leftText:SetText(Loc ["STRING_AVERAGE"] .. ": " .. Details:Format(spellBar.average)) --average damage - blockLine3.rightText:SetText(Loc ["STRING_DPS"] .. ": " .. Details:CommaValue(spellBar.perSecond)) --dps + blockLine3.rightText:SetText(Loc ["STRING_HPS"] .. ": " .. Details:CommaValue(spellBar.perSecond)) --dps end --check if there's normal hits and build the block @@ -639,7 +623,7 @@ local onEnterBreakdownSpellBar = function(spellBar) --parei aqui: precisa por no local tempo = (elapsedTime * spellTable.n_total) / math.max(spellTable.total, 0.001) local normalAveragePercent = spellBar.average / normalAverage * 100 local normalTempoPercent = normalAveragePercent * tempo / 100 - blockLine3.rightText:SetText(Loc ["STRING_DPS"] .. ": " .. Details:CommaValue(spellTable.n_total / normalTempoPercent)) + blockLine3.rightText:SetText(Loc ["STRING_HPS"] .. ": " .. Details:CommaValue(spellTable.n_total / normalTempoPercent)) end ---@type number @@ -668,7 +652,36 @@ local onEnterBreakdownSpellBar = function(spellBar) --parei aqui: precisa por no local tempo = (elapsedTime * spellTable.c_total) / math.max(spellTable.total, 0.001) local critAveragePercent = spellBar.average / critAverage * 100 local critTempoPercent = critAveragePercent * tempo / 100 - blockLine3.rightText:SetText(Loc ["STRING_DPS"] .. ": " .. Details:CommaValue(spellTable.c_total / critTempoPercent)) + blockLine3.rightText:SetText(Loc ["STRING_HPS"] .. ": " .. Details:CommaValue(spellTable.c_total / critTempoPercent)) + end + + ---@type number + local overheal = spellTable.overheal + if (overheal > 0) then + blockIndex = blockIndex + 1 --skip one block + ---@type breakdownspellblock + local critHitsBlock = spellBlockContainer:GetBlock(blockIndex) + critHitsBlock:Show() + blockIndex = blockIndex + 1 + + local blockName + if (spellTable.is_shield) then + blockName = Loc ["STRING_SHIELD_OVERHEAL"] + else + blockName = Loc ["STRING_OVERHEAL"] + end + + local percent = overheal / (overheal + spellTable.total) * 100 + critHitsBlock:SetValue(percent) + critHitsBlock.sparkTexture:SetPoint("left", critHitsBlock, "left", percent / 100 * critHitsBlock:GetWidth() + spellBreakdownSettings.blockspell_spark_offset, 0) + critHitsBlock:SetStatusBarColor(1, 1, 1, .5) + + local blockLine1, blockLine2, blockLine3 = critHitsBlock:GetLines() + blockLine1.leftText:SetText(blockName) + + local overhealString = Details:CommaValue(overheal) + local overhealText = overhealString .. " / " .. string.format("%.1f", percent) .. "%" + blockLine1.rightText:SetText(overhealText) end end @@ -682,74 +695,56 @@ end ---run this function when the mouse leaves a breakdownspellbar ---@param spellBar breakdownspellbar local onLeaveBreakdownSpellBar = function(spellBar) - --diminui o tamanho da barra + --remove effects on entering the bar line spellBar:SetHeight(CONST_SPELLSCROLL_LINEHEIGHT) - --volta com o alfa antigo da barra que era de 0.9 spellBar:SetAlpha(0.9) - --volto o background ao normal - spellBar:SetBackdrop(row_backdrop_onleave) - spellBar:SetBackdropBorderColor(0, 0, 0, 0) - spellBar:SetBackdropColor(0, 0, 0, 0) - GameTooltip:Hide() GameCooltip:Hide() - - if (spellBar.isMain) then - --retira o zoom no icone - spellBar.spellIcon:SetSize(CONST_SPELLSCROLL_LINEHEIGHT, CONST_SPELLSCROLL_LINEHEIGHT) - spellBar.spellIcon:SetAlpha(1) - - --remover o conte�do que estava sendo mostrado na direita - if (breakdownWindow.mostrando_mouse_over) then - breakdownWindow.mostrando = nil - breakdownWindow.mostrando_mouse_over = false - breakdownWindow.showing = nil - breakdownWindow.jogador.detalhes = nil - spellsTab.HidaAllDetalheInfo() - end - - elseif (spellBar.isAlvo) then - spellBar:SetHeight(CONST_TARGET_HEIGHT) - - elseif (spellBar.isDetalhe) then - spellBar:SetHeight(16) - end end ---on mouse down a breakdownspellbar in the breakdown window ---@param spellBar breakdownspellbar ---@param button string local onMouseDownBreakdownSpellBar = function(spellBar, button) - local x, y = _G.GetCursorPosition() - spellBar.cursorPosX = math.floor(x) - spellBar.cursorPosY = math.floor(y) - Details222.PlayerBreakdown.OnMouseDown(spellBar, button) + print(1, spellBar:GetName()) + if false then + local x, y = _G.GetCursorPosition() + spellBar.cursorPosX = math.floor(x) + spellBar.cursorPosY = math.floor(y) + Details222.PlayerBreakdown.OnMouseDown(spellBar, button) + end end ---on mouse up a breakdownspellbar in the breakdown window ---@param spellBar breakdownspellbar ---@param button string local onMouseUpBreakdownSpellBar = function(spellBar, button) - if (spellBar.onMouseUpTime == GetTime()) then - return + print(2, spellBar:GetName()) + if false then + if (spellBar.onMouseUpTime == GetTime()) then + return + end + + spellBar.onMouseUpTime = GetTime() + + ---@type number, number + local x, y = _G.GetCursorPosition() + x = math.floor(x) + y = math.floor(y) + + ---@type boolean + local bIsMouseInTheSamePosition = (x == spellBar.cursorPosX) and (y == spellBar.cursorPosY) + + --if the mouse is in the same position, then the user clicked the bar + --clicking the bar activate the lock mechanism + if (bIsMouseInTheSamePosition) then + spellsTab.SelectSpellBar(spellBar) + end end - spellBar.onMouseUpTime = GetTime() - - ---@type number, number - local x, y = _G.GetCursorPosition() - x = math.floor(x) - y = math.floor(y) - - ---@type boolean - local bIsMouseInTheSamePosition = (x == spellBar.cursorPosX) and (y == spellBar.cursorPosY) - - --if the mouse is in the same position, then the user clicked the bar - --clicking the bar activate the lock mechanism - if (bIsMouseInTheSamePosition) then - spellsTab.SelectSpellBar(spellBar) - end + --print("selecting spell bar") + --spellsTab.SelectSpellBar(spellBar) end @@ -1340,7 +1335,7 @@ function spellsTab.CreateSpellScrollContainer(tabFrame) local headerTable = {} - scrollFrame.Header = DetailsFramework:CreateHeader(scrollFrame, headerTable, headerOptions) + scrollFrame.Header = DetailsFramework:CreateHeader(tabFrame, headerTable, headerOptions) scrollFrame.Header:SetPoint("topleft", scrollFrame, "topleft", 0, 0) --create the scroll lines @@ -1375,7 +1370,7 @@ local onEnterSpellTarget = function(targetFrame) local spellId = targetFrame.spellId ---@type actor - local actorObject = Details:GetPlayerObjectFromBreakdownWindow() + local actorObject = Details:GetActorObjectFromBreakdownWindow() local targets if (targetFrame.bIsMainLine) then @@ -1549,16 +1544,45 @@ end ---@param index number ---@return breakdownspellbar function spellsTab.CreateSpellBar(self, index) --~spellbar ~spellline ~spell ~create ~createline + + if (index == 1) then + --on this debug the onmousedown and onmouseup are working properly because is parented to the breakdownWindow + --but not on the spellbar which is parented to the spellscrollframe + local b = CreateFrame("button", nil, breakdownWindow, "BackdropTemplate") + b:SetSize(64, 64) + b:EnableMouse(true) + b:RegisterForClicks("AnyUp", "AnyDown") + b:SetPoint("topleft", breakdownWindow, "topleft", 50, -30) + b:SetScript("OnMouseDown", function() print("hi") end) + b:SetScript("OnMouseUp", function() print("bye") end) + DF:ApplyStandardBackdrop(b) + end + + local buttonTest = CreateFrame("button", self:GetName() .. "SpellBarTest" .. index, self, "BackdropTemplate") + buttonTest:SetSize(64, 64) + buttonTest:EnableMouse(true) + buttonTest:RegisterForClicks("AnyUp", "AnyDown") + buttonTest:SetFrameStrata("TOOLTIP") + buttonTest:SetScript("OnMouseDown", function() print("hi") end) + buttonTest:SetScript("OnMouseUp", function() print("bye") end) + DF:ApplyStandardBackdrop(buttonTest) + ---@type breakdownspellbar local spellBar = CreateFrame("button", self:GetName() .. "SpellBar" .. index, self, "BackdropTemplate") - spellBar:SetHeight(CONST_SPELLSCROLL_LINEHEIGHT) spellBar.index = index + + --size and positioning + spellBar:SetHeight(CONST_SPELLSCROLL_LINEHEIGHT) local y = (index-1) * CONST_SPELLSCROLL_LINEHEIGHT * -1 + (1 * -index) - 15 spellBar:SetPoint("topleft", self, "topleft", 0, y) spellBar:SetPoint("topright", self, "topright", 0, y) - spellBar:SetFrameLevel(self:GetFrameLevel() + 1) + + buttonTest:SetPoint("topleft", self, "topleft", 0, y) + spellBar:EnableMouse(true) - spellBar:RegisterForClicks("LeftButtonDown", "RightButtonUp") + spellBar:RegisterForClicks("AnyUp", "AnyDown") + spellBar:SetAlpha(0.9) + spellBar:SetFrameStrata("HIGH") spellBar:SetScript("OnEnter", onEnterBreakdownSpellBar) spellBar:SetScript("OnLeave", onLeaveBreakdownSpellBar) spellBar:SetScript("OnMouseDown", onMouseDownBreakdownSpellBar) @@ -1567,9 +1591,11 @@ function spellsTab.CreateSpellBar(self, index) --~spellbar ~spellline ~spell ~cr spellBar.ExpandedChildren = {} DF:Mixin(spellBar, DF.HeaderFunctions) + DF:Mixin(buttonTest, DF.HeaderFunctions) ---@type statusbar local statusBar = CreateFrame("StatusBar", "$parentStatusBar", spellBar, "BackdropTemplate") + statusBar:EnableMouse(false) statusBar:SetFrameLevel(spellBar:GetFrameLevel()-1) statusBar:SetAllPoints() statusBar:SetAlpha(0.5) @@ -1672,91 +1698,9 @@ function spellsTab.CreateSpellBar(self, index) --~spellbar ~spellline ~spell ~cr end spellBar:AlignWithHeader(self.Header, "left") - - spellBar.on_focus = false - return spellBar end - ---[=[ -function gump:CriaNovaBarraInfo2(instance, index) --not used on this file, used on class damage, heal, etc - if (_detalhes.playerDetailWindow.barras2[index]) then - return - end - - local janela = info.container_alvos.gump - - local newBar = CreateFrame("Button", "Details_infobox2_bar_" .. index, info.container_alvos.gump, "BackdropTemplate") - newBar:SetHeight(CONST_TARGET_HEIGHT) - - local y = (index-1) * (CONST_TARGET_HEIGHT + 1) - y = y* - 1 - - newBar:SetPoint("LEFT", janela, "LEFT", CONST_TARGET_HEIGHT, 0) - newBar:SetPoint("RIGHT", janela, "RIGHT", 0, 0) - newBar:SetPoint("TOP", janela, "TOP", 0, y) - newBar:SetFrameLevel(janela:GetFrameLevel() + 1) - newBar:EnableMouse(true) - newBar:RegisterForClicks("LeftButtonDown","RightButtonUp") - - --icon - newBar.icone = newBar:CreateTexture(nil, "OVERLAY") - newBar.icone:SetWidth(CONST_TARGET_HEIGHT) - newBar.icone:SetHeight(CONST_TARGET_HEIGHT) - newBar.icone:SetPoint("RIGHT", newBar, "LEFT", 0, 0) - - CriaTexturaBarra(newBar) - - newBar:SetAlpha(ALPHA_BLEND_AMOUNT) - newBar.icone:SetAlpha(1) - - newBar.isAlvo = true - - SetBarraScripts(newBar, instance, index) - - info.barras2[index] = newBar --barra adicionada - - return newBar -end - -function gump:CriaNovaBarraInfo3(instance, index) --not used on this file, used on class damage, heal, etc - if (_detalhes.playerDetailWindow.barras3[index]) then - return - end - - local janela = info.container_detalhes - - local newBar = CreateFrame("button", "Details_infobox3_bar_" .. index, janela, "BackdropTemplate") - newBar:SetHeight(16) - - local y = (index-1) * 17 - y = y*-1 - - container3_bars_pointFunc(newBar, index) --what this fun does? - newBar:EnableMouse(true) - - --icon - newBar.icone = newBar:CreateTexture(nil, "OVERLAY") - newBar.icone:SetWidth(14) - newBar.icone:SetHeight(14) - newBar.icone:SetPoint("LEFT", newBar, "LEFT", 0, 0) - - CriaTexturaBarra(newBar) - - newBar:SetAlpha(0.9) - newBar.icone:SetAlpha(1) - - newBar.isDetalhe = true - - SetBarraScripts(newBar, instance, index) - - info.barras3[index] = newBar - - return newBar -end ---]=] - ----------------------------------------------------------------------------------------------------------------------- --> report data diff --git a/functions/macros.lua b/functions/macros.lua index 10e66774..a208ddeb 100644 --- a/functions/macros.lua +++ b/functions/macros.lua @@ -9,9 +9,9 @@ function Details:OpenPlayerDetails(window) if (instance) then local display, subDisplay = instance:GetDisplay() if (display == 1) then - instance:AbreJanelaInfo (Details:GetPlayer(false, 1)) + Details:OpenBreakdownWindow(instance, Details:GetPlayer(false, 1)) elseif (display == 2) then - instance:AbreJanelaInfo (Details:GetPlayer(false, 2)) + Details:OpenBreakdownWindow(instance, Details:GetPlayer(false, 2)) end end end \ No newline at end of file diff --git a/functions/mixin.lua b/functions/mixin.lua index cc3f4937..5234e09e 100644 --- a/functions/mixin.lua +++ b/functions/mixin.lua @@ -146,6 +146,10 @@ local spellTable_FieldsToSum = { ["b_dmg"] = true, ["a_amt"] = true, ["a_dmg"] = true, + ["totalabsorb"] = true, + ["absorbed"] = true, + ["overheal"] = true, + ["totaldenied"] = true, } ---get the array of spelltables and sum each spellTable with the first spellTable found or on targetTable diff --git a/functions/profiles.lua b/functions/profiles.lua index 81d9e161..f4afb2a8 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -471,9 +471,6 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy) --update tooltip settings _detalhes:SetTooltipBackdrop() - --update player detail window - _detalhes:ApplyPDWSkin() - --update the numerical system _detalhes:SelectNumericalSystem() diff --git a/startup.lua b/startup.lua index b9450a2c..9ccb9d65 100644 --- a/startup.lua +++ b/startup.lua @@ -94,7 +94,7 @@ function Details:StartMeUp() Details.MicroButtonAlert:Hide() --actor details window - Details.playerDetailWindow = Details.gump:CriaJanelaInfo() + Details.playerDetailWindow = Details:CreateBreakdownWindow() Details.FadeHandler.Fader(Details.playerDetailWindow, 1) --copy and paste window From f947e26945636518754ae70b519d481159702f43 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Wed, 12 Apr 2023 19:58:49 -0300 Subject: [PATCH 04/22] Reemove all startmoving scripts to be re-write soon --- Definitions.lua | 1 + classes/class_instance.lua | 21 ++-- core/control.lua | 21 ++-- frames/window_playerbreakdown.lua | 116 +++++++++++----------- frames/window_playerbreakdown_spells.lua | 117 +++++------------------ 5 files changed, 108 insertions(+), 168 deletions(-) diff --git a/Definitions.lua b/Definitions.lua index 8a122757..a3413dee 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -415,6 +415,7 @@ ---@field texture texture ---@class breakdownspellscrollframe : frame +---@field Header frame ---@class breakdownspellbar : button ---@field index number diff --git a/classes/class_instance.lua b/classes/class_instance.lua index 197923ce..55f61942 100644 --- a/classes/class_instance.lua +++ b/classes/class_instance.lua @@ -270,10 +270,9 @@ local instanceMixins = { end, ---call a refresh in the data shown in the instance - ---@param instance instance ---@param bForceRefresh boolean|nil RefreshData = function(instance, bForceRefresh) --deprecates Details:RefreshAllMainWindows() - local combatObject = instance.showing + local combatObject = instance:GetCombat() --check if the combat object exists, if not, freeze the window if (not combatObject) then @@ -283,24 +282,26 @@ local instanceMixins = { return end - local needRefresh = combatObject[instance.atributo].need_refresh + local mainAttribute, subAttribute = instance:GetDisplay() + + local needRefresh = combatObject:GetContainer(mainAttribute).need_refresh if (not needRefresh and not bForceRefresh) then return end - if (instance.atributo == 1) then --damage + if (mainAttribute == 1) then --damage Details.atributo_damage:RefreshWindow(instance, combatObject, bForceRefresh, nil, needRefresh) - elseif (instance.atributo == 2) then --heal + elseif (mainAttribute == 2) then --heal Details.atributo_heal:RefreshWindow(instance, combatObject, bForceRefresh, nil, needRefresh) - elseif (instance.atributo == 3) then --energy + elseif (mainAttribute == 3) then --energy Details.atributo_energy:RefreshWindow(instance, combatObject, bForceRefresh, nil, needRefresh) - elseif (instance.atributo == 4) then --utility + elseif (mainAttribute == 4) then --utility Details.atributo_misc:RefreshWindow(instance, combatObject, bForceRefresh, nil, needRefresh) - elseif (instance.atributo == 5) then --custom + elseif (mainAttribute == 5) then --custom Details.atributo_custom:RefreshWindow(instance, combatObject, bForceRefresh, nil, needRefresh) end end, @@ -330,11 +331,11 @@ local instanceMixins = { end --update player breakdown window if opened - if (not bForceRefresh) then + --if (not bForceRefresh) then if (Details:IsBreakdownWindowOpen()) then return Details:GetActorObjectFromBreakdownWindow():MontaInfo() end - end + --end end end, diff --git a/core/control.lua b/core/control.lua index 823a1d66..73cd9a30 100644 --- a/core/control.lua +++ b/core/control.lua @@ -1848,17 +1848,17 @@ self:RefreshMainWindow(true) end - function Details:RefreshMainWindow(instance, bForceRefresh) - if (not instance or type(instance) == "boolean") then - bForceRefresh = instance - instance = self + function Details:RefreshMainWindow(instanceObject, bForceRefresh) + if (not instanceObject or type(instanceObject) == "boolean") then + bForceRefresh = instanceObject + instanceObject = self end if (not bForceRefresh) then Details.LastUpdateTick = Details._tempo end - if (instance == -1) then + if (instanceObject == -1) then --update for index, thisInstance in ipairs(Details.tabela_instancias) do if (thisInstance.ativa) then @@ -1884,19 +1884,16 @@ return info.jogador:MontaInfo() end end - return - else - if (not instance.ativa) then - --print("instance not actived", instance.RefreshMainWindow, 1+nil) + if (not instanceObject.ativa) then return end end - if (instance.modo == modo_ALL or instance.modo == modo_GROUP) then - --print("updating all instances...") - return instance:RefreshAllMainWindows(bForceRefresh) + local currentMode = instanceObject:GetMode() + if (currentMode == DETAILS_MODE_ALL or currentMode == DETAILS_MODE_GROUP) then + return instanceObject:RefreshAllMainWindows(bForceRefresh) end end diff --git a/frames/window_playerbreakdown.lua b/frames/window_playerbreakdown.lua index f4b35708..82078549 100644 --- a/frames/window_playerbreakdown.lua +++ b/frames/window_playerbreakdown.lua @@ -84,19 +84,22 @@ end ---@param bIsShiftKeyDown boolean|nil ---@param bIsControlKeyDown boolean|nil function Details:OpenBreakdownWindow(instanceObject, actorObject, bFromAttributeChange, bIsRefresh, bIsShiftKeyDown, bIsControlKeyDown) + ---@type number, number + local mainAttribute, subAttribute = instanceObject:GetDisplay() + --create the player list frame in the left side of the window Details.PlayerBreakdown.CreatePlayerListFrame() - if (not Details.row_singleclick_overwrite[instanceObject.atributo] or not Details.row_singleclick_overwrite[instanceObject.atributo][instanceObject.sub_atributo]) then + if (not Details.row_singleclick_overwrite[mainAttribute] or not Details.row_singleclick_overwrite[mainAttribute][subAttribute]) then Details:CloseBreakdownWindow() return - elseif (type(Details.row_singleclick_overwrite[instanceObject.atributo][instanceObject.sub_atributo]) == "function") then + elseif (type(Details.row_singleclick_overwrite[mainAttribute][subAttribute]) == "function") then if (bFromAttributeChange) then Details:CloseBreakdownWindow() return end - return Details.row_singleclick_overwrite[instanceObject.atributo][instanceObject.sub_atributo](_, actorObject, instanceObject, bIsShiftKeyDown, bIsControlKeyDown) + return Details.row_singleclick_overwrite[mainAttribute][subAttribute](_, actorObject, instanceObject, bIsShiftKeyDown, bIsControlKeyDown) end if (instanceObject:GetMode() == DETAILS_MODE_RAID) then @@ -105,7 +108,7 @@ function Details:OpenBreakdownWindow(instanceObject, actorObject, bFromAttribute end --Details.info_jogador armazena o jogador que esta sendo mostrado na janela de detalhes - if (breakdownWindow.jogador and breakdownWindow.jogador == actorObject and instanceObject and breakdownWindow.atributo and instanceObject.atributo == breakdownWindow.atributo and instanceObject.sub_atributo == breakdownWindow.sub_atributo and not bIsRefresh) then + if (breakdownWindow.jogador and breakdownWindow.jogador == actorObject and instanceObject and breakdownWindow.atributo and mainAttribute == breakdownWindow.atributo and subAttribute == breakdownWindow.sub_atributo and not bIsRefresh) then Details:CloseBreakdownWindow() --se clicou na mesma barra ent�o fecha a janela de detalhes return @@ -142,15 +145,16 @@ function Details:OpenBreakdownWindow(instanceObject, actorObject, bFromAttribute breakdownWindow:CreateRightSideBar() end + --todo: all portuguese keys to english + breakdownWindow.ativo = true --sinaliza o addon que a janela esta aberta - breakdownWindow.atributo = instanceObject.atributo --instancia.atributo -> grava o atributo (damage, heal, etc) - breakdownWindow.sub_atributo = instanceObject.sub_atributo --instancia.sub_atributo -> grava o sub atributo (damage done, dps, damage taken, etc) + breakdownWindow.atributo = mainAttribute --instancia.atributo -> grava o atributo (damage, heal, etc) + breakdownWindow.sub_atributo = subAttribute --instancia.sub_atributo -> grava o sub atributo (damage done, dps, damage taken, etc) breakdownWindow.jogador = actorObject --de qual jogador (objeto classe_damage) breakdownWindow.instancia = instanceObject --salva a refer�ncia da inst�ncia que pediu o breakdownWindow breakdownWindow.target_text = Loc ["STRING_TARGETS"] .. ":" breakdownWindow.target_member = "total" breakdownWindow.target_persecond = false - breakdownWindow.mostrando = nil local nome = breakdownWindow.jogador.nome --nome do jogador @@ -299,6 +303,8 @@ function Details:OpenBreakdownWindow(instanceObject, actorObject, bFromAttribute tabButton:DoClick() tabButton:OnShowFunc() shownTab = tabButton + + actorObject:MontaInfo() --old api to update the breakdown window end end end @@ -644,41 +650,33 @@ function Details:CreatePlayerDetailsTab(tabName, locName, conditionFunc, fillFun tabName = "unnamed" end - --create a button for the tab - --tabOnClickFunc - local newTabButton = gump:CreateButton(breakdownWindow, function()end, 20, 20, nil, nil, nil, nil, nil, breakdownWindow:GetName() .. "TabButton" .. tabName .. math.random(1, 1000)) - newTabButton:SetTemplate("DETAILS_TAB_BUTTON_TEMPLATE") + --create a button to select the tab + local tabButton = DetailsFramework:CreateButton(breakdownWindow, function()end, 20, 20, locName, nil, nil, nil, nil, breakdownWindow:GetName() .. "TabButton" .. tabName .. math.random(1, 1000), nil, "DETAILS_TAB_BUTTON_TEMPLATE") + tabButton:SetFrameLevel(breakdownWindow:GetFrameLevel()+1) + tabButton:Hide() + if (tabName == "Summary") then - newTabButton:SetTemplate("DETAILS_TAB_BUTTONSELECTED_TEMPLATE") + tabButton:SetTemplate("DETAILS_TAB_BUTTONSELECTED_TEMPLATE") end - newTabButton.IsDefaultTab = bIsDefaultTab - - newTabButton:SetText(locName) - newTabButton:SetFrameStrata("HIGH") - newTabButton:SetFrameLevel(breakdownWindow:GetFrameLevel()+1) - newTabButton:Hide() - - newTabButton.condition = conditionFunc - newTabButton.tabname = tabName - newTabButton.localized_name = locName - newTabButton.onclick = tabOnClickFunc - newTabButton.fillfunction = fillFunc - newTabButton.last_actor = {} + tabButton.IsDefaultTab = bIsDefaultTab + tabButton.condition = conditionFunc + tabButton.tabname = tabName + tabButton.localized_name = locName + tabButton.onclick = tabOnClickFunc + tabButton.fillfunction = fillFunc + tabButton.last_actor = {} ---@type tabframe - local tabFrame = CreateFrame("frame", breakdownWindow:GetName() .. "TabFrame" .. tabName .. math.random(1, 1000), UIParent, "BackdropTemplate") - newTabButton.tabFrame = tabFrame - newTabButton.frame = tabFrame - - tabFrame:SetParent(breakdownWindow) - tabFrame:SetFrameStrata("HIGH") - tabFrame:SetFrameLevel(breakdownWindow:GetFrameLevel()+5) - tabFrame:EnableMouse(true) + 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:Hide() + tabButton.tabFrame = tabFrame + tabButton.frame = tabFrame + if (iconSettings) then local texture = iconSettings.texture local coords = iconSettings.coords @@ -687,35 +685,43 @@ function Details:CreatePlayerDetailsTab(tabName, locName, conditionFunc, fillFun local overlay, textdistance, leftpadding, textheight, short_method --nil - newTabButton:SetIcon (texture, width, height, "overlay", coords, overlay, textdistance, leftpadding, textheight, short_method) + tabButton:SetIcon(texture, width, height, "overlay", coords, overlay, textdistance, leftpadding, textheight, short_method) if (iconSettings.desaturated) then - newTabButton.icon:SetDesaturated(true) + tabButton.icon:SetDesaturated(true) end end - if (newTabButton.fillfunction) then + if (tabButton.fillfunction) then tabFrame:SetScript("OnShow", function() - if (newTabButton.last_actor == breakdownWindow.jogador) then + ---@type actor + local actorObject = Details:GetActorObjectFromBreakdownWindow() + ---@type instance + local instanceObject = Details:GetActiveWindowFromBreakdownWindow() + ---@type combat + local combatObject = instanceObject:GetCombat() + + if (tabButton.last_actor == actorObject) then return end - newTabButton.last_actor = breakdownWindow.jogador - newTabButton:fillfunction(breakdownWindow.jogador, breakdownWindow.instancia.showing) + + tabButton.last_actor = actorObject + tabButton:fillfunction(actorObject, combatObject) end) end if (onCreateFunc) then - onCreateFunc(newTabButton, tabFrame) + onCreateFunc(tabButton, tabFrame) end - newTabButton.replaces = replace - Details.player_details_tabs[#Details.player_details_tabs+1] = newTabButton + tabButton.replaces = replace + Details.player_details_tabs[#Details.player_details_tabs+1] = tabButton - local onTabClickCallback = function(self) - self = self.MyObject or self + local onTabClickCallback = function(self) --self = tabButton + self = self.MyObject or self --framework button - for _, tab in ipairs(Details:GetBreakdownTabsInUse()) do - tab.frame:Hide() - tab:SetTemplate("DETAILS_TAB_BUTTON_TEMPLATE") + for _, thisTabButton in ipairs(Details:GetBreakdownTabsInUse()) do + thisTabButton.frame:Hide() + thisTabButton:SetTemplate("DETAILS_TAB_BUTTON_TEMPLATE") end self:SetTemplate("DETAILS_TAB_BUTTONSELECTED_TEMPLATE") @@ -723,35 +729,35 @@ function Details:CreatePlayerDetailsTab(tabName, locName, conditionFunc, fillFun end if (not tabOnClickFunc) then - newTabButton.OnShowFunc = function(self) + tabButton.OnShowFunc = function(self) --hide all tab frames, reset the template on all tabs --then set the template on this tab and set as selected tab onTabClickCallback(self) --show the tab frame tabFrame:Show() end - newTabButton:SetScript("OnClick", newTabButton.OnShowFunc) + tabButton:SetScript("OnClick", tabButton.OnShowFunc) else --custom - newTabButton.OnShowFunc = function(self) + tabButton.OnShowFunc = function(self) --hide all tab frames, reset the template on all tabs --then set the template on this tab and set as selected tab onTabClickCallback(self) --run onclick func - local result, errorText = pcall(tabOnClickFunc, newTabButton, tabFrame) + local result, errorText = pcall(tabOnClickFunc, tabButton, tabFrame) if (not result) then print("error on running tabOnClick function:", errorText) end end - newTabButton:SetScript("OnClick", newTabButton.OnShowFunc) + tabButton:SetScript("OnClick", tabButton.OnShowFunc) end - function newTabButton:DoClick() + function tabButton:DoClick() self:GetScript("OnClick")(self) end - newTabButton:SetScript("PostClick", function(self) + tabButton:SetScript("PostClick", function(self) CurrentTab = self.tabname or self.MyObject.tabname if (CurrentTab ~= "Summary") then @@ -765,5 +771,5 @@ function Details:CreatePlayerDetailsTab(tabName, locName, conditionFunc, fillFun end end) - return newTabButton, tabFrame + return tabButton, tabFrame end \ No newline at end of file diff --git a/frames/window_playerbreakdown_spells.lua b/frames/window_playerbreakdown_spells.lua index 12995095..0c793e9a 100644 --- a/frames/window_playerbreakdown_spells.lua +++ b/frames/window_playerbreakdown_spells.lua @@ -211,6 +211,17 @@ function spellsTab.OnCreateTabCallback(tabButton, tabFrame) tabFrame.barras3 = {} --deprecated spellsTab.TabFrame = tabFrame + + --open the breakdown window at startup + --[=[ + C_Timer.After(1, function() + Details:OpenPlayerDetails(1) + C_Timer.After(1, function() + Details:OpenPlayerDetails(1) + Details:OpenPlayerDetails(1) + end) + end) + --]=] end function spellsTab.TrocaBackgroundInfo(tabFrame) --> spells tab | to be refactored | called fom OpenJanelaInfo function @@ -359,40 +370,6 @@ do --hide bars functions - to be refactored end end ---bar scripts -local onMouseDownCallback = function(self, button) - local hostFrame = breakdownWindow - - if (button == "LeftButton") then - hostFrame:StartMoving() - hostFrame.isMoving = true - - elseif (button == "RightButton" and not self.isMoving) then - Details:CloseBreakdownWindow() - end -end - -local onMouseUpCallback = function(self, button) - local hostFrame = breakdownWindow - - if (hostFrame.isMoving) then - hostFrame:StopMovingOrSizing() - hostFrame.isMoving = false - end -end - -function spellsTab.ApplyScripts() - local hostFrame = breakdownWindow --cannot be breakdown window, it should be the frame of the tab - hostFrame.SpellScrollFrame.gump:SetScript("OnMouseDown", onMouseDownCallback) - hostFrame.SpellScrollFrame.gump:SetScript("OnMouseUp", onMouseUpCallback) - - hostFrame.container_detalhes:SetScript("OnMouseDown", onMouseDownCallback) - hostFrame.container_detalhes:SetScript("OnMouseUp", onMouseUpCallback) - - hostFrame.container_alvos.gump:SetScript("OnMouseDown", onMouseDownCallback) - hostFrame.container_alvos.gump:SetScript("OnMouseUp", onMouseUpCallback) -end - function spellsTab.CreateReportButtons(tabFrame) --spell list report button tabFrame.report_esquerda = Details.gump:NewDetailsButton(tabFrame, tabFrame, nil, _detalhes.Reportar, tabFrame, 1, 16, 16, "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", nil, "DetailsJanelaInfoReport2") @@ -439,7 +416,6 @@ end ---@param spellBar breakdownspellbar local onEnterBreakdownSpellBar = function(spellBar) --parei aqui: precisa por nomes nas funções e formatar as linhas das funcções --all values from spellBar are cached values - --check if there's a spellbar selected, if there's one, ignore the mouseover if (spellsTab.HasSelectedSpellBar()) then return @@ -707,44 +683,29 @@ end ---@param spellBar breakdownspellbar ---@param button string local onMouseDownBreakdownSpellBar = function(spellBar, button) - print(1, spellBar:GetName()) - if false then - local x, y = _G.GetCursorPosition() - spellBar.cursorPosX = math.floor(x) - spellBar.cursorPosY = math.floor(y) - Details222.PlayerBreakdown.OnMouseDown(spellBar, button) - end + local x, y = _G.GetCursorPosition() + spellBar.cursorPosX = math.floor(x) + spellBar.cursorPosY = math.floor(y) end ---on mouse up a breakdownspellbar in the breakdown window ---@param spellBar breakdownspellbar ---@param button string local onMouseUpBreakdownSpellBar = function(spellBar, button) - print(2, spellBar:GetName()) - if false then - if (spellBar.onMouseUpTime == GetTime()) then - return - end + spellBar.onMouseUpTime = GetTime() - spellBar.onMouseUpTime = GetTime() + ---@type number, number + local x, y = _G.GetCursorPosition() + x = math.floor(x) + y = math.floor(y) - ---@type number, number - local x, y = _G.GetCursorPosition() - x = math.floor(x) - y = math.floor(y) + ---@type boolean + local bIsMouseInTheSamePosition = (x == spellBar.cursorPosX) and (y == spellBar.cursorPosY) - ---@type boolean - local bIsMouseInTheSamePosition = (x == spellBar.cursorPosX) and (y == spellBar.cursorPosY) - - --if the mouse is in the same position, then the user clicked the bar - --clicking the bar activate the lock mechanism - if (bIsMouseInTheSamePosition) then - spellsTab.SelectSpellBar(spellBar) - end + --if the mouse is in the same position, then the user clicked the bar + if (bIsMouseInTheSamePosition) then + spellsTab.SelectSpellBar(spellBar) end - - --print("selecting spell bar") - --spellsTab.SelectSpellBar(spellBar) end @@ -1229,7 +1190,7 @@ end ---@param scrollData breakdownscrolldata ---@param offset number ---@param totalLines number -local refreshFunc = function(scrollFrame, scrollData, offset, totalLines) --~refresh spells +local refreshFunc = function(scrollFrame, scrollData, offset, totalLines) --~refreshspells ~refresh ---@type number local maxValue = scrollData[1] and scrollData[1].total ---@type number @@ -1336,7 +1297,7 @@ function spellsTab.CreateSpellScrollContainer(tabFrame) local headerTable = {} scrollFrame.Header = DetailsFramework:CreateHeader(tabFrame, headerTable, headerOptions) - scrollFrame.Header:SetPoint("topleft", scrollFrame, "topleft", 0, 0) + scrollFrame.Header:SetPoint("topleft", scrollFrame, "topleft", 0, 1) --create the scroll lines for i = 1, CONST_SPELLSCROLL_AMTLINES do @@ -1544,29 +1505,6 @@ end ---@param index number ---@return breakdownspellbar function spellsTab.CreateSpellBar(self, index) --~spellbar ~spellline ~spell ~create ~createline - - if (index == 1) then - --on this debug the onmousedown and onmouseup are working properly because is parented to the breakdownWindow - --but not on the spellbar which is parented to the spellscrollframe - local b = CreateFrame("button", nil, breakdownWindow, "BackdropTemplate") - b:SetSize(64, 64) - b:EnableMouse(true) - b:RegisterForClicks("AnyUp", "AnyDown") - b:SetPoint("topleft", breakdownWindow, "topleft", 50, -30) - b:SetScript("OnMouseDown", function() print("hi") end) - b:SetScript("OnMouseUp", function() print("bye") end) - DF:ApplyStandardBackdrop(b) - end - - local buttonTest = CreateFrame("button", self:GetName() .. "SpellBarTest" .. index, self, "BackdropTemplate") - buttonTest:SetSize(64, 64) - buttonTest:EnableMouse(true) - buttonTest:RegisterForClicks("AnyUp", "AnyDown") - buttonTest:SetFrameStrata("TOOLTIP") - buttonTest:SetScript("OnMouseDown", function() print("hi") end) - buttonTest:SetScript("OnMouseUp", function() print("bye") end) - DF:ApplyStandardBackdrop(buttonTest) - ---@type breakdownspellbar local spellBar = CreateFrame("button", self:GetName() .. "SpellBar" .. index, self, "BackdropTemplate") spellBar.index = index @@ -1577,8 +1515,6 @@ function spellsTab.CreateSpellBar(self, index) --~spellbar ~spellline ~spell ~cr spellBar:SetPoint("topleft", self, "topleft", 0, y) spellBar:SetPoint("topright", self, "topright", 0, y) - buttonTest:SetPoint("topleft", self, "topleft", 0, y) - spellBar:EnableMouse(true) spellBar:RegisterForClicks("AnyUp", "AnyDown") spellBar:SetAlpha(0.9) @@ -1591,7 +1527,6 @@ function spellsTab.CreateSpellBar(self, index) --~spellbar ~spellline ~spell ~cr spellBar.ExpandedChildren = {} DF:Mixin(spellBar, DF.HeaderFunctions) - DF:Mixin(buttonTest, DF.HeaderFunctions) ---@type statusbar local statusBar = CreateFrame("StatusBar", "$parentStatusBar", spellBar, "BackdropTemplate") From f735cb63bd822cddce775e60891063e9a60bd02f Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Wed, 12 Apr 2023 22:41:34 -0300 Subject: [PATCH 05/22] More development on the new breakdown window --- Definitions.lua | 5 + Libs/DF/mixins.lua | 4 +- Libs/DF/panel.lua | 5 +- frames/window_playerbreakdown.lua | 44 ++-- frames/window_playerbreakdown_spells.lua | 71 ++++-- functions/events.lua | 2 + functions/profiles.lua | 262 ++++++++++++----------- startup.lua | 2 + 8 files changed, 234 insertions(+), 161 deletions(-) diff --git a/Definitions.lua b/Definitions.lua index a3413dee..85307627 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -279,6 +279,11 @@ ---@field GetSpellSchoolFormatedName fun(self: details, spellschool: number) : string ---@field CommaValue fun(self: details, number: number) : string ---@field SumSpellTables fun(self: details, spellTables: spelltable[], targetTable: table) +---@field CreateEventListener fun(self: details) : table + +---@class detailseventlistener : table +---@field RegisterEvent fun(self: detailseventlistener, event: "DETAILS_INSTANCE_OPEN"|"DETAILS_INSTANCE_CLOSE"|"DETAILS_INSTANCE_SIZECHANGED"|"DETAILS_INSTANCE_STARTRESIZE"|"DETAILS_INSTANCE_ENDRESIZE"|"DETAILS_INSTANCE_STARTSTRETCH"|"DETAILS_INSTANCE_ENDSTRETCH"|"DETAILS_INSTANCE_CHANGESEGMENT"|"DETAILS_INSTANCE_CHANGEATTRIBUTE"|"DETAILS_INSTANCE_CHANGEMODE"|"DETAILS_INSTANCE_NEWROW"|"DETAILS_OPTIONS_MODIFIED"|"DETAILS_DATA_RESET"|"DETAILS_DATA_SEGMENTREMOVED"|"COMBAT_ENCOUNTER_START"|"COMBAT_ENCOUNTER_END"|"COMBAT_PLAYER_ENTER"|"COMBAT_PLAYER_LEAVE"|"COMBAT_PLAYER_TIMESTARTED"|"COMBAT_BOSS_WIPE"|"COMBAT_BOSS_DEFEATED"|"COMBAT_BOSS_FOUND"|"COMBAT_INVALID"|"COMBAT_PREPOTION_UPDATED"|"COMBAT_CHARTTABLES_CREATING"|"COMBAT_CHARTTABLES_CREATED"|"COMBAT_ENCOUNTER_PHASE_CHANGED"|"COMBAT_ARENA_START"|"COMBAT_ARENA_END"|"COMBAT_MYTHICDUNGEON_START"|"COMBAT_MYTHICDUNGEON_END"|"GROUP_ONENTER"|"GROUP_ONLEAVE"|"ZONE_TYPE_CHANGED"|"REALM_CHANNEL_ENTER"|"REALM_CHANNEL_LEAVE"|"COMM_EVENT_RECEIVED"|"COMM_EVENT_SENT"|"UNIT_SPEC"|"UNIT_TALENTS"|"PLAYER_TARGET"|"DETAILS_PROFILE_APPLYED", callback: function) +---@field UnregisterEvent fun(self: detailseventlistener, event: "DETAILS_INSTANCE_OPEN"|"DETAILS_INSTANCE_CLOSE"|"DETAILS_INSTANCE_SIZECHANGED"|"DETAILS_INSTANCE_STARTRESIZE"|"DETAILS_INSTANCE_ENDRESIZE"|"DETAILS_INSTANCE_STARTSTRETCH"|"DETAILS_INSTANCE_ENDSTRETCH"|"DETAILS_INSTANCE_CHANGESEGMENT"|"DETAILS_INSTANCE_CHANGEATTRIBUTE"|"DETAILS_INSTANCE_CHANGEMODE"|"DETAILS_INSTANCE_NEWROW"|"DETAILS_OPTIONS_MODIFIED"|"DETAILS_DATA_RESET"|"DETAILS_DATA_SEGMENTREMOVED"|"COMBAT_ENCOUNTER_START"|"COMBAT_ENCOUNTER_END"|"COMBAT_PLAYER_ENTER"|"COMBAT_PLAYER_LEAVE"|"COMBAT_PLAYER_TIMESTARTED"|"COMBAT_BOSS_WIPE"|"COMBAT_BOSS_DEFEATED"|"COMBAT_BOSS_FOUND"|"COMBAT_INVALID"|"COMBAT_PREPOTION_UPDATED"|"COMBAT_CHARTTABLES_CREATING"|"COMBAT_CHARTTABLES_CREATED"|"COMBAT_ENCOUNTER_PHASE_CHANGED"|"COMBAT_ARENA_START"|"COMBAT_ARENA_END"|"COMBAT_MYTHICDUNGEON_START"|"COMBAT_MYTHICDUNGEON_END"|"GROUP_ONENTER"|"GROUP_ONLEAVE"|"ZONE_TYPE_CHANGED"|"REALM_CHANNEL_ENTER"|"REALM_CHANNEL_LEAVE"|"COMM_EVENT_RECEIVED"|"COMM_EVENT_SENT"|"UNIT_SPEC"|"UNIT_TALENTS"|"PLAYER_TARGET"|"DETAILS_PROFILE_APPLYED") ---@class combat : table ---@field GetCombatTime fun(combat) diff --git a/Libs/DF/mixins.lua b/Libs/DF/mixins.lua index b7cb09da..4e34bbf3 100644 --- a/Libs/DF/mixins.lua +++ b/Libs/DF/mixins.lua @@ -426,7 +426,9 @@ detailsFramework.ScrollBoxFunctions = { --hide all frames and tag as not in use self._LinesInUse = 0 for index, frame in ipairs(self.Frames) do - frame:Hide() + if (not self.DontHideChildrenOnPreRefresh) then + frame:Hide() + end frame._InUse = nil end diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index 2fa11c1b..120bd83c 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -3889,6 +3889,7 @@ function detailsFramework:CreateScrollBox(parent, name, refreshFunc, data, width scroll.Frames = {} scroll.ReajustNumFrames = autoAmount scroll.CreateLineFunc = createLineFunc + scroll.DontHideChildrenOnPreRefresh = false detailsFramework:Mixin(scroll, detailsFramework.SortFunctions) detailsFramework:Mixin(scroll, detailsFramework.ScrollBoxFunctions) @@ -5515,13 +5516,13 @@ detailsFramework.HeaderCoreFunctions = { resizerButton:SetScript("OnMouseDown", function() newHeader.bIsRezising = true print(1) - --newHeader:StartSizing("right") + newHeader:StartSizing("right") end) resizerButton:SetScript("OnMouseUp", function() newHeader.bIsRezising = false print(2) - --newHeader:StopMovingOrSizing() + newHeader:StopMovingOrSizing() end) resizerButton.texture = resizerButton:CreateTexture(nil, "overlay") diff --git a/frames/window_playerbreakdown.lua b/frames/window_playerbreakdown.lua index 82078549..ca603d49 100644 --- a/frames/window_playerbreakdown.lua +++ b/frames/window_playerbreakdown.lua @@ -7,14 +7,17 @@ local gump = Details.gump local _ local addonName, Details222 = ... ---lua locals +--remove warnings in the code local ipairs = ipairs -local pairs = pairs +local tinsert = tinsert +local tremove = tremove local type = type local unpack = _G.unpack - ---api locals +local PixelUtil = PixelUtil +local UISpecialFrames = UISpecialFrames +local wipe = wipe local CreateFrame = _G.CreateFrame + local subAttributes = Details.sub_atributos local breakdownWindow = Details.playerDetailWindow @@ -220,7 +223,7 @@ function Details:OpenBreakdownWindow(instanceObject, actorObject, bFromAttribute --spellsTab.ResetBars() --to be implemented ---@type string - local actorClass = actorObject.classe + local actorClass = actorObject.classe --classe not registered because it should be renamed to english if (not actorClass) then actorClass = "monster" @@ -239,7 +242,7 @@ function Details:OpenBreakdownWindow(instanceObject, actorObject, bFromAttribute local tabsReplaced = {} local tabReplacedAmount = 0 - table.wipe(breakdownWindow.currentTabsInUse) + wipe(breakdownWindow.currentTabsInUse) for index = 1, #Details.player_details_tabs do local tab = Details.player_details_tabs[index] @@ -314,16 +317,11 @@ function Details:OpenBreakdownWindow(instanceObject, actorObject, bFromAttribute end end -function Details:CloseBreakdownWindow(fromEscape) +function Details:CloseBreakdownWindow() if (breakdownWindow.ativo) then - if (fromEscape) then - Details.FadeHandler.Fader(breakdownWindow, "in") - else - Details.FadeHandler.Fader(breakdownWindow, 1) - end - breakdownWindow.ativo = false --sinaliza o addon que a janela esta agora fechada + Details.FadeHandler.Fader(breakdownWindow, 1) - --Details.info_jogador.detalhes = nil + breakdownWindow.ativo = false --sinaliza o addon que a janela esta agora fechada breakdownWindow.jogador = nil breakdownWindow.atributo = nil breakdownWindow.sub_atributo = nil @@ -331,6 +329,13 @@ function Details:CloseBreakdownWindow(fromEscape) breakdownWindow.actorName:SetText("") breakdownWindow.attributeName:SetText("") + + --iterate all tabs and clear caches + local tabsInUse = Details:GetBreakdownTabsInUse() + for index = 1, #tabsInUse do + local tabButton = tabsInUse[index] + tabButton.last_actor = nil + end end end @@ -695,16 +700,17 @@ function Details:CreatePlayerDetailsTab(tabName, locName, conditionFunc, fillFun tabFrame:SetScript("OnShow", function() ---@type actor local actorObject = Details:GetActorObjectFromBreakdownWindow() - ---@type instance - local instanceObject = Details:GetActiveWindowFromBreakdownWindow() - ---@type combat - local combatObject = instanceObject:GetCombat() if (tabButton.last_actor == actorObject) then return end - tabButton.last_actor = actorObject + ---@type instance + local instanceObject = Details:GetActiveWindowFromBreakdownWindow() + ---@type combat + local combatObject = instanceObject:GetCombat() + + tabButton.last_actor = actorObject --it's caching the actor, on pre-reset need to clean up this variable (need to check this later) tabButton:fillfunction(actorObject, combatObject) end) end diff --git a/frames/window_playerbreakdown_spells.lua b/frames/window_playerbreakdown_spells.lua index 0c793e9a..b8eaa9dc 100644 --- a/frames/window_playerbreakdown_spells.lua +++ b/frames/window_playerbreakdown_spells.lua @@ -52,7 +52,7 @@ function spellsTab.GetCombat() end function spellsTab.GetInstance() - return spellsTab.instance + return spellsTab.instance or Details:GetActiveWindowFromBreakdownWindow() end ---return the breakdownspellscrollframe object, there's only one of this in the breakdown window @@ -67,6 +67,13 @@ function spellsTab.GetSpellBlockContainer() return spellsTab.TabFrame.SpellBlockContainer end +function spellsTab.OnProfileChange() + spellsTab.spellcontainer_header_settings = Details.breakdown_spell_tab.spellcontainer_headers + spellsTab.UpdateHeadersSettings() +end + +---default settings for the header of the spells container +---label is a localized string ---@type {name: string, width: number, label: string, align: string, enabled: boolean, attribute: number|nil}[] local columnInfo = { {name = "icon", width = 22, label = "", align = "center", enabled = true,}, @@ -86,6 +93,33 @@ local columnInfo = { {name = "absorbed", label = "absorbed", width = 45, align = "left", enabled = false, attribute = DETAILS_ATTRIBUTE_HEAL}, } +function spellsTab.UpdateHeadersSettings() + --profile settings + ---@type table + local settings = spellsTab.spellcontainer_header_settings + + --do a loop and check if the column exists in the profile settings, if not, create it + for i = 1, #columnInfo do + --default column settings + local columnData = columnInfo[i] + --column settings for the column on details profile + local columnSettings = settings[columnData.name] + --check if this column does not have a mirror table in details profile + if (not columnSettings) then + --create the mirror table + settings[columnData.name] = { + enabled = columnData.enabled, + width = columnData.width, + align = columnData.align, + } + end + end + + spellsTab.spellsHeaderData = spellsTab.BuildHeaderTable() + print("headerTable = ", #spellsTab.spellsHeaderData) + spellsTab.SpellScrollFrame.Header:SetHeaderTable(spellsTab.spellsHeaderData) +end + function spellsTab.BuildHeaderTable() ---@type {name: string, width: number, label: string, align: string, enabled: boolean}[] local headerTable = {} @@ -96,9 +130,14 @@ function spellsTab.BuildHeaderTable() ---@type number, number local mainAttribute, subAttribute = instance:GetDisplay() + --settings from profile | updated at UpdateHeadersSettings() > called on OnProfileChange() and when the tab is opened + local settings = spellsTab.spellcontainer_header_settings + for i = 1, #columnInfo do local columnData = columnInfo[i] - if (columnData.enabled) then + local columnSettings = settings[columnData.name] + + if (columnSettings.enabled) then local bCanAdd = true if (columnData.attribute) then if (columnData.attribute ~= mainAttribute) then @@ -109,13 +148,14 @@ function spellsTab.BuildHeaderTable() if (bCanAdd) then headerTable[#headerTable+1] = { text = columnData.label, - width = columnData.width, + width = columnSettings.width, name = columnData.name, --align = column.align, } end end end + return headerTable end @@ -177,10 +217,14 @@ function spellsTab.OnShownTab() spellsTab.UnSelectSpellBar() --reset the spell blocks spellsTab.GetSpellBlockContainer():ClearBlocks() + --update spells header frame + spellsTab.UpdateHeadersSettings() end ---called when the tab is getting created +--called when the tab is getting created, run only once function spellsTab.OnCreateTabCallback(tabButton, tabFrame) + spellsTab.spellcontainer_header_settings = Details.breakdown_spell_tab.spellcontainer_headers + spellBreakdownSettings = Details.breakdown_spell_tab DetailsFramework:ApplyStandardBackdrop(tabFrame) @@ -1206,8 +1250,7 @@ local refreshFunc = function(scrollFrame, scrollData, offset, totalLines) --~ref ---@type instance local instanceObject = spellsTab.GetInstance() - local headerTable = spellsTab.BuildHeaderTable() - scrollFrame.Header:SetHeaderTable(headerTable) + local headerTable = spellsTab.spellsHeaderData local lineIndex = 1 for i = 1, totalLines do @@ -1281,7 +1324,9 @@ function spellsTab.CreateSpellScrollContainer(tabFrame) scrollFrame:SetPoint("topleft", tabFrame, "topleft", 5, -5) --need to set the points scrollFrame:EnableMouse(true) scrollFrame:SetMovable(true) + scrollFrame.DontHideChildrenOnPreRefresh = true tabFrame.SpellScrollFrame = scrollFrame + spellsTab.SpellScrollFrame = scrollFrame function scrollFrame:RefreshMe(data) self:SetData(data) @@ -1860,13 +1905,8 @@ function Details.InitializeSpellBreakdownTab() end end, - function() --[4] fill function - --spellsTab.JI_AtualizaContainerBarras(-1) --not in use anymore - spellsTab.TabFrame.no_targets:Hide() --this is nil - spellsTab.TabFrame.no_targets.text:Hide() - + function() --[4] fill function | passing a fill function, it'll set a OnShow() script on the tabFrame | only run if the actor is different spellsTab.OnShownTab() - --spellsTab.TrocaBackgroundInfo(spellsTab.TabFrame) end, function(tabButton, tabFrame) --[5] onclick @@ -1893,5 +1933,12 @@ function Details.InitializeSpellBreakdownTab() spellsTab.instance = instance spellsTab.TabFrame.SpellScrollFrame:RefreshMe(data) end + + ---@type detailseventlistener + local eventListener = Details:CreateEventListener() + eventListener:RegisterEvent("DETAILS_PROFILE_APPLYED", function() + --this event don't trigger at details startup + spellsTab.OnProfileChange() + end) end diff --git a/functions/events.lua b/functions/events.lua index 01d67ad5..4a492866 100644 --- a/functions/events.lua +++ b/functions/events.lua @@ -26,6 +26,7 @@ ["UNIT_SPEC"] = {}, ["UNIT_TALENTS"] = {}, ["PLAYER_TARGET"] = {}, + ["DETAILS_PROFILE_APPLYED"] = {}, --data ["DETAILS_DATA_RESET"] = {}, @@ -123,6 +124,7 @@ local common_events = { ["UNIT_SPEC"] = true, ["UNIT_TALENTS"] = true, ["PLAYER_TARGET"] = true, + ["DETAILS_PROFILE_APPLYED"] = true, } diff --git a/functions/profiles.lua b/functions/profiles.lua index f4afb2a8..507aead0 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -1,5 +1,5 @@ -local _detalhes = _G._detalhes +local Details = _G.Details local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" ) local _ local addonName, Details222 = ... @@ -7,7 +7,7 @@ local detailsFramework = DetailsFramework ---return the current profile name ---@return string -function _detalhes:GetCurrentProfileName() +function Details:GetCurrentProfileName() if (_detalhes_database.active_profile == "") then local characterKey = UnitName ("player") .. "-" .. GetRealmName() _detalhes_database.active_profile = characterKey @@ -18,7 +18,7 @@ end ---create a new profile ---@param profileName string ---@return boolean|table -function _detalhes:CreateProfile(profileName) +function Details:CreateProfile(profileName) if (not profileName or type(profileName) ~= "string" or profileName == "") then return false end @@ -29,7 +29,7 @@ function _detalhes:CreateProfile(profileName) end --copy the default table - local newProfile = Details.CopyTable(_detalhes.default_profile) + local newProfile = Details.CopyTable(Details.default_profile) newProfile.instances = {} --add to global container @@ -41,7 +41,7 @@ end ---return the list os all profiles ---@return table -function _detalhes:GetProfileList() +function Details:GetProfileList() local profileList = {} for profileName in pairs(_detalhes_global.__profiles) do profileList[#profileList + 1] = profileName @@ -96,12 +96,12 @@ function Details:GetProfile(profileName, create) return profile end -function _detalhes:SetProfileCProp (name, cprop, value) +function Details:SetProfileCProp (name, cprop, value) if (not name) then - name = _detalhes:GetCurrentProfileName() + name = Details:GetCurrentProfileName() end - local profile = _detalhes:GetProfile (name, false) + local profile = Details:GetProfile (name, false) if (profile) then if (type(value) == "table") then @@ -117,37 +117,37 @@ end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --Profiles: --reset the profile -function _detalhes:ResetProfile (profile_name) +function Details:ResetProfile (profile_name) --get the profile - local profile = _detalhes:GetProfile (profile_name, true) + local profile = Details:GetProfile (profile_name, true) if (not profile) then return false end --reset all already created instances - for index, instance in _detalhes:ListInstances() do + for index, instance in Details:ListInstances() do if (not instance.baseframe) then instance:AtivarInstancia() end instance.skin = "" - instance:ChangeSkin (_detalhes.default_skin_to_use) + instance:ChangeSkin (Details.default_skin_to_use) end - for index, instance in pairs(_detalhes.unused_instances) do + for index, instance in pairs(Details.unused_instances) do if (not instance.baseframe) then instance:AtivarInstancia() end instance.skin = "" - instance:ChangeSkin(_detalhes.default_skin_to_use) + instance:ChangeSkin(Details.default_skin_to_use) end --reset the profile table.wipe(profile.instances) --export first instance - local instance = _detalhes:GetInstance(1) + local instance = Details:GetInstance(1) local exported = instance:ExportSkin() exported.__was_opened = instance:IsEnabled() exported.__pos = Details.CopyTable(instance:GetPosition()) @@ -160,7 +160,7 @@ function _detalhes:ResetProfile (profile_name) instance.verticalSnap = false instance.snap = {} - _detalhes:ApplyProfile (profile_name, true) + Details:ApplyProfile (profile_name, true) --end return true @@ -170,39 +170,39 @@ end --Profiles: --return the profile table requested -function _detalhes:CreatePanicWarning() - _detalhes.instance_load_failed = CreateFrame("frame", "DetailsPanicWarningFrame", UIParent,"BackdropTemplate") - _detalhes.instance_load_failed:SetHeight(80) +function Details:CreatePanicWarning() + Details.instance_load_failed = CreateFrame("frame", "DetailsPanicWarningFrame", UIParent,"BackdropTemplate") + Details.instance_load_failed:SetHeight(80) --tinsert(UISpecialFrames, "DetailsPanicWarningFrame") - _detalhes.instance_load_failed.text = _detalhes.instance_load_failed:CreateFontString(nil, "overlay", "GameFontNormal") - _detalhes.instance_load_failed.text:SetPoint("center", _detalhes.instance_load_failed, "center") - _detalhes.instance_load_failed.text:SetTextColor(1, 0.6, 0) - _detalhes.instance_load_failed:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) - _detalhes.instance_load_failed:SetBackdropColor(1, 0, 0, 0.2) - _detalhes.instance_load_failed:SetPoint("topleft", UIParent, "topleft", 0, -250) - _detalhes.instance_load_failed:SetPoint("topright", UIParent, "topright", 0, -250) + Details.instance_load_failed.text = Details.instance_load_failed:CreateFontString(nil, "overlay", "GameFontNormal") + Details.instance_load_failed.text:SetPoint("center", Details.instance_load_failed, "center") + Details.instance_load_failed.text:SetTextColor(1, 0.6, 0) + Details.instance_load_failed:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) + Details.instance_load_failed:SetBackdropColor(1, 0, 0, 0.2) + Details.instance_load_failed:SetPoint("topleft", UIParent, "topleft", 0, -250) + Details.instance_load_failed:SetPoint("topright", UIParent, "topright", 0, -250) end local safe_load = function(func, param1, ...) local okey, errortext = pcall(func, param1, ...) if (not okey) then - if (not _detalhes.instance_load_failed) then - _detalhes:CreatePanicWarning() + if (not Details.instance_load_failed) then + Details:CreatePanicWarning() end - _detalhes.do_not_save_skins = true - _detalhes.instance_load_failed.text:SetText("Failed to load a Details! window.\n/reload or reboot the game client may fix the problem.\nIf the problem persist, try /details reinstall.\nError: " .. errortext .. "") + Details.do_not_save_skins = true + Details.instance_load_failed.text:SetText("Failed to load a Details! window.\n/reload or reboot the game client may fix the problem.\nIf the problem persist, try /details reinstall.\nError: " .. errortext .. "") end return okey end -function _detalhes:ApplyProfile (profile_name, nosave, is_copy) +function Details:ApplyProfile (profile_name, nosave, is_copy) --get the profile - local profile = _detalhes:GetProfile (profile_name, true) + local profile = Details:GetProfile (profile_name, true) --if the profile doesn't exist, just quit if (not profile) then - _detalhes:Msg("Profile Not Found.") + Details:Msg("Profile Not Found.") return false end @@ -211,15 +211,15 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy) --always save the previous profile, except if nosave flag is up if (not nosave) then --salva o profile ativo no momento - _detalhes:SaveProfile() + Details:SaveProfile() end --update profile keys before go - for key, value in pairs(_detalhes.default_profile) do + for key, value in pairs(Details.default_profile) do --the entire key doesn't exist if (profile [key] == nil) then if (type(value) == "table") then - profile [key] = Details.CopyTable(_detalhes.default_profile [key]) + profile [key] = Details.CopyTable(Details.default_profile [key]) else profile [key] = value end @@ -227,45 +227,45 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy) --the key exist and is a table, check for missing values on sub tables elseif (type(value) == "table") then --deploy only copy non existing data - _detalhes.table.deploy(profile [key], value) + Details.table.deploy(profile [key], value) end end --apply the profile values - for key, _ in pairs(_detalhes.default_profile) do + for key, _ in pairs(Details.default_profile) do local value = profile [key] if (type(value) == "table") then if (key == "class_specs_coords") then - value = Details.CopyTable(_detalhes.default_profile.class_specs_coords) + value = Details.CopyTable(Details.default_profile.class_specs_coords) end local ctable = Details.CopyTable(value) - _detalhes [key] = ctable + Details [key] = ctable else - _detalhes [key] = value + Details [key] = value end end --set the current profile if (not is_copy) then - _detalhes.active_profile = profile_name + Details.active_profile = profile_name _detalhes_database.active_profile = profile_name end --apply the skin --first save the local instance configs - _detalhes:SaveLocalInstanceConfig() + Details:SaveLocalInstanceConfig() local saved_skins = profile.instances - local instance_limit = _detalhes.instances_amount + local instance_limit = Details.instances_amount --then close all opened instances - for index, instance in _detalhes:ListInstances() do + for index, instance in Details:ListInstances() do if (not getmetatable(instance)) then instance.iniciada = false - setmetatable(instance, _detalhes) + setmetatable(instance, Details) end if (instance:IsStarted()) then if (instance:IsEnabled()) then @@ -276,16 +276,16 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy) --check if there is a skin saved or this is a empty profile if (#saved_skins == 0) then - local instance1 = _detalhes:GetInstance(1) + local instance1 = Details:GetInstance(1) if (not instance1) then - instance1 = _detalhes:CreateInstance (1) + instance1 = Details:CreateInstance (1) end --apply default config on this instance (flat skin texture was 'ResetInstanceConfig' running). instance1.modo = 2 instance1:ResetInstanceConfig() instance1.skin = "no skin" - instance1:ChangeSkin (_detalhes.default_skin_to_use) + instance1:ChangeSkin (Details.default_skin_to_use) --release the snap and lock instance1:LoadLocalInstanceConfig() @@ -294,11 +294,11 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy) instance1.verticalSnap = nil instance1:LockInstance (false) - if (#_detalhes.tabela_instancias > 1) then - for i = #_detalhes.tabela_instancias, 2, -1 do - _detalhes.tabela_instancias [i].modo = 2 - _detalhes.unused_instances [i] = _detalhes.tabela_instancias [i] - _detalhes.tabela_instancias [i] = nil + if (#Details.tabela_instancias > 1) then + for i = #Details.tabela_instancias, 2, -1 do + Details.tabela_instancias [i].modo = 2 + Details.unused_instances [i] = Details.tabela_instancias [i] + Details.tabela_instancias [i] = nil end end else @@ -312,10 +312,10 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy) end --get the instance - local instance = _detalhes:GetInstance(index) + local instance = Details:GetInstance(index) if (not instance) then --create a instance without creating its frames (not initializing) - instance = _detalhes:CreateDisabledInstance (index, skin) + instance = Details:CreateDisabledInstance (index, skin) end --copy skin @@ -339,7 +339,7 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy) --load data saved for this character only instance:LoadLocalInstanceConfig() if (skin.__was_opened) then - if (not safe_load (_detalhes.AtivarInstancia, instance, nil, true)) then + if (not safe_load (Details.AtivarInstancia, instance, nil, true)) then return end else @@ -351,7 +351,7 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy) --load data saved again instance:LoadLocalInstanceConfig() --check window positioning - if (_detalhes.profile_save_pos) then + if (Details.profile_save_pos) then --print("is profile save pos", skin.__pos.normal.x, skin.__pos.normal.y) if (skin.__pos) then instance.posicao = Details.CopyTable(skin.__pos) @@ -385,14 +385,14 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy) instance:LockInstance (instance.isLocked) - --tinsert(_detalhes.resize_debug, #_detalhes.resize_debug+1, "libwindow X (427): " .. (instance.libwindow.x or 0)) + --tinsert(Details.resize_debug, #Details.resize_debug+1, "libwindow X (427): " .. (instance.libwindow.x or 0)) instance:RestoreMainWindowPosition() instance:ReajustaGump() --instance:SaveMainWindowPosition() --Load StatusBarSaved values and options. instance.StatusBarSaved = skin.StatusBarSaved or {options = {}} instance.StatusBar.options = instance.StatusBarSaved.options - _detalhes.StatusBar:UpdateChilds (instance) + Details.StatusBar:UpdateChilds (instance) instance:ChangeSkin() else @@ -403,18 +403,18 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy) end --move unused instances for unused container - if (#_detalhes.tabela_instancias > instances_loaded) then - for i = #_detalhes.tabela_instancias, instances_loaded+1, -1 do - _detalhes.unused_instances [i] = _detalhes.tabela_instancias [i] - _detalhes.tabela_instancias [i] = nil + if (#Details.tabela_instancias > instances_loaded) then + for i = #Details.tabela_instancias, instances_loaded+1, -1 do + Details.unused_instances [i] = Details.tabela_instancias [i] + Details.tabela_instancias [i] = nil end end --check all snaps for invalid entries for i = 1, instances_loaded do - local instance = _detalhes:GetInstance(i) - local previous_instance_id = _detalhes:GetInstance(i-1) and _detalhes:GetInstance(i-1):GetId() or 0 - local next_instance_id = _detalhes:GetInstance(i+1) and _detalhes:GetInstance(i+1):GetId() or 0 + local instance = Details:GetInstance(i) + local previous_instance_id = Details:GetInstance(i-1) and Details:GetInstance(i-1):GetId() or 0 + local next_instance_id = Details:GetInstance(i+1) and Details:GetInstance(i+1):GetId() or 0 for snap_side, instance_id in pairs(instance.snap) do if (instance_id < 1) then --invalid instance @@ -426,18 +426,18 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy) end --auto realign windows - if (not _detalhes.initializing) then - for _, instance in _detalhes:ListInstances() do + if (not Details.initializing) then + for _, instance in Details:ListInstances() do if (instance:IsEnabled()) then - _detalhes.move_janela_func(instance.baseframe, true, instance) - _detalhes.move_janela_func(instance.baseframe, false, instance) + Details.move_janela_func(instance.baseframe, true, instance) + Details.move_janela_func(instance.baseframe, false, instance) end end else --is in startup - for _, instance in _detalhes:ListInstances() do + for _, instance in Details:ListInstances() do for side, id in pairs(instance.snap) do - local window = _detalhes.tabela_instancias [id] + local window = Details.tabela_instancias [id] if (not window.ativa) then instance.snap [side] = nil if ((side == 1 or side == 3) and (not instance.snap [1] and not instance.snap [3])) then @@ -460,36 +460,38 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy) end --check instance amount - _detalhes.opened_windows = 0 - for index = 1, _detalhes.instances_amount do - local instance = _detalhes.tabela_instancias [index] + Details.opened_windows = 0 + for index = 1, Details.instances_amount do + local instance = Details.tabela_instancias [index] if (instance and instance.ativa) then - _detalhes.opened_windows = _detalhes.opened_windows + 1 + Details.opened_windows = Details.opened_windows + 1 end end --update tooltip settings - _detalhes:SetTooltipBackdrop() + Details:SetTooltipBackdrop() --update the numerical system - _detalhes:SelectNumericalSystem() + Details:SelectNumericalSystem() --refresh the update interval - _detalhes:RefreshUpdater() + Details:RefreshUpdater() --refresh animation functions - _detalhes:RefreshAnimationFunctions() + Details:RefreshAnimationFunctions() --refresh broadcaster tools - _detalhes:LoadFramesForBroadcastTools() + Details:LoadFramesForBroadcastTools() --change the rogue spec combat icon to outlaw depending on the game version Details:HandleRogueCombatSpecIconByGameVersion() - if (_detalhes.initializing) then - _detalhes.profile_loaded = true + if (Details.initializing) then + Details.profile_loaded = true end + Details:SendEvent("DETAILS_PROFILE_APPLYED", profile_name) + return true end @@ -497,7 +499,7 @@ end --Profiles: --return the profile table requested -function _detalhes:SaveProfile (saveas) +function Details:SaveProfile (saveas) --get the current profile @@ -506,15 +508,15 @@ function _detalhes:SaveProfile (saveas) if (saveas) then profile_name = saveas else - profile_name = _detalhes:GetCurrentProfileName() + profile_name = Details:GetCurrentProfileName() end - local profile = _detalhes:GetProfile (profile_name, true) + local profile = Details:GetProfile (profile_name, true) --save default keys - for key, _ in pairs(_detalhes.default_profile) do + for key, _ in pairs(Details.default_profile) do - local current_value = _detalhes [key] + local current_value = Details [key] if (type(current_value) == "table") then local ctable = Details.CopyTable(current_value) @@ -526,9 +528,9 @@ function _detalhes:SaveProfile (saveas) end --save skins - if (not _detalhes.do_not_save_skins) then + if (not Details.do_not_save_skins) then table.wipe(profile.instances) - for index, instance in ipairs(_detalhes.tabela_instancias) do + for index, instance in ipairs(Details.tabela_instancias) do local exported = instance:ExportSkin() exported.__was_opened = instance:IsEnabled() exported.__pos = Details.CopyTable(instance:GetPosition()) @@ -539,8 +541,8 @@ function _detalhes:SaveProfile (saveas) profile.instances[index] = exported end end - _detalhes.do_not_save_skins = nil - _detalhes:SaveLocalInstanceConfig() + Details.do_not_save_skins = nil + Details:SaveLocalInstanceConfig() return profile end @@ -1068,7 +1070,7 @@ local default_profile = { }, --streamer --- _detalhes.streamer_config. +-- Details.streamer_config. streamer_config = { reset_spec_cache = false, disable_mythic_dungeon = false, @@ -1130,7 +1132,7 @@ local default_profile = { auto_swap_to_dynamic_overall = false, } -_detalhes.default_profile = default_profile +Details.default_profile = default_profile -- aqui fica as propriedades do jogador que n�o ser�o armazenadas no profile local default_player_data = { @@ -1259,7 +1261,7 @@ local default_player_data = { --information about this character character_data = {logons = 0}, --version - last_realversion = _detalhes.realversion, + last_realversion = Details.realversion, last_version = "v1.0.0", --profile active_profile = "", @@ -1318,7 +1320,7 @@ local default_player_data = { on_death_menu = false, } -_detalhes.default_player_data = default_player_data +Details.default_player_data = default_player_data local default_global_data = { @@ -1414,6 +1416,12 @@ local default_global_data = { blockspell_spark_width = 2, blockspell_spark_show = true, blockspell_spark_color = {1, 1, 1, 0.7}, + + spellcontainer_headers = {}, --store information about active headers and their sizes + spellcontainer_header_height = 20, + spellcontainer_header_fontsize = 10, + spellcontainer_header_fontcolor = {1, 1, 1, 1}, + }, --profile by spec @@ -1578,35 +1586,35 @@ local default_global_data = { }, } -_detalhes.default_global_data = default_global_data +Details.default_global_data = default_global_data -function _detalhes:GetTutorialCVar(key, default) +function Details:GetTutorialCVar(key, default) --is disabling all popups from the streamer options - if (_detalhes.streamer_config.no_alerts) then + if (Details.streamer_config.no_alerts) then return true end - local value = _detalhes.tutorial [key] + local value = Details.tutorial [key] if (value == nil and default) then - _detalhes.tutorial [key] = default + Details.tutorial [key] = default value = default end return value end -function _detalhes:SetTutorialCVar (key, value) - _detalhes.tutorial [key] = value +function Details:SetTutorialCVar (key, value) + Details.tutorial [key] = value end -function _detalhes:SaveProfileSpecial() +function Details:SaveProfileSpecial() --get the current profile - local profile_name = _detalhes:GetCurrentProfileName() - local profile = _detalhes:GetProfile (profile_name, true) + local profile_name = Details:GetCurrentProfileName() + local profile = Details:GetProfile (profile_name, true) --save default keys - for key, _ in pairs(_detalhes.default_profile) do + for key, _ in pairs(Details.default_profile) do - local current_value = _detalhes_database [key] or _detalhes_global [key] or _detalhes.default_player_data [key] or _detalhes.default_global_data [key] + local current_value = _detalhes_database [key] or _detalhes_global [key] or Details.default_player_data [key] or Details.default_global_data [key] if (type(current_value) == "table") then local ctable = Details.CopyTable(current_value) @@ -1620,8 +1628,8 @@ function _detalhes:SaveProfileSpecial() --save skins table.wipe(profile.instances) - if (_detalhes.tabela_instancias) then - for index, instance in ipairs(_detalhes.tabela_instancias) do + if (Details.tabela_instancias) then + for index, instance in ipairs(Details.tabela_instancias) do local exported = instance:ExportSkin() profile.instances [index] = exported end @@ -1632,8 +1640,8 @@ function _detalhes:SaveProfileSpecial() end --save things for the mythic dungeon run -function _detalhes:SaveState_CurrentMythicDungeonRun (runID, zoneName, zoneID, startAt, segmentID, level, ejID, latestBossAt) - local savedTable = _detalhes.mythic_dungeon_currentsaved +function Details:SaveState_CurrentMythicDungeonRun (runID, zoneName, zoneID, startAt, segmentID, level, ejID, latestBossAt) + local savedTable = Details.mythic_dungeon_currentsaved savedTable.started = true savedTable.run_id = runID savedTable.dungeon_name = zoneName @@ -1645,8 +1653,8 @@ function _detalhes:SaveState_CurrentMythicDungeonRun (runID, zoneName, zoneID, s savedTable.previous_boss_killed_at = latestBossAt end -function _detalhes:UpdateState_CurrentMythicDungeonRun (stillOngoing, segmentID, latestBossAt) - local savedTable = _detalhes.mythic_dungeon_currentsaved +function Details:UpdateState_CurrentMythicDungeonRun (stillOngoing, segmentID, latestBossAt) + local savedTable = Details.mythic_dungeon_currentsaved if (not stillOngoing) then savedTable.started = false @@ -1661,14 +1669,14 @@ function _detalhes:UpdateState_CurrentMythicDungeonRun (stillOngoing, segmentID, end end -function _detalhes:RestoreState_CurrentMythicDungeonRun() +function Details:RestoreState_CurrentMythicDungeonRun() --no need to check for mythic+ if the user is playing on classic wow if (DetailsFramework.IsTimewalkWoW()) then return end - local savedTable = _detalhes.mythic_dungeon_currentsaved + local savedTable = Details.mythic_dungeon_currentsaved local mythicLevel = C_ChallengeMode.GetActiveKeystoneInfo() local zoneName, _, _, _, _, _, _, currentZoneID = GetInstanceInfo() local mapID = C_Map.GetBestMapForUnit ("player") @@ -1691,21 +1699,21 @@ function _detalhes:RestoreState_CurrentMythicDungeonRun() --is there a mythic run ongoing and the level is the same as the saved state? if (mythicLevel and mythicLevel == savedTable.level) then --restore the state - _detalhes.MythicPlus.Started = true - _detalhes.MythicPlus.DungeonName = zoneName - _detalhes.MythicPlus.DungeonID = currentZoneID - _detalhes.MythicPlus.StartedAt = savedTable.started_at - _detalhes.MythicPlus.SegmentID = savedTable.segment_id - _detalhes.MythicPlus.Level = mythicLevel - _detalhes.MythicPlus.ejID = ejID - _detalhes.MythicPlus.PreviousBossKilledAt = savedTable.previous_boss_killed_at - _detalhes.MythicPlus.IsRestoredState = true + Details.MythicPlus.Started = true + Details.MythicPlus.DungeonName = zoneName + Details.MythicPlus.DungeonID = currentZoneID + Details.MythicPlus.StartedAt = savedTable.started_at + Details.MythicPlus.SegmentID = savedTable.segment_id + Details.MythicPlus.Level = mythicLevel + Details.MythicPlus.ejID = ejID + Details.MythicPlus.PreviousBossKilledAt = savedTable.previous_boss_killed_at + Details.MythicPlus.IsRestoredState = true DetailsMythicPlusFrame.IsDoingMythicDungeon = true print("D! (debug) mythic dungeon state restored.") C_Timer.After(2, function() - _detalhes:SendEvent("COMBAT_MYTHICDUNGEON_START") + Details:SendEvent("COMBAT_MYTHICDUNGEON_START") end) return else diff --git a/startup.lua b/startup.lua index 9ccb9d65..5280bab9 100644 --- a/startup.lua +++ b/startup.lua @@ -15,6 +15,8 @@ function Details:StartMeUp() end Details.AndIWillNeverStop = true + --note: this runs after profile loaded + --set default time for arena and bg to be the Details! load time in case the client loads mid event Details.lastArenaStartTime = GetTime() Details.lastBattlegroundStartTime = GetTime() From 20dcfb3866666032808be0102d8beeacce4aeae9 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Thu, 13 Apr 2023 16:38:28 -0300 Subject: [PATCH 06/22] More progress on the new breakdown window --- Definitions.lua | 53 ++++---- Libs/DF/panel.lua | 157 ++++++++++++++++------- boot.lua | 1 + frames/window_playerbreakdown_spells.lua | 105 ++++++++++++--- 4 files changed, 218 insertions(+), 98 deletions(-) diff --git a/Definitions.lua b/Definitions.lua index 85307627..186c41d0 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -76,7 +76,7 @@ ---@field SetDuration fun(self: animationgroup, duration: number) ---@field SetEndDelay fun(self: animationgroup, delay: number) ---@field SetLooping fun(self: animationgroup, loop: boolean) ----@field SetScript fun(self: animationgroup, event: string, handler: function) +---@field SetScript fun(self: animationgroup, event: string, handler: function) "OnEvent"|"OnShow" ---@field SetSmoothProgress fun(self: animationgroup, smooth: boolean) ---@field Stop fun(self: animationgroup) @@ -117,7 +117,7 @@ ---@field SetPropagateKeyboardInput fun(self: frame, propagate: boolean) ---@field SetPropagateGamepadInput fun(self: frame, propagate: boolean) ---@field StartMoving fun(self: frame) ----@field StartSizing fun(self: frame, point: string) +---@field StartSizing fun(self: frame, point: "top"|"topright"|"right"|"bottomright"|"bottom"|"bottomleft"|"left"|"topleft") ---@field StopMovingOrSizing fun(self: frame) ---@field GetAttribute fun(self: frame, name: string) : any ---@field GetFrameLevel fun(self: frame) : number @@ -133,6 +133,7 @@ ---@field CreateFontString fun(self: frame, name: string|nil, layer: "background"|"border"|"artwork"|"overlay"|"highlight", inherits: string|nil, subLayer: number|nil) : fontstring ---@field EnableMouse fun(self: frame, enable: boolean) ---@field SetResizable fun(self: frame, enable: boolean) +---@field SetResizeBounds fun(minWidth: number, minHeight: number, maxWidth: number, maxHeight: number) ---@class button : frame ---@field SetNormalTexture fun(self: button, texture: texture) @@ -155,12 +156,29 @@ ---@field GetButtonState fun(self: button, state: string) : boolean ---@field RegisterForClicks fun(self: button, button1: nil|"AnyUp"|"AnyDown"|"LeftButtonDown"|"LeftButtonUp"|"MiddleButtonUp"|"MiddleButtonDown"|"RightButtonDown"|"RightButtonUp"|"Button4Up"|"Button4Down"|"Button5Up"|"Button5Down", button2: nil|"AnyUp"|"AnyDown"|"LeftButtonDown"|"LeftButtonUp"|"MiddleButtonUp"|"MiddleButtonDown"|"RightButtonDown"|"RightButtonUp"|"Button4Up"|"Button4Down"|"Button5Up"|"Button5Down") ----@class fontstring : uiobject +---@class statusbar : frame +---@field SetStatusBarColor fun(self: statusbar, r: red|number, g: green|number, b: blue|number, a: alpha|number) +---@field SetStatusBarTexture fun(self: statusbar, path: string) +---@field SetMinMaxValues fun(self: statusbar, minValue: number, maxValue: number) +---@field SetValue fun(self: statusbar, value: number) +---@field SetValueStep fun(self: statusbar, valueStep: number) +---@field SetOrientation fun(self: statusbar, orientation: string) +---@field SetReverseFill fun(self: statusbar, reverseFill: boolean) +---@field GetMinMaxValues fun(self: statusbar) : number, number +---@field GetValue fun(self: statusbar) : number +---@field GetValueStep fun(self: statusbar) : number +---@field GetOrientation fun(self: statusbar) : string +---@field GetReverseFill fun(self: statusbar) : boolean + +---@class region : uiobject + +---@class fontstring : region ---@field SetDrawLayer fun(self: fontstring, layer: "background"|"border"|"artwork"|"overlay"|"highlight", subLayer: number|nil) ---@field SetFont fun(self: fontstring, font: string, size: number, flags: string) ---@field SetText fun(self: fontstring, text: string|number) ---@field GetText fun(self: fontstring) : string ---@field GetFont fun(self: fontstring) : string, number, string +---@field GetStringWidth fun(self: fontstring) : number return the width of the string in pixels ---@field SetShadowColor fun(self: fontstring, r: red|number, g: green|number, b: blue|number, a: alpha|number) ---@field GetShadowColor fun(self: fontstring) : number, number, number, number ---@field SetShadowOffset fun(self: fontstring, offsetX: number, offsetY: number) @@ -171,10 +189,6 @@ ---@field GetJustifyH fun(self: fontstring) : string ---@field SetJustifyV fun(self: fontstring, justifyV: string) ---@field GetJustifyV fun(self: fontstring) : string ----@field SetWidth fun(self: fontstring, width: number) ----@field GetWidth fun(self: fontstring) : number ----@field SetHeight fun(self: fontstring, height: number) ----@field GetHeight fun(self: fontstring) : number ---@field SetNonSpaceWrap fun(self: fontstring, nonSpaceWrap: boolean) ---@field GetNonSpaceWrap fun(self: fontstring) : boolean ---@field SetIndentedWordWrap fun(self: fontstring, indentedWordWrap: boolean) @@ -205,40 +219,17 @@ ---@field SetTextTruncateLines fun(self: fontstring, lines: number) ---@field GetTextTruncateLines fun(self: fontstring) : number ----@class statusbar : frame ----@field SetStatusBarColor fun(self: statusbar, r: red|number, g: green|number, b: blue|number, a: alpha|number) ----@field SetStatusBarTexture fun(self: statusbar, path: string) ----@field SetMinMaxValues fun(self: statusbar, minValue: number, maxValue: number) ----@field SetValue fun(self: statusbar, value: number) ----@field SetValueStep fun(self: statusbar, valueStep: number) ----@field SetOrientation fun(self: statusbar, orientation: string) ----@field SetReverseFill fun(self: statusbar, reverseFill: boolean) ----@field GetMinMaxValues fun(self: statusbar) : number, number ----@field GetValue fun(self: statusbar) : number ----@field GetValueStep fun(self: statusbar) : number ----@field GetOrientation fun(self: statusbar) : string ----@field GetReverseFill fun(self: statusbar) : boolean - ----@class texture : uiobject +---@class texture : region ---@field SetDrawLayer fun(self: texture, layer: "background"|"border"|"artwork"|"overlay"|"highlight", subLayer: number|nil) ---@field SetTexture fun(self: texture, path: string) ---@field SetColorTexture fun(self: texture, r: red|number, g: green|number, b: blue|number, a: alpha|number) ---@field SetDesaturated fun(self: texture, desaturate: boolean) ---@field SetBlendMode fun(self: texture, mode: "ADD"|"BLEND"|"DISABLE"|"MOD"|"MOD2X"|"OVERLAY"|"REPLACE"|"SUBTRACT") ---@field SetVertexColor fun(self: texture, r: red|number, g: green|number, b: blue|number, a: alpha|number) ----@field SetAlpha fun(self: texture, alpha: number) ----@field GetAlpha fun(self: texture) : number ----@field SetWidth fun(self: texture, width: number) ----@field SetHeight fun(self: texture, height: number) ----@field GetWidth fun(self: texture) : number ----@field GetHeight fun(self: texture) : number ---@field GetPoint fun(self: texture, index: number) : string, table, string, number, number ---@field SetShown fun(self: texture, state: boolean) ---@field IsShown fun(self: texture) : boolean ----@field SetParent fun(self: texture, parent: table) ---@field GetParent fun(self: texture) : table ----@field SetScale fun(self: texture, scale: number) ----@field GetScale fun(self: texture) : number ---@field SetTexCoord fun(self: texture, left: number, right: number, top: number, bottom: number) ---@field GetTexCoord fun(self: texture) : number, number, number, number ---@field SetRotation fun(self: texture, rotation: number) diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index 120bd83c..99ebd3a4 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -5090,12 +5090,14 @@ end ---@field SetBackdropColorForSelectedColumnHeader fun(self: headerframe, columnHeader: headercolumnframe) ---@field ClearColumnHeader fun(self: headerframe, columnHeader: headercolumnframe) ---@field GetNextHeader fun(self: headerframe) : headercolumnframe +---@field SetColumnSettingChangedCallback fun(self: headerframe, func: function) : boolean ---@field columnHeadersCreated headercolumnframe[] ---@field HeaderTable table ---@field NextHeader number ---@field HeaderWidth number ---@field HeaderHeight number ---@field columnSelected number +---@field OnColumnSettingChangeCallback function ---@class headercolumnframe: frame ---@field Icon texture @@ -5103,7 +5105,9 @@ end ---@field Arrow texture ---@field Separator texture ---@field resizerButton button - +---@field bIsRezising boolean +---@field bInUse boolean +---@field columnData table --mixed functions detailsFramework.HeaderFunctions = { @@ -5231,6 +5235,18 @@ detailsFramework.HeaderCoreFunctions = { self:Refresh() end, + ---@param self headerframe + ---@param func function + ---@return boolean + SetColumnSettingChangedCallback = function(self, func) + if (type(func) ~= "function") then + self.OnColumnSettingChangeCallback = nil + return false + end + self.OnColumnSettingChangeCallback = func + return true + end, + --return which header is current selected and the the order ASC DESC ---@param self headerframe GetSelectedColumn = function(self) @@ -5249,7 +5265,7 @@ detailsFramework.HeaderCoreFunctions = { --reset all header frames for i = 1, #self.columnHeadersCreated do local columnHeader = self.columnHeadersCreated[i] - columnHeader.InUse = false + columnHeader.bInUse = false columnHeader:Hide() end @@ -5357,13 +5373,14 @@ detailsFramework.HeaderCoreFunctions = { ---@param columnHeader headercolumnframe ---@param headerIndex number UpdateColumnHeader = function(self, columnHeader, headerIndex) - local headerData = self.HeaderTable[headerIndex] + --this is the data to update the columnHeader + local columnData = self.HeaderTable[headerIndex] - if (headerData.icon) then - columnHeader.Icon:SetTexture(headerData.icon) + if (columnData.icon) then + columnHeader.Icon:SetTexture(columnData.icon) - if (headerData.texcoord) then - columnHeader.Icon:SetTexCoord(unpack(headerData.texcoord)) + if (columnData.texcoord) then + columnHeader.Icon:SetTexCoord(unpack(columnData.texcoord)) else columnHeader.Icon:SetTexCoord(0, 1, 0, 1) end @@ -5372,8 +5389,8 @@ detailsFramework.HeaderCoreFunctions = { columnHeader.Icon:Show() end - if (headerData.text) then - columnHeader.Text:SetText(headerData.text) + if (columnData.text) then + columnHeader.Text:SetText(columnData.text) --text options detailsFramework:SetFontColor(columnHeader.Text, self.options.text_color) @@ -5381,7 +5398,7 @@ detailsFramework.HeaderCoreFunctions = { detailsFramework:SetFontOutline(columnHeader.Text, self.options.text_shadow) --point - if (not headerData.icon) then + if (not columnData.icon) then columnHeader.Text:SetPoint("left", columnHeader, "left", self.options.padding, 0) else columnHeader.Text:SetPoint("left", columnHeader.Icon, "right", self.options.padding, 0) @@ -5393,37 +5410,37 @@ detailsFramework.HeaderCoreFunctions = { --column header index columnHeader.columnIndex = headerIndex - if (headerData.canSort) then + if (columnData.canSort) then columnHeader.order = "DESC" columnHeader.Arrow:SetTexture(self.options.arrow_up_texture) else columnHeader.Arrow:Hide() end - if (headerData.selected) then + if (columnData.selected) then columnHeader.Arrow:Show() columnHeader.Arrow:SetAlpha(.843) self:UpdateSortArrow(columnHeader, true, columnHeader.order) self.columnSelected = headerIndex else - if (headerData.canSort) then + if (columnData.canSort) then self:UpdateSortArrow(columnHeader, false, columnHeader.order) end end --size - if (headerData.width) then - columnHeader:SetWidth(headerData.width) + if (columnData.width) then + columnHeader:SetWidth(columnData.width) end - if (headerData.height) then - columnHeader:SetHeight(headerData.height) + if (columnData.height) then + columnHeader:SetHeight(columnData.height) end columnHeader.XPosition = self.HeaderWidth -- + self.options.padding columnHeader.YPosition = self.HeaderHeight -- + self.options.padding - columnHeader.columnAlign = headerData.align or "left" - columnHeader.columnOffset = headerData.offset or 0 + columnHeader.columnAlign = columnData.align or "left" + columnHeader.columnOffset = columnData.offset or 0 --add the header piece size to the total header size local growDirection = string.lower(self.options.grow_direction) @@ -5437,8 +5454,20 @@ detailsFramework.HeaderCoreFunctions = { self.HeaderHeight = self.HeaderHeight + columnHeader:GetHeight() + self.options.padding end + local bShowColumnHeaderReziser = self.options.reziser_shown + if (bShowColumnHeaderReziser) then + local resizerButton = columnHeader.resizerButton + resizerButton:Show() + resizerButton.texture:SetVertexColor(unpack(self.options.reziser_color)) + resizerButton:SetWidth(self.options.reziser_width) + resizerButton:SetHeight(columnHeader:GetHeight()) + else + columnHeader.resizerButton:Hide() + end + columnHeader:Show() - columnHeader.InUse = true + columnHeader.bInUse = true + columnHeader.columnData = columnData end, ---reset column header backdrop @@ -5480,64 +5509,90 @@ detailsFramework.HeaderCoreFunctions = { if (not columnHeader) then --create a new column header ---@type headercolumnframe - local newHeader = CreateFrame("button", "$parentHeaderIndex" .. nextHeader, self, "BackdropTemplate") - newHeader:SetScript("OnClick", detailsFramework.HeaderFunctions.OnClick) - newHeader:SetMovable(true) - newHeader:SetResizable(true) + columnHeader = CreateFrame("button", "$parentHeaderIndex" .. nextHeader, self, "BackdropTemplate") + columnHeader:SetScript("OnClick", detailsFramework.HeaderFunctions.OnClick) + columnHeader:SetMovable(true) + columnHeader:SetResizable(true) - newHeader:SetScript("OnMouseDown", function() + columnHeader:SetScript("OnMouseDown", function() print(11) end) - newHeader:SetScript("OnMouseUp", function() + columnHeader:SetScript("OnMouseUp", function() print(22) --doesn't work either end) --header icon - detailsFramework:CreateImage(newHeader, "", self.options.header_height, self.options.header_height, "ARTWORK", nil, "Icon", "$parentIcon") + detailsFramework:CreateImage(columnHeader, "", self.options.header_height, self.options.header_height, "ARTWORK", nil, "Icon", "$parentIcon") --header separator - detailsFramework:CreateImage(newHeader, "", 1, 1, "ARTWORK", nil, "Separator", "$parentSeparator") + detailsFramework:CreateImage(columnHeader, "", 1, 1, "ARTWORK", nil, "Separator", "$parentSeparator") --header name text - detailsFramework:CreateLabel(newHeader, "", self.options.text_size, self.options.text_color, "GameFontNormal", "Text", "$parentText", "ARTWORK") + detailsFramework:CreateLabel(columnHeader, "", self.options.text_size, self.options.text_color, "GameFontNormal", "Text", "$parentText", "ARTWORK") --header selected and order icon - detailsFramework:CreateImage(newHeader, self.options.arrow_up_texture, 12, 12, "ARTWORK", nil, "Arrow", "$parentArrow") + detailsFramework:CreateImage(columnHeader, self.options.arrow_up_texture, 12, 12, "ARTWORK", nil, "Arrow", "$parentArrow") ---rezise button ---@type button - local resizerButton = _G.CreateFrame("button", "$parentResizer", newHeader) + local resizerButton = _G.CreateFrame("button", "$parentResizer", columnHeader) resizerButton:SetWidth(4) - resizerButton:SetFrameLevel(newHeader:GetFrameLevel()+2) - resizerButton:SetPoint("topright", newHeader, "topright", -1, 0) - resizerButton:SetPoint("bottomright", newHeader, "bottomright", -1, 0) + resizerButton:SetFrameLevel(columnHeader:GetFrameLevel()+2) + resizerButton:SetPoint("topright", columnHeader, "topright", -1, -1) + resizerButton:SetPoint("bottomright", columnHeader, "bottomright", -1, 1) resizerButton:EnableMouse(true) resizerButton:RegisterForClicks("LeftButtonDown", "LeftButtonUp") - newHeader.resizerButton = resizerButton + columnHeader.resizerButton = resizerButton - resizerButton:SetScript("OnMouseDown", function() - newHeader.bIsRezising = true - print(1) - newHeader:StartSizing("right") + resizerButton:SetScript("OnEnter", function() + resizerButton.texture:SetVertexColor(1, 1, 1, 0.9) + end) + + resizerButton:SetScript("OnLeave", function() + resizerButton.texture:SetVertexColor(unpack(self.options.reziser_color)) + end) + + resizerButton:SetScript("OnMouseDown", function() --move this to a single function + if (not columnHeader.bIsRezising) then + --get the string length to know the min size + local textLength = columnHeader.Text:GetStringWidth() + 6 + columnHeader:SetResizeBounds(math.max(textLength, self.options.reziser_min_width), columnHeader:GetHeight(), self.options.reziser_max_width, columnHeader:GetHeight()) + columnHeader.bIsRezising = true + columnHeader:StartSizing("right") + end end) resizerButton:SetScript("OnMouseUp", function() - newHeader.bIsRezising = false - print(2) - newHeader:StopMovingOrSizing() + if (columnHeader.bIsRezising) then + columnHeader.bIsRezising = false + columnHeader:StopMovingOrSizing() + + --callback or modify into a passed by table? + if (self.OnColumnSettingChangeCallback) then --need to get the header name + local columnName = columnHeader.columnData.name + xpcall(self.OnColumnSettingChangeCallback, geterrorhandler(), self, "width", columnName, columnHeader:GetWidth()) + end + end + end) + + resizerButton:SetScript("OnHide", function() + if (columnHeader.bIsRezising) then + columnHeader:StopMovingOrSizing() + columnHeader.bIsRezising = false + end end) resizerButton.texture = resizerButton:CreateTexture(nil, "overlay") resizerButton.texture:SetAllPoints() resizerButton.texture:SetColorTexture(1, 1, 1, 1) - newHeader.Arrow:SetPoint("right", newHeader, "right", -1, 0) + columnHeader.Arrow:SetPoint("right", columnHeader, "right", -1, 0) - newHeader.Separator:Hide() - newHeader.Arrow:Hide() + columnHeader.Separator:Hide() + columnHeader.Arrow:Hide() - self:UpdateSortArrow(newHeader, false, "DESC") + self:UpdateSortArrow(columnHeader, false, "DESC") - tinsert(self.columnHeadersCreated, newHeader) - columnHeader = newHeader + tinsert(self.columnHeadersCreated, columnHeader) + columnHeader = columnHeader end self:ClearColumnHeader(columnHeader) @@ -5561,6 +5616,12 @@ local default_header_options = { grow_direction = "RIGHT", padding = 2, + reziser_shown = false, --make sure to set the callback function with: header:SetOnColumnResizeScript(callbackFunction) + reziser_width = 2, + reziser_color = {1, 0.6, 0, 0.6}, + reziser_min_width = 16, + reziser_max_width = 200, + --each piece of the header header_backdrop = {bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}, header_backdrop_color = {0, 0, 0, 0.5}, diff --git a/boot.lua b/boot.lua index ee11d730..b9288b25 100644 --- a/boot.lua +++ b/boot.lua @@ -2,6 +2,7 @@ --global name declaration --local _StartDebugTime = debugprofilestop() print(debugprofilestop() - _StartDebugTime) --test if the packager will deploy to wago +--https://github.com/LuaLS/lua-language-server/wiki/Annotations#documenting-types --make an option to show death in the order of newest to oldest diff --git a/frames/window_playerbreakdown_spells.lua b/frames/window_playerbreakdown_spells.lua index b8eaa9dc..ca8eedb7 100644 --- a/frames/window_playerbreakdown_spells.lua +++ b/frames/window_playerbreakdown_spells.lua @@ -69,13 +69,16 @@ end function spellsTab.OnProfileChange() spellsTab.spellcontainer_header_settings = Details.breakdown_spell_tab.spellcontainer_headers - spellsTab.UpdateHeadersSettings() + spellsTab.UpdateHeadersSettings("spells") end +---@type table +local headerContainerType = {} + ---default settings for the header of the spells container ---label is a localized string ---@type {name: string, width: number, label: string, align: string, enabled: boolean, attribute: number|nil}[] -local columnInfo = { +local spellContainerColumnInfo = { {name = "icon", width = 22, label = "", align = "center", enabled = true,}, {name = "target", width = 22, label = "", align = "center", enabled = true}, {name = "rank", label = "#", width = 16, align = "center", enabled = true}, @@ -93,21 +96,59 @@ local columnInfo = { {name = "absorbed", label = "absorbed", width = 45, align = "left", enabled = false, attribute = DETAILS_ATTRIBUTE_HEAL}, } -function spellsTab.UpdateHeadersSettings() - --profile settings +---callback for when the user resizes a column on the header +---@param headerFrame headerframe +---@param optionName string +---@param columnName string +---@param value any +local onHeaderColumnOptionChanged = function(headerFrame, optionName, columnName, value) + ---@type string + local containerType = headerContainerType[headerFrame] ---@type table - local settings = spellsTab.spellcontainer_header_settings + local settings - --do a loop and check if the column exists in the profile settings, if not, create it - for i = 1, #columnInfo do + if (containerType == "spells") then + settings = spellsTab.spellcontainer_header_settings + + elseif (containerType == "targets") then + + end + + settings[columnName][optionName] = value + + spellsTab.UpdateHeadersSettings(containerType) +end + +---update details profile +---copy settings from the ColumnInfo table which doesn't exists in the details profile +---this is called when the profile changes or when the tab is opened with a different actor than before +---@param containerType "spells"|"targets" +function spellsTab.UpdateHeadersSettings(containerType) + ---details table which hold the settings for a container header + ---@type table + local settings + ---@type table + local containerInfo + if (containerType == "spells") then + settings = spellsTab.spellcontainer_header_settings + containerInfo = spellContainerColumnInfo + + elseif (containerType == "targets") then + + end + + --do a loop and check if the column data from columnInfo exists in the details profile settings, if not, add it + for i = 1, #containerInfo do --default column settings - local columnData = columnInfo[i] + local columnData = containerInfo[i] + ---@type string + local columnName = columnData.name --column settings for the column on details profile - local columnSettings = settings[columnData.name] + local columnSettings = settings[columnName] --check if this column does not have a mirror table in details profile if (not columnSettings) then --create the mirror table - settings[columnData.name] = { + settings[columnName] = { enabled = columnData.enabled, width = columnData.width, align = columnData.align, @@ -115,13 +156,20 @@ function spellsTab.UpdateHeadersSettings() end end - spellsTab.spellsHeaderData = spellsTab.BuildHeaderTable() - print("headerTable = ", #spellsTab.spellsHeaderData) - spellsTab.SpellScrollFrame.Header:SetHeaderTable(spellsTab.spellsHeaderData) + if (containerType == "spells") then + spellsTab.spellsHeaderData = spellsTab.BuildHeaderTable("spells") + spellsTab.SpellScrollFrame.Header:SetHeaderTable(spellsTab.spellsHeaderData) + + elseif (containerType == "targets") then + spellsTab.spellsHeaderData = spellsTab.BuildHeaderTable("targets") + end end -function spellsTab.BuildHeaderTable() - ---@type {name: string, width: number, label: string, align: string, enabled: boolean}[] +---parse the data from details profile and build a table with the data to be used by the header +---@param containerType "spells"|"targets" +---@return {name: string, width: number, text: string, align: string}[] +function spellsTab.BuildHeaderTable(containerType) + ---@type {name: string, width: number, text: string, align: string}[] local headerTable = {} ---@type instance @@ -131,10 +179,20 @@ function spellsTab.BuildHeaderTable() local mainAttribute, subAttribute = instance:GetDisplay() --settings from profile | updated at UpdateHeadersSettings() > called on OnProfileChange() and when the tab is opened - local settings = spellsTab.spellcontainer_header_settings + local settings - for i = 1, #columnInfo do - local columnData = columnInfo[i] + ---@type table + local containerInfo + + if (containerType == "spells") then + settings = spellsTab.spellcontainer_header_settings + containerInfo = spellContainerColumnInfo + elseif (containerType == "targets") then + + end + + for i = 1, #containerInfo do + local columnData = containerInfo[i] local columnSettings = settings[columnData.name] if (columnSettings.enabled) then @@ -218,7 +276,7 @@ function spellsTab.OnShownTab() --reset the spell blocks spellsTab.GetSpellBlockContainer():ClearBlocks() --update spells header frame - spellsTab.UpdateHeadersSettings() + spellsTab.UpdateHeadersSettings("spells") end --called when the tab is getting created, run only once @@ -1336,13 +1394,22 @@ function spellsTab.CreateSpellScrollContainer(tabFrame) --~header local headerOptions = { padding = 2, + header_height = 14, + reziser_shown = true, + reziser_width = 2, + reziser_color = {.5, .5, .5, 0.7}, + reziser_max_width = 246, } local headerTable = {} scrollFrame.Header = DetailsFramework:CreateHeader(tabFrame, headerTable, headerOptions) scrollFrame.Header:SetPoint("topleft", scrollFrame, "topleft", 0, 1) + scrollFrame.Header:SetColumnSettingChangedCallback(onHeaderColumnOptionChanged) + + --cache the type of this container + headerContainerType[scrollFrame.Header] = "spells" --create the scroll lines for i = 1, CONST_SPELLSCROLL_AMTLINES do From f370ce3deef9cc269c71063a73a3490d1c56e7ab Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Thu, 13 Apr 2023 21:43:04 -0300 Subject: [PATCH 07/22] More development --- Libs/DF/panel.lua | 33 +++++----- frames/window_playerbreakdown_spells.lua | 80 ++++++++++++++++++------ 2 files changed, 77 insertions(+), 36 deletions(-) diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index 99ebd3a4..f447601a 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -5158,38 +5158,43 @@ detailsFramework.HeaderFunctions = { end, ---comment - ---@param self button + ---@param columnHeader headercolumnframe ---@param buttonClicked string - OnClick = function(self, buttonClicked) + OnClick = function(columnHeader, buttonClicked) --get the header main frame ---@type headerframe - local headerFrame = self:GetParent() + local headerFrame = columnHeader:GetParent() --if this header does not have a clickable header, just ignore if (not headerFrame.columnSelected) then return end + --check if this column has 'canSort' key, otherwise ignore the click + if (not columnHeader.columnData.canSort) then + return + end + --get the latest column header selected ---@type headercolumnframe local previousColumnHeader = headerFrame.columnHeadersCreated[headerFrame.columnSelected] previousColumnHeader.Arrow:Hide() headerFrame:ResetColumnHeaderBackdrop(previousColumnHeader) - headerFrame:SetBackdropColorForSelectedColumnHeader(self) + headerFrame:SetBackdropColorForSelectedColumnHeader(columnHeader) - if (headerFrame.columnSelected == self.columnIndex) then - self.order = self.order ~= "ASC" and "ASC" or "DESC" + if (headerFrame.columnSelected == columnHeader.columnIndex) then + columnHeader.order = columnHeader.order ~= "ASC" and "ASC" or "DESC" end - headerFrame.columnOrder = self.order + headerFrame.columnOrder = columnHeader.order --set the new column header selected - headerFrame.columnSelected = self.columnIndex + headerFrame.columnSelected = columnHeader.columnIndex - headerFrame:UpdateSortArrow(self) + headerFrame:UpdateSortArrow(columnHeader) if (headerFrame.options.header_click_callback) then --callback with the main header frame, column header, column index and column order as payload - local okay, errortext = pcall(headerFrame.options.header_click_callback, headerFrame, self, self.columnIndex, self.order) + local okay, errortext = pcall(headerFrame.options.header_click_callback, headerFrame, columnHeader, columnHeader.columnIndex, columnHeader.order) if (not okay) then print("DF: Header onClick callback error:", errortext) end @@ -5514,14 +5519,6 @@ detailsFramework.HeaderCoreFunctions = { columnHeader:SetMovable(true) columnHeader:SetResizable(true) - columnHeader:SetScript("OnMouseDown", function() - print(11) - end) - - columnHeader:SetScript("OnMouseUp", function() - print(22) --doesn't work either - end) - --header icon detailsFramework:CreateImage(columnHeader, "", self.options.header_height, self.options.header_height, "ARTWORK", nil, "Icon", "$parentIcon") --header separator diff --git a/frames/window_playerbreakdown_spells.lua b/frames/window_playerbreakdown_spells.lua index ca8eedb7..c806cf1b 100644 --- a/frames/window_playerbreakdown_spells.lua +++ b/frames/window_playerbreakdown_spells.lua @@ -75,25 +75,28 @@ end ---@type table local headerContainerType = {} +---@type number +local columnOffset = 0 + ---default settings for the header of the spells container ---label is a localized string ----@type {name: string, width: number, label: string, align: string, enabled: boolean, attribute: number|nil}[] +---@type {name: string, width: number, selected: boolean|nil, label: string, align: string, enabled: boolean, attribute: number|nil, canSort: boolean|nil, dataType: string|nil, order: string|nil, offset: number|nil}[] local spellContainerColumnInfo = { - {name = "icon", width = 22, label = "", align = "center", enabled = true,}, - {name = "target", width = 22, label = "", align = "center", enabled = true}, - {name = "rank", label = "#", width = 16, align = "center", enabled = true}, - {name = "expand", label = "^", width = 16, align = "center", enabled = true}, - {name = "name", label = "spell name", width = 246, align = "left", enabled = true}, - {name = "amount", label = "total", width = 50, align = "left", enabled = true}, - {name = "persecond", label = "ps", width = 50, align = "left", enabled = true}, - {name = "percent", label = "%", width = 50, align = "left", enabled = true}, - {name = "casts", label = "casts", width = 40, align = "left", enabled = false}, - {name = "critpercent", label = "crit %", width = 40, align = "left", enabled = false}, - {name = "hits", label = "hits", width = 40, align = "left", enabled = false}, - {name = "castavg", label = "cast avg", width = 50, align = "left", enabled = false}, - {name = "uptime", label = "uptime", width = 45, align = "left", enabled = false}, - {name = "overheal", label = "overheal", width = 45, align = "left", enabled = false, attribute = DETAILS_ATTRIBUTE_HEAL}, - {name = "absorbed", label = "absorbed", width = 45, align = "left", enabled = false, attribute = DETAILS_ATTRIBUTE_HEAL}, + {name = "icon", width = 22, label = "", align = "center", enabled = true, offset = columnOffset}, + {name = "target", width = 22, label = "", align = "center", enabled = true, offset = columnOffset}, + {name = "rank", label = "#", width = 16, align = "center", enabled = true, offset = columnOffset, dataType = "number"}, + {name = "expand", label = "^", width = 16, align = "center", enabled = true, offset = columnOffset}, + {name = "name", label = "spell name", width = 246, align = "left", enabled = true, offset = columnOffset}, + {name = "amount", label = "total", selected = true, width = 50, align = "left", enabled = true, canSort = true, dataType = "number", order = "DESC", offset = columnOffset}, + {name = "persecond", label = "ps", width = 50, align = "left", enabled = true, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, + {name = "percent", label = "%", width = 50, align = "left", enabled = true, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, + {name = "casts", label = "casts", width = 40, align = "left", enabled = false, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, + {name = "critpercent", label = "crit %", width = 40, align = "left", enabled = false, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, + {name = "hits", label = "hits", width = 40, align = "left", enabled = false, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, + {name = "castavg", label = "cast avg", width = 50, align = "left", enabled = false, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, + {name = "uptime", label = "uptime", width = 45, align = "left", enabled = false, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, + {name = "overheal", label = "overheal", width = 45, align = "left", enabled = false, canSort = true, order = "DESC", dataType = "number", attribute = DETAILS_ATTRIBUTE_HEAL, offset = columnOffset}, + {name = "absorbed", label = "absorbed", width = 45, align = "left", enabled = false, canSort = true, order = "DESC", dataType = "number", attribute = DETAILS_ATTRIBUTE_HEAL, offset = columnOffset}, } ---callback for when the user resizes a column on the header @@ -119,6 +122,23 @@ local onHeaderColumnOptionChanged = function(headerFrame, optionName, columnName spellsTab.UpdateHeadersSettings(containerType) end +---run when the user clicks the columnHeader +---@param headerFrame headerframe +---@param columnHeader headercolumnframe +local onColumnHeaderClickCallback = function(headerFrame, columnHeader) + + print("column header clicked!") + + ---@type string + local containerType = headerContainerType[headerFrame] + + if (containerType == "spells") then + spellsTab.TabFrame.SpellScrollFrame:Refresh() + end + + --tab:fillfunction(Details:GetPlayerObjectFromBreakdownWindow(), Details:GetCombatFromBreakdownWindow()) +end + ---update details profile ---copy settings from the ColumnInfo table which doesn't exists in the details profile ---this is called when the profile changes or when the tab is opened with a different actor than before @@ -192,9 +212,13 @@ function spellsTab.BuildHeaderTable(containerType) end for i = 1, #containerInfo do + ---@type {name: string, width: number, selected: boolean|nil, label: string, align: string, enabled: boolean, attribute: number|nil, canSort: boolean|nil, dataType: string|nil, order: string|nil, offset: number|nil} local columnData = containerInfo[i] + ---@type {enabled: boolean, width: number, align: string} local columnSettings = settings[columnData.name] + --, canSort = true, dataType = "number", order = "DESC", offset = 0 + if (columnSettings.enabled) then local bCanAdd = true if (columnData.attribute) then @@ -205,10 +229,17 @@ function spellsTab.BuildHeaderTable(containerType) if (bCanAdd) then headerTable[#headerTable+1] = { - text = columnData.label, width = columnSettings.width, + text = columnData.label, name = columnData.name, - --align = column.align, + + --these values may be nil + selected = columnData.selected, + align = columnData.align, + canSort = columnData.canSort, + dataType = columnData.dataType, + order = columnData.order, + offset = columnData.offset, } end end @@ -1310,6 +1341,17 @@ local refreshFunc = function(scrollFrame, scrollData, offset, totalLines) --~ref local headerTable = spellsTab.spellsHeaderData + --get which column is currently selected and the sort order + local columnIndex, order = scrollFrame.Header:GetSelectedColumn() + + --[=[ + if (order == "DESC") then + table.sort(allSpells, function (t1, t2) return t1[4] > t2[4] end) + else + table.sort(allSpells, function (t1, t2) return t1[4] < t2[4] end) + end + --]=] + local lineIndex = 1 for i = 1, totalLines do local index = i + offset @@ -1400,6 +1442,8 @@ function spellsTab.CreateSpellScrollContainer(tabFrame) reziser_width = 2, reziser_color = {.5, .5, .5, 0.7}, reziser_max_width = 246, + + header_click_callback = onColumnHeaderClickCallback, } local headerTable = {} From f6665201b4a70113bfbc73002589b12a7a1ebd5b Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Mon, 17 Apr 2023 14:21:57 -0300 Subject: [PATCH 08/22] Keeping the development --- Definitions.lua | 6 ++ Libs/DF/panel.lua | 16 ++++- classes/class_damage.lua | 47 +++++++------- frames/window_playerbreakdown.lua | 3 +- frames/window_playerbreakdown_spells.lua | 83 +++++++++++++++--------- functions/mixin.lua | 5 +- 6 files changed, 100 insertions(+), 60 deletions(-) diff --git a/Definitions.lua b/Definitions.lua index 186c41d0..7f154563 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -413,6 +413,8 @@ ---@class breakdownspellscrollframe : frame ---@field Header frame + + ---@class breakdownspellbar : button ---@field index number ---@field rank number @@ -479,6 +481,10 @@ ---@field texture texture ---@field bIsMainLine boolean +---@class breakdownspelldatalist : breakdownspelldata[] +---@field totalValue number +---@field combatTime number + ---@class tabframe : frame this is the tab frame object for the breakdown window ---@class breakdownspellblockcontainer : frame container for the spellblocks in the breakdown window diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index f447601a..46e02659 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -5108,6 +5108,8 @@ end ---@field bIsRezising boolean ---@field bInUse boolean ---@field columnData table +---@field order string +---@field key string used to sort the values --mixed functions detailsFramework.HeaderFunctions = { @@ -5254,8 +5256,14 @@ detailsFramework.HeaderCoreFunctions = { --return which header is current selected and the the order ASC DESC ---@param self headerframe + ---@return number, string GetSelectedColumn = function(self) - return self.columnSelected, self.columnHeadersCreated[self.columnSelected or 1].order + ---@type number + local columnSelected = self.columnSelected + ---@type headercolumnframe + local columnHeader = self.columnHeadersCreated[columnSelected or 1] + + return columnSelected, columnHeader.order, columnHeader.key end, --clean up and rebuild the header following the header options @@ -5277,8 +5285,10 @@ detailsFramework.HeaderCoreFunctions = { local previousColumnHeader local growDirection = string.lower(self.options.grow_direction) - --update header frames + --amount of headers to be updated local headerSize = #self.HeaderTable + + --update header frames for i = 1, headerSize do --get the header button, a new one is created if it doesn't exists yet local columnHeader = self:GetNextHeader() @@ -5381,6 +5391,8 @@ detailsFramework.HeaderCoreFunctions = { --this is the data to update the columnHeader local columnData = self.HeaderTable[headerIndex] + columnHeader.key = columnData.key or "total" + if (columnData.icon) then columnHeader.Icon:SetTexture(columnData.icon) diff --git a/classes/class_damage.lua b/classes/class_damage.lua index 9e8b045b..f99b78eb 100644 --- a/classes/class_damage.lua +++ b/classes/class_damage.lua @@ -4517,12 +4517,13 @@ function atributo_damage:MontaInfoDamageDone() --I guess this fills the list of end end + ---@type breakdownspelldatalist + local breakdownSpellDataList = {} + ---@type number local totalDamageWithoutPet = actorObject.total_without_pet ---@type number local actorTotal = actorObject.total - ---@type table - local actorSpellsSorted = {} ---@type table local actorSpells = actorObject:GetSpellList() @@ -4539,10 +4540,9 @@ function atributo_damage:MontaInfoDamageDone() --I guess this fills the list of --actor spells ---@type table local alreadyAdded = {} - for spellId, spellTable in pairs(actorSpells) do - ---@cast spellId number - ---@cast spellTable spelltable + ---@type number, spelltable + for spellId, spellTable in pairs(actorSpells) do spellTable.ChartData = nil ---@type string @@ -4552,7 +4552,7 @@ function atributo_damage:MontaInfoDamageDone() --I guess this fills the list of local index = alreadyAdded[spellName] if (index) then ---@type breakdownspelldata - local bkSpellData = actorSpellsSorted[index] + local bkSpellData = breakdownSpellDataList[index] bkSpellData.spellIds[#bkSpellData.spellIds+1] = spellId bkSpellData.spellTables[#bkSpellData.spellTables+1] = spellTable bkSpellData.petNames[#bkSpellData.petNames+1] = "" @@ -4570,8 +4570,8 @@ function atributo_damage:MontaInfoDamageDone() --I guess this fills the list of petNames = {""}, } - actorSpellsSorted[#actorSpellsSorted+1] = bkSpellData - alreadyAdded[spellName] = #actorSpellsSorted + breakdownSpellDataList[#breakdownSpellDataList+1] = bkSpellData + alreadyAdded[spellName] = #breakdownSpellDataList end end end @@ -4596,7 +4596,7 @@ function atributo_damage:MontaInfoDamageDone() --I guess this fills the list of local index = alreadyAdded[spellName] if (index) then --PET ---@type breakdownspelldata - local bkSpellData = actorSpellsSorted[index] + local bkSpellData = breakdownSpellDataList[index] bkSpellData.spellIds[#bkSpellData.spellIds+1] = spellId bkSpellData.spellTables[#bkSpellData.spellTables+1] = spellTable bkSpellData.petNames[#bkSpellData.petNames+1] = petName @@ -4613,41 +4613,38 @@ function atributo_damage:MontaInfoDamageDone() --I guess this fills the list of spellTables = {spellTable}, petNames = {petName}, } - actorSpellsSorted[#actorSpellsSorted+1] = bkSpellData - alreadyAdded[spellName] = #actorSpellsSorted + breakdownSpellDataList[#breakdownSpellDataList+1] = bkSpellData + alreadyAdded[spellName] = #breakdownSpellDataList end end end end end - for i = 1, #actorSpellsSorted do + --copy the keys from the spelltable and add them to the breakdownspelldata + --repeated spells will be summed + for i = 1, #breakdownSpellDataList do ---@type breakdownspelldata - local bkSpellData = actorSpellsSorted[i] + local bkSpellData = breakdownSpellDataList[i] Details:SumSpellTables(bkSpellData.spellTables, bkSpellData) end - --table.sort(actorSpellsSorted, Details.Sort2) - table.sort(actorSpellsSorted, function(t1, t2) - return t1.total > t2.total - end) - - actorSpellsSorted.totalValue = actorTotal - actorSpellsSorted.combatTime = actorCombatTime - - --actorSpellsSorted has the spell infomation, need to pass to the summary tab + breakdownSpellDataList.totalValue = actorTotal + breakdownSpellDataList.combatTime = actorCombatTime --cleanup table.wipe(alreadyAdded) --send to the breakdown window - Details222.BreakdownWindow.SendSpellData(actorSpellsSorted, actorObject, combatObject, instance) + Details222.BreakdownWindow.SendSpellData(breakdownSpellDataList, actorObject, combatObject, instance) if 1 then return end + --to be deprecated and removed: + --gump:JI_AtualizaContainerBarras (#actorSpellsSorted + 1) - local max_ = actorSpellsSorted[1] and actorSpellsSorted[1][2] or 0 --dano que a primeiro magia vez + local max_ = breakdownSpellDataList[1] and breakdownSpellDataList[1][2] or 0 --dano que a primeiro magia vez local barra --aura bar @@ -4661,7 +4658,7 @@ function atributo_damage:MontaInfoDamageDone() --I guess this fills the list of end --spell bars - for index, tabela in ipairs(actorSpellsSorted) do + for index, tabela in ipairs(breakdownSpellDataList) do --index = index + 1 --with the aura bar index = index diff --git a/frames/window_playerbreakdown.lua b/frames/window_playerbreakdown.lua index ca603d49..2d8b5a3e 100644 --- a/frames/window_playerbreakdown.lua +++ b/frames/window_playerbreakdown.lua @@ -406,9 +406,8 @@ function Details222.BreakdownWindow.IsSpellExpanded(spellID) return Details222.BreakdownWindow.ExpandedSpells[spellID] end - ---receives spell data to show in the summary tab ----@param data table +---@param data breakdownspelldatalist ---@param actorObject actor ---@param combatObject combat ---@param instance instance diff --git a/frames/window_playerbreakdown_spells.lua b/frames/window_playerbreakdown_spells.lua index c806cf1b..1b13ba5d 100644 --- a/frames/window_playerbreakdown_spells.lua +++ b/frames/window_playerbreakdown_spells.lua @@ -87,16 +87,16 @@ local spellContainerColumnInfo = { {name = "rank", label = "#", width = 16, align = "center", enabled = true, offset = columnOffset, dataType = "number"}, {name = "expand", label = "^", width = 16, align = "center", enabled = true, offset = columnOffset}, {name = "name", label = "spell name", width = 246, align = "left", enabled = true, offset = columnOffset}, - {name = "amount", label = "total", selected = true, width = 50, align = "left", enabled = true, canSort = true, dataType = "number", order = "DESC", offset = columnOffset}, - {name = "persecond", label = "ps", width = 50, align = "left", enabled = true, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, - {name = "percent", label = "%", width = 50, align = "left", enabled = true, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, - {name = "casts", label = "casts", width = 40, align = "left", enabled = false, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, - {name = "critpercent", label = "crit %", width = 40, align = "left", enabled = false, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, - {name = "hits", label = "hits", width = 40, align = "left", enabled = false, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, - {name = "castavg", label = "cast avg", width = 50, align = "left", enabled = false, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, - {name = "uptime", label = "uptime", width = 45, align = "left", enabled = false, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, - {name = "overheal", label = "overheal", width = 45, align = "left", enabled = false, canSort = true, order = "DESC", dataType = "number", attribute = DETAILS_ATTRIBUTE_HEAL, offset = columnOffset}, - {name = "absorbed", label = "absorbed", width = 45, align = "left", enabled = false, canSort = true, order = "DESC", dataType = "number", attribute = DETAILS_ATTRIBUTE_HEAL, offset = columnOffset}, + {name = "amount", label = "total", key = "total", selected = true, width = 50, align = "left", enabled = true, canSort = true, sortKey = "total", dataType = "number", order = "DESC", offset = columnOffset}, + {name = "persecond", label = "ps", key = "total", width = 50, align = "left", enabled = true, canSort = true, sortKey = "ps", offset = columnOffset, order = "DESC", dataType = "number"}, + {name = "percent", label = "%", key = "total", width = 50, align = "left", enabled = true, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, + {name = "casts", label = "casts", key = "total", width = 40, align = "left", enabled = false, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, + {name = "critpercent", label = "crit %", key = "total", width = 40, align = "left", enabled = false, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, + {name = "hits", label = "hits", key = "counter", width = 40, align = "left", enabled = false, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, + {name = "castavg", label = "cast avg", key = "total", width = 50, align = "left", enabled = false, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, + {name = "uptime", label = "uptime", key = "total", width = 45, align = "left", enabled = false, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, + {name = "overheal", label = "overheal", key = "total", width = 45, align = "left", enabled = false, canSort = true, order = "DESC", dataType = "number", attribute = DETAILS_ATTRIBUTE_HEAL, offset = columnOffset}, + {name = "absorbed", label = "absorbed", key = "total", width = 45, align = "left", enabled = false, canSort = true, order = "DESC", dataType = "number", attribute = DETAILS_ATTRIBUTE_HEAL, offset = columnOffset}, } ---callback for when the user resizes a column on the header @@ -1320,7 +1320,7 @@ end ---refresh the data shown in the spells scroll box ---@param scrollFrame table ----@param scrollData breakdownscrolldata +---@param scrollData breakdownspelldatalist ---@param offset number ---@param totalLines number local refreshFunc = function(scrollFrame, scrollData, offset, totalLines) --~refreshspells ~refresh @@ -1328,7 +1328,6 @@ local refreshFunc = function(scrollFrame, scrollData, offset, totalLines) --~ref local maxValue = scrollData[1] and scrollData[1].total ---@type number local totalValue = scrollData.totalValue - ---@type actor local actorObject = spellsTab.GetActor() ---@type string @@ -1341,16 +1340,7 @@ local refreshFunc = function(scrollFrame, scrollData, offset, totalLines) --~ref local headerTable = spellsTab.spellsHeaderData - --get which column is currently selected and the sort order - local columnIndex, order = scrollFrame.Header:GetSelectedColumn() - - --[=[ - if (order == "DESC") then - table.sort(allSpells, function (t1, t2) return t1[4] > t2[4] end) - else - table.sort(allSpells, function (t1, t2) return t1[4] < t2[4] end) - end - --]=] + --todo: when swapping sort orders, close allexpanded spells local lineIndex = 1 for i = 1, totalLines do @@ -1428,11 +1418,6 @@ function spellsTab.CreateSpellScrollContainer(tabFrame) tabFrame.SpellScrollFrame = scrollFrame spellsTab.SpellScrollFrame = scrollFrame - function scrollFrame:RefreshMe(data) - self:SetData(data) - self:Refresh() - end - --~header local headerOptions = { padding = 2, @@ -1448,7 +1433,9 @@ function spellsTab.CreateSpellScrollContainer(tabFrame) local headerTable = {} - scrollFrame.Header = DetailsFramework:CreateHeader(tabFrame, headerTable, headerOptions) + ---@type headerframe + local header = DetailsFramework:CreateHeader(tabFrame, headerTable, headerOptions) + scrollFrame.Header = header scrollFrame.Header:SetPoint("topleft", scrollFrame, "topleft", 0, 1) scrollFrame.Header:SetColumnSettingChangedCallback(onHeaderColumnOptionChanged) @@ -1460,6 +1447,44 @@ function spellsTab.CreateSpellScrollContainer(tabFrame) scrollFrame:CreateLine(spellsTab.CreateSpellBar) end + ---set the data and refresh the scrollframe + ---@param self any + ---@param data breakdownspelldatalist + function scrollFrame:RefreshMe(data) + --get which column is currently selected and the sort order + local columnIndex, order, key = scrollFrame.Header:GetSelectedColumn() + + --here need an api from the header frame to get the key to sort + print("key:", key) + + --pre process the data which may be used into the scroll + + ---@type string + local keyToSort = "total" + if (columnIndex == 1) then + keyToSort = "total" + end + + if (order == "DESC") then + table.sort(data, + ---@param t1 breakdownspelldata + ---@param t2 breakdownspelldata + function(t1, t2) + return t1[keyToSort] > t2[keyToSort] + end) + else + table.sort(data, + ---@param t1 breakdownspelldata + ---@param t2 breakdownspelldata + function(t1, t2) + return t1[keyToSort] < t2[keyToSort] + end) + end + + self:SetData(data) + self:Refresh() + end + return scrollFrame end @@ -2034,7 +2059,7 @@ function Details.InitializeSpellBreakdownTab() spellsTab.TabFrame = tabFrame ---on receive data from a class - ---@param data table + ---@param data breakdownspelldatalist ---@param actorObject actor ---@param combatObject combat ---@param instance instance diff --git a/functions/mixin.lua b/functions/mixin.lua index 5234e09e..f31f1d65 100644 --- a/functions/mixin.lua +++ b/functions/mixin.lua @@ -154,7 +154,7 @@ local spellTable_FieldsToSum = { ---get the array of spelltables and sum each spellTable with the first spellTable found or on targetTable ---only sum the keys found in the spellTable_FieldsToSum table ----@param spellTables table[] +---@param spellTables spelltable[] ---@param targetTable table function Details:SumSpellTables(spellTables, targetTable) local amtSpellTables = #spellTables @@ -166,10 +166,11 @@ function Details:SumSpellTables(spellTables, targetTable) targetTable = targetTable or spellTables[1] for i = 1, amtSpellTables do - ---@type spelltable local spellTable = spellTables[i] if (spellTable) then for key, value in pairs(spellTable) do + ---@cast key string + ---@cast value number if (spellTable_FieldsToSum[key]) then targetTable[key] = (targetTable[key] or 0) + value end From d2524bb4a632e83b1eeb989920df79ffc575a13a Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Mon, 17 Apr 2023 15:28:08 -0300 Subject: [PATCH 09/22] Localization --- locales/Details-enUSS.lua | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 locales/Details-enUSS.lua diff --git a/locales/Details-enUSS.lua b/locales/Details-enUSS.lua new file mode 100644 index 00000000..f2cdbe82 --- /dev/null +++ b/locales/Details-enUSS.lua @@ -0,0 +1,6 @@ +local L = LibStub("AceLocale-3.0"):NewLocale ("Details", "enUS", true) +if not L then return end + +-------------------------------------------------------------------------------------------------------------------------------------------- + +@localization(locale="enUS", format="lua_additive_table")@ \ No newline at end of file From ca91c10ff8053cb06ac2100c093140a7f95c0242 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Mon, 17 Apr 2023 21:59:17 -0300 Subject: [PATCH 10/22] Cleanups and Created a new frame class "Frame Container" --- Definitions.lua | 3 +- Libs/DF/containers.lua | 221 +++++++++++++++++++++++ Libs/DF/load.xml | 1 + Libs/DF/mixins.lua | 2 +- Libs/DF/panel.lua | 56 ++++-- frames/window_playerbreakdown_spells.lua | 165 ----------------- 6 files changed, 265 insertions(+), 183 deletions(-) create mode 100644 Libs/DF/containers.lua diff --git a/Definitions.lua b/Definitions.lua index 7f154563..9858759a 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -133,7 +133,8 @@ ---@field CreateFontString fun(self: frame, name: string|nil, layer: "background"|"border"|"artwork"|"overlay"|"highlight", inherits: string|nil, subLayer: number|nil) : fontstring ---@field EnableMouse fun(self: frame, enable: boolean) ---@field SetResizable fun(self: frame, enable: boolean) ----@field SetResizeBounds fun(minWidth: number, minHeight: number, maxWidth: number, maxHeight: number) +---@field EnableMouseWheel fun(self: frame, enable: boolean) +---@field SetResizeBounds fun(self: frame, minWidth: number, minHeight: number, maxWidth: number, maxHeight: number) ---@class button : frame ---@field SetNormalTexture fun(self: button, texture: texture) diff --git a/Libs/DF/containers.lua b/Libs/DF/containers.lua new file mode 100644 index 00000000..60a653cb --- /dev/null +++ b/Libs/DF/containers.lua @@ -0,0 +1,221 @@ + +local detailsFramework = _G ["DetailsFramework"] +if (not detailsFramework or not DetailsFrameworkCanLoad) then + return +end + +local _ +local DF = detailsFramework + +local CreateFrame = CreateFrame + +---@class framecontainer : frame +---@field bIsSizing boolean +---@field options table +---@field leftResizer button +---@field rightResizer button +---@field OnSizeChanged fun(frameContainer: framecontainer) +---@field OnResizerMouseDown fun(resizerButton: button, mouseButton: string) +---@field OnResizerMouseUp fun(resizerButton: button, mouseButton: string) +---@field HideResizer fun(frameContainer: framecontainer) +---@field ShowResizer fun(frameContainer: framecontainer) +---@field OnInitialize fun(frameContainer: framecontainer) +---@field SetLocked fun(frameContainer: framecontainer, isLocked: boolean) +---@field CheckLockedState fun(frameContainer: framecontainer) + +detailsFramework.frameContainerMixin = { + --methods + ---run when the container has its size changed + ---@param frameContainer framecontainer + OnSizeChanged = function(frameContainer) + ---@type frame[] + local children = {frameContainer:GetChildren()} + ---@type number + local childrenAmount = #children + + --get the width of each children and sum the values, do the same thing for height + ---@type number + local childrenWidth = 0 + ---@type number + local childrenHeight = 0 + + for i = 1, childrenAmount do + childrenWidth = childrenWidth + children[i]:GetWidth() + childrenHeight = childrenHeight + children[i]:GetHeight() + end + + print("running...") + + --if the children width is bigger than the container width, then need to resize the width of the children to porportionally fit the container + --this resize is done by getting the width of each child and reduce the width of the child by the percentage of the difference between the container width and the children width + if childrenWidth > frameContainer:GetWidth() then + ---@type number + local widthDifference = childrenWidth - frameContainer:GetWidth() + + for i = 1, childrenAmount do + children[i]:SetWidth(children[i]:GetWidth() - (children[i]:GetWidth() * (widthDifference / childrenWidth))) + end + end + end, + + ---run when the user click on the resizer + ---@param resizerButton button + ---@param mouseButton string + OnResizerMouseDown = function(resizerButton, mouseButton) + if (mouseButton ~= "LeftButton") then + return + end +print(1) + ---@type framecontainer + local frameContainer = resizerButton:GetParent() --Cannot assign `frame` to `framecontainer`. .. but framecontainer is inherited from frame + + if (frameContainer.bIsSizing) then + return + end + + frameContainer.bIsSizing = true + frameContainer:StartSizing("bottomright") + end, + + ---run when the user click on the resizer + ---@param resizerButton button + ---@param mouseButton string + OnResizerMouseUp = function(resizerButton, mouseButton) + ---@type framecontainer + local frameContainer = resizerButton:GetParent() --Cannot assign `frame` to `framecontainer`. .. but framecontainer is inherited from frame + print(2) + if (not frameContainer.bIsSizing) then + print("fuck") + return + end + + frameContainer:StopMovingOrSizing() + frameContainer.bIsSizing = false + end, + + ---hide resizer + ---@param frameContainer framecontainer + HideResizer = function(frameContainer) + frameContainer.leftResizer:Hide() + frameContainer.rightResizer:Hide() + end, + + ---show resizer + ---@param frameContainer framecontainer + ShowResizer = function(frameContainer) + if (frameContainer.options.use_left_resizer) then + frameContainer.leftResizer:Show() + end + if (frameContainer.options.use_right_resizer) then + frameContainer.rightResizer:Show() + end + end, + + ---check the lock state and show or hide the resizer, set the frame as movable or not, resizeable or not + ---@param frameContainer framecontainer + CheckLockedState = function(frameContainer) + if (frameContainer.options.is_locked) then + frameContainer:HideResizer() + frameContainer:EnableMouse(false) + frameContainer:SetResizable(false) + else + frameContainer:ShowResizer() + frameContainer:EnableMouse(true) + frameContainer:SetResizable(true) + end + end, + + ---set the lock state + ---@param frameContainer framecontainer + ---@param isLocked boolean + SetLocked = function(frameContainer, isLocked) + frameContainer.options.is_locked = isLocked + frameContainer:CheckLockedState() + end, + + ---run when the container is created + ---@param frameContainer framecontainer + OnInitialize = function(frameContainer) + frameContainer.leftResizer:SetScript("OnMouseDown", frameContainer.OnResizerMouseDown) + frameContainer.leftResizer:SetScript("OnMouseUp", frameContainer.OnResizerMouseUp) + frameContainer.rightResizer:SetScript("OnMouseDown", frameContainer.OnResizerMouseDown) + frameContainer.rightResizer:SetScript("OnMouseUp", frameContainer.OnResizerMouseUp) + + if (frameContainer.options.is_locked) then + frameContainer:HideResizer() + else + frameContainer:ShowResizer() + end + + frameContainer:CheckLockedState() + + frameContainer:SetResizeBounds(50, 50, 1000, 1000) + end, + +} + +local frameContainerOptions = { + --default settings + width = 300, + height = 150, + is_locked = false, + use_left_resizer = false, + use_right_resizer = true, +} + +---create a frame container, which is a frame that envelops another frame, and can be moved, resized, etc. +---@param parent frame +---@param options table|nil +---@param frameName string|nil +---@return framecontainer +function DF:CreateFrameContainer(parent, options, frameName) + ---@type framecontainer + local container = CreateFrame("frame", frameName or ("$parentFrameContainer" .. math.random(10000, 99999)), parent, "BackdropTemplate") + + detailsFramework:Mixin(container, detailsFramework.frameContainerMixin) + detailsFramework:Mixin(container, detailsFramework.OptionsFunctions) + + detailsFramework:CreateResizeGrips(container) + + container:BuildOptionsTable(frameContainerOptions, options) + + container:SetScript("OnSizeChanged", container.OnSizeChanged) + + container.bIsSizing = false + + container:OnInitialize() + + return container +end + +function DF:CreateFrameContainerTest(parent, options, frameName) + + local container = DF:CreateFrameContainer(parent, options, frameName) + container:SetSize(400, 400) + container:SetPoint("center", UIParent, "center", 0, 0) + + detailsFramework:ApplyStandardBackdrop(container) + + for i = 1, 3 do + for o = 1, 3 do + local frame = CreateFrame("frame", "$parentFrame" .. math.random(10000, 99999), container, "BackdropTemplate") + frame:SetBackdrop({bgFile = "Interface\\AddOns\\Details\\images\\background", tile = true, tileSize = 16, edgeFile = "Interface\\AddOns\\Details\\images\\border_2", edgeSize = 16, insets = {left = 4, right = 4, top = 4, bottom = 4}}) + frame:SetBackdropColor(0, 0, 0, 0.5) + frame:SetBackdropBorderColor(1, 1, 1, 0.5) + frame:SetSize(100, 100) + frame:SetPoint("TOPLEFT", container, "TOPLEFT", 10 + (i - 1) * 110, -10 - (o - 1) * 110) + end + end +end + +C_Timer.After(2, function() + --DetailsFramework:CreateFrameContainerTest(UIParent) +end) + +--[=[ + /run DetailsFramework:CreateFrameContainerTest(UIParent) + + C_Timer.After(2, function() + DetailsFramework:CreateFrameContainerTest(UIParent) + end) +--]=] \ No newline at end of file diff --git a/Libs/DF/load.xml b/Libs/DF/load.xml index 7380d8d5..66e96f2c 100644 --- a/Libs/DF/load.xml +++ b/Libs/DF/load.xml @@ -4,6 +4,7 @@