Major cleanup on breakdown main file

This commit is contained in:
Tercio Jose
2023-04-11 22:03:32 -03:00
parent 4ab2f1241d
commit b946da73bb
15 changed files with 700 additions and 1214 deletions
+6 -2
View File
@@ -103,7 +103,7 @@
---@field SetAttribute fun(self: frame, name: string, value: any) ---@field SetAttribute fun(self: frame, name: string, value: any)
---@field SetScript fun(self: frame, event: string, handler: function) ---@field SetScript fun(self: frame, event: string, handler: function)
---@field GetScript fun(self: frame, event: string) : 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 SetFrameLevel fun(self: frame, level: number)
---@field SetClampedToScreen fun(self: frame, clamped: boolean) ---@field SetClampedToScreen fun(self: frame, clamped: boolean)
---@field SetClampRectInsets fun(self: frame, left: number, right: number, top: number, bottom: number) ---@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 SetToplevel fun(self: frame, toplevel: boolean)
---@field SetPropagateKeyboardInput fun(self: frame, propagate: boolean) ---@field SetPropagateKeyboardInput fun(self: frame, propagate: boolean)
---@field SetPropagateGamepadInput 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 GetAttribute fun(self: frame, name: string) : any
---@field GetFrameLevel fun(self: frame) : number ---@field GetFrameLevel fun(self: frame) : number
---@field GetFrameStrata fun(self: frame) : framestrata|string ---@field GetFrameStrata fun(self: frame) : framestrata|string
@@ -150,7 +153,7 @@
---@field GetFontString fun(self: button) : fontstring ---@field GetFontString fun(self: button) : fontstring
---@field SetButtonState fun(self: button, state: string, enable: boolean) ---@field SetButtonState fun(self: button, state: string, enable: boolean)
---@field GetButtonState fun(self: button, state: string) : 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 ---@class fontstring : uiobject
---@field SetDrawLayer fun(self: fontstring, layer: "background"|"border"|"artwork"|"overlay"|"highlight", subLayer: number|nil) ---@field SetDrawLayer fun(self: fontstring, layer: "background"|"border"|"artwork"|"overlay"|"highlight", subLayer: number|nil)
@@ -326,6 +329,7 @@
---@field targets_overheal table<string, number> ---@field targets_overheal table<string, number>
---@field targets_absorbs table<string, number> ---@field targets_absorbs table<string, number>
---@field id number --spellid ---@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 successful_casted number successful casted times (only for enemies)
---@field g_amt number glacing hits ---@field g_amt number glacing hits
---@field g_dmg number ---@field g_dmg number
+124 -19
View File
@@ -5054,7 +5054,7 @@ local default_icon_row_options = {
} }
function detailsFramework:CreateIconRow (parent, name, 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.IconPool = {}
f.NextIcon = 1 f.NextIcon = 1
f.AuraCache = {} f.AuraCache = {}
@@ -5077,19 +5077,46 @@ end
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--~header --~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 --mixed functions
detailsFramework.HeaderFunctions = { detailsFramework.HeaderFunctions = {
AddFrameToHeaderAlignment = function(self, frame) AddFrameToHeaderAlignment = function(self, frame)
self.FramesToAlign = self.FramesToAlign or {} self.FramesToAlign = self.FramesToAlign or {}
tinsert(self.FramesToAlign, frame) _G.tinsert(self.FramesToAlign, frame)
end, end,
ResetFramesToHeaderAlignment = function(self) ResetFramesToHeaderAlignment = function(self)
wipe(self.FramesToAlign) _G.wipe(self.FramesToAlign)
end, end,
SetFramesToHeaderAlignment = function(self, ...) SetFramesToHeaderAlignment = function(self, ...)
wipe(self.FramesToAlign) _G.wipe(self.FramesToAlign)
self.FramesToAlign = {...} self.FramesToAlign = {...}
end, end,
@@ -5097,9 +5124,9 @@ detailsFramework.HeaderFunctions = {
return self.FramesToAlign or {} return self.FramesToAlign or {}
end, end,
--@self: an object like a line ---@param self uiobject
--@headerFrame: the main header frame ---@param headerFrame headerframe
--@anchor: which side the columnHeaders are attach ---@param anchor string
AlignWithHeader = function(self, headerFrame, anchor) AlignWithHeader = function(self, headerFrame, anchor)
local columnHeaderFrames = headerFrame.columnHeadersCreated local columnHeaderFrames = headerFrame.columnHeadersCreated
anchor = anchor or "topleft" anchor = anchor or "topleft"
@@ -5108,6 +5135,7 @@ detailsFramework.HeaderFunctions = {
local frame = self.FramesToAlign[i] local frame = self.FramesToAlign[i]
frame:ClearAllPoints() frame:ClearAllPoints()
---@type headercolumnframe
local columnHeader = columnHeaderFrames[i] local columnHeader = columnHeaderFrames[i]
if (columnHeader) then if (columnHeader) then
local offset = 0 local offset = 0
@@ -5124,10 +5152,12 @@ detailsFramework.HeaderFunctions = {
end end
end, end,
--@self: column header button ---comment
---@param self button
---@param buttonClicked string
OnClick = function(self, buttonClicked) OnClick = function(self, buttonClicked)
--get the header main frame --get the header main frame
---@type headerframe
local headerFrame = self:GetParent() local headerFrame = self:GetParent()
--if this header does not have a clickable header, just ignore --if this header does not have a clickable header, just ignore
@@ -5136,6 +5166,7 @@ detailsFramework.HeaderFunctions = {
end end
--get the latest column header selected --get the latest column header selected
---@type headercolumnframe
local previousColumnHeader = headerFrame.columnHeadersCreated[headerFrame.columnSelected] local previousColumnHeader = headerFrame.columnHeadersCreated[headerFrame.columnSelected]
previousColumnHeader.Arrow:Hide() previousColumnHeader.Arrow:Hide()
headerFrame:ResetColumnHeaderBackdrop(previousColumnHeader) headerFrame:ResetColumnHeaderBackdrop(previousColumnHeader)
@@ -5159,13 +5190,37 @@ detailsFramework.HeaderFunctions = {
end end
end 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 = { detailsFramework.HeaderCoreFunctions = {
---@param self headerframe
---@param columnId number
---@return number
GetColumnWidth = function(self, columnId) GetColumnWidth = function(self, columnId)
return self.HeaderTable[columnId].width return self.HeaderTable[columnId].width
end, end,
---@param self headerframe
---@param newTable table
SetHeaderTable = function(self, newTable) SetHeaderTable = function(self, newTable)
self.columnHeadersCreated = self.columnHeadersCreated or {} self.columnHeadersCreated = self.columnHeadersCreated or {}
self.HeaderTable = newTable self.HeaderTable = newTable
@@ -5176,12 +5231,14 @@ detailsFramework.HeaderCoreFunctions = {
end, end,
--return which header is current selected and the the order ASC DESC --return which header is current selected and the the order ASC DESC
---@param self headerframe
GetSelectedColumn = function(self) GetSelectedColumn = function(self)
return self.columnSelected, self.columnHeadersCreated[self.columnSelected or 1].order return self.columnSelected, self.columnHeadersCreated[self.columnSelected or 1].order
end, end,
--clean up and rebuild the header following the header options --clean up and rebuild the header following the header options
--@self: main header frame --@self: main header frame
---@param self headerframe
Refresh = function(self) Refresh = function(self)
--refresh background frame --refresh background frame
self:SetBackdrop(self.options.backdrop) self:SetBackdrop(self.options.backdrop)
@@ -5263,7 +5320,10 @@ detailsFramework.HeaderCoreFunctions = {
self:SetSize(self.HeaderWidth, self.HeaderHeight) self:SetSize(self.HeaderWidth, self.HeaderHeight)
end, end,
--@self: main header frame ---@param self headerframe
---@param columnHeader headercolumnframe
---@param defaultShown boolean
---@param defaultOrder string
UpdateSortArrow = function(self, columnHeader, defaultShown, defaultOrder) UpdateSortArrow = function(self, columnHeader, defaultShown, defaultOrder)
local options = self.options local options = self.options
local order = defaultOrder or columnHeader.order local order = defaultOrder or columnHeader.order
@@ -5292,7 +5352,9 @@ detailsFramework.HeaderCoreFunctions = {
end end
end, end,
--@self: main header frame ---@param self headerframe
---@param columnHeader headercolumnframe
---@param headerIndex number
UpdateColumnHeader = function(self, columnHeader, headerIndex) UpdateColumnHeader = function(self, columnHeader, headerIndex)
local headerData = self.HeaderTable[headerIndex] local headerData = self.HeaderTable[headerIndex]
@@ -5378,21 +5440,24 @@ detailsFramework.HeaderCoreFunctions = {
columnHeader.InUse = true columnHeader.InUse = true
end, end,
--reset column header backdrop ---reset column header backdrop
--@self: main header frame ---@param self headerframe
---@param columnHeader headercolumnframe
ResetColumnHeaderBackdrop = function(self, columnHeader) ResetColumnHeaderBackdrop = function(self, columnHeader)
columnHeader:SetBackdrop(self.options.header_backdrop) columnHeader:SetBackdrop(self.options.header_backdrop)
columnHeader:SetBackdropColor(unpack(self.options.header_backdrop_color)) columnHeader:SetBackdropColor(unpack(self.options.header_backdrop_color))
columnHeader:SetBackdropBorderColor(unpack(self.options.header_backdrop_border_color)) columnHeader:SetBackdropBorderColor(unpack(self.options.header_backdrop_border_color))
end, end,
--@self: main header frame ---@param self headerframe
---@param columnHeader headercolumnframe
SetBackdropColorForSelectedColumnHeader = function(self, columnHeader) SetBackdropColorForSelectedColumnHeader = function(self, columnHeader)
columnHeader:SetBackdropColor(unpack(self.options.header_backdrop_color_selected)) columnHeader:SetBackdropColor(unpack(self.options.header_backdrop_color_selected))
end, end,
--clear the column header ---clear the column header
--@self: main header frame ---@param self headerframe
---@param columnHeader headercolumnframe
ClearColumnHeader = function(self, columnHeader) ClearColumnHeader = function(self, columnHeader)
columnHeader:SetSize(self.options.header_width, self.options.header_height) columnHeader:SetSize(self.options.header_width, self.options.header_height)
self:ResetColumnHeaderBackdrop(columnHeader) self:ResetColumnHeaderBackdrop(columnHeader)
@@ -5405,16 +5470,27 @@ detailsFramework.HeaderCoreFunctions = {
columnHeader.Text:Hide() columnHeader.Text:Hide()
end, end,
--get the next column header, create one if doesn't exists ---get the next column header, create one if doesn't exists
--@self: main header frame ---@param self headerframe
GetNextHeader = function(self) GetNextHeader = function(self)
local nextHeader = self.NextHeader local nextHeader = self.NextHeader
local columnHeader = self.columnHeadersCreated[nextHeader] local columnHeader = self.columnHeadersCreated[nextHeader]
if (not columnHeader) then if (not columnHeader) then
--create a new column header --create a new column header
---@type headercolumnframe
local newHeader = CreateFrame("button", "$parentHeaderIndex" .. nextHeader, self, "BackdropTemplate") local newHeader = CreateFrame("button", "$parentHeaderIndex" .. nextHeader, self, "BackdropTemplate")
newHeader:SetScript("OnClick", detailsFramework.HeaderFunctions.OnClick) 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 --header icon
detailsFramework:CreateImage(newHeader, "", self.options.header_height, self.options.header_height, "ARTWORK", nil, "Icon", "$parentIcon") 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 --header selected and order icon
detailsFramework:CreateImage(newHeader, self.options.arrow_up_texture, 12, 12, "ARTWORK", nil, "Arrow", "$parentArrow") 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.Arrow:SetPoint("right", newHeader, "right", -1, 0)
newHeader.Separator:Hide() newHeader.Separator:Hide()
@@ -5480,8 +5583,10 @@ local default_header_options = {
line_separator_gap_align = false, line_separator_gap_align = false,
} }
---@return headerframe
function detailsFramework:CreateHeader(parent, headerTable, options, frameName) 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.OptionsFunctions)
detailsFramework:Mixin(newHeader, detailsFramework.HeaderCoreFunctions) detailsFramework:Mixin(newHeader, detailsFramework.HeaderCoreFunctions)
+1 -1
View File
@@ -1748,7 +1748,7 @@
desc = Loc ["STRING_CUSTOM_MYSPELLS_DESC"], desc = Loc ["STRING_CUSTOM_MYSPELLS_DESC"],
source = false, source = false,
target = false, target = false,
script_version = 8, script_version = 9,
script = [[ script = [[
--get the parameters passed --get the parameters passed
local combat, instance_container, instance = ... local combat, instance_container, instance = ...
+133 -131
View File
@@ -5424,146 +5424,150 @@ function atributo_damage:MontaDetalhesDamageDone (spellId, spellLine, instance)
local spellTable = spellTable local spellTable = spellTable
local blockId = 6 local blockId = 6
local thatRectangle66 = Details222.BreakdownWindow.GetBlockIndex(blockId)
thatRectangle66 = thatRectangle66:GetFrame()
--hide all textures created if false then --debug the stuff for the chart damage done in the 6th spellblock
if (thatRectangle66.ChartTextures) then --GetBlockIndex doesn't exists anymore
for i = 1, #thatRectangle66.ChartTextures do local thatRectangle66 = Details222.BreakdownWindow.GetBlockIndex(blockId)
thatRectangle66.ChartTextures[i]:Hide() thatRectangle66 = thatRectangle66:GetFrame()
end
end
local chartData = Details222.TimeCapture.GetChartDataFromSpell(spellTable) --hide all textures created
if (chartData and instance) then if (thatRectangle66.ChartTextures) then
local width, height = thatRectangle66:GetSize() for i = 1, #thatRectangle66.ChartTextures do
--reset which texture is the next to be used thatRectangle66.ChartTextures[i]:Hide()
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)
end end
end end
if (not thatRectangle66.bloodLustIndicators) then local chartData = Details222.TimeCapture.GetChartDataFromSpell(spellTable)
thatRectangle66.bloodLustIndicators = {} if (chartData and instance) then
for i = 1, 5 do local width, height = thatRectangle66:GetSize()
local thisIndicator = thatRectangle66:CreateTexture(nil, "artwork", nil, 4) --reset which texture is the next to be used
thisIndicator:SetColorTexture(0.0980392, 0.0980392, 0.439216) thatRectangle66.nextChartTextureId = 1
thatRectangle66.bloodLustIndicators[#thatRectangle66.bloodLustIndicators+1] = thisIndicator
end
end
for i = 1, #thatRectangle66.bloodLustIndicators do local amountOfTimeStamps = 12
thatRectangle66.bloodLustIndicators[i]:Hide()
end
if (not thatRectangle66.ChartTextures) then if (not thatRectangle66.timeStamps) then
thatRectangle66.ChartTextures = {} thatRectangle66.timeStamps = {}
function thatRectangle66:GetChartTexture() for i = 1, amountOfTimeStamps do
local thisTexture = thatRectangle66.ChartTextures[thatRectangle66.nextChartTextureId] thatRectangle66.timeStamps[i] = thatRectangle66:CreateFontString(nil, "overlay", "GameFontNormal")
if (not thisTexture) then thatRectangle66.timeStamps[i]:SetPoint("topleft", thatRectangle66, "topleft", 2 + (i - 1) * (width / amountOfTimeStamps), -2)
thisTexture = thatRectangle66:CreateTexture(nil, "artwork", nil, 5) DetailsFramework:SetFontSize(thatRectangle66.timeStamps[i], 9)
thisTexture:SetColorTexture(1, 1, 1, 0.65)
thatRectangle66.ChartTextures[thatRectangle66.nextChartTextureId] = thisTexture
end end
thatRectangle66.nextChartTextureId = thatRectangle66.nextChartTextureId + 1
return thisTexture
end end
end
--elapsed combat time if (not thatRectangle66.bloodLustIndicators) then
local combatObject = instance:GetShowingCombat() thatRectangle66.bloodLustIndicators = {}
local combatTime = math.floor(combatObject:GetCombatTime()) for i = 1, 5 do
thatRectangle66.timeStamps[1]:SetText(DetailsFramework:IntegerToTimer(0)) local thisIndicator = thatRectangle66:CreateTexture(nil, "artwork", nil, 4)
for i = 2, #thatRectangle66.timeStamps do thisIndicator:SetColorTexture(0.0980392, 0.0980392, 0.439216)
local timePerSegment = combatTime / #thatRectangle66.timeStamps thatRectangle66.bloodLustIndicators[#thatRectangle66.bloodLustIndicators+1] = thisIndicator
thatRectangle66.timeStamps[i]:SetText(DetailsFramework:IntegerToTimer(i * timePerSegment)) end
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
end
DetailsBreakdownWindow_DetalheInfoBG_bg_end6:Hide() for i = 1, #thatRectangle66.bloodLustIndicators do
thatRectangle66:SetShown(true) 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 end
_table_sort(data, Details.Sort1) _table_sort(data, Details.Sort1)
@@ -5573,9 +5577,8 @@ function atributo_damage:MontaDetalhesDamageDone (spellId, spellLine, instance)
end end
for i = #data+2, 5 do for i = #data+2, 5 do
gump:HidaDetalheInfo (i) gump:HidaDetalheInfo(i)
end end
end end
function Details:BuildPlayerDetailsSpellChart() function Details:BuildPlayerDetailsSpellChart()
@@ -5662,7 +5665,6 @@ function Details:BuildPlayerDetailsSpellChart()
end end
function atributo_damage:MontaTooltipDamageTaken (thisLine, index) function atributo_damage:MontaTooltipDamageTaken (thisLine, index)
local aggressor = info.instancia.showing [1]:PegarCombatente (_, thisLine.nome_inimigo) local aggressor = info.instancia.showing [1]:PegarCombatente (_, thisLine.nome_inimigo)
local container = aggressor.spells._ActorTable local container = aggressor.spells._ActorTable
local habilidades = {} local habilidades = {}
+8 -8
View File
@@ -332,7 +332,7 @@ local instanceMixins = {
--update player breakdown window if opened --update player breakdown window if opened
if (not bForceRefresh) then if (not bForceRefresh) then
if (Details:IsBreakdownWindowOpen()) then if (Details:IsBreakdownWindowOpen()) then
return Details:GetPlayerObjectFromBreakdownWindow():MontaInfo() return Details:GetActorObjectFromBreakdownWindow():MontaInfo()
end end
end end
end end
@@ -519,9 +519,9 @@ local instanceMixins = {
Details:CloseBreakdownWindow() Details:CloseBreakdownWindow()
else else
---@type actor ---@type actor
local actorObject = Details:GetPlayerObjectFromBreakdownWindow() local actorObject = Details:GetActorObjectFromBreakdownWindow()
if (actorObject) then if (actorObject) then
Details:OpenPlayerBreakdown(instance, actorObject, true) Details:OpenBreakdownWindow(instance, actorObject, true)
else else
Details:CloseBreakdownWindow() Details:CloseBreakdownWindow()
end end
@@ -2832,13 +2832,13 @@ function _detalhes:TrocaTabela(instance, segmentId, attributeId, subAttributeId,
if (Details.playerDetailWindow:IsShown() and instance == Details.playerDetailWindow.instancia) then if (Details.playerDetailWindow:IsShown() and instance == Details.playerDetailWindow.instancia) then
if (not instance.showing or instance.atributo > 4) then if (not instance.showing or instance.atributo > 4) then
Details:FechaJanelaInfo() Details:CloseBreakdownWindow()
else else
local actor = instance.showing (instance.atributo, Details.playerDetailWindow.jogador.nome) local actorObject = instance.showing (instance.atributo, Details.playerDetailWindow.jogador.nome)
if (actor) then if (actorObject) then
instance:AbreJanelaInfo (actor, true) Details:OpenBreakdownWindow(instance, actorObject, true)
else else
Details:FechaJanelaInfo() Details:CloseBreakdownWindow()
end end
end end
end end
+2 -2
View File
@@ -451,7 +451,7 @@ function segmentClass:resetar_overall()
-- _detalhes.schedule_remove_overall = true -- _detalhes.schedule_remove_overall = true
--else --else
--fecha a janela de informaes do jogador --fecha a janela de informaes do jogador
Details:FechaJanelaInfo() Details:CloseBreakdownWindow()
Details.tabela_overall = combatClass:NovaTabela() Details.tabela_overall = combatClass:NovaTabela()
@@ -498,7 +498,7 @@ function segmentClass:resetar()
--_detalhes.schedule_remove_overall = nil --_detalhes.schedule_remove_overall = nil
--fecha a janela de informaes do jogador --fecha a janela de informaes do jogador
Details:FechaJanelaInfo() Details:CloseBreakdownWindow()
--empty temporary tables --empty temporary tables
Details.atributo_damage:ClearTempTables() Details.atributo_damage:ClearTempTables()
+2 -2
View File
@@ -5827,10 +5827,10 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
_detalhes.logoff_saving_data = true _detalhes.logoff_saving_data = true
--close info window --close info window
if (_detalhes.FechaJanelaInfo) then if (_detalhes.CloseBreakdownWindow) then
tinsert(_detalhes_global.exit_log, "1 - Closing Janela Info.") tinsert(_detalhes_global.exit_log, "1 - Closing Janela Info.")
currentStep = "Fecha Janela Info" currentStep = "Fecha Janela Info"
xpcall(_detalhes.FechaJanelaInfo, saver_error) xpcall(_detalhes.CloseBreakdownWindow, saver_error)
end end
--do not save window pos --do not save window pos
+19 -16
View File
@@ -1950,19 +1950,22 @@ local lineScript_Onmousedown = function(self, button)
end end
local lineScript_Onmouseup = function(self, button) local lineScript_Onmouseup = function(self, button)
local is_shift_down = _IsShiftKeyDown() local bIsShiftDown = _IsShiftKeyDown()
local is_control_down = _IsControlKeyDown() local bIsControlDown = _IsControlKeyDown()
if (self._instance.baseframe.isMoving) then ---@type instance
move_janela(self._instance.baseframe, false, self._instance) local instanceObject = self._instance
self._instance:SaveMainWindowPosition()
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) GameCooltip:Show (self, 1)
end end
end end
self._instance:HandleTextsOnMouseClick (self, "up") instanceObject:HandleTextsOnMouseClick (self, "up")
local x, y = _GetCursorPosition() local x, y = _GetCursorPosition()
x = floor(x) 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.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.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 --report
if (self._instance.atributo == 5 and is_shift_down) then if (instanceObject.atributo == 5 and bIsShiftDown) then
local custom = self._instance:GetCustomObject() local custom = instanceObject:GetCustomObject()
if (custom and custom.on_shift_click) then 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 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 if (not successful) then
Details:Msg("error occurred custom script shift+click:", errortext) Details:Msg("error occurred custom script shift+click:", errortext)
end end
@@ -1986,18 +1989,18 @@ local lineScript_Onmouseup = function(self, button)
end end
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 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 [self._instance.atributo][self._instance.sub_atributo] (_, self.minha_tabela, self._instance, is_shift_down, is_control_down) return Details.row_singleclick_overwrite [instanceObject.atributo][instanceObject.sub_atributo] (_, self.minha_tabela, instanceObject, bIsShiftDown, bIsControlDown)
end end
return Details:ReportSingleLine (self._instance, self) return Details:ReportSingleLine (instanceObject, self)
end end
if (not self.minha_tabela) then if (not self.minha_tabela) then
return Details:Msg("this bar is waiting update.") return Details:Msg("this bar is waiting update.")
end 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 end
end end
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -57,8 +57,8 @@
end end
local lineOnClick = function(self) local lineOnClick = function(self)
if (self.playerObject ~= Details:GetPlayerObjectFromBreakdownWindow()) then if (self.playerObject ~= Details:GetActorObjectFromBreakdownWindow()) then
Details:OpenPlayerBreakdown(Details:GetActiveWindowFromBreakdownWindow(), self.playerObject) Details:OpenBreakdownWindow(Details:GetActiveWindowFromBreakdownWindow(), self.playerObject)
f.playerScrollBox:Refresh() f.playerScrollBox:Refresh()
end end
end end
@@ -80,7 +80,7 @@
end end
local updatePlayerLine = function(self, topResult, encounterId, difficultyId) --~update local updatePlayerLine = function(self, topResult, encounterId, difficultyId) --~update
local playerSelected = Details:GetPlayerObjectFromBreakdownWindow() local playerSelected = Details:GetActorObjectFromBreakdownWindow()
if (playerSelected and playerSelected == self.playerObject) then if (playerSelected and playerSelected == self.playerObject) then
self:SetBackdropColor(unpack(scrollbox_line_backdrop_color_selected)) self:SetBackdropColor(unpack(scrollbox_line_backdrop_color_selected))
self.isSelected = true self.isSelected = true
+110 -166
View File
@@ -31,11 +31,6 @@ local spellBlockContainerSettings = {
local spellBreakdownSettings = {} 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_BAR_HEIGHT = 20
local CONST_TARGET_HEIGHT = 18 local CONST_TARGET_HEIGHT = 18
@@ -82,13 +77,13 @@ local columnInfo = {
{name = "amount", label = "total", width = 50, 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 = "persecond", label = "ps", width = 50, align = "left", enabled = true},
{name = "percent", label = "%", 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 = "casts", label = "casts", width = 40, align = "left", enabled = false},
{name = "critpercent", label = "crit %", width = 40, align = "left", enabled = true}, {name = "critpercent", label = "crit %", width = 40, align = "left", enabled = false},
{name = "hits", label = "hits", width = 40, align = "left", enabled = true}, {name = "hits", label = "hits", width = 40, align = "left", enabled = false},
{name = "castavg", label = "cast avg", width = 50, align = "left", enabled = true}, {name = "castavg", label = "cast avg", width = 50, align = "left", enabled = false},
{name = "uptime", label = "uptime", width = 45, align = "left", enabled = true}, {name = "uptime", label = "uptime", width = 45, align = "left", enabled = false},
{name = "overheal", label = "overheal", width = 45, align = "left", enabled = true, attribute = DETAILS_ATTRIBUTE_HEAL}, {name = "overheal", label = "overheal", width = 45, align = "left", enabled = false, attribute = DETAILS_ATTRIBUTE_HEAL},
{name = "absorbed", label = "absorbed", width = 45, align = "left", enabled = true, attribute = DETAILS_ATTRIBUTE_HEAL}, {name = "absorbed", label = "absorbed", width = 45, align = "left", enabled = false, attribute = DETAILS_ATTRIBUTE_HEAL},
} }
function spellsTab.BuildHeaderTable() function spellsTab.BuildHeaderTable()
@@ -187,6 +182,7 @@ end
--called when the tab is getting created --called when the tab is getting created
function spellsTab.OnCreateTabCallback(tabButton, tabFrame) function spellsTab.OnCreateTabCallback(tabButton, tabFrame)
spellBreakdownSettings = Details.breakdown_spell_tab spellBreakdownSettings = Details.breakdown_spell_tab
DetailsFramework:ApplyStandardBackdrop(tabFrame)
--create the scrollbar to show the spells in the breakdown window --create the scrollbar to show the spells in the breakdown window
---@type breakdownspellscrollframe ---@type breakdownspellscrollframe
@@ -209,13 +205,10 @@ function spellsTab.OnCreateTabCallback(tabButton, tabFrame)
spellsTab.CreateReportButtons(tabFrame) spellsTab.CreateReportButtons(tabFrame)
--these bars table are kinda deprecated now: --these bars table are kinda deprecated now:
--store the spell bars for the spell container --store the spell bars for the spell container
tabFrame.barras1 = {} tabFrame.barras1 = {} --deprecated
--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 --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 spellsTab.TabFrame = tabFrame
end end
@@ -332,15 +325,6 @@ do --hide bars functions - to be refactored
for index = 1, #allBars, 1 do for index = 1, #allBars, 1 do
allBars[index]:Hide() allBars[index]:Hide()
allBars[index].textura:SetStatusBarColor(1, 1, 1, 1) 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
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.leftText:SetText(Loc ["STRING_CAST"] .. ": " .. spellBar.amountCasts) --total amount of casts
blockLine1.rightText:SetText(Loc ["STRING_HITS"]..": " .. totalHits) --hits and uptime 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 blockLine2.rightText:SetText(Details:GetSpellSchoolFormatedName(spellTable.spellschool)) --spell school
blockLine3.leftText:SetText(Loc ["STRING_AVERAGE"] .. ": " .. Details:Format(spellBar.average)) --average damage 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 end
--check if there's normal hits and build the block --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 tempo = (elapsedTime * spellTable.n_total) / math.max(spellTable.total, 0.001)
local normalAveragePercent = spellBar.average / normalAverage * 100 local normalAveragePercent = spellBar.average / normalAverage * 100
local normalTempoPercent = normalAveragePercent * tempo / 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 end
---@type number ---@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 tempo = (elapsedTime * spellTable.c_total) / math.max(spellTable.total, 0.001)
local critAveragePercent = spellBar.average / critAverage * 100 local critAveragePercent = spellBar.average / critAverage * 100
local critTempoPercent = critAveragePercent * tempo / 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
end end
@@ -682,74 +695,56 @@ end
---run this function when the mouse leaves a breakdownspellbar ---run this function when the mouse leaves a breakdownspellbar
---@param spellBar breakdownspellbar ---@param spellBar breakdownspellbar
local onLeaveBreakdownSpellBar = function(spellBar) local onLeaveBreakdownSpellBar = function(spellBar)
--diminui o tamanho da barra --remove effects on entering the bar line
spellBar:SetHeight(CONST_SPELLSCROLL_LINEHEIGHT) spellBar:SetHeight(CONST_SPELLSCROLL_LINEHEIGHT)
--volta com o alfa antigo da barra que era de 0.9
spellBar:SetAlpha(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() GameTooltip:Hide()
GameCooltip: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 contedo 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 end
---on mouse down a breakdownspellbar in the breakdown window ---on mouse down a breakdownspellbar in the breakdown window
---@param spellBar breakdownspellbar ---@param spellBar breakdownspellbar
---@param button string ---@param button string
local onMouseDownBreakdownSpellBar = function(spellBar, button) local onMouseDownBreakdownSpellBar = function(spellBar, button)
local x, y = _G.GetCursorPosition() print(1, spellBar:GetName())
spellBar.cursorPosX = math.floor(x) if false then
spellBar.cursorPosY = math.floor(y) local x, y = _G.GetCursorPosition()
Details222.PlayerBreakdown.OnMouseDown(spellBar, button) spellBar.cursorPosX = math.floor(x)
spellBar.cursorPosY = math.floor(y)
Details222.PlayerBreakdown.OnMouseDown(spellBar, button)
end
end end
---on mouse up a breakdownspellbar in the breakdown window ---on mouse up a breakdownspellbar in the breakdown window
---@param spellBar breakdownspellbar ---@param spellBar breakdownspellbar
---@param button string ---@param button string
local onMouseUpBreakdownSpellBar = function(spellBar, button) local onMouseUpBreakdownSpellBar = function(spellBar, button)
if (spellBar.onMouseUpTime == GetTime()) then print(2, spellBar:GetName())
return 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 end
spellBar.onMouseUpTime = GetTime() --print("selecting spell bar")
--spellsTab.SelectSpellBar(spellBar)
---@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 end
@@ -1340,7 +1335,7 @@ function spellsTab.CreateSpellScrollContainer(tabFrame)
local headerTable = {} local headerTable = {}
scrollFrame.Header = DetailsFramework:CreateHeader(scrollFrame, headerTable, headerOptions) scrollFrame.Header = DetailsFramework:CreateHeader(tabFrame, headerTable, headerOptions)
scrollFrame.Header:SetPoint("topleft", scrollFrame, "topleft", 0, 0) scrollFrame.Header:SetPoint("topleft", scrollFrame, "topleft", 0, 0)
--create the scroll lines --create the scroll lines
@@ -1375,7 +1370,7 @@ local onEnterSpellTarget = function(targetFrame)
local spellId = targetFrame.spellId local spellId = targetFrame.spellId
---@type actor ---@type actor
local actorObject = Details:GetPlayerObjectFromBreakdownWindow() local actorObject = Details:GetActorObjectFromBreakdownWindow()
local targets local targets
if (targetFrame.bIsMainLine) then if (targetFrame.bIsMainLine) then
@@ -1549,16 +1544,45 @@ end
---@param index number ---@param index number
---@return breakdownspellbar ---@return breakdownspellbar
function spellsTab.CreateSpellBar(self, index) --~spellbar ~spellline ~spell ~create ~createline 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 ---@type breakdownspellbar
local spellBar = CreateFrame("button", self:GetName() .. "SpellBar" .. index, self, "BackdropTemplate") local spellBar = CreateFrame("button", self:GetName() .. "SpellBar" .. index, self, "BackdropTemplate")
spellBar:SetHeight(CONST_SPELLSCROLL_LINEHEIGHT)
spellBar.index = index spellBar.index = index
--size and positioning
spellBar:SetHeight(CONST_SPELLSCROLL_LINEHEIGHT)
local y = (index-1) * CONST_SPELLSCROLL_LINEHEIGHT * -1 + (1 * -index) - 15 local y = (index-1) * CONST_SPELLSCROLL_LINEHEIGHT * -1 + (1 * -index) - 15
spellBar:SetPoint("topleft", self, "topleft", 0, y) spellBar:SetPoint("topleft", self, "topleft", 0, y)
spellBar:SetPoint("topright", self, "topright", 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:EnableMouse(true)
spellBar:RegisterForClicks("LeftButtonDown", "RightButtonUp") spellBar:RegisterForClicks("AnyUp", "AnyDown")
spellBar:SetAlpha(0.9)
spellBar:SetFrameStrata("HIGH")
spellBar:SetScript("OnEnter", onEnterBreakdownSpellBar) spellBar:SetScript("OnEnter", onEnterBreakdownSpellBar)
spellBar:SetScript("OnLeave", onLeaveBreakdownSpellBar) spellBar:SetScript("OnLeave", onLeaveBreakdownSpellBar)
spellBar:SetScript("OnMouseDown", onMouseDownBreakdownSpellBar) spellBar:SetScript("OnMouseDown", onMouseDownBreakdownSpellBar)
@@ -1567,9 +1591,11 @@ function spellsTab.CreateSpellBar(self, index) --~spellbar ~spellline ~spell ~cr
spellBar.ExpandedChildren = {} spellBar.ExpandedChildren = {}
DF:Mixin(spellBar, DF.HeaderFunctions) DF:Mixin(spellBar, DF.HeaderFunctions)
DF:Mixin(buttonTest, DF.HeaderFunctions)
---@type statusbar ---@type statusbar
local statusBar = CreateFrame("StatusBar", "$parentStatusBar", spellBar, "BackdropTemplate") local statusBar = CreateFrame("StatusBar", "$parentStatusBar", spellBar, "BackdropTemplate")
statusBar:EnableMouse(false)
statusBar:SetFrameLevel(spellBar:GetFrameLevel()-1) statusBar:SetFrameLevel(spellBar:GetFrameLevel()-1)
statusBar:SetAllPoints() statusBar:SetAllPoints()
statusBar:SetAlpha(0.5) statusBar:SetAlpha(0.5)
@@ -1672,91 +1698,9 @@ function spellsTab.CreateSpellBar(self, index) --~spellbar ~spellline ~spell ~cr
end end
spellBar:AlignWithHeader(self.Header, "left") spellBar:AlignWithHeader(self.Header, "left")
spellBar.on_focus = false
return spellBar return spellBar
end 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 --> report data
+2 -2
View File
@@ -9,9 +9,9 @@ function Details:OpenPlayerDetails(window)
if (instance) then if (instance) then
local display, subDisplay = instance:GetDisplay() local display, subDisplay = instance:GetDisplay()
if (display == 1) then if (display == 1) then
instance:AbreJanelaInfo (Details:GetPlayer(false, 1)) Details:OpenBreakdownWindow(instance, Details:GetPlayer(false, 1))
elseif (display == 2) then elseif (display == 2) then
instance:AbreJanelaInfo (Details:GetPlayer(false, 2)) Details:OpenBreakdownWindow(instance, Details:GetPlayer(false, 2))
end end
end end
end end
+4
View File
@@ -146,6 +146,10 @@ local spellTable_FieldsToSum = {
["b_dmg"] = true, ["b_dmg"] = true,
["a_amt"] = true, ["a_amt"] = true,
["a_dmg"] = 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 ---get the array of spelltables and sum each spellTable with the first spellTable found or on targetTable
-3
View File
@@ -471,9 +471,6 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy)
--update tooltip settings --update tooltip settings
_detalhes:SetTooltipBackdrop() _detalhes:SetTooltipBackdrop()
--update player detail window
_detalhes:ApplyPDWSkin()
--update the numerical system --update the numerical system
_detalhes:SelectNumericalSystem() _detalhes:SelectNumericalSystem()
+1 -1
View File
@@ -94,7 +94,7 @@ function Details:StartMeUp()
Details.MicroButtonAlert:Hide() Details.MicroButtonAlert:Hide()
--actor details window --actor details window
Details.playerDetailWindow = Details.gump:CriaJanelaInfo() Details.playerDetailWindow = Details:CreateBreakdownWindow()
Details.FadeHandler.Fader(Details.playerDetailWindow, 1) Details.FadeHandler.Fader(Details.playerDetailWindow, 1)
--copy and paste window --copy and paste window