diff --git a/Definitions.lua b/Definitions.lua
index dca03186..ae0cb051 100644
--- a/Definitions.lua
+++ b/Definitions.lua
@@ -6,6 +6,50 @@
---| "TOOLBAR"
---| "STATUSBAR"
+---@alias detailsevent
+---| "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"
+
---@alias containertype number this container type is the number used to identify the actorcontainer type when using combat:GetContainer(containertype), can be 1, 2, 3, or 4.
---@class details
@@ -18,8 +62,19 @@
---@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")
+---@field RegisterEvent fun(self: detailseventlistener, event: detailsevent, callback: function)
+---@field UnregisterEvent fun(self: detailseventlistener, event: detailsevent)
+
+---@class deathtable : table
+---@field key1 any[] what happened to the player before death
+---@field key2 number unix time
+---@field key3 string player name
+---@field key4 string player class
+---@field key5 number max health
+---@field key6 string time of death as string
+---@field dead boolean just a boolean to indicate this is a death table
+---@field last_cooldown {key1: unixtime, key2: spellid}
+---@field dead_at number combatElapsedTime
---@class customspellinfo : {name: string, isPassive: boolean, itemId: number, icon: string|number}
---@class customiteminfo: {itemId: number, isPassive: boolean}
@@ -43,6 +98,8 @@
---@field totals {key1: table, key2: table, key3: table, key3: table}
---@field totals_grupo {key1: table, key2: table, key3: table, key3: table}
---@field __destroyed boolean
+---@field PhaseData table
+---@field is_boss table
---@field GetTimeData fun(dataName: string) : table
---@field GetPhases fun(combat: combat) : table
---@field GetCombatTime fun(combat) : number
diff --git a/Libs/DF/button.lua b/Libs/DF/button.lua
index ee0ffb93..eae2f3f1 100644
--- a/Libs/DF/button.lua
+++ b/Libs/DF/button.lua
@@ -1317,7 +1317,7 @@ detailsFramework.CloseButtonMixin = {
---@param parent frame
---@param frameName string|nil
---@return df_closebutton
-function detailsFramework:CreateCloseButton(parent, frameName)
+function detailsFramework:CreateCloseButton(parent, frameName) --make documentation
---@type df_closebutton
local closeButton = CreateFrame("button", frameName, parent, "UIPanelCloseButton")
closeButton:SetFrameLevel(parent:GetFrameLevel() + 1)
diff --git a/Libs/DF/charts.examples.lua b/Libs/DF/charts.examples.lua
new file mode 100644
index 00000000..589dcf09
--- /dev/null
+++ b/Libs/DF/charts.examples.lua
@@ -0,0 +1,109 @@
+
+--documentation: see the header of the file charts.lua
+
+
+--1º example: making a simple chart, just copy and paste this code into a lua file and run it
+do
+ local ChartFrameTest = ChartFrameExample1 or DetailsFramework:CreateGraphicLineFrame(UIParent, "ChartFrameExample1")
+ ChartFrameTest:SetPoint("left", UIParent, "left", 10, 0) --set the position of the chart
+ ChartFrameTest:SetSize(800, 600) --set the size of the chart
+ DetailsFramework:ApplyStandardBackdrop(ChartFrameTest) --apply a backdrop to this example hence see the frame size
+
+ --set the data (required)
+ local data = {1, 2, 30, 25, 6, 5, 4, 8, 7, 4, 1, 12, 15, 24, 18, 17, 14, 15, 8, 4, 14, 42, 22, 25, 30, 35, 39, 8, 7, 4, 1, 2, 5, 4, 8, 7, 4, 12, 12, 4}
+ local smoothnessLevel = 1 --(optional, default: 1)
+ ChartFrameTest:SetData(data, smoothnessLevel)
+ --draw the chart
+ ChartFrameTest:Plot()
+end
+
+--2º example: setting the color, thickness and scale of the line:
+do
+ local ChartFrameTest = ChartFrameExample2 or DetailsFramework:CreateGraphicLineFrame(UIParent, "ChartFrameExample2")
+ ChartFrameTest:SetPoint("left", UIParent, "left", 10, 0) --set the position of the chart
+ ChartFrameTest:SetSize(800, 600) --set the size of the chart
+ DetailsFramework:ApplyStandardBackdrop(ChartFrameTest) --apply a backdrop to this example hence see the frame size
+
+ --set the line thickness (optional, default: 2)
+ local lineThickness = 3
+ ChartFrameTest:SetLineThickness(lineThickness)
+
+ --set the chart color (optional, default: "white")
+ local lineColor = {r = 1, g = 1, b = 0} --set it to "yellow"
+ ChartFrameTest:SetColor(lineColor) --using {r = 1, g = 1, b = 0}
+ ChartFrameTest:SetColor("yellow") --using the color name
+ ChartFrameTest:SetColor(1, 1, 0) --passing the rgb directly
+ ChartFrameTest:SetColor({1, 1, 0}) --using an index table
+
+ --set the data (required)
+ local data = {1, 2, 30, 25, 6, 5, 4, 8, 7, 4, 1, 12, 15, 24 ,18, 17 ,14, 15, 8 , 4, 14, 42, 22, 25, 30, 35, 39, 8, 7, 4, 1, 2, 5, 4 ,8, 7 ,4, 12, 12 , 4}
+ local smoothnessLevel = 1 --(optional, default: 1)
+ ChartFrameTest:SetData(data, smoothnessLevel)
+
+ --height modifier, if for some reason need to scale the chart height
+ local heightScale = 1 --(optional, default: 1)
+ --draw the chart
+ ChartFrameTest:Plot(heightScale)
+end
+
+--3º example: setting the axes lines and labels
+do
+ local ChartFrameTest = ChartFrameExample3 or DetailsFramework:CreateGraphicLineFrame(UIParent, "ChartFrameExample3")
+ ChartFrameTest:SetPoint("left", UIParent, "left", 10, 0)
+ ChartFrameTest:SetSize(800, 600)
+ DetailsFramework:ApplyStandardBackdrop(ChartFrameTest)
+
+ --create guide lines in the left and bottom of the chart
+ local xOffset = 48 --pixels from the left border of the chart
+ local yOffset = 28 --pixels from the bottom border of the chart
+ local whichSide = "left" --which side of vertical line should be placed
+ local thickness = 1
+ local amountYLabels = 10 --amounf of texts indicating the scale of the chart
+ local amountXLabels = 10
+ local r, g, b, a = 1, 1, 1, 1
+ ChartFrameTest:CreateAxesLines(xOffset, yOffset, whichSide, thickness, amountYLabels, amountXLabels, r, g, b, a)
+
+ --the labels in the bottom line can be 'time', 'number' or 'value'
+ ChartFrameTest:SetXAxisDataType("time")
+ --set the data to be used in the bottom line labels, how the data is formatted depends on the type set above
+ ChartFrameTest:SetXAxisData(10) --with type 'time' the chart interprets this as seconds and shows 1:00 to 10:00
+
+ ChartFrameTest:SetXAxisDataType("number")
+ ChartFrameTest:SetXAxisData(600) --the chart interprets this as a 'number' type and displays it as 60, 120, 180.
+
+ ChartFrameTest:SetXAxisDataType("value")
+ ChartFrameTest:SetXAxisData("hello", "world", 1, 2, 3, 4, "chart", 0, 1, 0) --and 'value' show the values passed
+
+ --setting the data, doesn't matter if it is set at the top or right before Plot()
+ local data = {1, 2, 30, 25, 6, 5, 4, 8, 7, 4, 1, 12, 15, 24 ,18, 17 ,14, 15, 8 , 4, 14, 42, 22, 25, 30, 35, 39, 8, 7, 4, 1, 2, 5, 4 ,8, 7 ,4, 12, 12 , 4}
+ ChartFrameTest:SetData(data) --smoothnessLevel is absent here, it'll use 1 as default
+ ChartFrameTest:Plot()
+end
+
+--4º example: a multi line chart is a chart which supports multiple lines, each line can have a different color, name, smoothnessLevel and thickness
+do
+ local ChartFrameTest = ChartFrameExample4 or DetailsFramework:CreateGraphicMultiLineFrame(UIParent, "ChartFrameExample4")
+ ChartFrameTest:SetPoint("left", UIParent, "left", 10, 0)
+ ChartFrameTest:SetSize(800, 600)
+ DetailsFramework:ApplyStandardBackdrop(ChartFrameTest)
+
+ --when using multi-line, the Reset() function instructs the chart to discard the previous data as new data is about to be added
+ ChartFrameTest:Reset()
+
+ --smoothnessLevel, name, red, green, blue, alpha
+ local smoothnessLevel = 2 --(optional, default: 0)
+ local line1Name, line2Name, line3Name = "Line 1", "Line 2", "Line 3" --show the line name at the top right corner (optional, default none)
+ local line1Color, line2Color, line3Color = "lime", "purple", "orange" --(optional, default "white")
+
+ --add data into the chart (it plots a line for each data added when :Plot() is called)
+ local data1 = {1, 2, 30, 25, 6, 5, 4, 8, 7, 4, 1, 12, 15, 24 ,18, 17 ,14, 15, 8 , 4, 14, 42, 22, 25, 30, 35, 39, 8, 7, 4, 1, 2, 5, 4}
+ ChartFrameTest:AddData(data1, smoothnessLevel, line1Name, line1Color)
+
+ local data2 = {3, 5, 20, 25, 6, 5, 15, 18, 12, 14, 11, 8, 7, 8 ,7, 4 ,1, 25, 26 , 30, 28, 20, 22, 25, 20, 15, 10, 8, 7, 4, 1, 2, 5, 4}
+ ChartFrameTest:AddData(data2, smoothnessLevel, line2Name, line2Color)
+
+ local data3 = {5, 7, 15, 30, 6, 2, 10, 13, 10, 5, 11, 8, 7, 5, 3, 1, 1, 8, 10 , 12, 15, 20, 25, 25, 20, 17, 12, 7, 7, 6, 4, 5, 6, 5}
+ ChartFrameTest:AddData(data3, smoothnessLevel, line3Name, line3Color)
+
+ ChartFrameTest:Plot()
+end
\ No newline at end of file
diff --git a/Libs/DF/charts.lua b/Libs/DF/charts.lua
index 453bc836..b640e237 100644
--- a/Libs/DF/charts.lua
+++ b/Libs/DF/charts.lua
@@ -6,48 +6,95 @@ end
local CreateFrame = CreateFrame
local unpack = unpack
+local wipe = table.wipe
local _
+---@class chart_guideline : fontstring
+---@field circleTexture texture
+---@field guideLine line
+
+---@class chart_nameindicator : frame
+---@field Texture texture
+---@field Label fontstring
+
+---@alias x_axisdatatype
+---| "time" when setting the text into the labels, it will be converted into a time format
+---| "number" same as timer, but the number is not comverted to time
+---| "value" a fixed table with values is passed by the SetXAxisData() function
+
---@class df_chartshared: table
---@field yAxisLine line the vertical line which can be anchored in the left or right side of the frame, if the chart is a multi chart, this line is shared by all charts
----@field xAxisLine line
----@field lineThickness number
----@field yAxisLabels fontstring[]
----@field xAxisLabels fontstring[]
----@field SetAxisColor fun(self: df_chartmulti, red: number|string|table|nil, green: number|nil, blue: number|nil, alpha: number|nil) : boolean set the color of both axis lines
----@field SetAxisThickness fun(self: df_chartmulti, thickness: number) : boolean set the thickness of both axis lines
+---@field xAxisLine line the horizontal line which can be anchored in the top or bottom side of the frame, if the chart is a multi chart, this line is shared by all charts
+---@field xAxisDataNumber any if the data type of the x axis is "number" or "time"
+---@field xAxisDataValues table if the data type of the x axis is "value"
+---@field xAxisDataType x_axisdatatype the data type of the x axis, if time, the x axis will be a time axis, if value, the x axis will be a value axis
+---@field yAxisLabels chart_guideline[] the vertical axis labels to indicate the values of the chart data
+---@field xAxisLabels fontstring[] the horizontal axis labels to indicate the values of the chart data
+---@field plotFrame frame the plot frame which is the frame that will hold the chart lines
+---@field lineThickness number the thickness of the chart lines
+---@field chartLeftOffset number the offset of the left side of the chart frame to the plot frame
+---@field chartBottomOffset number the offset of the bottom side of the chart frame to the plot frame
+---@field xAxisLabelsYOffset number default: -6, the offset of the horizontal axis labels to the horizontal axis line (y coordinate)
+---@field smoothnessLevel number default: 0, the smoothness level of the chart lines, 0 is no smoothness
+---@field SetAxesColor fun(self: df_chartmulti, red: number|string|table|nil, green: number|nil, blue: number|nil, alpha: number|nil) : boolean set the color of both axis lines
+---@field SetAxesThickness fun(self: df_chartmulti, thickness: number) : boolean set the thickness of both axis lines
+---@field CreateAxesLines fun(self: df_chartmulti|df_chart, xOffset: number, yOffset: number, whichSide: "left"|"right", thickness: number, amountYLabels: number, amountXLabels: number, red: any, green: number|nil, blue: number|nil, alpha: number|nil)
+---@field SetXAxisDataType fun(self: df_chartmulti|df_chart, dataType: x_axisdatatype) : boolean set the data type of the x axis, if time, the x axis will be a time axis, if value, the x axis will be a value axis
+---@field SetXAxisData fun(self: df_chartmulti|df_chart, data: any) set the data of the x axis, if time, the x axis will be a time axis, if value, the x axis will be a value axis
+---@field SharedContrustor fun(self: df_chartmulti|df_chart) set default values for fields used on both chart types
+---@field IsMultiChart fun(self: df_chartmulti|df_chart) : boolean return true if the chart is a multi chart
+
+---@param self df_chart|df_chartmulti
+local chartFrameSharedConstructor = function(self)
+ self.xAxisDataType = "number"
+ self.lineThickness = 2
+ self.xAxisDataNumber = 0
+ self.xAxisDataValues = {}
+ self.xAxisLabels = {}
+ self.yAxisLabels = {}
+ self.chartLeftOffset = 0
+ self.chartBottomOffset = 0
+ self.xAxisLabelsYOffset = -6
+ self.smoothnessLevel = 0
+end
---@class df_chart: frame, df_data, df_value, df_chartshared
---@field _dataInfo df_data
---@field color number[] red green blue alpha
+---@field height number
---@field nextLine number
---@field minValue number
---@field maxValue number
---@field data number[]
---@field lines line[]
+---@field fixedLineWidth number
+---@field chartName string
---@field ChartFrameConstructor fun(self: df_chart) set the default values for the chart frame
---@field GetLine fun(self: df_chart) : line return a line and also internally handle next line
---@field GetLines fun(self: df_chart) : line[] return a table with all lines already created
---@field GetLineWidth fun(self: df_chart) : number calculate the width of each drawn line
---@field SetLineWidth fun(self: df_chart, width: number) set the line width to a fixed value
----@field Plot fun(self: df_chart) draw the graphic using lines and following the data set by SetData()
---@field GetAmountLines fun(self: df_chart) : number return the amount of lines in use
---@field OnSizeChanged fun(self: df_chart)
---@field HideLines fun(self: df_chart) hide all lines already created
---@field Reset fun(self: df_chart) hide all lines and reset the next line to 1
---@field SetColor fun(self: df_chart, r: number|string|table|nil, g: number|nil, b: number|nil, a: number|nil) set the color for the lines
+---@field GetColor fun(self: df_chart) : red, green, blue, alpha
---@field SetLineThickness fun(self: df_chart, thickness: number) set the line thickness
----@field CalcYAxisPointForValue fun(self: df_chart, value: number)
+---@field CalcYAxisPointForValue fun(self: df_chart, value: number, plotFrameHeightScaled: number) : number
---@field UpdateFrameSizeCache fun(self: df_chart)
+---@field Plot fun(self: df_chart, yPointScale: number|nil, bUpdateLabels: boolean|nil) draw the graphic using lines and following the data set by SetData() or AddData() in multi chart
---@class df_chartmulti : df_chart, df_chartshared
---@field chartFrames df_chart[]
---@field nextChartselframe number
---@field biggestDataValue number
+---@field nextChartFrame number
+---@field lineNameIndicators chart_nameindicator[]
---@field MultiChartFrameConstructor fun(self: df_chartmulti)
---@field GetCharts fun(self: df_chartmulti) : df_chart[]
---@field GetChart fun(self: df_chartmulti) : df_chart
----@field AddData fun(self: df_chartmulti, data: table, red: number|string|table|nil, green: number|nil, blue: number|nil, alpha: number|nil)
+---@field AddData fun(self: df_chartmulti, data: table, name: string, red: any, green: number|nil, blue: number|nil, alpha: number|nil)
---@field GetAmountCharts fun(self: df_chartmulti): number
---@field HideCharts fun(self: df_chartmulti)
---@field Reset fun(self: df_chartmulti)
@@ -55,44 +102,75 @@ local _
---@field SetMaxDataSize fun(self: df_chartmulti, dataSize: number)
---@field GetMaxDataSize fun(self: df_chartmulti)
---@field SetLineThickness fun(self: df_chart, thickness: number) set the line thickness for all chart frames
----@field Plot fun(self: df_chartmulti)
+---@field UpdateChartNamesIndicator fun(self: df_chartmulti) if the chart names has been passed while adding data, this function will update the chart names indicator
+---@field Plot fun(self: df_chartmulti) draw the graphic using lines and following the data set by SetData() or AddData() in multi chart
-detailsFramework.ChartFrameSharedMixin = {
- ---set the color of both axis lines
- ---@param self df_chart|df_chartmulti
- ---@param red any
- ---@param green number|nil
- ---@param blue number|nil
- ---@param alpha number|nil
- ---@return boolean bColorChanged return true if the color was set, false if the axis lines are not created yet
- SetAxisColor = function(self, red, green, blue, alpha)
- if (not self.yAxisLine) then
- return false
- end
- red, green, blue, alpha = detailsFramework:ParseColors(red, green, blue, alpha)
- self.yAxisLine:SetColorTexture(red, green, blue, alpha)
- self.xAxisLine:SetColorTexture(red, green, blue, alpha)
- return true
- end,
+---create the plot frame which is the frame that will hold the chart lines
+---@param self df_chartmulti|df_chart
+---@return frame
+local createPlotFrame = function(self)
+ local plotFrame = CreateFrame("frame", "$parentPlotFrame", self, "BackdropTemplate")
+ plotFrame:SetAllPoints()
+ self.plotFrame = plotFrame
+ return plotFrame
+end
- ---set the thickness of both axis lines
- ---@param self df_chart|df_chartmulti
- ---@param thickness number
- ---@return boolean bThicknessChanged return true if the thickness was set, false if the axis lines are not created yet
- SetAxisThickness = function(self, thickness)
- if (not self.yAxisLine) then
- return false
- end
- self.yAxisLine:SetThickness(thickness)
- self.xAxisLine:SetThickness(thickness)
- return true
- end,
-}
+---generate the vertical axis labels to indicate the values of the chart data
+---@param parent frame
+---@param amountLabels number
+---@param labelsTable chart_guideline[]
+---@param red number
+---@param green number
+---@param blue number
+---@param alpha number
+local createVerticalAxisLabels = function(parent, amountLabels, labelsTable, red, green, blue, alpha)
+ for i = 1, amountLabels do
+ ---@type fontstring
+ local label = parent:CreateFontString("$parentYAxisLabel" .. i, "overlay", "GameFontNormal")
+ ---@cast label chart_guideline
---> functions shared by both single and multi chart frames
+ label:SetJustifyH("right")
+ label:SetTextColor(red, green, blue, alpha)
+ detailsFramework:SetFontSize(label, 11)
+ table.insert(labelsTable, label)
+
+ local circleTexture = parent:CreateTexture("$parentYAxisLabel" .. i .. "CircleTexture", "border")
+ circleTexture:SetSize(4, 4)
+ circleTexture:SetTexture([[Interface\CHARACTERFRAME\TempPortraitAlphaMaskSmall]])
+ circleTexture:SetVertexColor(red, green, blue, alpha)
+ circleTexture:SetPoint("right", label, "right", 5, 0)
+
+ local guideLine = parent:CreateLine("$parentYAxisLabel" .. i .. "GuideLine", "border")
+ guideLine:SetThickness(1)
+ guideLine:SetColorTexture(red, green, blue, 0.05)
+
+ label.circleTexture = circleTexture
+ label.guideLine = guideLine
+ end
+end
+
+---generate the horizontal axis labels to indicate the values of the chart data
+---@param parent frame
+---@param amountLabels number
+---@param labelsTable fontstring[]
+---@param red number
+---@param green number
+---@param blue number
+---@param alpha number
+local createHorizontalAxisLabels = function(parent, amountLabels, labelsTable, red, green, blue, alpha)
+ for i = 1, amountLabels do
+ local label = parent:CreateFontString("$parentXAxisLabel" .. i, "overlay", "GameFontNormal")
+ label:SetJustifyH("left")
+ label:SetTextColor(red, green, blue, alpha)
+ detailsFramework:SetFontSize(label, 11)
+ table.insert(labelsTable, label)
+ end
+end
---create the x and y axis lines with their labels
---@param self df_chart|df_chartmulti
+---@param xOffset number
+---@param yOffset number
---@param whichSide "left"|"right"
---@param thickness number
---@param amountYLabels number
@@ -102,58 +180,217 @@ detailsFramework.ChartFrameSharedMixin = {
---@param blue number|nil
---@param alpha number|nil
---@return boolean
-local createAxysLines = function(self, whichSide, thickness, amountYLabels, amountXLabels, red, green, blue, alpha)
+local createAxesLines = function(self, xOffset, yOffset, whichSide, thickness, amountYLabels, amountXLabels, red, green, blue, alpha)
if (self.axisCreated) then
return false
end
- self.yAxisLabels = {}
- self.xAxisLabels = {}
+ local plotFrame = self.plotFrame
- --this is the vertical line which can be anchored in the left or right side of the frame, it separates the chart lines from the measurements texts
+ self.chartLeftOffset = xOffset or 48
+ self.chartBottomOffset = yOffset or 28
+ whichSide = whichSide or "left"
+ thickness = thickness or 1
+ amountYLabels = amountYLabels or 10
+ amountXLabels = amountXLabels or 10
+ red = red or 1
+ green = green or 1
+ blue = blue or 1
+ alpha = alpha or 1
+
+ --adjust the plotFrame size and point taking in consideration of the left and bottom offsets, this is done to free space for the axis labels
+ plotFrame:SetSize(self:GetWidth() - self.chartLeftOffset - 10, self:GetHeight() - self.chartBottomOffset - 20)
+ plotFrame:ClearAllPoints()
+ plotFrame:SetPoint("topleft", self, "topleft", self.chartLeftOffset, -1)
+ plotFrame:SetPoint("bottomright", self, "bottomright", -1, self.chartBottomOffset)
+
+ --this is the vertical line which can be anchored in the left or right side of the frame, it separates the chart lines from the labels
---@type line
- local yAxisLine = self:CreateLine("$parentYAxisLine", "overlay")
+ local yAxisLine = plotFrame:CreateLine("$parentYAxisLine", "overlay")
self.yAxisLine = yAxisLine
-
--and the horizontal line which is always anchored in the bottom of the frame
---@type line
- local xAxisLine = self:CreateLine("$parentXAxisLine", "overlay")
+ local xAxisLine = plotFrame:CreateLine("$parentXAxisLine", "overlay")
self.xAxisLine = xAxisLine
+ --vertical axis point
+ if (whichSide == "left") then
+ yAxisLine:SetStartPoint("topleft", plotFrame, 0, -1)
+ yAxisLine:SetEndPoint("bottomleft", plotFrame, 0, self.chartBottomOffset * -1)
+ else
+ yAxisLine:SetStartPoint("topright", plotFrame, 0, -1)
+ yAxisLine:SetEndPoint("bottomleft", plotFrame, 0, self.chartBottomOffset)
+ end
+
+ --horizontal axis point
+ xAxisLine:SetStartPoint("bottomleft", plotFrame, self.chartLeftOffset * -1, 0)
+ xAxisLine:SetEndPoint("bottomright", plotFrame, -1, 0)
+
red, green, blue, alpha = detailsFramework:ParseColors(red, green, blue, alpha)
+ self:SetAxesColor(red, green, blue, alpha)
- self:SetAxisColor(red, green, blue, alpha)
- self:SetAxisThickness(thickness)
+ --set the thickness of the both axis lines
+ self:SetAxesThickness(thickness)
- --create the labels in the vertical axis line
- for i = 1, amountYLabels do
- local label = self:CreateFontString("$parentYAxisLabel" .. i, "overlay", "GameFontNormal")
- label:SetJustifyH("right")
- label:SetTextColor(red, green, blue, alpha)
- table.insert(self.yAxisLabels, label)
- end
-
- --create the labels in the horizontal axis line
- for i = 1, amountXLabels do
- local label = self:CreateFontString("$parentXAxisLabel" .. i, "overlay", "GameFontNormal")
- label:SetJustifyH("left")
- label:SetTextColor(red, green, blue, alpha)
- table.insert(self.xAxisLabels, label)
- end
-
- yAxisLine:SetStartPoint("topleft", self, "topleft", 0, 0)
- yAxisLine:SetEndPoint("bottomleft", self, "bottomleft", 0, 0)
- yAxisLine:Hide()
-
- xAxisLine:SetStartPoint("bottomleft", self, "bottomleft", 0, 0)
- xAxisLine:SetEndPoint("bottomright", self, "bottomright", 0, 0)
- xAxisLine:Hide()
+ createVerticalAxisLabels(plotFrame, amountYLabels, self.yAxisLabels, red, green, blue, alpha)
+ createHorizontalAxisLabels(plotFrame, amountXLabels, self.xAxisLabels, red, green, blue, alpha)
self.axisCreated = true
-
return true
end
+---@param self df_chartmulti|df_chart
+---@param ... any
+local setXAxisData = function(self, ...)
+ --when the data type is set to time, the x axis data is a number which represents the biggest time in seconds of all charts added
+ if (self.xAxisDataType == "time" or self.xAxisDataType == "number") then
+ self.xAxisDataNumber = math.max(self.xAxisDataNumber, select(1, ...))
+ else
+ wipe(self.xAxisDataValues)
+ self.xAxisDataValues = {...}
+ end
+end
+
+---@param self df_chartmulti|df_chart
+---@param dataType x_axisdatatype
+local setXAxisDataType = function(self, dataType)
+ assert(type(dataType) == "string", "string expected on :SetXAxisDataType(string)")
+ self.xAxisDataType = dataType
+
+ if (dataType == "time" or dataType == "number") then
+ self.xAxisDataNumber = 0
+
+ elseif (dataType == "value") then
+ wipe(self.xAxisDataValues)
+ end
+end
+
+---updates the values of the labels on the axes to reflect the data shown
+---@param self df_chart|df_chartmulti
+local updateLabelValues = function(self)
+ local maxValue = self:GetMaxValue()
+ local height = self.plotFrame:GetHeight()
+ local verticalLabelCount = #self.yAxisLabels
+ local heightStep = height / verticalLabelCount
+
+ --update the labels in the vertical axis line
+ for i = 1, verticalLabelCount do
+ local label = self.yAxisLabels[i]
+ local value = maxValue * (i / verticalLabelCount)
+ label:ClearAllPoints()
+ label:SetPoint("topright", self.yAxisLine, "bottomleft", -6, heightStep * i + self.chartBottomOffset)
+ label:SetText(detailsFramework.FormatNumber(value))
+
+ label.circleTexture:ClearAllPoints()
+ label.circleTexture:SetPoint("center", self.yAxisLine, "bottomleft", -2, heightStep * i - 5 + self.chartBottomOffset)
+
+ label.guideLine:SetStartPoint("center", label.circleTexture, 0, 0)
+ label.guideLine:SetEndPoint("bottomright", self.plotFrame, 0, heightStep * i - 5)
+ end
+
+ --update the labels in the horizontal axis line
+ local xAxisDataType = self.xAxisDataType
+ local horizontalLabelCount = #self.xAxisLabels
+ local width = self.plotFrame:GetWidth()
+ local widthStep = width / horizontalLabelCount
+
+ for i = horizontalLabelCount, 1, -1 do
+ local label = self.xAxisLabels[i]
+ label:ClearAllPoints()
+ label:SetJustifyH("right")
+
+ --set the point of each x axis label
+ label:SetPoint("topright", self.plotFrame, "bottomleft", widthStep * i, self.xAxisLabelsYOffset or -6)
+
+ --get the type set for the x axis labels and format the value accordingly
+ if (xAxisDataType == "time" or xAxisDataType == "number") then
+ local maxNumberValue = self.xAxisDataNumber
+ local thisValue = maxNumberValue * (i / horizontalLabelCount)
+ if (xAxisDataType == "time") then
+ label:SetText(detailsFramework:IntegerToTimer(thisValue))
+ else
+ label:SetText(detailsFramework.FormatNumber(thisValue))
+ end
+
+ elseif (xAxisDataType == "value") then
+ label:SetText(self.xAxisDataValues[i])
+ end
+ end
+end
+
+detailsFramework.ChartFrameSharedMixin = {
+ ---set the color of both axis lines
+ ---@param self df_chart|df_chartmulti
+ ---@param red any
+ ---@param green number|nil
+ ---@param blue number|nil
+ ---@param alpha number|nil
+ ---@return boolean bColorChanged return true if the color was set, false if the axis lines are not created yet
+ SetAxesColor = function(self, red, green, blue, alpha)
+ if (not self.yAxisLine) then
+ return false
+ end
+
+ --set the color of both axis lines
+ red, green, blue, alpha = detailsFramework:ParseColors(red, green, blue, alpha)
+ self.yAxisLine:SetColorTexture(red, green, blue, alpha)
+ self.xAxisLine:SetColorTexture(red, green, blue, alpha)
+
+ --iterage over all labels and set their color
+ for i = 1, #self.yAxisLabels do
+ self.yAxisLabels[i]:SetTextColor(red, green, blue, alpha)
+ end
+
+ for i = 1, #self.xAxisLabels do
+ self.xAxisLabels[i]:SetTextColor(red, green, blue, alpha)
+ end
+
+ return true
+ end,
+
+ ---set the thickness of both axis lines
+ ---@param self df_chart|df_chartmulti
+ ---@param thickness number
+ ---@return boolean bThicknessChanged return true if the thickness was set, false if the axis lines are not created yet
+ SetAxesThickness = function(self, thickness)
+ if (not self.yAxisLine) then
+ return false
+ end
+ self.yAxisLine:SetThickness(thickness)
+ self.xAxisLine:SetThickness(thickness)
+ return true
+ end,
+
+ ---create the x and y axis lines with their labels
+ ---@param self df_chart|df_chartmulti
+ ---@param xOffset number
+ ---@param yOffset number
+ ---@param whichSide "left"|"right"
+ ---@param thickness number
+ ---@param amountYLabels number
+ ---@param amountXLabels number
+ ---@param red any
+ ---@param green number|nil
+ ---@param blue number|nil
+ ---@param alpha number|nil
+ ---@return boolean
+ CreateAxesLines = function(self, xOffset, yOffset, whichSide, thickness, amountYLabels, amountXLabels, red, green, blue, alpha)
+ return createAxesLines(self, xOffset, yOffset, whichSide, thickness, amountYLabels, amountXLabels, red, green, blue, alpha)
+ end,
+
+ ---@param self df_chartmulti|df_chart
+ ---@param ... any
+ SetXAxisData = function(self, ...)
+ setXAxisData(self, ...)
+ end,
+
+ ---@param self df_chartmulti|df_chart
+ ---@param dataType x_axisdatatype
+ SetXAxisDataType = function(self, dataType)
+ setXAxisDataType(self, dataType)
+ end,
+}
+
detailsFramework.ChartFrameMixin = {
---set the default values for the chart frame
---@param self df_chart
@@ -161,13 +398,28 @@ detailsFramework.ChartFrameMixin = {
self.nextLine = 1
self.minValue = 0
self.maxValue = 1
- self.lineThickness = 1
+ self.lineThickness = 2
self.data = {}
self.lines = {}
self.color = {1, 1, 1, 1}
-
--OnSizeChanged
self:SetScript("OnSizeChanged", self.OnSizeChanged)
+
+ chartFrameSharedConstructor(self)
+ end,
+
+ IsMultiChart = function(self)
+ return false
+ end,
+
+ ---get the chart color
+ ---@param self df_chart
+ ---@return number red
+ ---@return number green
+ ---@return number blue
+ ---@return number alpha
+ GetColor = function(self)
+ return unpack(self.color)
end,
---set the color for the lines
@@ -192,7 +444,7 @@ detailsFramework.ChartFrameMixin = {
if (not line) then
---@type line
- line = self:CreateLine(nil, "overlay")
+ line = self.plotFrame:CreateLine(nil, "overlay", nil, 5)
self.lines[self.nextLine] = line
end
@@ -247,7 +499,7 @@ detailsFramework.ChartFrameMixin = {
return self.fixedLineWidth
else
local amountData = self:GetDataSize()
- local frameWidth = self:GetWidth()
+ local frameWidth = self.plotFrame:GetWidth()
return frameWidth / amountData
end
end,
@@ -262,8 +514,10 @@ detailsFramework.ChartFrameMixin = {
---@param self df_chart
---@param value number
- CalcYAxisPointForValue = function(self, value)
- return value / self.maxValue * self.height
+ ---@param plotFrameHeightScaled number
+ ---@return number
+ CalcYAxisPointForValue = function(self, value, plotFrameHeightScaled)
+ return value / self.maxValue * (plotFrameHeightScaled)
end,
---@param self df_chart
@@ -278,11 +532,11 @@ detailsFramework.ChartFrameMixin = {
end,
---@param self df_chart
- Plot = function(self)
+ ---@param yPointScale number|nil
+ ---@param bUpdateLabels boolean|nil
+ Plot = function(self, yPointScale, bUpdateLabels)
--debug
--self:SetData({38, 26, 12, 63, 100, 96, 42, 94, 25, 75, 61, 54, 71, 40, 34, 100, 66, 90, 39, 13, 99, 18, 72, 18, 83, 45, 56, 24, 33, 85, 95, 71, 15, 66, 19, 58, 52, 9, 83, 99, 100, 4, 3, 56, 6, 80, 94, 7, 40, 55, 98, 92, 20, 9, 35, 89, 72, 7, 13, 81, 29, 78, 55, 70, 12, 33, 39, 3, 84, 31, 10, 53, 51, 69, 66, 58, 71, 60, 31, 71, 27, 76, 21, 75, 15, 89, 2, 81, 72, 78, 74, 80, 97, 10, 59, 0, 31, 5, 1, 82, 71, 89, 78, 94, 74, 20, 65, 72, 56, 40, 92, 91, 40, 79, 4, 56, 18, 88, 88, 20, 20, 10, 47, 26, 80, 26, 75, 21, 57, 10, 67, 66, 84, 83, 14, 47, 83, 9, 7, 73, 63, 32, 64, 20, 40, 3, 46, 54, 17, 37, 82, 66, 65, 22, 12, 1, 100, 41, 1, 72, 38, 41, 71, 69, 88, 34, 10, 50, 9, 25, 19, 27, 3, 13, 40, 75, 3, 11, 93, 58, 81, 80, 93, 25, 74, 68, 91, 87, 79, 48, 66, 53, 64, 18, 51, 19, 32, 4, 21, 43})
- local currentXPoint = 0
- local currentYPoint = 0
self:UpdateFrameSizeCache()
@@ -293,7 +547,9 @@ detailsFramework.ChartFrameMixin = {
local firstValue = self:GetDataFirstValue()
assert(firstValue, "Can't Plot(), chart has no data, use Chart:SetData(table)")
- currentYPoint = self:CalcYAxisPointForValue(firstValue)
+ local plotFrameHeightScaled = self.plotFrame:GetHeight() * (yPointScale or 1)
+ local currentXPoint = 0
+ local currentYPoint = self:CalcYAxisPointForValue(firstValue, plotFrameHeightScaled)
--calculate the width space which line should have
local eachLineWidth = self:GetLineWidth()
@@ -302,8 +558,13 @@ detailsFramework.ChartFrameMixin = {
for i = 1, maxLines do
local line = self:GetLine()
+
line:SetColorTexture(unpack(self.color))
- line:SetThickness(self.lineThickness)
+
+ if (line.thickness ~= self.lineThickness) then
+ line:SetThickness(self.lineThickness)
+ line.thickness = self.lineThickness
+ end
--the start point starts where the latest point finished
line:SetStartPoint("bottomleft", currentXPoint, currentYPoint)
@@ -313,9 +574,13 @@ detailsFramework.ChartFrameMixin = {
--end point
local value = self:GetDataNextValue()
- currentYPoint = self:CalcYAxisPointForValue(value)
+ currentYPoint = self:CalcYAxisPointForValue(value, plotFrameHeightScaled)
line:SetEndPoint("bottomleft", currentXPoint, currentYPoint)
end
+
+ if (bUpdateLabels or bUpdateLabels == nil) then
+ updateLabelValues(self)
+ end
end,
}
@@ -337,7 +602,36 @@ local createChartFrame = function(parent, name)
chartFrame:ChartFrameConstructor()
--when a new data is set, update the min and max values
- local onSetDataCallback = function()
+ local onSetDataCallback = function(data, smoothnessLevel)
+ local newData = {}
+
+ smoothnessLevel = smoothnessLevel or 0
+
+ if (smoothnessLevel > 0) then
+ smoothnessLevel = smoothnessLevel + 2
+
+ for i = 1, #data do
+ local thisValue = 0
+ local amountDataAdded = 0
+
+ --calculate the sum within the window
+ for o = i - math.floor(smoothnessLevel / 2), i + math.floor(smoothnessLevel / 2) do
+ if o >= 1 and o <= #data then
+ thisValue = thisValue + data[o]
+ amountDataAdded = amountDataAdded + 1
+ end
+ end
+
+ --calculate the average and store in the smoothedData value
+ local average = thisValue / amountDataAdded
+ table.insert(newData, average)
+ end
+ else
+ newData = data
+ end
+
+ chartFrame:SetDataRaw(newData)
+
local minValue, maxValue = chartFrame:GetDataMinMaxValues()
chartFrame:SetMinMaxValues(minValue, maxValue)
--clear the lines
@@ -345,6 +639,7 @@ local createChartFrame = function(parent, name)
end
chartFrame:AddDataChangeCallback(onSetDataCallback)
+ createPlotFrame(chartFrame) --creates chartFrame.plotFrame
return chartFrame
end
@@ -358,26 +653,36 @@ detailsFramework.MultiChartFrameMixin = {
MultiChartFrameConstructor = function(self)
self.nextChartselframe = 1
self.biggestDataValue = 0
- self.lineThickness = 1
+ self.lineThickness = 2
+ self.nextChartFrame = 1
self.chartFrames = {}
+ self.lineNameIndicators = {}
+
+ chartFrameSharedConstructor(self)
end,
- CreateAxisLines = function(self, whichSide, thickness, amountYLabels, amountXLabels, red, green, blue, alpha)
- createAxysLines(self, whichSide, thickness, amountYLabels, amountXLabels, red, green, blue, alpha)
+ IsMultiChart = function(self)
+ return true
end,
---add a new chart data and create a new chart frame if necessary to the multi chart
---@param self df_chartmulti
---@param data table
- ---@param red number|string|table|nil
+ ---@param smoothnessLevel number|nil
+ ---@param name string|nil
+ ---@param red any
---@param green number|nil
---@param blue number|nil
---@param alpha number|nil
- AddData = function(self, data, red, green, blue, alpha)
+ AddData = function(self, data, smoothnessLevel, name, red, green, blue, alpha)
assert(type(data) == "table", "MultiChartFrame:AddData() usage: AddData(table)")
local chartFrame = self:GetChart()
+
+ red, green, blue, alpha = detailsFramework:ParseColors(red, green, blue, alpha)
chartFrame:SetColor(red, green, blue, alpha)
- chartFrame:SetData(data)
+ chartFrame:SetData(data, smoothnessLevel)
+
+ chartFrame.chartName = name or ""
self:SetMaxValueIfBigger(chartFrame:GetMaxValue())
self:SetMinValueIfLower(chartFrame:GetMinValue())
@@ -466,23 +771,94 @@ detailsFramework.MultiChartFrameMixin = {
self.lineThickness = value
end,
- ---draw all the charts added to the multi chart frame
---@param self df_chartmulti
- Plot = function(self)
- local minValue, maxValue = self:GetMinMaxValues()
- self:SetChartsMinMaxValues(minValue, maxValue)
-
- local plotAreaWidth = self:GetWidth()
- local maxDataSize = self:GetMaxDataSize()
- local eachLineWidth = plotAreaWidth / maxDataSize
-
+ UpdateChartNamesIndicator = function(self)
local allCharts = self:GetCharts()
- for i = 1, self:GetAmountCharts() do
- local chartFrame = allCharts[i]
- chartFrame:SetLineThickness(self.lineThickness)
- chartFrame:SetLineWidth(eachLineWidth)
- chartFrame:Plot()
+ local allChartsAmount = self:GetAmountCharts()
+
+ --hide all indicators already created
+ for i = 1, #self.lineNameIndicators do
+ local thisIndicator = self.lineNameIndicators[i]
+ thisIndicator:Hide()
end
+
+ local nameIndicatorIndex = 1
+
+ for i = allChartsAmount, 1, -1 do
+ local chartFrame = allCharts[i]
+ local chartName = chartFrame.chartName
+ local red, green, blue, alpha = chartFrame:GetColor()
+
+ ---@type chart_nameindicator
+ local thisIndicator = self.lineNameIndicators[nameIndicatorIndex]
+ if (not thisIndicator) then
+ ---@type chart_nameindicator
+ thisIndicator = CreateFrame("frame", "$parentLineNameIndicator" .. i, self)
+ thisIndicator:SetSize(60, 12)
+ thisIndicator:Hide()
+ if (nameIndicatorIndex == 1) then
+ thisIndicator:SetPoint("topright", self, "topright", nameIndicatorIndex * -10, -10)
+ end
+
+ thisIndicator.Texture = thisIndicator:CreateTexture("$parentTexture", "overlay")
+ thisIndicator.Texture:SetSize(12, 12)
+
+ thisIndicator.Label = thisIndicator:CreateFontString("$parentLabel", "overlay", "GameFontNormal")
+ detailsFramework:SetFontSize(thisIndicator.Label, 11)
+ detailsFramework:SetFontColor(thisIndicator.Label, "white")
+
+ thisIndicator.Texture:SetPoint("left", thisIndicator, "left", 0, 0)
+ thisIndicator.Label:SetPoint("left", thisIndicator.Texture, "right", 2, 0)
+ self.lineNameIndicators[nameIndicatorIndex] = thisIndicator
+ end
+
+ thisIndicator.Texture:SetColorTexture(red, green, blue, alpha)
+ thisIndicator.Label:SetText(chartName)
+ local textWidth = thisIndicator.Label:GetStringWidth()
+ thisIndicator:SetWidth(math.max(textWidth + thisIndicator.Texture:GetWidth() + 4, 85))
+
+ if (nameIndicatorIndex > 1) then
+ local previousIndicator = self.lineNameIndicators[nameIndicatorIndex-1]
+ thisIndicator:SetPoint("topright", previousIndicator, "topleft", -2, 0)
+ end
+
+ nameIndicatorIndex = nameIndicatorIndex + 1
+
+ if (chartName ~= "") then
+ thisIndicator:Show()
+ end
+ end
+ end,
+
+ ---draw all the charts added to the multi chart frame
+ ---@param multiChartFrame df_chartmulti
+ Plot = function(multiChartFrame)
+ local minValue, multiChartMaxValue = multiChartFrame:GetMinMaxValues()
+ local plotAreaWidth = multiChartFrame.plotFrame:GetWidth() --if there's no axis, the plotFrame has no width
+ local maxDataSize = multiChartFrame:GetMaxDataSize()
+ local eachLineWidth = plotAreaWidth / maxDataSize
+ local allCharts = multiChartFrame:GetCharts()
+
+ for i = 1, multiChartFrame:GetAmountCharts() do
+ local chartFrame = allCharts[i]
+ chartFrame.chartLeftOffset = multiChartFrame.chartLeftOffset
+ chartFrame.chartBottomOffset = multiChartFrame.chartLeftOffset
+
+ chartFrame.plotFrame:ClearAllPoints()
+ chartFrame.plotFrame:SetAllPoints(multiChartFrame.plotFrame)
+
+ chartFrame:SetLineThickness(multiChartFrame.lineThickness)
+ chartFrame:SetLineWidth(eachLineWidth)
+
+ --get the percentage of how small this data is compared to the biggest data
+ --this percentage is then used to scale down the to fit correctly the fontStrings showing the value metrics
+ local yPointScale = chartFrame.maxValue / multiChartMaxValue
+ local bUpdateLabels = false
+ chartFrame:Plot(yPointScale, bUpdateLabels)
+ end
+
+ updateLabelValues(multiChartFrame)
+ multiChartFrame:UpdateChartNamesIndicator()
end,
}
@@ -503,5 +879,6 @@ function detailsFramework:CreateGraphicMultiLineFrame(parent, name)
chartFrame:ValueConstructor()
chartFrame:MultiChartFrameConstructor()
+ createPlotFrame(chartFrame) --creates chartFrame.plotFrame
return chartFrame
end
\ No newline at end of file
diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua
index 3ba7decc..62f0a706 100644
--- a/Libs/DF/fw.lua
+++ b/Libs/DF/fw.lua
@@ -1,6 +1,6 @@
-local dversion = 439
+local dversion = 441
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)
diff --git a/Libs/DF/load.xml b/Libs/DF/load.xml
index b1bae6a3..9e5dcd29 100644
--- a/Libs/DF/load.xml
+++ b/Libs/DF/load.xml
@@ -21,6 +21,7 @@
+
diff --git a/Libs/DF/mixins.lua b/Libs/DF/mixins.lua
index 0ebe41a3..4ac633f1 100644
--- a/Libs/DF/mixins.lua
+++ b/Libs/DF/mixins.lua
@@ -730,7 +730,8 @@ detailsFramework.SortFunctions = {
---@field GetDataLastValue fun(self: df_data) : any
---@field GetDataMinMaxValues fun(self: df_data) : number, number
---@field GetDataMinMaxValueFromSubTable fun(self: df_data, key: string) : number, number when data uses sub tables, get the min max values from a specific index or key, if the value stored is number, return the min and max values
----@field SetData fun(self: df_data, data: table)
+---@field SetData fun(self: df_data, data: table, anyValue: any)
+---@field SetDataRaw fun(self: df_data, data: table) set the data without triggering callback
---@field GetDataNextValue fun(self: df_data) : any
---@field ResetDataIndex fun(self: df_data)
@@ -767,17 +768,27 @@ detailsFramework.DataMixin = {
allCallbacks[func] = nil
end,
+ ---set the data without callback
+ ---@param self table
+ ---@param data table
+ SetDataRaw = function(self, data)
+ assert(type(data) == "table", "invalid table for SetData.")
+ self._dataInfo.data = data
+ self:ResetDataIndex()
+ end,
+
---set the data table
---@param self table
---@param data table
- SetData = function(self, data)
+ ---@param anyValue any @any value to pass to the callback functions before the payload is added
+ SetData = function(self, data, anyValue)
assert(type(data) == "table", "invalid table for SetData.")
self._dataInfo.data = data
self:ResetDataIndex()
local allCallbacks = self._dataInfo.callbacks
for func, payload in pairs(allCallbacks) do
- xpcall(func, geterrorhandler(), data, unpack(payload))
+ xpcall(func, geterrorhandler(), data, anyValue, unpack(payload))
end
end,
diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua
index 35c4d698..793d415d 100644
--- a/Libs/DF/panel.lua
+++ b/Libs/DF/panel.lua
@@ -13,6 +13,7 @@ local unpack = table.unpack or unpack --lua local
local type = type --lua local
local floor = math.floor --lua local
local loadstring = loadstring --lua local
+local CreateFrame = CreateFrame
local IS_WOW_PROJECT_MAINLINE = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE
local IS_WOW_PROJECT_NOT_MAINLINE = WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE
@@ -4391,11 +4392,18 @@ detailsFramework.TitleFunctions = {
}
-function detailsFramework:CreateTitleBar (f, titleText)
+---@class df_titlebar : frame
+---@field TitleLabel fontstring
+---@field CloseButton button
- local titleBar = CreateFrame("frame", f:GetName() and f:GetName() .. "TitleBar" or nil, f,"BackdropTemplate")
- titleBar:SetPoint("topleft", f, "topleft", 2, -3)
- titleBar:SetPoint("topright", f, "topright", -2, -3)
+---create a title bar with a font string in the center and a close button in the right side
+---@param parent frame
+---@param titleText string
+---@return df_titlebar
+function detailsFramework:CreateTitleBar(parent, titleText)
+ local titleBar = CreateFrame("frame", parent:GetName() and parent:GetName() .. "TitleBar" or nil, parent, "BackdropTemplate")
+ titleBar:SetPoint("topleft", parent, "topleft", 2, -3)
+ titleBar:SetPoint("topright", parent, "topright", -2, -3)
titleBar:SetHeight(20)
titleBar:SetBackdrop(SimplePanel_frame_backdrop) --it's an upload from this file
titleBar:SetBackdropColor(.2, .2, .2, 1)
@@ -4415,7 +4423,7 @@ function detailsFramework:CreateTitleBar (f, titleText)
closeButton:SetScript("OnClick", simple_panel_close_click) --upvalue from this file
local titleLabel = titleBar:CreateFontString(titleBar:GetName() and titleBar:GetName() .. "TitleText" or nil, "overlay", "GameFontNormal")
- titleLabel:SetTextColor(.8, .8, .8, 1)
+ titleLabel:SetTextColor(detailsFramework:ParseColors("gold"))
titleLabel:SetText(titleText or "")
--anchors
@@ -4423,14 +4431,14 @@ function detailsFramework:CreateTitleBar (f, titleText)
titleLabel:SetPoint("center", titleBar, "center")
--members
- f.TitleBar = titleBar
- f.CloseButton = closeButton
- f.TitleLabel = titleLabel
+ parent.TitleBar = titleBar
+ parent.CloseButton = closeButton
+ parent.TitleLabel = titleLabel
titleBar.CloseButton = closeButton
titleBar.Text = titleLabel
- detailsFramework:Mixin(f, detailsFramework.TitleFunctions)
+ detailsFramework:Mixin(parent, detailsFramework.TitleFunctions)
return titleBar
end
diff --git a/Libs/DF/scripting.lua b/Libs/DF/scripting.lua
new file mode 100644
index 00000000..8b632870
--- /dev/null
+++ b/Libs/DF/scripting.lua
@@ -0,0 +1,132 @@
+
+local detailsFramework = DetailsFramework
+
+if (not detailsFramework or not DetailsFrameworkCanLoad) then
+ return
+end
+
+local unpack = unpack
+local CreateFrame = CreateFrame
+local geterrorhandler = geterrorhandler
+local wipe = wipe
+
+local parseCodeForNamedLocalFunctions = function(codeBlock, startIndex, listOfFunctionsFound)
+ local nestedLevel = 0
+ local endIndex = startIndex
+ local currentQuote = ""
+ ---@type number for the 'function' keyword, need to ignore the one that started the 'local function' capture
+ local ignoreFunctionIndex = startIndex + 6
+
+ ---@type boolean
+ local bFoundEnd = false
+ ---@type boolean
+ local bIsInString = false
+ ---@type boolean
+ local bIsInComment = false
+
+ while (endIndex <= #codeBlock) do
+ local char = string.sub(codeBlock, endIndex, endIndex)
+
+ --check if the character is inside a comment
+ if (char == "-") then
+ local nextChar = string.sub(codeBlock, endIndex + 1, endIndex + 1)
+ if nextChar == "-" then
+ bIsInComment = true
+ end
+
+ elseif (char == "\n") then
+ bIsInComment = false
+ end
+
+ if (not bIsInComment) then
+ --check if it is inside a string
+ if (char == "'" or char == '"') then
+ if (not bIsInString) then
+ bIsInString = true
+ currentQuote = char
+
+ elseif (bIsInString and currentQuote == char) then
+ bIsInString = false
+ currentQuote = ""
+ end
+ end
+
+ if (not bIsInString) then
+ --check if the word starts with "i", "f", "d" or "e"
+ if (char == "i") then
+ local nextChars = string.sub(codeBlock, endIndex, endIndex + 1)
+ if (nextChars == "if") then
+ nestedLevel = nestedLevel + 1
+ end
+
+ elseif (char == "f") then
+ local nextChars = string.sub(codeBlock, endIndex, endIndex + 7)
+ --also check if the index isn't the one that started the 'local function' capture
+ if (nextChars == "function" and endIndex ~= ignoreFunctionIndex) then
+ nestedLevel = nestedLevel + 1
+ end
+
+ --for 'do' keyword, used by for and while and also by the 'do' keyword itself creating a block
+ elseif (char == "d") then
+ local nextChars = string.sub(codeBlock, endIndex, endIndex + 1)
+ if (nextChars == "do") then
+ nestedLevel = nestedLevel + 1
+ end
+
+ elseif (char == "e") then
+ local nextChars = string.sub(codeBlock, endIndex, endIndex + 2)
+ if (nextChars == "end") then
+ if (nestedLevel > 0) then
+ --reduce the nested level by 1
+ nestedLevel = nestedLevel - 1
+ else
+ --if the nested level is zero then the end of the function got found
+ bFoundEnd = true
+ endIndex = endIndex + 2 --adjust endIndex to include the 'end' keyword
+ break
+ end
+ end
+ end
+ end
+ end
+
+ endIndex = endIndex + 1
+ end
+
+ if (bFoundEnd) then
+ ---@type string get the function body
+ local functionBody = string.sub(codeBlock, startIndex, endIndex)
+ table.insert(listOfFunctionsFound, functionBody)
+ return endIndex
+ end
+end
+
+---search a code block for named local functions and bring them to the top of the code block
+---this is useful for when you want to call a function before it's defined
+---same thing as been implemented in Lua 5.2 but not in WoW Lua
+---@param codeBlock string
+function detailsFramework:BringNamedLocalFunctionToTop(codeBlock)
+ ---@type string[]
+ local listOfFunctionsFound = {}
+ ---@type number|nil
+ local startIndex = string.find(codeBlock, "local function")
+
+ while startIndex do
+ startIndex = parseCodeForNamedLocalFunctions(codeBlock, startIndex, listOfFunctionsFound)
+ if (not startIndex) then
+ break
+ end
+ startIndex = string.find(codeBlock, "local function", startIndex + 1)
+ end
+
+ for i = #listOfFunctionsFound, 1, -1 do
+ local thisMatch = listOfFunctionsFound[i]
+ local blockStartIndex = thisMatch[2]
+ local blockEndIndex = thisMatch[3]
+ codeBlock = codeBlock:sub(1, blockStartIndex - 1) .. codeBlock:sub(blockEndIndex + 1)
+ end
+
+ for i = #listOfFunctionsFound, 1, -1 do
+ codeBlock = listOfFunctionsFound[i][1] .. "\n\n" .. codeBlock
+ end
+end
\ No newline at end of file
diff --git a/Libs/DF/textentry.lua b/Libs/DF/textentry.lua
index f487bf50..94e9b347 100644
--- a/Libs/DF/textentry.lua
+++ b/Libs/DF/textentry.lua
@@ -447,6 +447,7 @@ detailsFramework.TextEntryCounter = detailsFramework.TextEntryCounter or 1
OnEnterPressed(self.editbox, byScript)
end
+ ---set the textEntry as a search box, it will add a magnifying glass icon on the left side and a clearSearchButton in the right.
function TextEntryMetaFunctions:SetAsSearchBox()
if (self.__bIsSearchBox) then
return
@@ -941,10 +942,14 @@ local set_speciallua_editor_font_size = function(borderFrame, newSize)
borderFrame.editboxlines:SetFont(file, newSize, flags)
end
-function detailsFramework:NewSpecialLuaEditorEntry(parent, width, height, member, name, nointent, showLineNumbers)
- if (name:find("$parent")) then
- local parentName = detailsFramework.GetParentName(parent)
- name = name:gsub("$parent", parentName)
+function detailsFramework:NewSpecialLuaEditorEntry(parent, width, height, member, name, nointent, showLineNumbers, bNoName)
+ if (not bNoName) then
+ if (name:find("$parent")) then
+ local parentName = detailsFramework.GetParentName(parent)
+ name = name:gsub("$parent", parentName)
+ end
+ else
+ name = nil
end
local borderframe = CreateFrame("Frame", name, parent,"BackdropTemplate")
@@ -955,9 +960,9 @@ function detailsFramework:NewSpecialLuaEditorEntry(parent, width, height, member
end
local scrollframe = CreateFrame("ScrollFrame", name, borderframe, "UIPanelScrollFrameTemplate, BackdropTemplate")
- local scrollframeNumberLines = CreateFrame("ScrollFrame", name .. "NumberLines", borderframe, "UIPanelScrollFrameTemplate, BackdropTemplate")
+ local scrollframeNumberLines = CreateFrame("ScrollFrame", name and (name .. "NumberLines"), borderframe, "UIPanelScrollFrameTemplate, BackdropTemplate")
- scrollframe.editbox = CreateFrame("editbox", "$parentEditBox", scrollframe,"BackdropTemplate")
+ scrollframe.editbox = CreateFrame("editbox", name and "$parentEditBox", scrollframe,"BackdropTemplate")
scrollframe.editbox:SetMultiLine (true)
scrollframe.editbox:SetAutoFocus(false)
scrollframe.editbox:SetScript("OnCursorChanged", _G.ScrollingEdit_OnCursorChanged)
@@ -967,7 +972,7 @@ function detailsFramework:NewSpecialLuaEditorEntry(parent, width, height, member
--line number
if (showLineNumbers) then
- scrollframeNumberLines.editbox = CreateFrame("editbox", "$parentLineNumbers", scrollframeNumberLines, "BackdropTemplate")
+ scrollframeNumberLines.editbox = CreateFrame("editbox", name and "$parentLineNumbers", scrollframeNumberLines, "BackdropTemplate")
scrollframeNumberLines.editbox:SetMultiLine (true)
scrollframeNumberLines.editbox:SetAutoFocus(false)
scrollframeNumberLines.editbox:SetEnabled (false)
diff --git a/Libs/LibLuaServer/LuaServerDefinitions.lua b/Libs/LibLuaServer/LuaServerDefinitions.lua
index 35630a83..d889245b 100644
--- a/Libs/LibLuaServer/LuaServerDefinitions.lua
+++ b/Libs/LibLuaServer/LuaServerDefinitions.lua
@@ -77,6 +77,20 @@
---| "Button5Up"
---| "Button5Down"
+---@alias justifyh
+---| "left"
+---| "right"
+---| "center"
+
+---@alias justifyv
+---| "top"
+---| "bottom"
+---| "middle"
+
+---@alias orientation
+---| "HORIZONTAL"
+---| "VERTICAL"
+
---@alias width number property that represents the horizontal size of a UI element, such as a frame or a texture. Gotten from the first result of GetWidth() or from the first result of GetSize(). It is expected a GetWidth() or GetSize() when the type 'height' is used.
---@alias height number property that represents the vertical size of a UI element, such as a frame or a texture. Gotten from the first result of GetHeight() or from the second result of GetSize(). It is expected a GetHeight() or GetSize() when the type 'height' is used.
---@alias red number color value representing the red component of a color, the value must be between 0 and 1. To retrieve a color from a string or table use: local red, green, blue, alpha = DetailsFramework:ParseColors(color)
@@ -99,7 +113,7 @@
---@alias npcid number a number that identifies a specific npc in the game.
---@alias textureid number each texture from the game client has an id.
---@alias texturepath string access textures from addons.
-
+---@alias unixtime number
---@class _G
---@field RegisterAttributeDriver fun(statedriver: frame, attribute: string, conditional: string)
@@ -109,8 +123,6 @@
---@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.
---@field C_Timer C_Timer
----@class unixtime : number const
-
---@class timer : table
---@field Cancel fun(self: timer)
---@field IsCancelled fun(self: timer): boolean
@@ -238,12 +250,13 @@
---@field GetRegions fun(self: frame) : region[]
---@field CreateTexture fun(self: frame, name: string|nil, layer: drawlayer, inherits: string|nil, subLayer: number|nil) : texture
---@field CreateFontString fun(self: frame, name: string|nil, layer: drawlayer, inherits: string|nil, subLayer: number|nil) : fontstring
----@field EnableMouse fun(self: frame, enable: boolean)
----@field SetResizable fun(self: frame, enable: boolean)
----@field EnableMouseWheel fun(self: frame, enable: boolean)
----@field RegisterForDrag fun(self: frame, button: string)
----@field SetResizeBounds fun(self: frame, minWidth: number, minHeight: number, maxWidth: number, maxHeight: number)
----@field RegisterEvent fun(self: frame, event: string)
+---@field EnableMouse fun(self: frame, enable: boolean) enable mouse interaction
+---@field SetResizable fun(self: frame, enable: boolean) enable resizing of the frame
+---@field EnableMouseWheel fun(self: frame, enable: boolean) enable mouse wheel scrolling
+---@field RegisterForDrag fun(self: frame, button: string) register the frame for drag events, allowing it to be dragged by the mouse
+---@field SetResizeBounds fun(self: frame, minWidth: number, minHeight: number, maxWidth: number, maxHeight: number) set the minimum and maximum size of the frame
+---@field RegisterEvent fun(self: frame, event: string) register for an event, trigers "OnEvent" script when the event is fired
+---@field HookScript fun(self: frame, event: string, handler: function) run a function after the frame's script has been executed, carrying the same arguments
---@class button : frame
---@field Click fun(self: button)
@@ -278,12 +291,12 @@
---@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 SetOrientation fun(self: statusbar, orientation: orientation)
---@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 GetOrientation fun(self: statusbar) : orientation
---@field GetReverseFill fun(self: statusbar) : boolean
---@class scrollframe : frame
@@ -311,9 +324,9 @@
---@field GetShadowOffset fun(self: fontstring) : number, number
---@field SetTextColor fun(self: fontstring, r: red|number, g: green|number, b: blue|number, a: alpha|number)
---@field GetTextColor fun(self: fontstring) : number, number, number, number
----@field SetJustifyH fun(self: fontstring, justifyH: string)
+---@field SetJustifyH fun(self: fontstring, justifyH: justifyh)
---@field GetJustifyH fun(self: fontstring) : string
----@field SetJustifyV fun(self: fontstring, justifyV: string)
+---@field SetJustifyV fun(self: fontstring, justifyV: justifyv)
---@field GetJustifyV fun(self: fontstring) : string
---@field SetNonSpaceWrap fun(self: fontstring, nonSpaceWrap: boolean)
---@field GetNonSpaceWrap fun(self: fontstring) : boolean
diff --git a/boot.lua b/boot.lua
index 22f3b489..28be4bbe 100644
--- a/boot.lua
+++ b/boot.lua
@@ -82,6 +82,8 @@
Details222.Textures = {}
--namespace for pet
Details222.Pets = {}
+ --auto run code
+ Details222.AutoRunCode = {}
Details222.Instances = {}
Details222.MythicPlus = {}
Details222.EJCache = {}
@@ -1162,7 +1164,8 @@ end
function Details222.ClassCache.MakeCache()
--iterage among all segments in the container history, get the damage container and get the actor list, check if the actor is a player and if it is, get the class and store it in the cache
- for _, combatObject in ipairs(Details.tabela_historico.tabelas) do
+ local segmentsTable = Details:GetCombatSegments()
+ for _, combatObject in ipairs(segmentsTable) do
for _, actorObject in combatObject:GetContainer(DETAILS_ATTRIBUTE_DAMAGE):ListActors() do
if (actorObject:IsPlayer()) then
local actorName = actorObject.nome
@@ -1303,6 +1306,13 @@ function Details:DestroyActor(actorObject, actorContainer, combatObject, callSta
local combatTotalsTable = combatObject.totals[containerType] --without group
local combatTotalsTableInGroup = combatObject.totals_grupo[containerType] --with group
+ --remove the actor from the parser cache
+ local c1, c2, c3, c4 = Details222.Cache.GetParserCacheTables()
+ c1[actorObject.serial] = nil
+ c2[actorObject.serial] = nil
+ c3[actorObject.serial] = nil
+ c4[actorObject.serial] = nil
+
if (not actorObject.ownerName) then --not a pet
if (containerType == 1 or containerType == 2) then --damage|healing done
combatTotalsTable = combatTotalsTable - actorObject.total
diff --git a/classes/class_combat.lua b/classes/class_combat.lua
index 1068c144..0eacd8c4 100644
--- a/classes/class_combat.lua
+++ b/classes/class_combat.lua
@@ -731,9 +731,9 @@ end
function classCombat:TravarTempos()
if (self [1]) then
for _, jogador in ipairs(self [1]._ActorTable) do --damage
- if (jogador:Iniciar()) then -- retorna se ele esta com o dps ativo
+ if (jogador:GetOrChangeActivityStatus()) then -- retorna se ele esta com o dps ativo
Details222.TimeMachine.StopTime(jogador)
- jogador:Iniciar(false) --lock the actor timer
+ jogador:GetOrChangeActivityStatus(false) --lock the actor timer
else
if (jogador.start_time == 0) then
jogador.start_time = _tempo
@@ -746,9 +746,9 @@ end
end
if (self [2]) then
for _, jogador in ipairs(self [2]._ActorTable) do --healing
- if (jogador:Iniciar()) then -- retorna se ele esta com o dps ativo
+ if (jogador:GetOrChangeActivityStatus()) then -- retorna se ele esta com o dps ativo
Details222.TimeMachine.StopTime(jogador)
- jogador:Iniciar(false) --lock the actor timer
+ jogador:GetOrChangeActivityStatus(false) --lock the actor timer
else
if (jogador.start_time == 0) then
jogador.start_time = _tempo
diff --git a/classes/class_damage.lua b/classes/class_damage.lua
index e2c617b3..4972e546 100644
--- a/classes/class_damage.lua
+++ b/classes/class_damage.lua
@@ -854,9 +854,9 @@ end
end
if (not bIsCustomSpell) then
- for spellId, spellTable in pairs(actorObject.spells._ActorTable) do
- if (spellId ~= spellId) then
- local spellname = select(1, GetSpellInfo(spellId))
+ for thisSpellId, spellTable in pairs(actorObject.spells._ActorTable) do
+ if (thisSpellId ~= spellId) then --this is invalid
+ local spellname = select(1, GetSpellInfo(thisSpellId))
if (spellname == spellName) then
for targetName, damageAmount in pairs(spellTable.targets) do
local got = false
@@ -905,8 +905,7 @@ end
return totalDamage, topDamage, amount
]]
- local function ShowDTBSInWindow (spell, instance)
-
+ local function ShowDTBSInWindow (spell, instance) --for hold shift key and click, show players which took damage from this spell
local spellname, _, icon = _GetSpellInfo(spell [1])
local custom_name = spellname .. " - " .. Loc ["STRING_CUSTOM_DTBS"] .. ""
@@ -2657,10 +2656,12 @@ function damageClass:RefreshLine(instance, lineContainer, whichRowLine, rank, to
percentString = format("%.1f", self[keyName] / instance.top * 100)
end
+ local currentCombat = Details:GetCurrentCombat()
+
--calculate the actor dps
if ((Details.time_type == 2 and self.grupo) or not Details:CaptureGet("damage") or instance.segmento == -1) then
if (instance.segmento == -1 and combat_time == 0) then
- local actor = Details.tabela_vigente(1, self.nome)
+ local actor = currentCombat(1, self.nome)
if (actor) then
local combatTime = actor:Tempo()
dps = damageTotal / combatTime
@@ -6198,16 +6199,17 @@ function damageClass:MontaTooltipAlvos (thisLine, index, instancia) --~deprecate
GameCooltip:Show()
return true
-
end
--controla se o dps do jogador esta travado ou destravado
-function damageClass:Iniciar (iniciar)
- if (iniciar == nil) then
+function damageClass:GetOrChangeActivityStatus(activityStatus)
+ if (activityStatus == nil) then
return self.dps_started --retorna se o dps esta aberto ou fechado para este jogador
- elseif (iniciar) then
+
+ elseif (activityStatus) then
self.dps_started = true
Details222.TimeMachine.AddActor(self)
+
else
self.dps_started = false
Details222.TimeMachine.RemoveActor(self)
diff --git a/classes/class_heal.lua b/classes/class_heal.lua
index 8893b5ba..41cf8335 100644
--- a/classes/class_heal.lua
+++ b/classes/class_heal.lua
@@ -2768,7 +2768,7 @@ function healingClass:MontaDetalhesHealingDone (spellid, barra) --deprecated wit
end
--controla se o dps do jogador esta travado ou destravado
-function healingClass:Iniciar (iniciar)
+function healingClass:GetOrChangeActivityStatus (iniciar)
if (iniciar == nil) then
return self.iniciar_hps --retorna se o dps esta aberto ou fechado para este jogador
elseif (iniciar) then
diff --git a/classes/class_instance.lua b/classes/class_instance.lua
index 8376a8ab..9a52862d 100644
--- a/classes/class_instance.lua
+++ b/classes/class_instance.lua
@@ -19,40 +19,40 @@ local _UnitGroupRolesAssigned = DetailsFramework.UnitGroupRolesAssigned --wow ap
local segmentClass = Details.historico
local combatClass = Details.combate
-local _detalhes = _G.Details
+local Details = _G.Details
local _
local addonName, Details222 = ...
-local gump = _detalhes.gump
+local gump = Details.gump
-local modo_raid = _detalhes._detalhes_props["MODO_RAID"]
-local modo_alone = _detalhes._detalhes_props["MODO_ALONE"]
-local modo_grupo = _detalhes._detalhes_props["MODO_GROUP"]
-local modo_all = _detalhes._detalhes_props["MODO_ALL"]
+local modo_raid = Details._detalhes_props["MODO_RAID"]
+local modo_alone = Details._detalhes_props["MODO_ALONE"]
+local modo_grupo = Details._detalhes_props["MODO_GROUP"]
+local modo_all = Details._detalhes_props["MODO_ALL"]
-local atributos = _detalhes.atributos
-local sub_atributos = _detalhes.sub_atributos
+local atributos = Details.atributos
+local sub_atributos = Details.sub_atributos
--STARTUP reativa as instancias e regenera as tabelas das mesmas
- function _detalhes:RestartInstances()
- return _detalhes:ReativarInstancias()
+ function Details:RestartInstances()
+ return Details:ReativarInstancias()
end
- function _detalhes:ReativarInstancias()
- _detalhes.opened_windows = 0
+ function Details:ReativarInstancias()
+ Details.opened_windows = 0
--set metatables
- for index = 1, #_detalhes.tabela_instancias do
- local instancia = _detalhes.tabela_instancias[index]
+ for index = 1, #Details.tabela_instancias do
+ local instancia = Details.tabela_instancias[index]
if (not getmetatable(instancia)) then
- setmetatable(_detalhes.tabela_instancias[index], _detalhes)
+ setmetatable(Details.tabela_instancias[index], Details)
end
end
--create frames
- for index = 1, #_detalhes.tabela_instancias do
- local instancia = _detalhes.tabela_instancias [index]
+ for index = 1, #Details.tabela_instancias do
+ local instancia = Details.tabela_instancias [index]
if (instancia:IsEnabled()) then
- _detalhes.opened_windows = _detalhes.opened_windows + 1
+ Details.opened_windows = Details.opened_windows + 1
instancia:RestauraJanela(index, nil, true)
else
instancia.iniciada = false
@@ -60,8 +60,8 @@ local sub_atributos = _detalhes.sub_atributos
end
--load
- for index = 1, #_detalhes.tabela_instancias do
- local instancia = _detalhes.tabela_instancias [index]
+ for index = 1, #Details.tabela_instancias do
+ local instancia = Details.tabela_instancias [index]
if (instancia:IsEnabled()) then
instancia.iniciada = true
instancia:AtivarInstancia()
@@ -70,11 +70,11 @@ local sub_atributos = _detalhes.sub_atributos
end
--send open event
- for index = 1, #_detalhes.tabela_instancias do
- local instancia = _detalhes.tabela_instancias[index]
+ for index = 1, #Details.tabela_instancias do
+ local instancia = Details.tabela_instancias[index]
if (instancia:IsEnabled()) then
- if (not _detalhes.initializing) then
- _detalhes:SendEvent("DETAILS_INSTANCE_OPEN", nil, instancia)
+ if (not Details.initializing) then
+ Details:SendEvent("DETAILS_INSTANCE_OPEN", nil, instancia)
end
end
end
@@ -618,26 +618,26 @@ function Details:GetRaidMode()
return Details.tabela_instancias[Details.raid]
end
-function _detalhes:IsSoloMode(offline)
+function Details:IsSoloMode(offline)
if (offline) then
return self.modo == 1
end
- if (not _detalhes.solo) then
+ if (not Details.solo) then
return false
else
- return _detalhes.solo == self:GetInstanceId()
+ return Details.solo == self:GetInstanceId()
end
end
-function _detalhes:IsRaidMode()
- return self.modo == _detalhes._detalhes_props["MODO_RAID"]
+function Details:IsRaidMode()
+ return self.modo == Details._detalhes_props["MODO_RAID"]
end
-function _detalhes:IsGroupMode()
- return self.modo == _detalhes._detalhes_props["MODO_GROUP"]
+function Details:IsGroupMode()
+ return self.modo == Details._detalhes_props["MODO_GROUP"]
end
-function _detalhes:IsNormalMode()
+function Details:IsNormalMode()
if (self:GetInstanceId() == 2 or self:GetInstanceId() == 3) then
return true
else
@@ -645,23 +645,23 @@ function _detalhes:IsNormalMode()
end
end
-function _detalhes:GetShowingCombat()
+function Details:GetShowingCombat()
return self.showing
end
-function _detalhes:GetCustomObject (object_name)
+function Details:GetCustomObject (object_name)
if (object_name) then
- for _, object in ipairs(_detalhes.custom) do
+ for _, object in ipairs(Details.custom) do
if (object.name == object_name) then
return object
end
end
else
- return _detalhes.custom [self.sub_atributo]
+ return Details.custom [self.sub_atributo]
end
end
-function _detalhes:ResetAttribute()
+function Details:ResetAttribute()
if (self.iniciada) then
self:TrocaTabela(nil, 1, 1, true)
else
@@ -670,35 +670,35 @@ function _detalhes:ResetAttribute()
end
end
-function _detalhes:ListInstances()
- return ipairs(_detalhes.tabela_instancias)
+function Details:ListInstances()
+ return ipairs(Details.tabela_instancias)
end
-function _detalhes:GetPosition()
+function Details:GetPosition()
return self.posicao
end
-function _detalhes:GetDisplay()
+function Details:GetDisplay()
return self.atributo, self.sub_atributo
end
-function _detalhes:GetMaxInstancesAmount()
- return _detalhes.instances_amount
+function Details:GetMaxInstancesAmount()
+ return Details.instances_amount
end
-function _detalhes:SetMaxInstancesAmount (amount)
+function Details:SetMaxInstancesAmount (amount)
if (type(amount) == "number") then
- _detalhes.instances_amount = amount
+ Details.instances_amount = amount
end
end
-function _detalhes:GetFreeInstancesAmount()
- return _detalhes.instances_amount - #_detalhes.tabela_instancias
+function Details:GetFreeInstancesAmount()
+ return Details.instances_amount - #Details.tabela_instancias
end
-function _detalhes:GetOpenedWindowsAmount()
+function Details:GetOpenedWindowsAmount()
local amount = 0
- for _, instance in _detalhes:ListInstances() do
+ for _, instance in Details:ListInstances() do
if (instance:IsEnabled()) then
amount = amount + 1
end
@@ -706,20 +706,20 @@ function _detalhes:GetOpenedWindowsAmount()
return amount
end
-function _detalhes:GetNumRows()
+function Details:GetNumRows()
return self.rows_fit_in_window
end
-function _detalhes:GetRow (index)
+function Details:GetRow (index)
return self.barras [index]
end
-function _detalhes:GetSkin()
- return _detalhes.skins [self.skin]
+function Details:GetSkin()
+ return Details.skins [self.skin]
end
-function _detalhes:GetSkinTexture()
- return _detalhes.skins [self.skin] and _detalhes.skins [self.skin].file
+function Details:GetSkinTexture()
+ return Details.skins [self.skin] and Details.skins [self.skin].file
end
function Details:GetAllLines()
@@ -777,29 +777,29 @@ end
------------------------------------------------------------------------------------------------------------------------
--retorna se a inst�ncia esta ou n�o ativa
-function _detalhes:IsAtiva()
+function Details:IsAtiva()
return self.ativa
end
--english alias
-function _detalhes:IsShown()
+function Details:IsShown()
return self.ativa
end
-function _detalhes:IsEnabled()
+function Details:IsEnabled()
return self.ativa
end
-function _detalhes:IsStarted()
+function Details:IsStarted()
return self.iniciada
end
------------------------------------------------------------------------------------------------------------------------
- function _detalhes:LoadLocalInstanceConfig()
- local config = _detalhes.local_instances_config [self.meu_id]
+ function Details:LoadLocalInstanceConfig()
+ local config = Details.local_instances_config [self.meu_id]
if (config) then
- if (not _detalhes.profile_save_pos) then
+ if (not Details.profile_save_pos) then
self.posicao = Details.CopyTable(config.pos)
end
@@ -827,8 +827,8 @@ end
end
end
- function _detalhes:ShutDownAllInstances()
- for index, instance in ipairs(_detalhes.tabela_instancias) do
+ function Details:ShutDownAllInstances()
+ for index, instance in ipairs(Details.tabela_instancias) do
if (instance:IsEnabled() and instance.baseframe and not instance.ignore_mass_showhide) then
instance:ShutDown(true)
end
@@ -836,44 +836,44 @@ end
end
--alias
- function _detalhes:HideWindow(all)
+ function Details:HideWindow(all)
return self:DesativarInstancia(all)
end
- function _detalhes:ShutDown(all)
+ function Details:ShutDown(all)
return self:DesativarInstancia(all)
end
- function _detalhes:Shutdown(all)
+ function Details:Shutdown(all)
return self:DesativarInstancia(all)
end
- function _detalhes:GetNumWindows()
+ function Details:GetNumWindows()
end
--desativando a inst�ncia ela fica em stand by e apenas hida a janela ~shutdown ~close ~fechar
- function _detalhes:DesativarInstancia(all)
+ function Details:DesativarInstancia(all)
self.ativa = false
- _detalhes.opened_windows = _detalhes.opened_windows-1
+ Details.opened_windows = Details.opened_windows-1
if (not self.baseframe) then
--windown isn't initialized yet
- if (_detalhes.debug) then
- _detalhes:Msg("(debug) called HideWindow() but the window isn't initialized yet.")
+ if (Details.debug) then
+ Details:Msg("(debug) called HideWindow() but the window isn't initialized yet.")
end
return
end
- local lower = _detalhes:GetLowerInstanceNumber()
- _detalhes:GetLowerInstanceNumber()
+ local lower = Details:GetLowerInstanceNumber()
+ Details:GetLowerInstanceNumber()
if (lower == self.meu_id) then
--os icones dos plugins estao hostiados nessa instancia.
- _detalhes.ToolBar:ReorganizeIcons (true) --n�o precisa recarregar toda a skin
+ Details.ToolBar:ReorganizeIcons (true) --n�o precisa recarregar toda a skin
end
- if (_detalhes.switch.current_instancia and _detalhes.switch.current_instancia == self) then
- _detalhes.switch:CloseMe()
+ if (Details.switch.current_instancia and Details.switch.current_instancia == self) then
+ Details.switch:CloseMe()
end
self:ResetaGump()
@@ -888,23 +888,23 @@ end
end
if (self.modo == modo_raid) then
- _detalhes.RaidTables:DisableRaidMode (self)
+ Details.RaidTables:DisableRaidMode (self)
elseif (self.modo == modo_alone) then
- _detalhes.SoloTables:switch()
+ Details.SoloTables:switch()
self.atualizando = false
- _detalhes.solo = nil
+ Details.solo = nil
end
- if (not _detalhes.initializing) then
- _detalhes:SendEvent("DETAILS_INSTANCE_CLOSE", nil, self)
+ if (not Details.initializing) then
+ Details:SendEvent("DETAILS_INSTANCE_CLOSE", nil, self)
end
end
------------------------------------------------------------------------------------------------------------------------
- function _detalhes:InstanciaFadeBarras (instancia, segmento)
- local _fadeType, _fadeSpeed = _unpack(_detalhes.row_fade_in)
+ function Details:InstanciaFadeBarras (instancia, segmento)
+ local _fadeType, _fadeSpeed = _unpack(Details.row_fade_in)
if (segmento) then
if (instancia.segmento == segmento) then
return Details.FadeHandler.Fader(instancia, _fadeType, _fadeSpeed, "barras")
@@ -914,8 +914,8 @@ end
end
end
- function _detalhes:ToggleWindow (index)
- local window = _detalhes:GetInstance(index)
+ function Details:ToggleWindow (index)
+ local window = Details:GetInstance(index)
if (window and getmetatable (window)) then
if (window:IsEnabled()) then
@@ -924,24 +924,24 @@ end
window:EnableInstance()
if (window.meu_id == 1) then
- local instance2 = _detalhes:GetInstance(2)
+ local instance2 = Details:GetInstance(2)
if (instance2 and instance2:IsEnabled()) then
- _detalhes.move_janela_func(instance2.baseframe, true, instance2, true)
- _detalhes.move_janela_func(instance2.baseframe, false, instance2, true)
+ Details.move_janela_func(instance2.baseframe, true, instance2, true)
+ Details.move_janela_func(instance2.baseframe, false, instance2, true)
end
elseif (window.meu_id == 2) then
- _detalhes.move_janela_func(window.baseframe, true, window, true)
- _detalhes.move_janela_func(window.baseframe, false, window, true)
+ Details.move_janela_func(window.baseframe, true, window, true)
+ Details.move_janela_func(window.baseframe, false, window, true)
end
end
end
end
- function _detalhes:CheckCoupleWindows (instance1, instance2)
- instance1 = instance1 or _detalhes:GetInstance(1)
- instance2 = instance2 or _detalhes:GetInstance(2)
+ function Details:CheckCoupleWindows (instance1, instance2)
+ instance1 = instance1 or Details:GetInstance(1)
+ instance2 = instance2 or Details:GetInstance(2)
if (instance1 and instance2 and not instance1.ignore_mass_showhide and not instance1.ignore_mass_showhide) then
@@ -954,7 +954,7 @@ end
instance1:AtualizaPontos()
instance2:AtualizaPontos()
- local _R, _T, _L, _B = _detalhes.VPL (instance2, instance1), _detalhes.VPB (instance2, instance1), _detalhes.VPR (instance2, instance1), _detalhes.VPT (instance2, instance1)
+ local _R, _T, _L, _B = Details.VPL (instance2, instance1), Details.VPB (instance2, instance1), Details.VPR (instance2, instance1), Details.VPT (instance2, instance1)
if (_R) then
instance2:MakeInstanceGroup ({false, false, 1, false})
@@ -969,12 +969,12 @@ end
end
- function _detalhes:ToggleWindows()
+ function Details:ToggleWindows()
local instance
- for i = 1, #_detalhes.tabela_instancias do
- local this_instance = _detalhes:GetInstance(i)
+ for i = 1, #Details.tabela_instancias do
+ local this_instance = Details:GetInstance(i)
if (this_instance and not this_instance.ignore_mass_showhide) then
instance = this_instance
break
@@ -983,17 +983,17 @@ end
if (instance) then
if (instance:IsEnabled()) then
- _detalhes:ShutDownAllInstances()
+ Details:ShutDownAllInstances()
else
- _detalhes:ReabrirTodasInstancias()
+ Details:ReabrirTodasInstancias()
- local instance1 = _detalhes:GetInstance(1)
- local instance2 = _detalhes:GetInstance(2)
+ local instance1 = Details:GetInstance(1)
+ local instance2 = Details:GetInstance(2)
if (instance1 and instance2) then
if (not Details.disable_window_groups) then
if (not instance1.ignore_mass_showhide and not instance2.ignore_mass_showhide) then
- _detalhes:CheckCoupleWindows (instance1, instance2)
+ Details:CheckCoupleWindows (instance1, instance2)
end
end
end
@@ -1002,16 +1002,16 @@ end
end
-- reabre todas as instancias
- function _detalhes:ReabrirTodasInstancias (temp)
- for index = math.min (#_detalhes.tabela_instancias, _detalhes.instances_amount), 1, -1 do
- local instancia = _detalhes:GetInstance(index)
+ function Details:ReabrirTodasInstancias (temp)
+ for index = math.min (#Details.tabela_instancias, Details.instances_amount), 1, -1 do
+ local instancia = Details:GetInstance(index)
if (instancia and not instancia.ignore_mass_showhide) then
instancia:AtivarInstancia (temp, true)
end
end
end
- function _detalhes:LockInstance (flag)
+ function Details:LockInstance (flag)
if (type(flag) == "boolean") then
self.isLocked = not flag
@@ -1042,27 +1042,27 @@ end
end
end
- function _detalhes:TravasInstancias()
- for index, instancia in ipairs(_detalhes.tabela_instancias) do
+ function Details:TravasInstancias()
+ for index, instancia in ipairs(Details.tabela_instancias) do
instancia:LockInstance (true)
end
end
- function _detalhes:DestravarInstancias()
- for index, instancia in ipairs(_detalhes.tabela_instancias) do
+ function Details:DestravarInstancias()
+ for index, instancia in ipairs(Details.tabela_instancias) do
instancia:LockInstance (false)
end
end
--alias
- function _detalhes:ShowWindow (temp, all)
+ function Details:ShowWindow (temp, all)
return self:AtivarInstancia (temp, all)
end
- function _detalhes:EnableInstance (temp, all)
+ function Details:EnableInstance (temp, all)
return self:AtivarInstancia (temp, all)
end
- function _detalhes:AtivarInstancia (temp, all)
+ function Details:AtivarInstancia (temp, all)
self.ativa = true
DetailsFramework:Mixin(self, instanceMixins)
@@ -1070,11 +1070,11 @@ end
self.modo = self.modo or 2
- local lower = _detalhes:GetLowerInstanceNumber()
+ local lower = Details:GetLowerInstanceNumber()
if (lower == self.meu_id) then
--os icones dos plugins precisam ser hostiados nessa instancia.
- _detalhes.ToolBar:ReorganizeIcons (true) --n�o precisa recarregar toda a skin
+ Details.ToolBar:ReorganizeIcons (true) --n�o precisa recarregar toda a skin
end
if (not self.iniciada) then
@@ -1082,11 +1082,11 @@ end
--tiny threat parou de funcionar depois de /reload depois dessa mudança, talvez tenha algo para carregar ainda
self.iniciada = true
else
- _detalhes.opened_windows = _detalhes.opened_windows+1
+ Details.opened_windows = Details.opened_windows+1
end
self:ChangeSkin() --carrega a skin aqui que era antes feito dentro do restaura janela
- _detalhes:TrocaTabela(self, nil, nil, nil, true)
+ Details:TrocaTabela(self, nil, nil, nil, true)
if (self.hide_icon) then
Details.FadeHandler.Fader(self.baseframe.cabecalho.atributo_icon, 1)
@@ -1105,14 +1105,14 @@ end
if (not temp) then
if (self.modo == modo_raid) then
- _detalhes.RaidTables:EnableRaidMode(self)
+ Details.RaidTables:EnableRaidMode(self)
elseif (self.modo == modo_alone) then
self:SoloMode (true)
end
end
- if (_detalhes.LastShowCommand and _detalhes.LastShowCommand+10 > GetTime()) then
+ if (Details.LastShowCommand and Details.LastShowCommand+10 > GetTime()) then
self:ToolbarMenuButtons()
self:ToolbarSide()
self:AttributeMenu()
@@ -1128,12 +1128,12 @@ end
self:CheckFor_EnabledTrashSuppression()
- if (not temp and not _detalhes.initializing) then
- _detalhes:SendEvent("DETAILS_INSTANCE_OPEN", nil, self)
+ if (not temp and not Details.initializing) then
+ Details:SendEvent("DETAILS_INSTANCE_OPEN", nil, self)
end
if (self.modo == modo_raid) then
- _detalhes.RaidTables:EnableRaidMode(self)
+ Details.RaidTables:EnableRaidMode(self)
elseif (self.modo == modo_alone) then
self:SoloMode (true)
@@ -1144,32 +1144,32 @@ end
------------------------------------------------------------------------------------------------------------------------
--apaga de vez um inst�ncia
- function _detalhes:ApagarInstancia (ID)
- return _table_remove(_detalhes.tabela_instancias, ID)
+ function Details:ApagarInstancia (ID)
+ return _table_remove(Details.tabela_instancias, ID)
end
------------------------------------------------------------------------------------------------------------------------
--retorna quantas inst�ncia h� no momento
- function _detalhes:GetNumInstancesAmount()
- return #_detalhes.tabela_instancias
+ function Details:GetNumInstancesAmount()
+ return #Details.tabela_instancias
end
- function _detalhes:QuantasInstancias()
- return #_detalhes.tabela_instancias
+ function Details:QuantasInstancias()
+ return #Details.tabela_instancias
end
------------------------------------------------------------------------------------------------------------------------
- function _detalhes:DeleteInstance (id)
- local instance = _detalhes:GetInstance(id)
+ function Details:DeleteInstance (id)
+ local instance = Details:GetInstance(id)
if (not instance) then
return false
end
--break snaps of previous and next window
- local left_instance = _detalhes:GetInstance(id-1)
+ local left_instance = Details:GetInstance(id-1)
if (left_instance) then
for snap_side, instance_id in pairs(left_instance.snap) do
if (instance_id == id) then --snap na proxima instancia
@@ -1177,7 +1177,7 @@ end
end
end
end
- local right_instance = _detalhes:GetInstance(id+1)
+ local right_instance = Details:GetInstance(id+1)
if (right_instance) then
for snap_side, instance_id in pairs(right_instance.snap) do
if (instance_id == id) then --snap na proxima instancia
@@ -1187,8 +1187,8 @@ end
end
--re align snaps for higher instances
- for i = id+1, #_detalhes.tabela_instancias do
- local this_instance = _detalhes:GetInstance(i)
+ for i = id+1, #Details.tabela_instancias do
+ local this_instance = Details:GetInstance(i)
--fix the snaps
for snap_side, instance_id in pairs(this_instance.snap) do
if (instance_id == i+1) then --snap na proxima instancia
@@ -1201,40 +1201,40 @@ end
end
end
- table.remove (_detalhes.tabela_instancias, id)
+ table.remove (Details.tabela_instancias, id)
end
------------------------------------------------------------------------------------------------------------------------
--cria uma nova inst�ncia e a joga para o container de inst�ncias
- function _detalhes:CreateInstance (id)
- return _detalhes:CriarInstancia(_, id)
+ function Details:CreateInstance (id)
+ return Details:CriarInstancia(_, id)
end
- function _detalhes:CriarInstancia(_, id)
+ function Details:CriarInstancia(_, id)
if (id and type(id) == "boolean") then
- if (#_detalhes.tabela_instancias >= _detalhes.instances_amount) then
- _detalhes:Msg(Loc ["STRING_INSTANCE_LIMIT"])
+ if (#Details.tabela_instancias >= Details.instances_amount) then
+ Details:Msg(Loc ["STRING_INSTANCE_LIMIT"])
return false
end
- local next_id = #_detalhes.tabela_instancias+1
+ local next_id = #Details.tabela_instancias+1
- if (_detalhes.unused_instances [next_id]) then
- local new_instance = _detalhes.unused_instances [next_id]
- _detalhes.tabela_instancias [next_id] = new_instance
- _detalhes.unused_instances [next_id] = nil
+ if (Details.unused_instances [next_id]) then
+ local new_instance = Details.unused_instances [next_id]
+ Details.tabela_instancias [next_id] = new_instance
+ Details.unused_instances [next_id] = nil
new_instance:AtivarInstancia()
return new_instance
end
- local new_instance = _detalhes:CreateNewInstance (next_id)
+ local new_instance = Details:CreateNewInstance (next_id)
- if (_detalhes.standard_skin) then
- for key, value in pairs(_detalhes.standard_skin) do
+ if (Details.standard_skin) then
+ for key, value in pairs(Details.standard_skin) do
if (type(value) == "table") then
new_instance [key] = Details.CopyTable(value)
else
@@ -1247,7 +1247,7 @@ end
--se n�o tiver um padr�o, criar de outra inst�ncia j� aberta.
local copy_from
for i = 1, next_id-1 do
- local opened_instance = _detalhes:GetInstance(i)
+ local opened_instance = Details:GetInstance(i)
if (opened_instance and opened_instance:IsEnabled() and opened_instance.baseframe) then
copy_from = opened_instance
break
@@ -1256,7 +1256,7 @@ end
if (copy_from) then
for key, value in pairs(copy_from) do
- if (_detalhes.instance_defaults [key] ~= nil) then
+ if (Details.instance_defaults [key] ~= nil) then
if (type(value) == "table") then
new_instance [key] = Details.CopyTable(value)
else
@@ -1271,55 +1271,55 @@ end
return new_instance
elseif (id) then
- local instancia = _detalhes.tabela_instancias [id]
+ local instancia = Details.tabela_instancias [id]
if (instancia and not instancia:IsAtiva()) then
instancia:AtivarInstancia()
- _detalhes:DelayOptionsRefresh (instancia)
+ Details:DelayOptionsRefresh (instancia)
return instancia
end
end
--antes de criar uma nova, ver se n�o h� alguma para reativar
- for index, instancia in ipairs(_detalhes.tabela_instancias) do
+ for index, instancia in ipairs(Details.tabela_instancias) do
if (not instancia:IsAtiva()) then
instancia:AtivarInstancia()
return instancia
end
end
- if (#_detalhes.tabela_instancias >= _detalhes.instances_amount) then
- return _detalhes:Msg(Loc ["STRING_INSTANCE_LIMIT"])
+ if (#Details.tabela_instancias >= Details.instances_amount) then
+ return Details:Msg(Loc ["STRING_INSTANCE_LIMIT"])
end
--verifica se n�o tem uma janela na pool de janelas fechadas
- local next_id = #_detalhes.tabela_instancias+1
+ local next_id = #Details.tabela_instancias+1
- if (_detalhes.unused_instances [next_id]) then
- local new_instance = _detalhes.unused_instances [next_id]
- _detalhes.tabela_instancias [next_id] = new_instance
- _detalhes.unused_instances [next_id] = nil
+ if (Details.unused_instances [next_id]) then
+ local new_instance = Details.unused_instances [next_id]
+ Details.tabela_instancias [next_id] = new_instance
+ Details.unused_instances [next_id] = nil
new_instance:AtivarInstancia()
- _detalhes:GetLowerInstanceNumber()
+ Details:GetLowerInstanceNumber()
return new_instance
end
--cria uma nova janela
- local new_instance = _detalhes:CreateNewInstance (#_detalhes.tabela_instancias+1)
+ local new_instance = Details:CreateNewInstance (#Details.tabela_instancias+1)
- if (not _detalhes.initializing) then
- _detalhes:SendEvent("DETAILS_INSTANCE_OPEN", nil, new_instance)
+ if (not Details.initializing) then
+ Details:SendEvent("DETAILS_INSTANCE_OPEN", nil, new_instance)
end
- _detalhes:GetLowerInstanceNumber()
+ Details:GetLowerInstanceNumber()
return new_instance
end
------------------------------------------------------------------------------------------------------------------------
--self � a inst�ncia que esta sendo movida.. instancia � a que esta parada
-function _detalhes:EstaAgrupada(esta_instancia, lado) --lado //// 1 = encostou na esquerda // 2 = escostou emaixo // 3 = encostou na direita // 4 = encostou em cima
+function Details:EstaAgrupada(esta_instancia, lado) --lado //// 1 = encostou na esquerda // 2 = escostou emaixo // 3 = encostou na direita // 4 = encostou em cima
--local meu_snap = self.snap --pegou a tabela com {side, side, side, side}
if (esta_instancia.snap [lado]) then
@@ -1345,7 +1345,7 @@ function _detalhes:EstaAgrupada(esta_instancia, lado) --lado //// 1 = encostou n
return false --do contr�rio retorna false
end
-function _detalhes:BaseFrameSnap()
+function Details:BaseFrameSnap()
local group = self:GetInstanceGroup()
for meu_id, instancia in ipairs(group) do
@@ -1361,7 +1361,7 @@ function _detalhes:BaseFrameSnap()
local my_baseframe = self.baseframe
for lado, snap_to in pairs(self.snap) do
- local instancia_alvo = _detalhes.tabela_instancias [snap_to]
+ local instancia_alvo = Details.tabela_instancias [snap_to]
if (instancia_alvo) then
if (instancia_alvo.ativa and instancia_alvo.baseframe) then
@@ -1397,13 +1397,13 @@ function _detalhes:BaseFrameSnap()
--aqui faz o efeito reverso:
local inicio_retro = self.meu_id - 1
for meu_id = inicio_retro, 1, -1 do
- local instancia = _detalhes.tabela_instancias [meu_id]
+ local instancia = Details.tabela_instancias [meu_id]
for lado, snap_to in pairs(instancia.snap) do
if (snap_to < instancia.meu_id and snap_to ~= self.meu_id) then --se o lado que esta grudado for menor que o meu id... EX instnacia #2 grudada na #1
--ent�o tenho que pegar a inst�ncia do snap
- local instancia_alvo = _detalhes.tabela_instancias [snap_to]
+ local instancia_alvo = Details.tabela_instancias [snap_to]
local lado_reverso
if (lado == 1) then
lado_reverso = 3
@@ -1450,11 +1450,11 @@ function _detalhes:BaseFrameSnap()
end
--]]
- for meu_id, instancia in ipairs(_detalhes.tabela_instancias) do
+ for meu_id, instancia in ipairs(Details.tabela_instancias) do
if (meu_id > self.meu_id) then
for lado, snap_to in pairs(instancia.snap) do
if (snap_to > instancia.meu_id and snap_to ~= self.meu_id) then
- local instancia_alvo = _detalhes.tabela_instancias [snap_to]
+ local instancia_alvo = Details.tabela_instancias [snap_to]
if (instancia_alvo.ativa and instancia_alvo.baseframe) then
if (lado == 1) then --a esquerda
@@ -1487,14 +1487,14 @@ function _detalhes:BaseFrameSnap()
end
end
-function _detalhes:agrupar_janelas(lados)
+function Details:agrupar_janelas(lados)
local instancia = self
for lado, esta_instancia in pairs(lados) do
if (esta_instancia) then
instancia.baseframe:ClearAllPoints()
- esta_instancia = _detalhes.tabela_instancias [esta_instancia]
+ esta_instancia = Details.tabela_instancias [esta_instancia]
instancia:SetWindowScale (esta_instancia.window_scale)
@@ -1572,31 +1572,31 @@ function _detalhes:agrupar_janelas(lados)
end
end
- if (not _detalhes.disable_lock_ungroup_buttons) then
+ if (not Details.disable_lock_ungroup_buttons) then
instancia.break_snap_button:SetAlpha(1)
end
- if (_detalhes.tutorial.unlock_button < 4) then
+ if (Details.tutorial.unlock_button < 4) then
- _detalhes.temp_table1.IconSize = 32
- _detalhes.temp_table1.TextHeightMod = -6
- _detalhes.popup:ShowMe(instancia.break_snap_button, "tooltip", "Interface\\Buttons\\LockButton-Unlocked-Up", Loc ["STRING_UNLOCK"], 150, _detalhes.temp_table1)
+ Details.temp_table1.IconSize = 32
+ Details.temp_table1.TextHeightMod = -6
+ Details.popup:ShowMe(instancia.break_snap_button, "tooltip", "Interface\\Buttons\\LockButton-Unlocked-Up", Loc ["STRING_UNLOCK"], 150, Details.temp_table1)
--UIFrameFlash (instancia.break_snap_button, .5, .5, 5, false, 0, 0)
- _detalhes.tutorial.unlock_button = _detalhes.tutorial.unlock_button + 1
+ Details.tutorial.unlock_button = Details.tutorial.unlock_button + 1
end
- _detalhes:DelayOptionsRefresh()
+ Details:DelayOptionsRefresh()
end
-_detalhes.MakeInstanceGroup = _detalhes.agrupar_janelas
+Details.MakeInstanceGroup = Details.agrupar_janelas
-function _detalhes:UngroupInstance()
+function Details:UngroupInstance()
return self:Desagrupar(-1)
end
-function _detalhes:Desagrupar (instancia, lado, lado2)
+function Details:Desagrupar (instancia, lado, lado2)
if (lado2 == -1) then
instancia = lado
self = instancia
@@ -1609,10 +1609,10 @@ function _detalhes:Desagrupar (instancia, lado, lado2)
end
if (type(instancia) == "number") then --significa que passou o n�mero da inst�ncia
- instancia = _detalhes.tabela_instancias [instancia]
+ instancia = Details.tabela_instancias [instancia]
end
- _detalhes:DelayOptionsRefresh (nil, true)
+ Details:DelayOptionsRefresh (nil, true)
if (not lado) then
return
@@ -1621,7 +1621,7 @@ function _detalhes:Desagrupar (instancia, lado, lado2)
if (lado < 0) then --clicou no bot�o para desagrupar tudo
local ID = instancia.meu_id
- for id, esta_instancia in ipairs(_detalhes.tabela_instancias) do
+ for id, esta_instancia in ipairs(Details.tabela_instancias) do
for index, iid in pairs(esta_instancia.snap) do -- index = 1 left , 3 right, 2 bottom, 4 top
if (iid and (iid == ID or id == ID)) then -- iid = instancia.meu_id
@@ -1657,7 +1657,7 @@ function _detalhes:Desagrupar (instancia, lado, lado2)
return
end
- local esta_instancia = _detalhes.tabela_instancias [instancia.snap[lado]]
+ local esta_instancia = Details.tabela_instancias [instancia.snap[lado]]
if (not esta_instancia) then
return
@@ -1689,8 +1689,8 @@ function _detalhes:Desagrupar (instancia, lado, lado2)
end
end
-function _detalhes:SnapTextures (remove)
- for id, esta_instancia in ipairs(_detalhes.tabela_instancias) do
+function Details:SnapTextures (remove)
+ for id, esta_instancia in ipairs(Details.tabela_instancias) do
if (esta_instancia:IsAtiva()) then
if (esta_instancia.baseframe.rodape.esquerdo.have_snap) then
if (remove) then
@@ -1705,19 +1705,19 @@ end
--cria uma janela para uma nova inst�ncia
--search key: ~new ~nova
- function _detalhes:CreateDisabledInstance(ID, skin_table)
+ function Details:CreateDisabledInstance(ID, skin_table)
--first check if we can recycle a old instance
- if (_detalhes.unused_instances [ID]) then
- local new_instance = _detalhes.unused_instances [ID]
- _detalhes.tabela_instancias [ID] = new_instance
- _detalhes.unused_instances [ID] = nil
+ if (Details.unused_instances [ID]) then
+ local new_instance = Details.unused_instances [ID]
+ Details.tabela_instancias [ID] = new_instance
+ Details.unused_instances [ID] = nil
--replace the values on recycled instance
new_instance:ResetInstanceConfig()
--copy values from a previous skin saved
if (skin_table) then
--copy from skin_table to new_instance
- _detalhes.table.copy(new_instance, skin_table)
+ Details.table.copy(new_instance, skin_table)
end
return new_instance
@@ -1770,8 +1770,8 @@ end
DetailsFramework:Mixin(new_instance, instanceMixins)
- setmetatable(new_instance, _detalhes)
- _detalhes.tabela_instancias[#_detalhes.tabela_instancias+1] = new_instance
+ setmetatable(new_instance, Details)
+ Details.tabela_instancias[#Details.tabela_instancias+1] = new_instance
--fill the empty instance with default values
new_instance:ResetInstanceConfig()
@@ -1779,7 +1779,7 @@ end
--copy values from a previous skin saved
if (skin_table) then
--copy from skin_table to new_instance
- _detalhes.table.copy(new_instance, skin_table)
+ Details.table.copy(new_instance, skin_table)
end
--setup default wallpaper
@@ -1905,7 +1905,7 @@ function Details:RestoreWindow(index, temp, loadOnly)
self:RestauraJanela (index, temp, loadOnly)
end
-function _detalhes:RestauraJanela(index, temp, load_only)
+function Details:RestauraJanela(index, temp, load_only)
DetailsFramework:Mixin(self, instanceMixins)
@@ -1945,7 +1945,7 @@ function _detalhes:RestauraJanela(index, temp, load_only)
--self.isLocked = isLocked --window isn't locked when just created it
--change the attribute
- _detalhes:TrocaTabela(self, self.segmento, self.atributo, self.sub_atributo, true) --passando true no 5� valor para a fun��o ignorar a checagem de valores iguais
+ Details:TrocaTabela(self, self.segmento, self.atributo, self.sub_atributo, true) --passando true no 5� valor para a fun��o ignorar a checagem de valores iguais
--set wallpaper
if (self.wallpaper.enabled) then
@@ -1972,36 +1972,36 @@ function _detalhes:RestauraJanela(index, temp, load_only)
if (self.StatusBarSaved.left and self.StatusBarSaved.left == "NONE") then
self.StatusBarSaved.left = "DETAILS_STATUSBAR_PLUGIN_PSEGMENT"
end
- local segment = _detalhes.StatusBar:CreateStatusBarChildForInstance (self, self.StatusBarSaved.left or "DETAILS_STATUSBAR_PLUGIN_PSEGMENT")
- _detalhes.StatusBar:SetLeftPlugin (self, segment, true)
+ local segment = Details.StatusBar:CreateStatusBarChildForInstance (self, self.StatusBarSaved.left or "DETAILS_STATUSBAR_PLUGIN_PSEGMENT")
+ Details.StatusBar:SetLeftPlugin (self, segment, true)
if (self.StatusBarSaved.center and self.StatusBarSaved.center == "NONE") then
self.StatusBarSaved.center = "DETAILS_STATUSBAR_PLUGIN_CLOCK"
end
- local clock = _detalhes.StatusBar:CreateStatusBarChildForInstance (self, self.StatusBarSaved.center or "DETAILS_STATUSBAR_PLUGIN_CLOCK")
- _detalhes.StatusBar:SetCenterPlugin (self, clock, true)
+ local clock = Details.StatusBar:CreateStatusBarChildForInstance (self, self.StatusBarSaved.center or "DETAILS_STATUSBAR_PLUGIN_CLOCK")
+ Details.StatusBar:SetCenterPlugin (self, clock, true)
if (self.StatusBarSaved.right and self.StatusBarSaved.right == "NONE") then
self.StatusBarSaved.right = "DETAILS_STATUSBAR_PLUGIN_PDURABILITY"
end
- local durability = _detalhes.StatusBar:CreateStatusBarChildForInstance (self, self.StatusBarSaved.right or "DETAILS_STATUSBAR_PLUGIN_PDURABILITY")
- _detalhes.StatusBar:SetRightPlugin (self, durability, true)
+ local durability = Details.StatusBar:CreateStatusBarChildForInstance (self, self.StatusBarSaved.right or "DETAILS_STATUSBAR_PLUGIN_PDURABILITY")
+ Details.StatusBar:SetRightPlugin (self, durability, true)
--load mode
if (self.modo == modo_alone) then
- if (_detalhes.solo and _detalhes.solo ~= self.meu_id) then --prote��o para ter apenas uma inst�ncia com a janela SOLO
+ if (Details.solo and Details.solo ~= self.meu_id) then --prote��o para ter apenas uma inst�ncia com a janela SOLO
self.modo = modo_grupo
self.mostrando = "normal"
else
self:SoloMode (true)
- _detalhes.solo = self.meu_id
+ Details.solo = self.meu_id
end
elseif (self.modo == modo_raid) then
- _detalhes.raid = self.meu_id
+ Details.raid = self.meu_id
else
self.mostrando = "normal"
end
@@ -2016,11 +2016,11 @@ function _detalhes:RestauraJanela(index, temp, load_only)
--fix for the weird white window default skin
--this is a auto detect for configuration corruption, happens usually when the user install Details! over old config settings
--check if the skin used in the window is the default skin, check if statusbar is in use and if the color of the window is full white
- if (self.skin == _detalhes.default_skin_to_use and self.show_statusbar) then
+ if (self.skin == Details.default_skin_to_use and self.show_statusbar) then
if(self.color[1] == 1 and self.color[2] == 1 and self.color[3] == 1 and self.color[4] == 1) then
Details:Msg("error 0xFF85DD")
self.skin = "no skin"
- self:ChangeSkin(_detalhes.default_skin_to_use)
+ self:ChangeSkin(Details.default_skin_to_use)
end
end
@@ -2058,14 +2058,14 @@ end
function Details:SwitchTo (switch_table, nosave)
if (not nosave) then
- self.auto_switch_to_old = {self.modo, self.atributo, self.sub_atributo, self.segmento, self:GetRaidPluginName(), _detalhes.SoloTables.Mode}
+ self.auto_switch_to_old = {self.modo, self.atributo, self.sub_atributo, self.segmento, self:GetRaidPluginName(), Details.SoloTables.Mode}
end
if (switch_table [1] == "raid") then
local plugin_global_name, can_switch = switch_table[2], true
--plugin global name
- for _, instance in ipairs(_detalhes.tabela_instancias) do
+ for _, instance in ipairs(Details.tabela_instancias) do
if (instance ~= self and instance:IsEnabled() and instance.baseframe and instance.modo == modo_raid) then
if (instance.current_raid_plugin == plugin_global_name) then
can_switch = false
@@ -2075,22 +2075,22 @@ function Details:SwitchTo (switch_table, nosave)
end
if (can_switch) then
- _detalhes.RaidTables:EnableRaidMode (self, switch_table [2])
+ Details.RaidTables:EnableRaidMode (self, switch_table [2])
else
- local plugin = _detalhes:GetPlugin (plugin_global_name)
- _detalhes:Msg("Auto Switch: a window is already showing " .. (plugin.__name or "" .. ", please review your switch config."))
+ local plugin = Details:GetPlugin (plugin_global_name)
+ Details:Msg("Auto Switch: a window is already showing " .. (plugin.__name or "" .. ", please review your switch config."))
end
else
--muda para um atributo normal
- if (self.modo ~= _detalhes._detalhes_props["MODO_GROUP"]) then
- self:SetMode(_detalhes._detalhes_props["MODO_GROUP"])
+ if (self.modo ~= Details._detalhes_props["MODO_GROUP"]) then
+ self:SetMode(Details._detalhes_props["MODO_GROUP"])
end
- _detalhes:TrocaTabela(self, nil, switch_table [1], switch_table [2])
+ Details:TrocaTabela(self, nil, switch_table [1], switch_table [2])
end
end
--backtable indexes: [1]: mode [2]: attribute [3]: sub attribute [4]: segment [5]: raidmode index [6]: solomode index
-function _detalhes:CheckSwitchOnCombatEnd (nowipe, warning)
+function Details:CheckSwitchOnCombatEnd (nowipe, warning)
local old_attribute, old_sub_atribute = self:GetDisplay()
@@ -2112,7 +2112,7 @@ function _detalhes:CheckSwitchOnCombatEnd (nowipe, warning)
self:SwitchTo (self.switch_tank, true)
got_switch = true
- elseif (role == "NONE" and _detalhes.last_assigned_role ~= "NONE") then
+ elseif (role == "NONE" and Details.last_assigned_role ~= "NONE") then
self:SwitchBack()
got_switch = true
@@ -2127,7 +2127,7 @@ function _detalhes:CheckSwitchOnCombatEnd (nowipe, warning)
end
if (self.switch_all_roles_after_wipe and not nowipe) then
- if (_detalhes.tabela_vigente.is_boss and _detalhes.tabela_vigente.instance_type == "raid" and not _detalhes.tabela_vigente.is_boss.killed and _detalhes.tabela_vigente.is_boss.name) then
+ if (Details.tabela_vigente.is_boss and Details.tabela_vigente.instance_type == "raid" and not Details.tabela_vigente.is_boss.killed and Details.tabela_vigente.is_boss.name) then
self:SwitchBack()
self:SwitchTo (self.switch_all_roles_after_wipe)
end
@@ -2135,19 +2135,19 @@ function _detalhes:CheckSwitchOnCombatEnd (nowipe, warning)
end
-function _detalhes:CheckSwitchOnLogon (warning)
- for index, instancia in ipairs(_detalhes.tabela_instancias) do
+function Details:CheckSwitchOnLogon (warning)
+ for index, instancia in ipairs(Details.tabela_instancias) do
if (instancia.ativa) then
instancia:CheckSwitchOnCombatEnd (true, warning)
end
end
end
-function _detalhes:CheckSegmentForSwitchOnCombatStart()
+function Details:CheckSegmentForSwitchOnCombatStart()
end
-function _detalhes:CheckSwitchOnCombatStart (check_segment)
+function Details:CheckSwitchOnCombatStart (check_segment)
self:SwitchBack()
@@ -2198,16 +2198,16 @@ local createStatusbarOptions = function(optionsTable)
return newTable
end
-function _detalhes:ExportSkin()
+function Details:ExportSkin()
--create the table
local exported = {
- version = _detalhes.preset_version --skin version
+ version = Details.preset_version --skin version
}
--export the keys
for key, value in pairs(self) do
- if (_detalhes.instance_defaults [key] ~= nil) then
+ if (Details.instance_defaults [key] ~= nil) then
if (type(value) == "table") then
exported [key] = Details.CopyTable(value)
else
@@ -2217,7 +2217,7 @@ function _detalhes:ExportSkin()
end
--export size and positioning
- if (_detalhes.profile_save_pos) then
+ if (Details.profile_save_pos) then
exported.posicao = self.posicao
else
exported.posicao = nil
@@ -2261,10 +2261,10 @@ function _detalhes:ExportSkin()
return exported
end
-function _detalhes:ApplySavedSkin (style)
+function Details:ApplySavedSkin (style)
- if (not style.version or _detalhes.preset_version > style.version) then
- return _detalhes:Msg(Loc ["STRING_OPTIONS_PRESETTOOLD"])
+ if (not style.version or Details.preset_version > style.version) then
+ return Details:Msg(Loc ["STRING_OPTIONS_PRESETTOOLD"])
end
--set skin preset
@@ -2284,12 +2284,12 @@ function _detalhes:ApplySavedSkin (style)
end
--check for new keys inside tables
- for key, value in pairs(_detalhes.instance_defaults) do
+ for key, value in pairs(Details.instance_defaults) do
if (type(value) == "table") then
for key2, value2 in pairs(value) do
if (self [key] [key2] == nil) then
if (type(value2) == "table") then
- self [key] [key2] = Details.CopyTable(_detalhes.instance_defaults [key] [key2])
+ self [key] [key2] = Details.CopyTable(Details.instance_defaults [key] [key2])
else
self [key] [key2] = value2
end
@@ -2300,13 +2300,13 @@ function _detalhes:ApplySavedSkin (style)
self.StatusBarSaved = style.StatusBarSaved and Details.CopyTable(style.StatusBarSaved) or {options = {}}
self.StatusBar.options = self.StatusBarSaved.options
- _detalhes.StatusBar:UpdateChilds (self)
+ Details.StatusBar:UpdateChilds (self)
--apply all changed attributes
self:ChangeSkin()
--export size and positioning
- if (_detalhes.profile_save_pos) then
+ if (Details.profile_save_pos) then
self.posicao = style.posicao
self:RestoreMainWindowPosition()
else
@@ -2317,7 +2317,7 @@ end
------------------------------------------------------------------------------------------------------------------------
-function _detalhes:InstanceReset(instance)
+function Details:InstanceReset(instance)
if (instance) then
self = instance
end
@@ -2327,19 +2327,19 @@ function _detalhes:InstanceReset(instance)
self:AtualizaSoloMode_AfertReset()
self:ResetaGump()
- if (not _detalhes.initializing) then
- _detalhes:RefreshMainWindow(self, true) --atualiza todas as instancias
+ if (not Details.initializing) then
+ Details:RefreshMainWindow(self, true) --atualiza todas as instancias
end
end
-function _detalhes:RefreshBars(instance)
+function Details:RefreshBars(instance)
if (instance) then
self = instance
end
self:InstanceRefreshRows(instance)
end
-function _detalhes:SetBackgroundColor(...)
+function Details:SetBackgroundColor(...)
local red = select(1, ...)
if (not red) then
self.bgdisplay:SetBackdropColor(self.bg_r, self.bg_g, self.bg_b, self.bg_alpha)
@@ -2348,14 +2348,14 @@ function _detalhes:SetBackgroundColor(...)
end
local r, g, b = gump:ParseColors(...)
- self.bgdisplay:SetBackdropColor(r, g, b, self.bg_alpha or _detalhes.default_bg_alpha)
- self.baseframe:SetBackdropColor(r, g, b, self.bg_alpha or _detalhes.default_bg_alpha)
+ self.bgdisplay:SetBackdropColor(r, g, b, self.bg_alpha or Details.default_bg_alpha)
+ self.baseframe:SetBackdropColor(r, g, b, self.bg_alpha or Details.default_bg_alpha)
self.bg_r = r
self.bg_g = g
self.bg_b = b
end
-function _detalhes:SetBackgroundAlpha (alpha)
+function Details:SetBackgroundAlpha (alpha)
if (not alpha) then
alpha = self.bg_alpha
end
@@ -2365,15 +2365,15 @@ function _detalhes:SetBackgroundAlpha (alpha)
self.bg_alpha = alpha
end
-function _detalhes:GetSize()
+function Details:GetSize()
return self.baseframe:GetWidth(), self.baseframe:GetHeight()
end
-function _detalhes:GetRealSize()
+function Details:GetRealSize()
return self.baseframe:GetWidth() * self.baseframe:GetScale(), self.baseframe:GetHeight() * self.baseframe:GetScale()
end
-function _detalhes:GetPositionOnScreen()
+function Details:GetPositionOnScreen()
local xOfs, yOfs = self.baseframe:GetCenter()
if (not xOfs) then
return
@@ -2387,11 +2387,11 @@ function _detalhes:GetPositionOnScreen()
end
--alias
-function _detalhes:SetSize(w, h)
+function Details:SetSize(w, h)
return self:Resize (w, h)
end
-function _detalhes:Resize (w, h)
+function Details:Resize (w, h)
if (w) then
self.baseframe:SetWidth(w)
end
@@ -2406,7 +2406,7 @@ function _detalhes:Resize (w, h)
end
--/run Details:GetWindow(1):ToggleMaxSize()
-function _detalhes:ToggleMaxSize()
+function Details:ToggleMaxSize()
if (self.is_in_max_size) then
self.is_in_max_size = false
self:SetSize(self.original_width, self.original_height)
@@ -2472,7 +2472,7 @@ function Details:Freeze(instancia)
instancia = self
end
- if (not _detalhes.initializing) then
+ if (not Details.initializing) then
instancia:ResetaGump()
Details.FadeHandler.Fader(instancia, "in", nil, "barras")
end
@@ -2487,7 +2487,7 @@ function Details:Freeze(instancia)
instancia.freezed = true
end
-function _detalhes:UnFreeze(instancia)
+function Details:UnFreeze(instancia)
if (not instancia) then
instancia = self
end
@@ -2498,7 +2498,7 @@ function _detalhes:UnFreeze(instancia)
--instancia.freeze_texto:Hide()
instancia.freezed = false
- if (not _detalhes.initializing) then
+ if (not Details.initializing) then
--instancia:RestoreMainWindowPosition()
instancia:ReajustaGump()
end
@@ -2514,34 +2514,37 @@ function Details:UpdateCombatObjectInUse(instance)
if (instance.iniciada) then
if (instance.segmento == -1) then
instance.showing = Details.tabela_overall
+
elseif (instance.segmento == 0) then
- instance.showing = Details.tabela_vigente
+ instance.showing = Details:GetCurrentCombat()
else
- instance.showing = Details.tabela_historico.tabelas[instance.segmento]
+ local segmentsTable = Details:GetCombatSegments()
+ local combatObject = segmentsTable[instance.segmento]
+ instance.showing = combatObject
end
end
end
-function _detalhes:AtualizaSegmentos_AfterCombat (instancia, historico)
+function Details:AtualizaSegmentos_AfterCombat (instancia, historico)
if (instancia.freezed) then
return --se esta congelada n�o tem o que fazer
end
local segmento = instancia.segmento
- local _fadeType, _fadeSpeed = _unpack(_detalhes.row_fade_in)
+ local _fadeType, _fadeSpeed = _unpack(Details.row_fade_in)
- if (segmento == _detalhes.segments_amount) then --significa que o index [5] passou a ser [6] com a entrada da nova tabela
- instancia.showing = historico.tabelas [_detalhes.segments_amount] --ent�o ele volta a pegar o index [5] que antes era o index [4]
+ if (segmento == Details.segments_amount) then --significa que o index [5] passou a ser [6] com a entrada da nova tabela
+ instancia.showing = historico.tabelas [Details.segments_amount] --ent�o ele volta a pegar o index [5] que antes era o index [4]
--print("==> Changing the Segment now! - classe_instancia.lua 1942")
Details.FadeHandler.Fader(instancia, _fadeType, _fadeSpeed, "barras")
instancia.showing[instancia.atributo].need_refresh = true
instancia.v_barras = true
instancia:ResetaGump()
instancia:RefreshMainWindow(true)
- _detalhes:AtualizarJanela (instancia)
+ Details:AtualizarJanela (instancia)
- elseif (segmento < _detalhes.segments_amount and segmento > 0) then
+ elseif (segmento < Details.segments_amount and segmento > 0) then
instancia.showing = historico.tabelas [segmento]
--print("==> Changing the Segment now! - classe_instancia.lua 1952")
@@ -2550,7 +2553,7 @@ function _detalhes:AtualizaSegmentos_AfterCombat (instancia, historico)
instancia.v_barras = true
instancia:ResetaGump()
instancia:RefreshMainWindow(true)
- _detalhes:AtualizarJanela (instancia)
+ Details:AtualizarJanela (instancia)
end
end
@@ -2560,22 +2563,22 @@ end
---@return boolean
function Details222.Instances.ValidateAttribute(attributeId, subAttributeId)
if (attributeId == 1) then
- if (subAttributeId < 0 or subAttributeId > _detalhes.atributos[1]) then
+ if (subAttributeId < 0 or subAttributeId > Details.atributos[1]) then
return false
end
elseif (attributeId == 2) then
- if (subAttributeId < 0 or subAttributeId > _detalhes.atributos[2]) then
+ if (subAttributeId < 0 or subAttributeId > Details.atributos[2]) then
return false
end
elseif (attributeId == 3) then
- if (subAttributeId < 0 or subAttributeId > _detalhes.atributos[3]) then
+ if (subAttributeId < 0 or subAttributeId > Details.atributos[3]) then
return false
end
elseif (attributeId == 4) then
- if (subAttributeId < 0 or subAttributeId > _detalhes.atributos[4]) then
+ if (subAttributeId < 0 or subAttributeId > Details.atributos[4]) then
return false
end
@@ -2588,7 +2591,7 @@ function Details222.Instances.ValidateAttribute(attributeId, subAttributeId)
return true
end
-function _detalhes:SetDisplay(segment, attribute, subAttribute, isInstanceStarup, instanceMode)
+function Details:SetDisplay(segment, attribute, subAttribute, isInstanceStarup, instanceMode)
if (not self.meu_id) then
return
end
@@ -2603,7 +2606,7 @@ end
---@param fromInstanceStart any
---@param instanceMode any
---@return unknown
-function _detalhes:TrocaTabela(instance, segmentId, attributeId, subAttributeId, fromInstanceStart, instanceMode)
+function Details:TrocaTabela(instance, segmentId, attributeId, subAttributeId, fromInstanceStart, instanceMode)
if (self and self.meu_id and not instance) then
instanceMode = fromInstanceStart
fromInstanceStart = subAttributeId
@@ -2638,7 +2641,7 @@ function _detalhes:TrocaTabela(instance, segmentId, attributeId, subAttributeId,
elseif (segmentId == -2) then --clicou para mudar de segmento
segmentId = instance.segmento + 1
- if (segmentId > _detalhes.segments_amount) then
+ if (segmentId > Details.segments_amount) then
segmentId = -1
end
update_coolTip = true
@@ -2697,14 +2700,14 @@ function _detalhes:TrocaTabela(instance, segmentId, attributeId, subAttributeId,
end
--j� esta mostrando isso que esta pedindo
- if (not fromInstanceStart and segmentId == current_segmento and attributeId == current_atributo and subAttributeId == current_sub_atributo and not _detalhes.initializing) then
+ if (not fromInstanceStart and segmentId == current_segmento and attributeId == current_atributo and subAttributeId == current_sub_atributo and not Details.initializing) then
return false
end
if (not Details222.Instances.ValidateAttribute(attributeId, subAttributeId)) then
subAttributeId = 1
attributeId = 1
- _detalhes:Msg("invalid attribute, switching to damage done.")
+ Details:Msg("invalid attribute, switching to damage done.")
end
if (Details.auto_swap_to_dynamic_overall and Details.in_combat and UnitAffectingCombat("player")) then
@@ -2731,7 +2734,7 @@ function _detalhes:TrocaTabela(instance, segmentId, attributeId, subAttributeId,
end
--Muda o segmento caso necess�rio
- if (segmentId ~= current_segmento or _detalhes.initializing or fromInstanceStart) then
+ if (segmentId ~= current_segmento or Details.initializing or fromInstanceStart) then
--na troca de segmento, conferir se a instancia esta frozen
if (instance.freezed) then
if (not fromInstanceStart) then
@@ -2743,28 +2746,26 @@ function _detalhes:TrocaTabela(instance, segmentId, attributeId, subAttributeId,
instance.segmento = segmentId
+ ---@type combat[]
+ local segmentsTable = Details:GetCombatSegments()
+
if (segmentId == -1) then --overall
- instance.showing = _detalhes.tabela_overall
+ instance.showing = Details:GetOverallCombat()
elseif (segmentId == 0) then --combate atual
- instance.showing = _detalhes.tabela_vigente
- --print("==> Changing the Segment now! - classe_instancia.lua 2115")
- else --alguma tabela do hist�rico
- instance.showing = _detalhes.tabela_historico.tabelas [segmentId]
+ instance.showing = Details:GetCurrentCombat()
+ else
+ instance.showing = segmentsTable[segmentId]
end
if (update_coolTip) then
- _detalhes.popup:Select(1, segmentId+2)
+ Details.popup:Select(1, segmentId+2)
end
- if (instance.showing and instance.showing.contra) then
- --print("DEBUG: contra", instancia.showing.contra)
- end
+ Details:SendEvent("DETAILS_INSTANCE_CHANGESEGMENT", nil, instance, segmentId)
- _detalhes:SendEvent("DETAILS_INSTANCE_CHANGESEGMENT", nil, instance, segmentId)
-
- if (_detalhes.instances_segments_locked and not fromInstanceStart) then
- for _, thisInstance in ipairs(_detalhes.tabela_instancias) do
+ if (Details.instances_segments_locked and not fromInstanceStart) then
+ for _, thisInstance in ipairs(Details.tabela_instancias) do
if (thisInstance.meu_id ~= instance.meu_id and thisInstance.ativa and not thisInstance._postponing_switch and not thisInstance._postponing_current) then
if (thisInstance:GetSegment() >= 0) then
if (thisInstance.modo == 2 or thisInstance.modo == 3) then
@@ -2799,12 +2800,12 @@ function _detalhes:TrocaTabela(instance, segmentId, attributeId, subAttributeId,
thisInstance.v_barras = true
thisInstance.showing [attributeId].need_refresh = true
- if (not _detalhes.initializing and not fromInstanceStart) then
+ if (not Details.initializing and not fromInstanceStart) then
thisInstance:ResetaGump()
thisInstance:RefreshMainWindow(true)
end
- _detalhes:SendEvent("DETAILS_INSTANCE_CHANGESEGMENT", nil, thisInstance, segmentId)
+ Details:SendEvent("DETAILS_INSTANCE_CHANGESEGMENT", nil, thisInstance, segmentId)
end
end
end
@@ -2814,24 +2815,24 @@ function _detalhes:TrocaTabela(instance, segmentId, attributeId, subAttributeId,
--if the main attibute is 5 (custom), check if there is any custom display, is isn't, change the attribute and sub attribute to 1 (damage done)
if (attributeId == 5) then
- if (#_detalhes.custom < 1) then
+ if (#Details.custom < 1) then
attributeId = 1
subAttributeId = 1
end
end
- if (attributeId ~= current_atributo or _detalhes.initializing or fromInstanceStart or (instance.modo == modo_alone or instance.modo == modo_raid)) then
- if (instance.modo == modo_alone and not (_detalhes.initializing or fromInstanceStart)) then
- if (_detalhes.SoloTables.Mode == #_detalhes.SoloTables.Plugins) then
- _detalhes.popup:Select(1, 1)
+ if (attributeId ~= current_atributo or Details.initializing or fromInstanceStart or (instance.modo == modo_alone or instance.modo == modo_raid)) then
+ if (instance.modo == modo_alone and not (Details.initializing or fromInstanceStart)) then
+ if (Details.SoloTables.Mode == #Details.SoloTables.Plugins) then
+ Details.popup:Select(1, 1)
else
- if (_detalhes.PluginCount.SOLO > 0) then
- _detalhes.popup:Select(1, _detalhes.SoloTables.Mode+1)
+ if (Details.PluginCount.SOLO > 0) then
+ Details.popup:Select(1, Details.SoloTables.Mode+1)
end
end
- return _detalhes.SoloTables.switch (nil, nil, -1)
+ return Details.SoloTables.switch (nil, nil, -1)
- elseif ((instance.modo == modo_raid) and not (_detalhes.initializing or fromInstanceStart)) then --raid
+ elseif ((instance.modo == modo_raid) and not (Details.initializing or fromInstanceStart)) then --raid
return --do nothing when clicking in the button
end
@@ -2843,15 +2844,15 @@ function _detalhes:TrocaTabela(instance, segmentId, attributeId, subAttributeId,
instance:ChangeIcon()
if (update_coolTip) then
- _detalhes.popup:Select(1, attributeId)
- _detalhes.popup:Select(2, instance.sub_atributo, attributeId)
+ Details.popup:Select(1, attributeId)
+ Details.popup:Select(2, instance.sub_atributo, attributeId)
end
- _detalhes:InstanceCall(_detalhes.CheckPsUpdate)
- _detalhes:SendEvent("DETAILS_INSTANCE_CHANGEATTRIBUTE", nil, instance, attributeId, subAttributeId)
+ Details:InstanceCall(Details.CheckPsUpdate)
+ Details:SendEvent("DETAILS_INSTANCE_CHANGEATTRIBUTE", nil, instance, attributeId, subAttributeId)
end
- if (subAttributeId ~= current_sub_atributo or _detalhes.initializing or fromInstanceStart or atributo_changed) then
+ if (subAttributeId ~= current_sub_atributo or Details.initializing or fromInstanceStart or atributo_changed) then
instance.sub_atributo = subAttributeId
if (sub_attribute_click) then
@@ -2902,21 +2903,21 @@ function _detalhes:TrocaTabela(instance, segmentId, attributeId, subAttributeId,
return true
end
-function _detalhes:GetRaidPluginName()
+function Details:GetRaidPluginName()
return self.current_raid_plugin or self.last_raid_plugin
end
-function _detalhes:GetInstanceAttributeText()
+function Details:GetInstanceAttributeText()
if (self.modo == modo_grupo or self.modo == modo_all) then
local attribute = self.atributo
local sub_attribute = self.sub_atributo
- local name = _detalhes:GetSubAttributeName (attribute, sub_attribute)
+ local name = Details:GetSubAttributeName (attribute, sub_attribute)
return name or "Unknown"
elseif (self.modo == modo_raid) then
local plugin_name = self.current_raid_plugin or self.last_raid_plugin
if (plugin_name) then
- local plugin_object = _detalhes:GetPlugin (plugin_name)
+ local plugin_object = Details:GetPlugin (plugin_name)
if (plugin_object) then
return plugin_object.__name
else
@@ -2927,8 +2928,8 @@ function _detalhes:GetInstanceAttributeText()
end
elseif (self.modo == modo_alone) then
- local atributo = _detalhes.SoloTables.Mode or 1
- local SoloInfo = _detalhes.SoloTables.Menu [atributo]
+ local atributo = Details.SoloTables.Mode or 1
+ local SoloInfo = Details.SoloTables.Menu [atributo]
if (SoloInfo) then
return SoloInfo [1]
else
@@ -2937,8 +2938,8 @@ function _detalhes:GetInstanceAttributeText()
end
end
-function _detalhes:MontaRaidOption (instancia)
- local available_plugins = _detalhes.RaidTables:GetAvailablePlugins()
+function Details:MontaRaidOption (instancia)
+ local available_plugins = Details.RaidTables:GetAvailablePlugins()
if (#available_plugins == 0) then
return false
@@ -2947,7 +2948,7 @@ function _detalhes:MontaRaidOption (instancia)
local amount = 0
for index, ptable in ipairs(available_plugins) do
if (ptable [3].__enabled) then
- GameCooltip:AddMenu (1, _detalhes.RaidTables.switch, ptable [4], instancia, nil, ptable [1], ptable [2], true) --PluginName, PluginIcon, PluginObject, PluginAbsoluteName
+ GameCooltip:AddMenu (1, Details.RaidTables.switch, ptable [4], instancia, nil, ptable [1], ptable [2], true) --PluginName, PluginIcon, PluginObject, PluginAbsoluteName
amount = amount + 1
end
end
@@ -2958,22 +2959,22 @@ function _detalhes:MontaRaidOption (instancia)
GameCooltip:SetOption("NoLastSelectedBar", true)
- GameCooltip:SetWallpaper (1, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true)
+ GameCooltip:SetWallpaper (1, Details.tooltip.menus_bg_texture, Details.tooltip.menus_bg_coords, Details.tooltip.menus_bg_color, true)
return true
end
-function _detalhes:MontaSoloOption (instancia)
- for index, ptable in ipairs(_detalhes.SoloTables.Menu) do
+function Details:MontaSoloOption (instancia)
+ for index, ptable in ipairs(Details.SoloTables.Menu) do
if (ptable [3].__enabled) then
- GameCooltip:AddMenu (1, _detalhes.SoloTables.switch, index, nil, nil, ptable [1], ptable [2], true)
+ GameCooltip:AddMenu (1, Details.SoloTables.switch, index, nil, nil, ptable [1], ptable [2], true)
end
end
- if (_detalhes.SoloTables.Mode) then
- GameCooltip:SetLastSelected (1, _detalhes.SoloTables.Mode)
+ if (Details.SoloTables.Mode) then
+ GameCooltip:SetLastSelected (1, Details.SoloTables.Mode)
end
- GameCooltip:SetWallpaper (1, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true)
+ GameCooltip:SetWallpaper (1, Details.tooltip.menus_bg_texture, Details.tooltip.menus_bg_coords, Details.tooltip.menus_bg_color, true)
return true
end
@@ -2988,7 +2989,7 @@ local menu_icones = {
"Interface\\AddOns\\Details\\images\\atributos_icones_misc"
}
-function _detalhes:MontaAtributosOption (instancia, func)
+function Details:MontaAtributosOption (instancia, func)
func = func or instancia.TrocaTabela
local checked1 = instancia.atributo
@@ -2997,7 +2998,7 @@ function _detalhes:MontaAtributosOption (instancia, func)
local options
if (atributo_ativo == 5) then --custom
options = {Loc ["STRING_CUSTOM_NEW"]}
- for index, custom in ipairs(_detalhes.custom) do
+ for index, custom in ipairs(Details.custom) do
options [#options+1] = custom.name
end
else
@@ -3013,7 +3014,7 @@ function _detalhes:MontaAtributosOption (instancia, func)
CoolTip:AddMenu (1, func, nil, i, nil, atributos.lista[i], nil, true)
CoolTip:AddIcon ("Interface\\AddOns\\Details\\images\\atributos_icones", 1, 1, 20, 20, p*(i-1), p*(i), 0, 1)
- if (_detalhes.tooltip.submenu_wallpaper) then
+ if (Details.tooltip.submenu_wallpaper) then
if (i == 1) then
CoolTip:SetWallpaper (2, [[Interface\TALENTFRAME\WarlockDestruction-TopLeft]], {1, 0.22, 0, 0.55}, wallpaper_bg_color)
elseif (i == 2) then
@@ -3035,7 +3036,7 @@ function _detalhes:MontaAtributosOption (instancia, func)
end
for o = 1, atributos [i] do
- if (_detalhes:CaptureIsEnabled ( _detalhes.atributos_capture [gindex] )) then
+ if (Details:CaptureIsEnabled ( Details.atributos_capture [gindex] )) then
CoolTip:AddMenu (2, func, true, i, o, options[o], nil, true)
CoolTip:AddIcon (menu_icones[i], 2, 1, 20, 20, p*(o-1), p*(o), 0, 1)
else
@@ -3058,12 +3059,12 @@ function _detalhes:MontaAtributosOption (instancia, func)
CoolTip:AddMenu (1, func, nil, 5, nil, atributos.lista[5], nil, true)
CoolTip:AddIcon ("Interface\\AddOns\\Details\\images\\atributos_icones", 1, 1, 20, 20, p*(5-1), p*(5), 0, 1)
- CoolTip:AddMenu (2, _detalhes.OpenCustomDisplayWindow, nil, nil, nil, Loc ["STRING_CUSTOM_NEW"], nil, true)
+ CoolTip:AddMenu (2, Details.OpenCustomDisplayWindow, nil, nil, nil, Loc ["STRING_CUSTOM_NEW"], nil, true)
CoolTip:AddIcon ([[Interface\CHATFRAME\UI-ChatIcon-Maximize-Up]], 2, 1, 20, 20, 3/32, 29/32, 3/32, 29/32)
CoolTip:AddLine("$div", nil, 2, nil, -8, -13)
- for index, custom in ipairs(_detalhes.custom) do
+ for index, custom in ipairs(Details.custom) do
if (custom.temp) then
CoolTip:AddLine(custom.name .. Loc ["STRING_CUSTOM_TEMPORARILY"], nil, 2)
else
@@ -3075,13 +3076,13 @@ function _detalhes:MontaAtributosOption (instancia, func)
end
--set the wallpaper on custom
- if (_detalhes.tooltip.submenu_wallpaper) then
+ if (Details.tooltip.submenu_wallpaper) then
CoolTip:SetWallpaper (2, [[Interface\TALENTFRAME\WarriorArm-TopLeft]], menu_wallpaper_custom_color, wallpaper_bg_color)
else
--CoolTip:SetWallpaper (2, _detalhes.tooltip.menus_bg_texture, _detalhes.tooltip.menus_bg_coords, _detalhes.tooltip.menus_bg_color, true)
end
- if (#_detalhes.custom == 0) then
+ if (#Details.custom == 0) then
CoolTip:SetLastSelected (2, 6, 2)
else
if (instancia.atributo == 5) then
@@ -3101,9 +3102,9 @@ function _detalhes:MontaAtributosOption (instancia, func)
CoolTip:SetOption("SelectedTopAnchorMod", -2)
CoolTip:SetOption("SelectedBottomAnchorMod", 2)
- CoolTip:SetOption("TextFont", _detalhes.font_faces.menus)
+ CoolTip:SetOption("TextFont", Details.font_faces.menus)
- _detalhes:SetTooltipMinWidth()
+ Details:SetTooltipMinWidth()
local last_selected = atributo_ativo
if (atributo_ativo == 5) then
@@ -3127,10 +3128,10 @@ local getFineTunedIconCoords = function(attribute, subAttribute)
return iconCoords[attribute] and iconCoords[attribute][subAttribute] or 0
end
-function _detalhes:ChangeIcon(icon)
- local skin = _detalhes.skins [self.skin]
+function Details:ChangeIcon(icon)
+ local skin = Details.skins [self.skin]
if (not skin) then
- skin = _detalhes.skins [_detalhes.default_skin_to_use]
+ skin = Details.skins [Details.default_skin_to_use]
end
if (not self.hide_icon) then
@@ -3161,8 +3162,8 @@ function _detalhes:ChangeIcon(icon)
if (self.atributo == 5) then
--custom
- if (_detalhes.custom [self.sub_atributo]) then
- local icon = _detalhes.custom [self.sub_atributo].icon
+ if (Details.custom [self.sub_atributo]) then
+ local icon = Details.custom [self.sub_atributo].icon
self.baseframe.cabecalho.atributo_icon:SetTexture(icon)
self.baseframe.cabecalho.atributo_icon:SetTexCoord(5/64, 60/64, 3/64, 62/64)
@@ -3261,7 +3262,7 @@ local function GetDpsHps (_thisActor, key)
if (_thisActor [keyname]) then
return _thisActor [keyname]
else
- if ((_detalhes.time_type == 2 and _thisActor.grupo) or not _detalhes:CaptureGet("damage")) then
+ if ((Details.time_type == 2 and _thisActor.grupo) or not Details:CaptureGet("damage")) then
local dps = _thisActor.total / _thisActor:GetCombatTime()
_thisActor [keyname] = dps
return dps
@@ -3293,27 +3294,27 @@ local default_format_value3 = function(i, v1, v2)
return "" .. i .. ". " .. v1 .. " " .. v2
end
-function _detalhes:FormatReportLines (report_table, data, f1, f2, f3)
+function Details:FormatReportLines (report_table, data, f1, f2, f3)
f1 = f1 or default_format_value1
f2 = f2 or default_format_value2
f3 = f3 or default_format_value3
- if (not _detalhes.fontstring_len) then
- _detalhes.fontstring_len = _detalhes.listener:CreateFontString(nil, "background", "GameFontNormal")
+ if (not Details.fontstring_len) then
+ Details.fontstring_len = Details.listener:CreateFontString(nil, "background", "GameFontNormal")
end
local _, fontSize = FCF_GetChatWindowInfo (1)
if (fontSize < 1) then
fontSize = 10
end
- local fonte, _, flags = _detalhes.fontstring_len:GetFont()
- _detalhes.fontstring_len:SetFont(fonte, fontSize, flags)
- _detalhes.fontstring_len:SetText("DEFAULT NAME")
- local biggest_len = _detalhes.fontstring_len:GetStringWidth()
+ local fonte, _, flags = Details.fontstring_len:GetFont()
+ Details.fontstring_len:SetFont(fonte, fontSize, flags)
+ Details.fontstring_len:SetText("DEFAULT NAME")
+ local biggest_len = Details.fontstring_len:GetStringWidth()
for index, t in ipairs(data) do
local v1 = f1 (t[1])
- _detalhes.fontstring_len:SetText(v1)
- local len = _detalhes.fontstring_len:GetStringWidth()
+ Details.fontstring_len:SetText(v1)
+ local len = Details.fontstring_len:GetStringWidth()
if (len > biggest_len) then
biggest_len = len
end
@@ -3327,13 +3328,13 @@ function _detalhes:FormatReportLines (report_table, data, f1, f2, f3)
local v1, v2 = f1 (t[1]), f2 (t[2])
if (v1 and v2 and type(v1) == "string" and type(v2) == "string") then
v1 = v1 .. " "
- _detalhes.fontstring_len:SetText(v1)
- local len = _detalhes.fontstring_len:GetStringWidth()
+ Details.fontstring_len:SetText(v1)
+ local len = Details.fontstring_len:GetStringWidth()
while (len < biggest_len) do
v1 = v1 .. "."
- _detalhes.fontstring_len:SetText(v1)
- len = _detalhes.fontstring_len:GetStringWidth()
+ Details.fontstring_len:SetText(v1)
+ len = Details.fontstring_len:GetStringWidth()
end
report_table [#report_table+1] = f3 (index, v1, v2)
@@ -3345,7 +3346,7 @@ end
local report_name_function = function(name)
local name, index = unpack(name)
- if (_detalhes.remove_realm_from_name and name:find("-")) then
+ if (Details.remove_realm_from_name and name:find("-")) then
return index .. ". " .. name:gsub(("%-.*"), "")
else
return index .. ". " .. name
@@ -3357,18 +3358,18 @@ local report_amount_function = function(t)
if (not is_string) then
if (dps) then
- if (_detalhes.report_schema == 1) then
- return _detalhes:ToKReport (_math_floor(amount)) .. " (" .. _detalhes:ToKMin (_math_floor(dps)) .. ", " .. percent .. "%)"
- elseif (_detalhes.report_schema == 2) then
- return percent .. "% (" .. _detalhes:ToKMin (_math_floor(dps)) .. ", " .. _detalhes:ToKReport ( _math_floor(amount)) .. ")"
- elseif (_detalhes.report_schema == 3) then
- return percent .. "% (" .. _detalhes:ToKReport ( _math_floor(amount) ) .. ", " .. _detalhes:ToKMin (_math_floor(dps)) .. ")"
+ if (Details.report_schema == 1) then
+ return Details:ToKReport (_math_floor(amount)) .. " (" .. Details:ToKMin (_math_floor(dps)) .. ", " .. percent .. "%)"
+ elseif (Details.report_schema == 2) then
+ return percent .. "% (" .. Details:ToKMin (_math_floor(dps)) .. ", " .. Details:ToKReport ( _math_floor(amount)) .. ")"
+ elseif (Details.report_schema == 3) then
+ return percent .. "% (" .. Details:ToKReport ( _math_floor(amount) ) .. ", " .. Details:ToKMin (_math_floor(dps)) .. ")"
end
else
- if (_detalhes.report_schema == 1) then
- return _detalhes:ToKReport (amount) .. " (" .. percent .. "%)"
+ if (Details.report_schema == 1) then
+ return Details:ToKReport (amount) .. " (" .. percent .. "%)"
else
- return percent .. "% (" .. _detalhes:ToKReport (amount) .. ")"
+ return percent .. "% (" .. Details:ToKReport (amount) .. ")"
end
end
else
@@ -3381,18 +3382,18 @@ local report_build_line = function(i, v1, v2)
end
--Reportar o que esta na janela da inst�ncia
-function _detalhes:monta_relatorio (este_relatorio, custom)
+function Details:monta_relatorio (este_relatorio, custom)
if (custom) then
--shrink
local report_lines = {}
- for i = 1, _detalhes.report_lines+1, 1 do --#este_relatorio -- o +1 � pq ele conta o cabe�alho como uma linha
+ for i = 1, Details.report_lines+1, 1 do --#este_relatorio -- o +1 � pq ele conta o cabe�alho como uma linha
report_lines [#report_lines+1] = este_relatorio[i]
end
return self:envia_relatorio (report_lines, true)
end
- local amt = _detalhes.report_lines
+ local amt = Details.report_lines
local report_lines = {}
@@ -3405,16 +3406,16 @@ function _detalhes:monta_relatorio (este_relatorio, custom)
else
if (self.segmento == -1) then --overall
- report_lines [#report_lines+1] = "Details!: " .. Loc ["STRING_OVERALL"] .. " " .. _detalhes.sub_atributos [self.atributo].lista [self.sub_atributo]
+ report_lines [#report_lines+1] = "Details!: " .. Loc ["STRING_OVERALL"] .. " " .. Details.sub_atributos [self.atributo].lista [self.sub_atributo]
else
- report_lines [#report_lines+1] = "Details!: " .. _detalhes.sub_atributos [self.atributo].lista [self.sub_atributo]
+ report_lines [#report_lines+1] = "Details!: " .. Details.sub_atributos [self.atributo].lista [self.sub_atributo]
end
end
- if (self.meu_id and self.atributo and self.sub_atributo and _detalhes.report_where ~= "WHISPER" and _detalhes.report_where ~= "WHISPER2") then
+ if (self.meu_id and self.atributo and self.sub_atributo and Details.report_where ~= "WHISPER" and Details.report_where ~= "WHISPER2") then
local already_exists
- for index, reported in ipairs(_detalhes.latest_report_table) do
- if (reported [1] == self.meu_id and reported [2] == self.atributo and reported [3] == self.sub_atributo and reported [5] == _detalhes.report_where) then
+ for index, reported in ipairs(Details.latest_report_table) do
+ if (reported [1] == self.meu_id and reported [2] == self.atributo and reported [3] == self.sub_atributo and reported [5] == Details.report_where) then
already_exists = index
break
end
@@ -3422,19 +3423,19 @@ function _detalhes:monta_relatorio (este_relatorio, custom)
if (already_exists) then
--push it to front
- local t = tremove(_detalhes.latest_report_table, already_exists)
+ local t = tremove(Details.latest_report_table, already_exists)
t [4] = amt
- table.insert(_detalhes.latest_report_table, 1, t)
+ table.insert(Details.latest_report_table, 1, t)
else
if (self.atributo == 5) then
local custom_name = self:GetCustomObject():GetName()
- table.insert(_detalhes.latest_report_table, 1, {self.meu_id, self.atributo, self.sub_atributo, amt, _detalhes.report_where, custom_name})
+ table.insert(Details.latest_report_table, 1, {self.meu_id, self.atributo, self.sub_atributo, amt, Details.report_where, custom_name})
else
- table.insert(_detalhes.latest_report_table, 1, {self.meu_id, self.atributo, self.sub_atributo, amt, _detalhes.report_where})
+ table.insert(Details.latest_report_table, 1, {self.meu_id, self.atributo, self.sub_atributo, amt, Details.report_where})
end
end
- tremove(_detalhes.latest_report_table, 11)
+ tremove(Details.latest_report_table, 11)
end
local barras = self.barras
@@ -3463,18 +3464,18 @@ function _detalhes:monta_relatorio (este_relatorio, custom)
elseif (self.sub_atributo == 7) then --auras e voidzones
- total, keyName, first, container_amount, container, name_member = _detalhes.atributo_damage:RefreshWindow (self, self.showing, true, true)
+ total, keyName, first, container_amount, container, name_member = Details.atributo_damage:RefreshWindow (self, self.showing, true, true)
elseif (self.sub_atributo == 8) then --damage taken by spell
- total, keyName, first, container_amount, container = _detalhes.atributo_damage:RefreshWindow (self, self.showing, true, true)
+ total, keyName, first, container_amount, container = Details.atributo_damage:RefreshWindow (self, self.showing, true, true)
for _, t in ipairs(container) do
- t.nome = _detalhes:GetSpellLink(t.spellid)
+ t.nome = Details:GetSpellLink(t.spellid)
end
else
- total, keyName, first, container_amount = _detalhes.atributo_damage:RefreshWindow (self, self.showing, true, true)
+ total, keyName, first, container_amount = Details.atributo_damage:RefreshWindow (self, self.showing, true, true)
if (self.sub_atributo == 1) then
keyNameSec = "dps"
elseif (self.sub_atributo == 2) then
@@ -3483,14 +3484,14 @@ function _detalhes:monta_relatorio (este_relatorio, custom)
end
elseif (atributo == 2) then --heal
- total, keyName, first, container_amount = _detalhes.atributo_heal:RefreshWindow (self, self.showing, true, true)
+ total, keyName, first, container_amount = Details.atributo_heal:RefreshWindow (self, self.showing, true, true)
if (self.sub_atributo == 1) then
keyNameSec = "hps"
end
elseif (atributo == 3) then --energy
- total, keyName, first, container_amount = _detalhes.atributo_energy:RefreshWindow (self, self.showing, true, true)
+ total, keyName, first, container_amount = Details.atributo_energy:RefreshWindow (self, self.showing, true, true)
elseif (atributo == 4) then --misc
if (self.sub_atributo == 5) then --mortes
@@ -3504,19 +3505,19 @@ function _detalhes:monta_relatorio (este_relatorio, custom)
container_amount = #reportarMortes
keyName = "dead"
else
- total, keyName, first, container_amount = _detalhes.atributo_misc:RefreshWindow (self, self.showing, true, true)
+ total, keyName, first, container_amount = Details.atributo_misc:RefreshWindow (self, self.showing, true, true)
end
elseif (atributo == 5) then --custom
- if (_detalhes.custom [self.sub_atributo]) then
- total, container, first, container_amount, nm = _detalhes.atributo_custom:RefreshWindow (self, self.showing, true, true)
+ if (Details.custom [self.sub_atributo]) then
+ total, container, first, container_amount, nm = Details.atributo_custom:RefreshWindow (self, self.showing, true, true)
if (nm) then
name_member = nm
end
keyName = "report_value"
else
- total, keyName, first, container_amount = _detalhes.atributo_damage:RefreshWindow (self, self.showing, true, true)
+ total, keyName, first, container_amount = Details.atributo_damage:RefreshWindow (self, self.showing, true, true)
total = 1
atributo = 1
container = self.showing [atributo]._ActorTable
@@ -3574,12 +3575,12 @@ function _detalhes:monta_relatorio (este_relatorio, custom)
break
end
end
- _detalhes:FormatReportLines (report_lines, t, report_name_function, report_amount_function, report_build_line)
+ Details:FormatReportLines (report_lines, t, report_name_function, report_amount_function, report_build_line)
else
for i = #raw_data_to_report, amt+1, -1 do
tremove(raw_data_to_report, i)
end
- _detalhes:FormatReportLines (report_lines, raw_data_to_report, report_name_function, report_amount_function, report_build_line)
+ Details:FormatReportLines (report_lines, raw_data_to_report, report_name_function, report_amount_function, report_build_line)
end
else
local raw_data_to_report = {}
@@ -3597,49 +3598,51 @@ function _detalhes:monta_relatorio (este_relatorio, custom)
end
end
- _detalhes:FormatReportLines (report_lines, raw_data_to_report, nil, nil, report_build_line)
+ Details:FormatReportLines (report_lines, raw_data_to_report, nil, nil, report_build_line)
end
return self:envia_relatorio (report_lines)
end
-function _detalhes:envia_relatorio (linhas, custom)
+function Details:envia_relatorio (linhas, custom)
local segmento = self.segmento
local luta = nil
local combatObject
+ ---@type combat[]
+ local segmentsTable = Details:GetCombatSegments()
+
if (not custom) then
if (not linhas[1]) then
- return _detalhes:Msg(Loc ["STRING_ACTORFRAME_NOTHING"])
+ return Details:Msg(Loc ["STRING_ACTORFRAME_NOTHING"])
end
if (segmento == -1) then --overall
- --luta = Loc ["STRING_REPORT_LAST"] .. " " .. #_detalhes.tabela_historico.tabelas .. " " .. Loc ["STRING_REPORT_FIGHTS"]
- luta = _detalhes.tabela_overall.overall_enemy_name
- combatObject = _detalhes.tabela_overall
+ luta = Details.tabela_overall.overall_enemy_name
+ combatObject = Details.tabela_overall
elseif (segmento == 0) then --current
- if (_detalhes.tabela_vigente.is_boss) then
- local encounterName = _detalhes.tabela_vigente.is_boss.name
+ if (Details.tabela_vigente.is_boss) then
+ local encounterName = Details.tabela_vigente.is_boss.name
if (encounterName) then
luta = encounterName
end
- elseif (_detalhes.tabela_vigente.is_pvp) then
- local battleground_name = _detalhes.tabela_vigente.is_pvp.name
+ elseif (Details.tabela_vigente.is_pvp) then
+ local battleground_name = Details.tabela_vigente.is_pvp.name
if (battleground_name) then
luta = battleground_name
end
end
- local isMythicDungeon = _detalhes.tabela_vigente:IsMythicDungeon()
+ local isMythicDungeon = Details.tabela_vigente:IsMythicDungeon()
if (isMythicDungeon) then
- local mythicDungeonInfo = _detalhes.tabela_vigente:GetMythicDungeonInfo()
+ local mythicDungeonInfo = Details.tabela_vigente:GetMythicDungeonInfo()
if (mythicDungeonInfo) then
- local isMythicOverallSegment, segmentID, mythicLevel, EJID, mapID, zoneName, encounterID, encounterName, startedAt, endedAt, runID = _detalhes:UnpackMythicDungeonInfo (mythicDungeonInfo)
+ local isMythicOverallSegment, segmentID, mythicLevel, EJID, mapID, zoneName, encounterID, encounterName, startedAt, endedAt, runID = Details:UnpackMythicDungeonInfo (mythicDungeonInfo)
if (isMythicOverallSegment) then
luta = zoneName .. " +" .. mythicLevel .. " (" .. Loc ["STRING_SEGMENTS_LIST_OVERALL"] .. ")"
@@ -3656,39 +3659,38 @@ function _detalhes:envia_relatorio (linhas, custom)
end
if (not luta) then
- if (_detalhes.tabela_vigente.enemy) then
- luta = _detalhes.tabela_vigente.enemy
+ if (Details.tabela_vigente.enemy) then
+ luta = Details.tabela_vigente.enemy
end
end
if (not luta) then
- luta = _detalhes.segmentos.current
+ luta = Details.segmentos.current
end
- combatObject = _detalhes.tabela_vigente
-
+ combatObject = Details.tabela_vigente
else
if (segmento == 1) then
- if (_detalhes.tabela_historico.tabelas[1].is_boss) then
- local encounterName = _detalhes.tabela_historico.tabelas[1].is_boss.name
+ if (segmentsTable[1].is_boss) then
+ local encounterName = segmentsTable[1].is_boss.name
if (encounterName) then
luta = encounterName .. " (" .. Loc ["STRING_REPORT_LASTFIGHT"] .. ")"
end
- elseif (_detalhes.tabela_historico.tabelas[1].is_pvp) then
- local battleground_name = _detalhes.tabela_historico.tabelas[1].is_pvp.name
+ elseif (segmentsTable[1].is_pvp) then
+ local battleground_name = segmentsTable[1].is_pvp.name
if (battleground_name) then
luta = battleground_name .. " (" .. Loc ["STRING_REPORT_LASTFIGHT"] .. ")"
end
end
- local thisSegment = _detalhes.tabela_historico.tabelas[1]
+ local thisSegment = segmentsTable[1]
local isMythicDungeon = thisSegment:IsMythicDungeon()
if (isMythicDungeon) then
local mythicDungeonInfo = thisSegment:GetMythicDungeonInfo()
if (mythicDungeonInfo) then
- local isMythicOverallSegment, segmentID, mythicLevel, EJID, mapID, zoneName, encounterID, encounterName, startedAt, endedAt, runID = _detalhes:UnpackMythicDungeonInfo (mythicDungeonInfo)
+ local isMythicOverallSegment, segmentID, mythicLevel, EJID, mapID, zoneName, encounterID, encounterName, startedAt, endedAt, runID = Details:UnpackMythicDungeonInfo (mythicDungeonInfo)
if (isMythicOverallSegment) then
luta = zoneName .. " +" .. mythicLevel .. " (" .. Loc ["STRING_SEGMENTS_LIST_OVERALL"] .. ")"
@@ -3705,8 +3707,8 @@ function _detalhes:envia_relatorio (linhas, custom)
end
if (not luta) then
- if (_detalhes.tabela_historico.tabelas[1].enemy) then
- luta = _detalhes.tabela_historico.tabelas[1].enemy .. " (" .. Loc ["STRING_REPORT_LASTFIGHT"] .. ")"
+ if (segmentsTable[1].enemy) then
+ luta = segmentsTable[1].enemy .. " (" .. Loc ["STRING_REPORT_LASTFIGHT"] .. ")"
end
end
@@ -3714,29 +3716,27 @@ function _detalhes:envia_relatorio (linhas, custom)
luta = Loc ["STRING_REPORT_LASTFIGHT"]
end
- combatObject = _detalhes.tabela_historico.tabelas[1]
-
+ combatObject = segmentsTable[1]
else
-
- if (_detalhes.tabela_historico.tabelas[segmento].is_boss) then
- local encounterName = _detalhes.tabela_historico.tabelas[segmento].is_boss.name
+ if (segmentsTable[segmento].is_boss) then
+ local encounterName = segmentsTable[segmento].is_boss.name
if (encounterName) then
luta = encounterName .. " (" .. segmento .. " " .. Loc ["STRING_REPORT_PREVIOUSFIGHTS"] .. ")"
end
- elseif (_detalhes.tabela_historico.tabelas[segmento].is_pvp) then
- local battleground_name = _detalhes.tabela_historico.tabelas[segmento].is_pvp.name
+ elseif (segmentsTable[segmento].is_pvp) then
+ local battleground_name = segmentsTable[segmento].is_pvp.name
if (battleground_name) then
luta = battleground_name .. " (" .. Loc ["STRING_REPORT_LASTFIGHT"] .. ")"
end
end
- local thisSegment = _detalhes.tabela_historico.tabelas [segmento]
+ local thisSegment = segmentsTable [segmento]
local isMythicDungeon = thisSegment:IsMythicDungeon()
if (isMythicDungeon) then
local mythicDungeonInfo = thisSegment:GetMythicDungeonInfo()
if (mythicDungeonInfo) then
- local isMythicOverallSegment, segmentID, mythicLevel, EJID, mapID, zoneName, encounterID, encounterName, startedAt, endedAt, runID = _detalhes:UnpackMythicDungeonInfo (mythicDungeonInfo)
+ local isMythicOverallSegment, segmentID, mythicLevel, EJID, mapID, zoneName, encounterID, encounterName, startedAt, endedAt, runID = Details:UnpackMythicDungeonInfo (mythicDungeonInfo)
if (isMythicOverallSegment) then
luta = zoneName .. " +" .. mythicLevel .. " (" .. Loc ["STRING_SEGMENTS_LIST_OVERALL"] .. ")"
@@ -3753,8 +3753,8 @@ function _detalhes:envia_relatorio (linhas, custom)
end
if (not luta) then
- if (_detalhes.tabela_historico.tabelas[segmento].enemy) then
- luta = _detalhes.tabela_historico.tabelas[segmento].enemy .. " (" .. segmento .. " " .. Loc ["STRING_REPORT_PREVIOUSFIGHTS"] .. ")"
+ if (segmentsTable[segmento].enemy) then
+ luta = segmentsTable[segmento].enemy .. " (" .. segmento .. " " .. Loc ["STRING_REPORT_PREVIOUSFIGHTS"] .. ")"
end
end
@@ -3762,52 +3762,51 @@ function _detalhes:envia_relatorio (linhas, custom)
luta = " (" .. segmento .. " " .. Loc ["STRING_REPORT_PREVIOUSFIGHTS"] .. ")"
end
- combatObject = _detalhes.tabela_historico.tabelas[segmento]
+ combatObject = segmentsTable[segmento]
end
end
linhas[1] = linhas[1] .. " " .. Loc ["STRING_REPORT"] .. " " .. luta
-
end
--add the combat time
local segmentTime = ""
if (combatObject) then
local combatTime = combatObject:GetCombatTime()
- segmentTime = _detalhes.gump:IntegerToTimer(combatTime or 0)
+ segmentTime = Details.gump:IntegerToTimer(combatTime or 0)
end
--effective ou active time
- if (_detalhes.time_type == 2) then
+ if (Details.time_type == 2) then
linhas[1] = linhas[1] .. " [" .. segmentTime .. " EF]"
else
linhas[1] = linhas[1] .. " [" .. segmentTime .. " AC]"
end
- local editbox = _detalhes.janela_report.editbox
+ local editbox = Details.janela_report.editbox
if (editbox.focus) then --n�o precionou enter antes de clicar no okey
- local texto = _detalhes:trim (editbox:GetText())
+ local texto = Details:trim (editbox:GetText())
if (_string_len (texto) > 0) then
- _detalhes.report_to_who = texto
+ Details.report_to_who = texto
editbox:AddHistoryLine (texto)
editbox:SetText(texto)
else
- _detalhes.report_to_who = ""
+ Details.report_to_who = ""
editbox:SetText("")
end
editbox.perdeu_foco = true --isso aqui pra quando estiver editando e clicar em outra caixa
editbox:ClearFocus()
end
- _detalhes:DelayUpdateReportWindowRecentlyReported()
+ Details:DelayUpdateReportWindowRecentlyReported()
- if (_detalhes.report_where == "COPY") then
- _detalhes:SendReportTextWindow (linhas)
+ if (Details.report_where == "COPY") then
+ Details:SendReportTextWindow (linhas)
return
end
- local to_who = _detalhes.report_where
+ local to_who = Details.report_where
local channel = to_who:find("CHANNEL")
local is_btag = to_who:find("REALID")
@@ -3855,10 +3854,10 @@ function _detalhes:envia_relatorio (linhas, custom)
elseif (to_who == "WHISPER") then --whisper
- local alvo = _detalhes.report_to_who
+ local alvo = Details.report_to_who
if (not alvo or alvo == "") then
- _detalhes:Msg(Loc ["STRING_REPORT_INVALIDTARGET"])
+ Details:Msg(Loc ["STRING_REPORT_INVALIDTARGET"])
return
end
@@ -3883,11 +3882,11 @@ function _detalhes:envia_relatorio (linhas, custom)
end
alvo = nome
else
- _detalhes:Msg(Loc ["STRING_REPORT_INVALIDTARGET"])
+ Details:Msg(Loc ["STRING_REPORT_INVALIDTARGET"])
return
end
else
- _detalhes:Msg(Loc ["STRING_REPORT_INVALIDTARGET"])
+ Details:Msg(Loc ["STRING_REPORT_INVALIDTARGET"])
return
end
diff --git a/classes/class_resources.lua b/classes/class_resources.lua
index b5fa1eed..a706eeb9 100644
--- a/classes/class_resources.lua
+++ b/classes/class_resources.lua
@@ -1374,7 +1374,7 @@ end
--controla se o dps do jogador esta travado ou destravado
-function atributo_energy:Iniciar (iniciar)
+function atributo_energy:GetOrChangeActivityStatus (iniciar)
return false --retorna se o dps esta aberto ou fechado para este jogador
end
diff --git a/classes/class_utility.lua b/classes/class_utility.lua
index 251d4346..ba2de26c 100644
--- a/classes/class_utility.lua
+++ b/classes/class_utility.lua
@@ -2316,7 +2316,7 @@ function atributo_misc:MontaTooltipAlvos (esta_barra, index)
end
--controla se o dps do jogador esta travado ou destravado
-function atributo_misc:Iniciar (iniciar)
+function atributo_misc:GetOrChangeActivityStatus (iniciar)
return false --retorna se o dps esta aberto ou fechado para este jogador
end
diff --git a/classes/container_segments.lua b/classes/container_segments.lua
index 7597ffb8..1bac781a 100644
--- a/classes/container_segments.lua
+++ b/classes/container_segments.lua
@@ -5,7 +5,6 @@ local addonName, Details222 = ...
local combatClass = Details.combate
local segmentClass = Details.historico
-local timeMachine = Details.timeMachine
local bitBand = bit.band
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -32,29 +31,42 @@ end
function Details:GetCombat(combat)
if (not combat) then
- return Details.tabela_vigente
+ return Details:GetCurrentCombat()
elseif (type(combat) == "number") then
if (combat == -1) then --overall
- return Details.tabela_overall
+ return Details:GetOverallCombat()
elseif (combat == 0) then --current
- return Details.tabela_vigente
+ return Details:GetCurrentCombat()
else
- return Details.tabela_historico.tabelas[combat]
+ local segmentsTable = Details:GetCombatSegments()
+ return segmentsTable[combat]
end
elseif (type(combat) == "string") then
if (combat == "overall") then
- return Details.tabela_overall
+ return Details:GetOverallCombat()
+
elseif (combat == "current") then
- return Details.tabela_vigente
+ return Details:GetCurrentCombat()
end
end
return nil
end
+---remove a segment from the segments table
+---@param segmentIndex number
+---@return boolean, combat
+function Details:RemoveSegment(segmentIndex)
+ assert(type(segmentIndex) == "number", "Usage: Details:RemoveSegment(segmentIndex: number)")
+
+ local segmentsTable = Details:GetCombatSegments()
+ local segmentRemoved = table.remove(segmentsTable, segmentIndex)
+ return segmentRemoved ~= nil, segmentRemoved
+end
+
--returns a private table containing all stored segments
function Details:GetCombatSegments()
return Details.tabela_historico.tabelas
@@ -82,9 +94,11 @@ function segmentClass:AddToOverallData(combatObject)
if (Details.debug) then
Details:Msg("(debug) new boss detected 'overall_clear_newboss' is true, cleaning overall data.")
end
- for index, combat in ipairs(Details.tabela_historico.tabelas) do
+
+ for index, combat in ipairs(Details:GetCombatSegments()) do
combat.overall_added = false
end
+
segmentClass:ResetOverallData()
end
end
@@ -145,8 +159,9 @@ function segmentClass:AddToOverallData(combatObject)
Details.tabela_overall:SetEndTime(combatObject.end_time)
end
+ local currentCombat = Details:GetCurrentCombat()
if (Details.tabela_overall.data_inicio == 0) then
- Details.tabela_overall.data_inicio = Details.tabela_vigente.data_inicio or 0
+ Details.tabela_overall.data_inicio = currentCombat.data_inicio or 0
end
Details.tabela_overall:seta_data(Details._detalhes_props.DATA_TYPE_END)
@@ -239,23 +254,25 @@ end
---@param combatObject combat
function segmentClass:AddCombat(combatObject)
---@type combat[]
- local segmentTable = self.tabelas
+ local segmentsTable = Details:GetCombatSegments()
---@type number
local maxSegmentsAllowed = Details.segments_amount
+ local bSegmentDestroyed = false
+
--check all instances for freeze state
- if (#segmentTable < maxSegmentsAllowed) then
+ if (#segmentsTable < maxSegmentsAllowed) then
---@type combat
- local oldestCombatObject = segmentTable[#segmentTable]
+ local oldestCombatObject = segmentsTable[#segmentsTable]
--if there's no segment stored, then this as the first segment
if (not oldestCombatObject) then
oldestCombatObject = combatObject
end
- Details:InstanciaCallFunction(Details.CheckFreeze, #segmentTable + 1, oldestCombatObject)
+ Details:InstanciaCallFunction(Details.CheckFreeze, #segmentsTable + 1, oldestCombatObject)
end
--add to the first index of the segment table
- table.insert(segmentTable, 1, combatObject)
+ table.insert(segmentsTable, 1, combatObject)
--count boss tries
---@type string
@@ -266,8 +283,8 @@ function segmentClass:AddCombat(combatObject)
if (not tryNumber) then
---@type combat
local previousCombatObject
- for i = 2, #segmentTable do
- previousCombatObject = segmentTable[i]
+ for i = 2, #segmentsTable do
+ previousCombatObject = segmentsTable[i]
if (previousCombatObject and previousCombatObject.is_boss and previousCombatObject.is_boss.name and previousCombatObject.is_boss.try_number and previousCombatObject.is_boss.name == bossName and not previousCombatObject.is_boss.killed) then
tryNumber = previousCombatObject.is_boss.try_number + 1
break
@@ -296,9 +313,9 @@ function segmentClass:AddCombat(combatObject)
end
--erase trash segments
- if (segmentTable[2]) then
+ if (segmentsTable[2]) then
---@type combat
- local previousCombatObject = segmentTable[2]
+ local previousCombatObject = segmentsTable[2]
---@type actorcontainer
local containerDamage = previousCombatObject:GetContainer(DETAILS_ATTRIBUTE_DAMAGE)
---@type actorcontainer
@@ -320,7 +337,7 @@ function segmentClass:AddCombat(combatObject)
if (Details.trash_auto_remove) then
---@type combat
- local thirdCombat = segmentTable[3]
+ local thirdCombat = segmentsTable[3]
if (thirdCombat and not thirdCombat.is_mythic_dungeon_segment) then
if ((thirdCombat.is_trash and not thirdCombat.is_boss) or(thirdCombat.is_temporary)) then
@@ -333,17 +350,18 @@ function segmentClass:AddCombat(combatObject)
end
--remove
- local combatObjectRemoved = table.remove(segmentTable, 3)
- if (combatObjectRemoved) then
+ ---@type boolean, combat
+ local bSegmentRemoved, combatObjectRemoved = Details:RemoveSegment(3)
+ if (bSegmentRemoved) then
Details:DestroyCombat(combatObjectRemoved)
- Details:SendEvent("DETAILS_DATA_SEGMENTREMOVED")
+ bSegmentDestroyed = true
end
end
end
end
end
- local segmentsTable = Details.tabela_historico.tabelas
+ local segmentsTable = Details:GetCombatSegments()
--check if the segment table is full
if (#segmentsTable > maxSegmentsAllowed) then
@@ -399,19 +417,35 @@ function segmentClass:AddCombat(combatObject)
end
--remove it
- segmentsTable = Details.tabela_historico.tabelas
- ---@type combat
- local combatObjectRemoved = table.remove(segmentsTable, segmentIdToBeRemoved)
- if (combatObjectRemoved) then
+ segmentsTable = Details:GetCombatSegments()
+ ---@type boolean, combat
+ local bSegmentRemoved, combatObjectRemoved = Details:RemoveSegment(segmentIdToBeRemoved)
+ if (bSegmentRemoved) then
Details:DestroyCombat(combatObjectRemoved)
- Details:SendEvent("DETAILS_DATA_SEGMENTREMOVED")
+ bSegmentDestroyed = true
end
end
+ ---@debug check if there's a destroyed segment within the segment container
+ local segments = Details:GetCombatSegments()
+ if (#segments > 0) then
+ for i = 1, #segments do
+ local thisCombatObject = segments[i]
+ if (thisCombatObject.__destroyed) then
+ Details:Msg("(debug) container_segments line: 419 (__destroyed combat in segments container)")
+ end
+ end
+ end
+ ---@end-debug
+
Details:InstanceCall(function(instanceObject) instanceObject:RefreshCombat() end)
--update the combat shown on all instances
Details:InstanciaCallFunction(Details.AtualizaSegmentos_AfterCombat, self)
+
+ if (bSegmentDestroyed) then
+ Details:SendEvent("DETAILS_DATA_SEGMENTREMOVED")
+ end
end
---verify if the instance is freezed, if true unfreeze it
@@ -451,7 +485,6 @@ function segmentClass:ResetOverallData()
Details:CloseBreakdownWindow()
Details:DestroyCombat(Details.tabela_overall)
- Details:SendEvent("DETAILS_DATA_SEGMENTREMOVED")
Details.tabela_overall = combatClass:NovaTabela()
for index, instanceObject in ipairs(Details:GetAllInstances()) do
@@ -471,6 +504,8 @@ function segmentClass:ResetOverallData()
--stop bar testing if any
Details:StopTestBarUpdate()
Details:ClockPluginTickOnSegment()
+
+ Details:SendEvent("DETAILS_DATA_SEGMENTREMOVED")
end
function segmentClass:ResetAllCombatData()
@@ -481,8 +516,10 @@ function segmentClass:ResetAllCombatData()
--stop bar testing if any
Details:StopTestBarUpdate()
- if (Details.tabela_vigente.verifica_combate) then --finaliza a checagem se esta ou n�o no combate
- Details:CancelTimer(Details.tabela_vigente.verifica_combate)
+ local currentCombat = Details:GetCurrentCombat()
+
+ if (currentCombat.verifica_combate) then --finaliza a checagem se esta ou n�o no combate
+ Details:CancelTimer(currentCombat.verifica_combate)
end
Details.last_closed_combat = nil
@@ -497,30 +534,30 @@ function segmentClass:ResetAllCombatData()
Details.schedule_store_boss_encounter = nil
--_detalhes.schedule_remove_overall = nil
- --fecha a janela de informa��es do jogador
+ --close breakdown window
Details:CloseBreakdownWindow()
--empty temporary tables
Details.atributo_damage:ClearTempTables()
- for i = #Details.tabela_historico.tabelas, 1, -1 do
- ---@type combat
- local combtaObjectRemoved = table.remove(Details.tabela_historico.tabelas, i)
- Details:DestroyCombat(combtaObjectRemoved)
- Details:SendEvent("DETAILS_DATA_SEGMENTREMOVED")
+ local segmentsTable = Details:GetCombatSegments()
+
+ for i = #segmentsTable, 1, -1 do
+ ---@type boolean, combat
+ local bSegmentRemoved, combatObjectRemoved = Details:RemoveSegment(i)
+ Details:DestroyCombat(combatObjectRemoved)
end
- --the current combat when finished will be moved to the first index of "tabela_historico.tabelas", need the check if the current combat was already destroyed
- if (not Details.tabela_vigente.__destroyed) then
- Details:DestroyCombat(Details.tabela_vigente)
- if (Details.tabela_vigente == Details.tabela_historico.tabelas[1]) then
- table.remove(Details.tabela_historico.tabelas, 1)
+ --the current combat when finished will be moved to the first index of "segmentsTable", need the check if the current combat was already destroyed
+ if (not currentCombat.__destroyed) then
+ Details:DestroyCombat(currentCombat)
+ if (currentCombat == segmentsTable[1]) then
+ ---@type boolean, combat
+ local bSegmentRemoved, combatObjectRemoved = Details:RemoveSegment(1)
end
- Details:SendEvent("DETAILS_DATA_SEGMENTREMOVED")
end
Details:DestroyCombat(Details.tabela_overall) --not creating a new one immediatelly
- Details:SendEvent("DETAILS_DATA_SEGMENTREMOVED")
Details:Destroy(Details.spellcache)
@@ -590,6 +627,7 @@ function segmentClass:ResetAllCombatData()
Details:RefreshMainWindow(-1) --atualiza todas as instancias
Details:SendEvent("DETAILS_DATA_RESET", nil, nil)
+ Details:SendEvent("DETAILS_DATA_SEGMENTREMOVED")
end
function Details.refresh:r_historico(este_historico)
diff --git a/core/control.lua b/core/control.lua
index d73e21fe..a2f616dc 100644
--- a/core/control.lua
+++ b/core/control.lua
@@ -48,103 +48,244 @@
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()
- local ZoneName, InstanceType, DifficultyID, _, _, _, _, ZoneMapID = GetInstanceInfo()
- local in_instance = IsInInstance() --garrison returns party as instance type.
+ function Details:FindEnemy()
+ local ZoneName, InstanceType, DifficultyID, _, _, _, _, ZoneMapID = GetInstanceInfo()
+ local in_instance = IsInInstance() --garrison returns party as instance type.
- if ((InstanceType == "party" or InstanceType == "raid") and in_instance) then
- if (InstanceType == "party") then
- if (Details:GetBossNames (Details.zone_id)) then
- return Loc ["STRING_SEGMENT_TRASH"]
- end
- else
+ if ((InstanceType == "party" or InstanceType == "raid") and in_instance) then
+ if (InstanceType == "party") then
+ if (Details:GetBossNames (Details.zone_id)) then
return Loc ["STRING_SEGMENT_TRASH"]
end
+ else
+ return Loc ["STRING_SEGMENT_TRASH"]
+ end
+ end
+
+ for _, actor in ipairs(Details.tabela_vigente[class_type_dano]._ActorTable) do
+
+ if (not actor.grupo and not actor.owner and not actor.nome:find("[*]") and bitBand(actor.flag_original, 0x00000060) ~= 0) then --0x20+0x40 neutral + enemy reaction
+ for name, _ in pairs(actor.targets) do
+ if (name == Details.playername) then
+ return actor.nome
+ else
+ local _target_actor = Details.tabela_vigente (class_type_dano, name)
+ if (_target_actor and _target_actor.grupo) then
+ return actor.nome
+ end
+ end
+ end
end
- for _, actor in ipairs(Details.tabela_vigente[class_type_dano]._ActorTable) do
+ end
- if (not actor.grupo and not actor.owner and not actor.nome:find("[*]") and bitBand(actor.flag_original, 0x00000060) ~= 0) then --0x20+0x40 neutral + enemy reaction
- for name, _ in pairs(actor.targets) do
- if (name == Details.playername) then
- return actor.nome
- else
- local _target_actor = Details.tabela_vigente (class_type_dano, name)
- if (_target_actor and _target_actor.grupo) then
- return actor.nome
+ for _, actor in ipairs(Details.tabela_vigente[class_type_dano]._ActorTable) do
+
+ if (actor.grupo and not actor.owner) then
+ for target_name, _ in pairs(actor.targets) do
+ return target_name
+ end
+ end
+
+ end
+
+ return Loc ["STRING_UNKNOW"]
+ end
+
+ -- try get the current encounter name during the encounter
+ local boss_found_not_registered = function(t, ZoneName, ZoneMapID, DifficultyID)
+
+ local boss_table = {
+ index = 0,
+ name = t[1],
+ encounter = t[1],
+ zone = ZoneName,
+ mapid = ZoneMapID,
+ diff = DifficultyID,
+ diff_string = select(4, GetInstanceInfo()),
+ ej_instance_id = t[5],
+ id = t[2],
+ bossimage = t[4],
+ }
+
+ Details.tabela_vigente.is_boss = boss_table
+ end
+
+ local boss_found = function(index, name, zone, mapid, diff, encounterid)
+
+ local mapID = C_Map.GetBestMapForUnit ("player")
+ local ejid
+ if (mapID) then
+ ejid = DetailsFramework.EncounterJournal.EJ_GetInstanceForMap (mapID)
+ end
+
+ if (not mapID) then
+ --print("Details! exeption handled: zone has no map")
+ return
+ end
+
+ if (ejid == 0) then
+ ejid = Details:GetInstanceEJID()
+ end
+
+ local boss_table = {
+ index = index,
+ name = name,
+ encounter = name,
+ zone = zone,
+ mapid = mapid,
+ diff = diff,
+ diff_string = select(4, GetInstanceInfo()),
+ ej_instance_id = ejid,
+ id = encounterid,
+ }
+
+ if (not Details:IsRaidRegistered (mapid) and Details.zone_type == "raid") then
+ local boss_list = Details:GetCurrentDungeonBossListFromEJ()
+ if (boss_list) then
+ local ActorsContainer = Details.tabela_vigente [class_type_dano]._ActorTable
+ if (ActorsContainer) then
+ for index, Actor in ipairs(ActorsContainer) do
+ if (not Actor.grupo) then
+ if (boss_list [Actor.nome]) then
+ Actor.boss = true
+ boss_table.bossimage = boss_list [Actor.nome][4]
+ break
end
end
end
end
+ end
+ end
+ Details.tabela_vigente.is_boss = boss_table
+
+ if (Details.in_combat and not Details.leaving_combat) then
+
+ --catch boss function if any
+ local bossFunction, bossFunctionType = Details:GetBossFunction (ZoneMapID, BossIndex)
+ if (bossFunction) then
+ if (bitBand(bossFunctionType, 0x1) ~= 0) then --realtime
+ Details.bossFunction = bossFunction
+ Details.tabela_vigente.bossFunction = Details:ScheduleTimer("bossFunction", 1)
+ end
end
- for _, actor in ipairs(Details.tabela_vigente[class_type_dano]._ActorTable) do
+ if (Details.zone_type ~= "raid") then
+ local endType, endData = Details:GetEncounterEnd (ZoneMapID, BossIndex)
+ if (endType and endData) then
- if (actor.grupo and not actor.owner) then
- for target_name, _ in pairs(actor.targets) do
- return target_name
+ if (Details.debug) then
+ Details:Msg("(debug) setting boss end type to:", endType)
+ end
+
+ Details.encounter_end_table.type = endType
+ Details.encounter_end_table.killed = {}
+ Details.encounter_end_table.data = {}
+
+ if (type(endData) == "table") then
+ if (Details.debug) then
+ Details:Msg("(debug) boss type is table:", endType)
+ end
+ if (endType == 1 or endType == 2) then
+ for _, npcID in ipairs(endData) do
+ Details.encounter_end_table.data [npcID] = false
+ end
+ end
+ else
+ if (endType == 1 or endType == 2) then
+ Details.encounter_end_table.data [endData] = false
+ end
end
end
-
end
-
- return Loc ["STRING_UNKNOW"]
end
- -- try get the current encounter name during the encounter
-
- local boss_found_not_registered = function(t, ZoneName, ZoneMapID, DifficultyID)
-
- local boss_table = {
- index = 0,
- name = t[1],
- encounter = t[1],
- zone = ZoneName,
- mapid = ZoneMapID,
- diff = DifficultyID,
- diff_string = select(4, GetInstanceInfo()),
- ej_instance_id = t[5],
- id = t[2],
- bossimage = t[4],
- }
-
- Details.tabela_vigente.is_boss = boss_table
+ --we the boss was found during the combat table creation, we must postpone the event trigger
+ if (not Details.tabela_vigente.IsBeingCreated) then
+ Details:SendEvent("COMBAT_BOSS_FOUND", nil, index, name)
+ Details:CheckFor_SuppressedWindowsOnEncounterFound()
end
- local boss_found = function(index, name, zone, mapid, diff, encounterid)
+ return boss_table
+ end
- local mapID = C_Map.GetBestMapForUnit ("player")
- local ejid
- if (mapID) then
- ejid = DetailsFramework.EncounterJournal.EJ_GetInstanceForMap (mapID)
+ function Details:ReadBossFrames()
+
+ if (Details.tabela_vigente.is_boss) then
+ return --no need to check
+ end
+
+ if (Details.encounter_table.name) then
+ local encounter_table = Details.encounter_table
+ return boss_found (encounter_table.index, encounter_table.name, encounter_table.zone, encounter_table.mapid, encounter_table.diff, encounter_table.id)
+ end
+
+ for index = 1, 5, 1 do
+ if (UnitExists("boss"..index)) then
+ local guid = UnitGUID("boss"..index)
+ if (guid) then
+ local serial = Details:GetNpcIdFromGuid (guid)
+
+ if (serial) then
+
+ local ZoneName, _, DifficultyID, _, _, _, _, ZoneMapID = GetInstanceInfo()
+
+ local BossIds = Details:GetBossIds (ZoneMapID)
+ if (BossIds) then
+ local BossIndex = BossIds [serial]
+
+ if (BossIndex) then
+ if (Details.debug) then
+ Details:Msg("(debug) boss found:",Details:GetBossName (ZoneMapID, BossIndex))
+ end
+
+ return boss_found (BossIndex, Details:GetBossName (ZoneMapID, BossIndex), ZoneName, ZoneMapID, DifficultyID)
+ end
+ end
+ end
+ end
end
+ end
+ end
- if (not mapID) then
- --print("Details! exeption handled: zone has no map")
- return
+ --try to get the encounter name after the encounter (can be called during the combat as well)
+ function Details:FindBoss (noJournalSearch)
+
+ if (Details.encounter_table.name) then
+ local encounter_table = Details.encounter_table
+ return boss_found (encounter_table.index, encounter_table.name, encounter_table.zone, encounter_table.mapid, encounter_table.diff, encounter_table.id)
+ end
+
+ local ZoneName, InstanceType, DifficultyID, _, _, _, _, ZoneMapID = GetInstanceInfo()
+ local BossIds = Details:GetBossIds (ZoneMapID)
+
+ if (BossIds) then
+ local BossIndex = nil
+ local ActorsContainer = Details.tabela_vigente [class_type_dano]._ActorTable
+
+ if (ActorsContainer) then
+ for index, Actor in ipairs(ActorsContainer) do
+ if (not Actor.grupo) then
+ local serial = Details:GetNpcIdFromGuid (Actor.serial)
+ if (serial) then
+ BossIndex = BossIds [serial]
+ if (BossIndex) then
+ Actor.boss = true
+ return boss_found (BossIndex, Details:GetBossName (ZoneMapID, BossIndex), ZoneName, ZoneMapID, DifficultyID)
+ end
+ end
+ end
+ end
end
+ end
- if (ejid == 0) then
- ejid = Details:GetInstanceEJID()
- end
+ noJournalSearch = true --disabling the scan on encounter journal
- local boss_table = {
- index = index,
- name = name,
- encounter = name,
- zone = zone,
- mapid = mapid,
- diff = diff,
- diff_string = select(4, GetInstanceInfo()),
- ej_instance_id = ejid,
- id = encounterid,
- }
-
- if (not Details:IsRaidRegistered (mapid) and Details.zone_type == "raid") then
+ if (not noJournalSearch) then
+ local in_instance = IsInInstance() --garrison returns party as instance type.
+ if ((InstanceType == "party" or InstanceType == "raid") and in_instance) then
local boss_list = Details:GetCurrentDungeonBossListFromEJ()
if (boss_list) then
local ActorsContainer = Details.tabela_vigente [class_type_dano]._ActorTable
@@ -153,98 +294,7 @@
if (not Actor.grupo) then
if (boss_list [Actor.nome]) then
Actor.boss = true
- boss_table.bossimage = boss_list [Actor.nome][4]
- break
- end
- end
- end
- end
- end
- end
-
- Details.tabela_vigente.is_boss = boss_table
-
- if (Details.in_combat and not Details.leaving_combat) then
-
- --catch boss function if any
- local bossFunction, bossFunctionType = Details:GetBossFunction (ZoneMapID, BossIndex)
- if (bossFunction) then
- if (bitBand(bossFunctionType, 0x1) ~= 0) then --realtime
- Details.bossFunction = bossFunction
- Details.tabela_vigente.bossFunction = Details:ScheduleTimer("bossFunction", 1)
- end
- end
-
- if (Details.zone_type ~= "raid") then
- local endType, endData = Details:GetEncounterEnd (ZoneMapID, BossIndex)
- if (endType and endData) then
-
- if (Details.debug) then
- Details:Msg("(debug) setting boss end type to:", endType)
- end
-
- Details.encounter_end_table.type = endType
- Details.encounter_end_table.killed = {}
- Details.encounter_end_table.data = {}
-
- if (type(endData) == "table") then
- if (Details.debug) then
- Details:Msg("(debug) boss type is table:", endType)
- end
- if (endType == 1 or endType == 2) then
- for _, npcID in ipairs(endData) do
- Details.encounter_end_table.data [npcID] = false
- end
- end
- else
- if (endType == 1 or endType == 2) then
- Details.encounter_end_table.data [endData] = false
- end
- end
- end
- end
- end
-
- --we the boss was found during the combat table creation, we must postpone the event trigger
- if (not Details.tabela_vigente.IsBeingCreated) then
- Details:SendEvent("COMBAT_BOSS_FOUND", nil, index, name)
- Details:CheckFor_SuppressedWindowsOnEncounterFound()
- end
-
- return boss_table
- end
-
- function Details:ReadBossFrames()
-
- if (Details.tabela_vigente.is_boss) then
- return --no need to check
- end
-
- if (Details.encounter_table.name) then
- local encounter_table = Details.encounter_table
- return boss_found (encounter_table.index, encounter_table.name, encounter_table.zone, encounter_table.mapid, encounter_table.diff, encounter_table.id)
- end
-
- for index = 1, 5, 1 do
- if (UnitExists("boss"..index)) then
- local guid = UnitGUID("boss"..index)
- if (guid) then
- local serial = Details:GetNpcIdFromGuid (guid)
-
- if (serial) then
-
- local ZoneName, _, DifficultyID, _, _, _, _, ZoneMapID = GetInstanceInfo()
-
- local BossIds = Details:GetBossIds (ZoneMapID)
- if (BossIds) then
- local BossIndex = BossIds [serial]
-
- if (BossIndex) then
- if (Details.debug) then
- Details:Msg("(debug) boss found:",Details:GetBossName (ZoneMapID, BossIndex))
- end
-
- return boss_found (BossIndex, Details:GetBossName (ZoneMapID, BossIndex), ZoneName, ZoneMapID, DifficultyID)
+ return boss_found_not_registered (boss_list [Actor.nome], ZoneName, ZoneMapID, DifficultyID)
end
end
end
@@ -252,1315 +302,1268 @@
end
end
end
+ return false
+ end
- --try to get the encounter name after the encounter (can be called during the combat as well)
- function Details:FindBoss (noJournalSearch)
-
- if (Details.encounter_table.name) then
- local encounter_table = Details.encounter_table
- return boss_found (encounter_table.index, encounter_table.name, encounter_table.zone, encounter_table.mapid, encounter_table.diff, encounter_table.id)
- end
-
- local ZoneName, InstanceType, DifficultyID, _, _, _, _, ZoneMapID = GetInstanceInfo()
- local BossIds = Details:GetBossIds (ZoneMapID)
-
- if (BossIds) then
- local BossIndex = nil
- local ActorsContainer = Details.tabela_vigente [class_type_dano]._ActorTable
-
- if (ActorsContainer) then
- for index, Actor in ipairs(ActorsContainer) do
- if (not Actor.grupo) then
- local serial = Details:GetNpcIdFromGuid (Actor.serial)
- if (serial) then
- BossIndex = BossIds [serial]
- if (BossIndex) then
- Actor.boss = true
- return boss_found (BossIndex, Details:GetBossName (ZoneMapID, BossIndex), ZoneName, ZoneMapID, DifficultyID)
- end
- end
- end
- end
+ local showTutorialForDiscardedSegment = function()
+ --tutorial about the combat time < then 'minimum_combat_time'
+ local hasSeenTutorial = Details:GetTutorialCVar("MIN_COMBAT_TIME")
+ if (not hasSeenTutorial) then
+ local lowerInstanceId = Details:GetLowerInstanceNumber()
+ if (lowerInstanceId) then
+ ---@type instance
+ local lowerInstanceObject = Details:GetInstance(lowerInstanceId)
+ if (lowerInstanceObject) then
+ lowerInstanceObject:InstanceAlert("combat ignored: less than 5 seconds.", {[[Interface\BUTTONS\UI-GROUPLOOT-PASS-DOWN]], 18, 18, false, 0, 1, 0, 1}, 20, {function() Details:Msg("combat ignored: elapsed time less than 5 seconds."); Details:Msg("add '|cFFFFFF00Details.minimum_combat_time = 2;|r' on Auto Run Code to change the minimum time.") end})
+ Details:SetTutorialCVar("MIN_COMBAT_TIME", true)
end
end
-
- noJournalSearch = true --disabling the scan on encounter journal
-
- if (not noJournalSearch) then
- local in_instance = IsInInstance() --garrison returns party as instance type.
- if ((InstanceType == "party" or InstanceType == "raid") and in_instance) then
- local boss_list = Details:GetCurrentDungeonBossListFromEJ()
- if (boss_list) then
- local ActorsContainer = Details.tabela_vigente [class_type_dano]._ActorTable
- if (ActorsContainer) then
- for index, Actor in ipairs(ActorsContainer) do
- if (not Actor.grupo) then
- if (boss_list [Actor.nome]) then
- Actor.boss = true
- return boss_found_not_registered (boss_list [Actor.nome], ZoneName, ZoneMapID, DifficultyID)
- end
- end
- end
- end
- end
- end
- end
- return false
end
+ end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--internal functions
-- Details.statistics = {container_calls = 0, container_pet_calls = 0, container_unknow_pet = 0, damage_calls = 0, heal_calls = 0, absorbs_calls = 0, energy_calls = 0, pets_summons = 0}
- function Details:StartCombat(...)
- return Details:EntrarEmCombate (...)
+ function Details:StartCombat(...)
+ return Details:EntrarEmCombate (...)
+ end
+
+ -- ~start ~inicio ~novo �ovo
+ function Details:EntrarEmCombate (...)
+ if (Details.debug) then
+ Details:Msg("(debug) |cFFFFFF00started a new combat|r|cFFFF7700", Details.encounter_table and Details.encounter_table.name or "")
+ local from = debugstack(2, 1, 0)
+ print("from:", from)
end
- -- ~start ~inicio ~novo �ovo
- function Details:EntrarEmCombate (...)
- if (Details.debug) then
- Details:Msg("(debug) |cFFFFFF00started a new combat|r|cFFFF7700", Details.encounter_table and Details.encounter_table.name or "")
- --local from = debugstack (2, 1, 0)
- --print(from)
+ local segmentsTable = Details:GetCombatSegments()
+
+ --check if there's a 'current segment in place', if not, re-create the overall data before creating the new segment
+ if (not segmentsTable[1]) then
+ Details.tabela_overall = Details.combate:NovaTabela()
+ Details:InstanciaCallFunction(Details.ResetaGump, nil, -1) --reseta scrollbar, iterators, rodap�, etc
+ Details:InstanciaCallFunction(Details.InstanciaFadeBarras, -1) --esconde todas as barras
+ Details:InstanciaCallFunction(Details.UpdateCombatObjectInUse) --atualiza o showing
+ end
+
+ --re-lock nos tempos da tabela passada -- lock again last table times
+ Details.tabela_vigente:TravarTempos()
+
+ ---@type number
+ local combatCounter = Details:GetOrSetCombatId(1) --increate the combat counter by 1
+
+ Details.tabela_vigente = Details.combate:NovaTabela (true, Details.tabela_overall, combatCounter, ...) --cria uma nova tabela de combate
+
+ --flag this combat as being created
+ Details.tabela_vigente.IsBeingCreated = true
+
+ Details.tabela_vigente:seta_data (Details._detalhes_props.DATA_TYPE_START) --seta na tabela do combate a data do inicio do combate -- setup time data
+ Details.in_combat = true --sinaliza ao addon que h� um combate em andamento -- in combat flag up
+ Details.tabela_vigente.combat_id = combatCounter --grava o n�mero deste combate na tabela atual -- setup combat id on new table
+ Details.last_combat_pre_pot_used = nil
+
+ Details:FlagCurrentCombat()
+
+ --� o timer que ve se o jogador ta em combate ou n�o -- check if any party or raid members are in combat
+ Details.tabela_vigente.verifica_combate = Details:ScheduleRepeatingTimer ("EstaEmCombate", 1)
+
+ Details:ClearCCPetsBlackList()
+
+ Details:Destroy(Details.encounter_end_table)
+
+ Details:Destroy(Details.pets_ignored)
+ Details:Destroy(Details.pets_no_owner)
+ Details.container_pets:BuscarPets()
+
+ Details:Destroy(Details.cache_damage_group)
+ Details:Destroy(Details.cache_healing_group)
+ Details:UpdateParserGears()
+
+ --get all buff already applied before the combat start
+ Details:CatchRaidBuffUptime ("BUFF_UPTIME_IN")
+ Details:CatchRaidDebuffUptime ("DEBUFF_UPTIME_IN")
+ Details:UptadeRaidMembersCache()
+
+ --Details222.TimeCapture.StartCombatTimer(Details.tabela_vigente)
+
+ --we already have boss information? build .is_boss table
+ if (Details.encounter_table.id and Details.encounter_table ["start"] >= GetTime() - 3 and not Details.encounter_table ["end"]) then
+ local encounter_table = Details.encounter_table
+ --boss_found will trigger "COMBAT_BOSS_FOUND" event, but at this point of the combat creation is safe to send it
+ boss_found (encounter_table.index, encounter_table.name, encounter_table.zone, encounter_table.mapid, encounter_table.diff, encounter_table.id)
+ else
+ --if we don't have this infor right now, lets check in few seconds dop
+ if (Details.EncounterInformation [Details.zone_id]) then
+ Details:ScheduleTimer("ReadBossFrames", 1)
+ Details:ScheduleTimer("ReadBossFrames", 30)
end
+ end
- if (not Details.tabela_historico.tabelas[1]) then
- Details.tabela_overall = Details.combate:NovaTabela()
+ --if the window is showing current segment, switch it for the new combat
+ --also if the window has auto current, jump to current segment
+ Details:InstanciaCallFunction(Details.TrocaSegmentoAtual, Details.tabela_vigente.is_boss and true)
- Details:InstanciaCallFunction(Details.ResetaGump, nil, -1) --reseta scrollbar, iterators, rodap�, etc
- Details:InstanciaCallFunction(Details.InstanciaFadeBarras, -1) --esconde todas as barras
- Details:InstanciaCallFunction(Details.UpdateCombatObjectInUse) --atualiza o showing
- end
+ --clear hosts and make the cloud capture stuff
+ Details.host_of = nil
+ Details.host_by = nil
- --re-lock nos tempos da tabela passada -- lock again last table times
- Details.tabela_vigente:TravarTempos()
-
- ---@type number
- local combatCounter = Details:GetOrSetCombatId(1) --increate the combat counter by 1
-
- --cria a nova tabela de combates -- create new table
- local ultimo_combate = Details.tabela_vigente
- Details.tabela_vigente = Details.combate:NovaTabela (true, Details.tabela_overall, combatCounter, ...) --cria uma nova tabela de combate
-
- --flag this combat as being created
- Details.tabela_vigente.IsBeingCreated = true
-
- Details.tabela_vigente:seta_data (Details._detalhes_props.DATA_TYPE_START) --seta na tabela do combate a data do inicio do combate -- setup time data
- Details.in_combat = true --sinaliza ao addon que h� um combate em andamento -- in combat flag up
- Details.tabela_vigente.combat_id = combatCounter --grava o n�mero deste combate na tabela atual -- setup combat id on new table
- Details.last_combat_pre_pot_used = nil
-
- Details:FlagCurrentCombat()
-
- --� o timer que ve se o jogador ta em combate ou n�o -- check if any party or raid members are in combat
- Details.tabela_vigente.verifica_combate = Details:ScheduleRepeatingTimer ("EstaEmCombate", 1)
-
- Details:ClearCCPetsBlackList()
-
- Details:Destroy(Details.encounter_end_table)
-
- Details:Destroy(Details.pets_ignored)
- Details:Destroy(Details.pets_no_owner)
- Details.container_pets:BuscarPets()
-
- Details:Destroy(Details.cache_damage_group)
- Details:Destroy(Details.cache_healing_group)
- Details:UpdateParserGears()
-
- --get all buff already applied before the combat start
- Details:CatchRaidBuffUptime ("BUFF_UPTIME_IN")
- Details:CatchRaidDebuffUptime ("DEBUFF_UPTIME_IN")
- Details:UptadeRaidMembersCache()
-
- --Details222.TimeCapture.StartCombatTimer(Details.tabela_vigente)
-
- --we already have boss information? build .is_boss table
- if (Details.encounter_table.id and Details.encounter_table ["start"] >= GetTime() - 3 and not Details.encounter_table ["end"]) then
- local encounter_table = Details.encounter_table
- --boss_found will trigger "COMBAT_BOSS_FOUND" event, but at this point of the combat creation is safe to send it
- boss_found (encounter_table.index, encounter_table.name, encounter_table.zone, encounter_table.mapid, encounter_table.diff, encounter_table.id)
- else
- --if we don't have this infor right now, lets check in few seconds dop
- if (Details.EncounterInformation [Details.zone_id]) then
- Details:ScheduleTimer("ReadBossFrames", 1)
- Details:ScheduleTimer("ReadBossFrames", 30)
- end
- end
-
- --if the window is showing current segment, switch it for the new combat
- --also if the window has auto current, jump to current segment
- Details:InstanciaCallFunction(Details.TrocaSegmentoAtual, Details.tabela_vigente.is_boss and true)
-
- --clear hosts and make the cloud capture stuff
- Details.host_of = nil
- Details.host_by = nil
-
- if (Details.in_group and Details.cloud_capture) then
- if (Details:IsInInstance() or Details.debug) then
- if (not Details:CaptureIsAllEnabled()) then
- Details:ScheduleSendCloudRequest()
- --if (Details.debug) then
- -- Details:Msg("(debug) requesting a cloud server.")
- --end
- end
- else
+ if (Details.in_group and Details.cloud_capture) then
+ if (Details:IsInInstance() or Details.debug) then
+ if (not Details:CaptureIsAllEnabled()) then
+ Details:ScheduleSendCloudRequest()
--if (Details.debug) then
- -- Details:Msg("(debug) isn't inside a registred instance", Details:IsInInstance())
+ -- Details:Msg("(debug) requesting a cloud server.")
--end
end
else
--if (Details.debug) then
- -- Details:Msg("(debug) isn't in group or cloud is turned off", Details.in_group, Details.cloud_capture)
+ -- Details:Msg("(debug) isn't inside a registred instance", Details:IsInInstance())
--end
end
-
- --hide / alpha / switch in combat
- for index, instancia in ipairs(Details.tabela_instancias) do
- if (instancia.ativa) then
- instancia:CheckSwitchOnCombatStart (true)
- end
- end
-
- Details:InstanceCall(Details.CheckPsUpdate)
-
- --combat creation is completed, remove the flag
- Details.tabela_vigente.IsBeingCreated = nil
-
- Details:SendEvent("COMBAT_PLAYER_ENTER", nil, Details.tabela_vigente, Details.encounter_table and Details.encounter_table.id)
-
- if (Details.tabela_vigente.is_boss) then
- --the encounter was found through encounter_start event
- Details:SendEvent("COMBAT_BOSS_FOUND", nil, Details.tabela_vigente.is_boss.index, Details.tabela_vigente.is_boss.name)
- end
-
- Details:CheckSwitchToCurrent()
- Details:CheckForTextTimeCounter (true)
-
- --stop bar testing if any
- Details:StopTestBarUpdate()
- end
-
- function Details:DelayedSyncAlert()
- local lower_instance = Details:GetLowerInstanceNumber()
- if (lower_instance) then
- lower_instance = Details:GetInstance(lower_instance)
- if (lower_instance) then
- if (not lower_instance:HaveInstanceAlert()) then
- lower_instance:InstanceAlert (Loc ["STRING_EQUILIZING"], {[[Interface\COMMON\StreamCircle]], 22, 22, true}, 5, {function() end})
- end
- end
- end
- end
-
- function Details:ScheduleSyncPlayerActorData()
- if ((IsInGroup() or IsInRaid()) and (Details.zone_type == "party" or Details.zone_type == "raid")) then
- --do not sync if in battleground or arena
- Details:SendCharacterData()
- end
- end
-
- function Details:EndCombat()
- return Details:SairDoCombate()
- end
-
- -- ~end ~leave
- function Details:SairDoCombate (bossKilled, from_encounter_end)
-
- if (Details.debug) then
- Details:Msg("(debug) |cFFFFFF00ended a combat|r|cFFFF7700", Details.encounter_table and Details.encounter_table.name or "")
- end
-
- --in case of something somehow someway call to close the same combat a second time.
- if (Details.tabela_vigente == Details.last_closed_combat) then
- return
- end
- Details.last_closed_combat = Details.tabela_vigente
-
- --if (Details.statistics) then
- -- for k, v in pairs(Details.statistics) do
- -- print(k, v)
- -- end
+ else
+ --if (Details.debug) then
+ -- Details:Msg("(debug) isn't in group or cloud is turned off", Details.in_group, Details.cloud_capture)
--end
+ end
- Details.leaving_combat = true
- Details.last_combat_time = _tempo
+ --hide / alpha / switch in combat
+ for index, instancia in ipairs(Details.tabela_instancias) do
+ if (instancia.ativa) then
+ instancia:CheckSwitchOnCombatStart (true)
+ end
+ end
- Details:CatchRaidBuffUptime ("BUFF_UPTIME_OUT")
- Details:CatchRaidDebuffUptime ("DEBUFF_UPTIME_OUT")
- Details:CloseEnemyDebuffsUptime()
+ Details:InstanceCall(Details.CheckPsUpdate)
- --Details222.TimeCapture.StopCombat()
+ --combat creation is completed, remove the flag
+ Details.tabela_vigente.IsBeingCreated = nil
- --check if this isn't a boss and try to find a boss in the segment
+ Details:SendEvent("COMBAT_PLAYER_ENTER", nil, Details.tabela_vigente, Details.encounter_table and Details.encounter_table.id)
+
+ if (Details.tabela_vigente.is_boss) then
+ --the encounter was found through encounter_start event
+ Details:SendEvent("COMBAT_BOSS_FOUND", nil, Details.tabela_vigente.is_boss.index, Details.tabela_vigente.is_boss.name)
+ end
+
+ Details:CheckSwitchToCurrent()
+ Details:CheckForTextTimeCounter (true)
+
+ --stop bar testing if any
+ Details:StopTestBarUpdate()
+ end
+
+ function Details:DelayedSyncAlert()
+ local lower_instance = Details:GetLowerInstanceNumber()
+ if (lower_instance) then
+ lower_instance = Details:GetInstance(lower_instance)
+ if (lower_instance) then
+ if (not lower_instance:HaveInstanceAlert()) then
+ lower_instance:InstanceAlert (Loc ["STRING_EQUILIZING"], {[[Interface\COMMON\StreamCircle]], 22, 22, true}, 5, {function() end})
+ end
+ end
+ end
+ end
+
+ function Details:ScheduleSyncPlayerActorData()
+ if ((IsInGroup() or IsInRaid()) and (Details.zone_type == "party" or Details.zone_type == "raid")) then
+ --do not sync if in battleground or arena
+ Details:SendCharacterData()
+ end
+ end
+
+ function Details:EndCombat()
+ return Details:SairDoCombate()
+ end
+
+ -- ~end ~leave
+ function Details:SairDoCombate (bossKilled, from_encounter_end)
+
+ if (Details.debug) then
+ Details:Msg("(debug) |cFFFFFF00ended a combat|r|cFFFF7700", Details.encounter_table and Details.encounter_table.name or "")
+ end
+
+ --in case of something somehow someway call to close the same combat a second time.
+ if (Details.tabela_vigente == Details.last_closed_combat) then
+ return
+ end
+ Details.last_closed_combat = Details.tabela_vigente
+
+ --if (Details.statistics) then
+ -- for k, v in pairs(Details.statistics) do
+ -- print(k, v)
+ -- end
+ --end
+
+ Details.leaving_combat = true
+ Details.last_combat_time = _tempo
+
+ Details:CatchRaidBuffUptime ("BUFF_UPTIME_OUT")
+ Details:CatchRaidDebuffUptime ("DEBUFF_UPTIME_OUT")
+ Details:CloseEnemyDebuffsUptime()
+
+ --Details222.TimeCapture.StopCombat()
+
+ --check if this isn't a boss and try to find a boss in the segment
+ if (not Details.tabela_vigente.is_boss) then
+
+ --if this is a mythic+ dungeon, do not scan for encounter journal boss names in the actor list
+ Details:FindBoss()
+
+ --still didn't find the boss
if (not Details.tabela_vigente.is_boss) then
-
- --if this is a mythic+ dungeon, do not scan for encounter journal boss names in the actor list
- Details:FindBoss()
-
- --still didn't find the boss
- if (not Details.tabela_vigente.is_boss) then
- local ZoneName, _, DifficultyID, _, _, _, _, ZoneMapID = GetInstanceInfo()
- local findboss = Details:GetRaidBossFindFunction (ZoneMapID)
- if (findboss) then
- local BossIndex = findboss()
- if (BossIndex) then
- boss_found (BossIndex, Details:GetBossName (ZoneMapID, BossIndex), ZoneName, ZoneMapID, DifficultyID)
- end
+ local ZoneName, _, DifficultyID, _, _, _, _, ZoneMapID = GetInstanceInfo()
+ local findboss = Details:GetRaidBossFindFunction (ZoneMapID)
+ if (findboss) then
+ local BossIndex = findboss()
+ if (BossIndex) then
+ boss_found (BossIndex, Details:GetBossName (ZoneMapID, BossIndex), ZoneName, ZoneMapID, DifficultyID)
end
end
end
+ end
- if (Details.tabela_vigente.bossFunction) then
- Details:CancelTimer(Details.tabela_vigente.bossFunction)
- Details.tabela_vigente.bossFunction = nil
- end
+ if (Details.tabela_vigente.bossFunction) then
+ Details:CancelTimer(Details.tabela_vigente.bossFunction)
+ Details.tabela_vigente.bossFunction = nil
+ end
- --finaliza a checagem se esta ou n�o no combate -- finish combat check
- if (Details.tabela_vigente.verifica_combate) then
- Details:CancelTimer(Details.tabela_vigente.verifica_combate)
- Details.tabela_vigente.verifica_combate = nil
- end
+ --finaliza a checagem se esta ou n�o no combate -- finish combat check
+ if (Details.tabela_vigente.verifica_combate) then
+ Details:CancelTimer(Details.tabela_vigente.verifica_combate)
+ Details.tabela_vigente.verifica_combate = nil
+ end
- --lock timers
- Details.tabela_vigente:TravarTempos()
+ --lock timers
+ Details.tabela_vigente:TravarTempos()
- --get waste shields
- if (Details.close_shields) then
- Details:CloseShields (Details.tabela_vigente)
- end
+ --get waste shields
+ if (Details.close_shields) then
+ Details:CloseShields (Details.tabela_vigente)
+ end
- --salva hora, minuto, segundo do fim da luta
- Details.tabela_vigente:seta_data (Details._detalhes_props.DATA_TYPE_END)
- Details.tabela_vigente:seta_tempo_decorrido()
+ --salva hora, minuto, segundo do fim da luta
+ Details.tabela_vigente:seta_data (Details._detalhes_props.DATA_TYPE_END)
+ Details.tabela_vigente:seta_tempo_decorrido()
- --drop last events table to garbage collector
- Details.tabela_vigente.player_last_events = {}
+ --drop last events table to garbage collector
+ Details.tabela_vigente.player_last_events = {}
- --flag instance type
- local _, InstanceType = GetInstanceInfo()
- Details.tabela_vigente.instance_type = InstanceType
+ --flag instance type
+ local _, InstanceType = GetInstanceInfo()
+ Details.tabela_vigente.instance_type = InstanceType
- if (not Details.tabela_vigente.is_boss and from_encounter_end and type(from_encounter_end) == "table") then
- local encounterID, encounterName, difficultyID, raidSize, endStatus = unpack(from_encounter_end)
- if (encounterID) then
- local ZoneName, InstanceType, DifficultyID, DifficultyName, _, _, _, ZoneMapID = GetInstanceInfo()
+ if (not Details.tabela_vigente.is_boss and from_encounter_end and type(from_encounter_end) == "table") then
+ local encounterID, encounterName, difficultyID, raidSize, endStatus = unpack(from_encounter_end)
+ if (encounterID) then
+ local ZoneName, InstanceType, DifficultyID, DifficultyName, _, _, _, ZoneMapID = GetInstanceInfo()
- local mapID = C_Map.GetBestMapForUnit ("player")
+ local mapID = C_Map.GetBestMapForUnit ("player")
- if (not mapID) then
- mapID = 0
- end
-
- local ejid = DetailsFramework.EncounterJournal.EJ_GetInstanceForMap (mapID)
-
- if (ejid == 0) then
- ejid = Details:GetInstanceEJID()
- end
- local _, boss_index = Details:GetBossEncounterDetailsFromEncounterId (ZoneMapID, encounterID)
-
- Details.tabela_vigente.is_boss = {
- index = boss_index or 0,
- name = encounterName,
- encounter = encounterName,
- zone = ZoneName,
- mapid = ZoneMapID,
- diff = DifficultyID,
- diff_string = DifficultyName,
- ej_instance_id = ejid or 0,
- id = encounterID,
- }
- end
- end
-
- --tag as a mythic dungeon segment, can be any type of segment, this tag also avoid the segment to be tagged as trash
- local mythicLevel = C_ChallengeMode and C_ChallengeMode.GetActiveKeystoneInfo()
- if (mythicLevel and mythicLevel >= 2) then
- Details.tabela_vigente.is_mythic_dungeon_segment = true
- Details.tabela_vigente.is_mythic_dungeon_run_id = Details.mythic_dungeon_id
- end
-
- --send item level after a combat if is in raid or party group
- C_Timer.After(1, Details.ScheduleSyncPlayerActorData)
-
- --if this segment isn't a boss fight
- if (not Details.tabela_vigente.is_boss) then
-
- if (Details.tabela_vigente.is_pvp or Details.tabela_vigente.is_arena) then
- Details:FlagActorsOnPvPCombat()
+ if (not mapID) then
+ mapID = 0
end
- if (Details.tabela_vigente.is_arena) then
- Details.tabela_vigente.enemy = "[" .. ARENA .. "] " .. Details.tabela_vigente.is_arena.name
- end
+ local ejid = DetailsFramework.EncounterJournal.EJ_GetInstanceForMap (mapID)
- local in_instance = IsInInstance() --garrison returns party as instance type.
- if ((InstanceType == "party" or InstanceType == "raid") and in_instance) then
- if (InstanceType == "party") then
- if (Details.tabela_vigente.is_mythic_dungeon_segment) then --setted just above
- --is inside a mythic+ dungeon and this is not a boss segment, so tag it as a dungeon mythic+ trash segment
- local zoneName, instanceType, difficultyID, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceMapID, instanceGroupSize = GetInstanceInfo()
- Details.tabela_vigente.is_mythic_dungeon_trash = {
- ZoneName = zoneName,
- MapID = instanceMapID,
- Level = Details.MythicPlus.Level,
- EJID = Details.MythicPlus.ejID,
- }
- else
- --tag the combat as trash clean up
- Details.tabela_vigente.is_trash = true
- end
+ if (ejid == 0) then
+ ejid = Details:GetInstanceEJID()
+ end
+ local _, boss_index = Details:GetBossEncounterDetailsFromEncounterId (ZoneMapID, encounterID)
+
+ Details.tabela_vigente.is_boss = {
+ index = boss_index or 0,
+ name = encounterName,
+ encounter = encounterName,
+ zone = ZoneName,
+ mapid = ZoneMapID,
+ diff = DifficultyID,
+ diff_string = DifficultyName,
+ ej_instance_id = ejid or 0,
+ id = encounterID,
+ }
+ end
+ end
+
+ --tag as a mythic dungeon segment, can be any type of segment, this tag also avoid the segment to be tagged as trash
+ local mythicLevel = C_ChallengeMode and C_ChallengeMode.GetActiveKeystoneInfo()
+ if (mythicLevel and mythicLevel >= 2) then
+ Details.tabela_vigente.is_mythic_dungeon_segment = true
+ Details.tabela_vigente.is_mythic_dungeon_run_id = Details.mythic_dungeon_id
+ end
+
+ --send item level after a combat if is in raid or party group
+ C_Timer.After(1, Details.ScheduleSyncPlayerActorData)
+
+ --if this segment isn't a boss fight
+ if (not Details.tabela_vigente.is_boss) then
+
+ if (Details.tabela_vigente.is_pvp or Details.tabela_vigente.is_arena) then
+ Details:FlagActorsOnPvPCombat()
+ end
+
+ if (Details.tabela_vigente.is_arena) then
+ Details.tabela_vigente.enemy = "[" .. ARENA .. "] " .. Details.tabela_vigente.is_arena.name
+ end
+
+ local in_instance = IsInInstance() --garrison returns party as instance type.
+ if ((InstanceType == "party" or InstanceType == "raid") and in_instance) then
+ if (InstanceType == "party") then
+ if (Details.tabela_vigente.is_mythic_dungeon_segment) then --setted just above
+ --is inside a mythic+ dungeon and this is not a boss segment, so tag it as a dungeon mythic+ trash segment
+ local zoneName, instanceType, difficultyID, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceMapID, instanceGroupSize = GetInstanceInfo()
+ Details.tabela_vigente.is_mythic_dungeon_trash = {
+ ZoneName = zoneName,
+ MapID = instanceMapID,
+ Level = Details.MythicPlus.Level,
+ EJID = Details.MythicPlus.ejID,
+ }
else
+ --tag the combat as trash clean up
Details.tabela_vigente.is_trash = true
end
else
- if (not in_instance) then
- if (Details.world_combat_is_trash) then
- Details.tabela_vigente.is_temporary = true
- end
- end
+ Details.tabela_vigente.is_trash = true
end
-
- if (not Details.tabela_vigente.enemy) then
- local enemy = Details:FindEnemy()
-
- if (enemy and Details.debug) then
- Details:Msg("(debug) enemy found", enemy)
- end
-
- Details.tabela_vigente.enemy = enemy
- end
-
- if (Details.debug) then
- -- Details:Msg("(debug) forcing equalize actors behavior.")
- -- Details:EqualizeActorsSchedule (Details.host_of)
- end
-
- Details:FlagActorsOnCommonFight() --fight_component
else
+ if (not in_instance) then
+ if (Details.world_combat_is_trash) then
+ Details.tabela_vigente.is_temporary = true
+ end
+ end
+ end
- --this segment is a boss fight
- if (not InCombatLockdown() and not UnitAffectingCombat("player")) then
+ if (not Details.tabela_vigente.enemy) then
+ local enemy = Details:FindEnemy()
+ if (enemy and Details.debug) then
+ Details:Msg("(debug) enemy found", enemy)
+ end
+
+ Details.tabela_vigente.enemy = enemy
+ end
+
+ if (Details.debug) then
+ -- Details:Msg("(debug) forcing equalize actors behavior.")
+ -- Details:EqualizeActorsSchedule (Details.host_of)
+ end
+
+ Details:FlagActorsOnCommonFight() --fight_component
+ else
+
+ --this segment is a boss fight
+ if (not InCombatLockdown() and not UnitAffectingCombat("player")) then
+
+ else
+ --Details.schedule_flag_boss_components = true
+ end
+
+ --calling here without checking for combat since the does not ran too long for scripts
+ Details:FlagActorsOnBossFight()
+
+ local boss_id = Details.encounter_table.id
+
+ if (bossKilled) then
+ Details.tabela_vigente.is_boss.killed = true
+
+ --add to storage
+ if (not InCombatLockdown() and not UnitAffectingCombat("player") and not Details.logoff_saving_data) then
+ local successful, errortext = pcall(Details.Database.StoreEncounter)
+ if (not successful) then
+ Details:Msg("error occurred on Details.Database.StoreEncounter():", errortext)
+ end
else
- --Details.schedule_flag_boss_components = true
+ Details.schedule_store_boss_encounter = true
end
- --calling here without checking for combat since the does not ran too long for scripts
- Details:FlagActorsOnBossFight()
+ Details:SendEvent("COMBAT_BOSS_DEFEATED", nil, Details.tabela_vigente)
- local boss_id = Details.encounter_table.id
+ Details:CheckFor_TrashSuppressionOnEncounterEnd()
+ else
+ Details:SendEvent("COMBAT_BOSS_WIPE", nil, Details.tabela_vigente)
- if (bossKilled) then
- Details.tabela_vigente.is_boss.killed = true
-
- --add to storage
- if (not InCombatLockdown() and not UnitAffectingCombat("player") and not Details.logoff_saving_data) then
- local successful, errortext = pcall(Details.Database.StoreEncounter)
- if (not successful) then
- Details:Msg("error occurred on Details.Database.StoreEncounter():", errortext)
- end
- else
- Details.schedule_store_boss_encounter = true
+ --add to storage
+ if (not InCombatLockdown() and not UnitAffectingCombat("player") and not Details.logoff_saving_data) then
+ local successful, errortext = pcall(Details.Database.StoreWipe)
+ if (not successful) then
+ Details:Msg("error occurred on Details.Database.StoreWipe():", errortext)
end
-
- Details:SendEvent("COMBAT_BOSS_DEFEATED", nil, Details.tabela_vigente)
-
- Details:CheckFor_TrashSuppressionOnEncounterEnd()
else
- Details:SendEvent("COMBAT_BOSS_WIPE", nil, Details.tabela_vigente)
-
- --add to storage
- if (not InCombatLockdown() and not UnitAffectingCombat("player") and not Details.logoff_saving_data) then
- local successful, errortext = pcall(Details.Database.StoreWipe)
- if (not successful) then
- Details:Msg("error occurred on Details.Database.StoreWipe():", errortext)
- end
- else
- Details.schedule_store_boss_encounter_wipe = true
- end
-
+ Details.schedule_store_boss_encounter_wipe = true
end
- --if (Details:GetBossDetails (Details.tabela_vigente.is_boss.mapid, Details.tabela_vigente.is_boss.index) or ) then
-
- Details.tabela_vigente.is_boss.index = Details.tabela_vigente.is_boss.index or 1
-
- Details.tabela_vigente.enemy = Details.tabela_vigente.is_boss.encounter
-
- if (Details.tabela_vigente.instance_type == "raid") then
-
- Details.last_encounter2 = Details.last_encounter
- Details.last_encounter = Details.tabela_vigente.is_boss.name
-
- if (Details.pre_pot_used) then
- Details.last_combat_pre_pot_used = Details.CopyTable(Details.pre_pot_used)
- end
-
- if (Details.pre_pot_used and Details.announce_prepots.enabled) then
- Details:Msg(Details.pre_pot_used or "")
- Details.pre_pot_used = nil
- end
- end
-
- if (from_encounter_end) then
- if (Details.encounter_table.start) then
- Details.tabela_vigente:SetStartTime (Details.encounter_table.start)
- end
- Details.tabela_vigente:SetEndTime (Details.encounter_table ["end"] or GetTime())
- end
-
- --encounter boss function
- local bossFunction, bossFunctionType = Details:GetBossFunction (Details.tabela_vigente.is_boss.mapid or 0, Details.tabela_vigente.is_boss.index or 0)
- if (bossFunction) then
- if (bitBand(bossFunctionType, 0x2) ~= 0) then --end of combat
- if (not Details.logoff_saving_data) then
- local successful, errortext = pcall(bossFunction, Details.tabela_vigente)
- if (not successful) then
- Details:Msg("error occurred on Encounter Boss Function:", errortext)
- end
- end
- end
- end
-
- if (Details.tabela_vigente.instance_type == "raid") then
- --schedule captures off
-
- Details:CaptureSet (false, "damage", false, 15)
- Details:CaptureSet (false, "energy", false, 15)
- Details:CaptureSet (false, "aura", false, 15)
- Details:CaptureSet (false, "energy", false, 15)
- Details:CaptureSet (false, "spellcast", false, 15)
-
- if (Details.debug) then
- Details:Msg("(debug) freezing parser for 15 seconds.")
- end
- end
-
- --schedule sync
- Details:EqualizeActorsSchedule (Details.host_of)
- if (Details:GetEncounterEqualize (Details.tabela_vigente.is_boss.mapid, Details.tabela_vigente.is_boss.index)) then
- Details:ScheduleTimer("DelayedSyncAlert", 3)
- end
-
- --else
- -- if (Details.debug) then
- -- Details:EqualizeActorsSchedule (Details.host_of)
- -- end
- --end
end
- if (Details.solo) then
- --debuffs need a checkup, not well functional right now
- Details.CloseSoloDebuffs()
- end
+ --if (Details:GetBossDetails (Details.tabela_vigente.is_boss.mapid, Details.tabela_vigente.is_boss.index) or ) then
- local tempo_do_combate = Details.tabela_vigente:GetCombatTime()
+ Details.tabela_vigente.is_boss.index = Details.tabela_vigente.is_boss.index or 1
- ---@type combat
- local invalidCombat
+ Details.tabela_vigente.enemy = Details.tabela_vigente.is_boss.encounter
- local zoneName, zoneType = GetInstanceInfo()
- if (not Details.tabela_vigente.discard_segment and (zoneType == "none" or tempo_do_combate >= Details.minimum_combat_time or not Details.tabela_historico.tabelas[1])) then
- --combat accepted
- Details.tabela_historico:AddCombat(Details.tabela_vigente) --move a tabela atual para dentro do hist�rico
- if (Details.tabela_vigente.is_boss) then
- if (IsInRaid()) then
- local cleuID = Details.tabela_vigente.is_boss.id
- local diff = Details.tabela_vigente.is_boss.diff
- if (cleuID and diff == 16) then -- 16 mythic
- local raidData = Details.raid_data
+ if (Details.tabela_vigente.instance_type == "raid") then
- --get or build mythic raid data table
- local mythicRaidData = raidData.mythic_raid_data
- if (not mythicRaidData) then
- mythicRaidData = {}
- raidData.mythic_raid_data = mythicRaidData
- end
+ Details.last_encounter2 = Details.last_encounter
+ Details.last_encounter = Details.tabela_vigente.is_boss.name
- --get or build a table for this cleuID
- mythicRaidData [cleuID] = mythicRaidData [cleuID] or {wipes = 0, kills = 0, best_try = 1, longest = 0, try_history = {}}
- local cleuIDData = mythicRaidData [cleuID]
-
- --store encounter data for plugins and weakauras
- if (Details.tabela_vigente:GetCombatTime() > cleuIDData.longest) then
- cleuIDData.longest = Details.tabela_vigente:GetCombatTime()
- end
-
- if (Details.tabela_vigente.is_boss.killed) then
- cleuIDData.kills = cleuIDData.kills + 1
- cleuIDData.best_try = 0
- table.insert(cleuIDData.try_history, {0, Details.tabela_vigente:GetCombatTime()})
- --print("KILL", "best try", cleuIDData.best_try, "amt kills", cleuIDData.kills, "wipes", cleuIDData.wipes, "longest", cleuIDData.longest)
- else
- cleuIDData.wipes = cleuIDData.wipes + 1
- if (Details.boss1_health_percent and Details.boss1_health_percent < cleuIDData.best_try) then
- cleuIDData.best_try = Details.boss1_health_percent
- table.insert(cleuIDData.try_history, {Details.boss1_health_percent, Details.tabela_vigente:GetCombatTime()})
- end
- --print("WIPE", "best try", cleuIDData.best_try, "amt kills", cleuIDData.kills, "wipes", cleuIDData.wipes, "longest", cleuIDData.longest)
- end
- end
+ if (Details.pre_pot_used) then
+ Details.last_combat_pre_pot_used = Details.CopyTable(Details.pre_pot_used)
end
- --
- end
- --the combat is valid, see if the user is sharing data with somebody
- if (Details.shareData) then
- local zipData = Details:CompressData (Details.tabela_vigente, "comm")
- if (zipData) then
- print("has zip data")
+ if (Details.pre_pot_used and Details.announce_prepots.enabled) then
+ Details:Msg(Details.pre_pot_used or "")
+ Details.pre_pot_used = nil
end
end
- else
- --combat did not pass the filter and cannot be added into the segment history
- invalidCombat = Details.tabela_vigente
-
- --tutorial about the combat time < then 'minimum_combat_time'
- local hasSeenTutorial = Details:GetTutorialCVar("MIN_COMBAT_TIME")
- if (not hasSeenTutorial) then
- local lowerInstanceId = Details:GetLowerInstanceNumber()
- if (lowerInstanceId) then
- ---@type instance
- local lowerInstanceObject = Details:GetInstance(lowerInstanceId)
- if (lowerInstanceObject) then
- lowerInstanceObject:InstanceAlert("combat ignored: less than 5 seconds.", {[[Interface\BUTTONS\UI-GROUPLOOT-PASS-DOWN]], 18, 18, false, 0, 1, 0, 1}, 20, {function() Details:Msg("combat ignored: elapsed time less than 5 seconds."); Details:Msg("add '|cFFFFFF00Details.minimum_combat_time = 2;|r' on Auto Run Code to change the minimum time.") end})
- Details:SetTutorialCVar("MIN_COMBAT_TIME", true)
- end
+ if (from_encounter_end) then
+ if (Details.encounter_table.start) then
+ Details.tabela_vigente:SetStartTime (Details.encounter_table.start)
end
+ Details.tabela_vigente:SetEndTime (Details.encounter_table ["end"] or GetTime())
end
- --in case of a forced discard segment, just check a second time if we have a previous combat.
- if (not Details.tabela_historico.tabelas[1]) then
- Details.tabela_vigente = Details.tabela_vigente
- else
- Details.tabela_vigente = Details.tabela_historico.tabelas[1] --get the latest combat available in the segment history
- end
-
- if (Details.tabela_vigente:GetStartTime() == 0) then
- Details.tabela_vigente:SetStartTime(GetTime())
- Details.tabela_vigente:SetEndTime(GetTime())
- end
-
- Details.tabela_vigente.resincked = true
- Details:InstanciaCallFunction(Details.AtualizarJanela)
-
- if (Details.solo) then
- if (Details.SoloTables.CombatID == Details:GetOrSetCombatId()) then --significa que o solo mode validou o combate, como matar um bixo muito low level com uma s� porrada
- if (Details.SoloTables.CombatIDLast and Details.SoloTables.CombatIDLast ~= 0) then --volta os dados da luta anterior
- Details.SoloTables.CombatID = Details.SoloTables.CombatIDLast
- else
- if (Details.RefreshSolo) then
- Details:RefreshSolo()
- end
- Details.SoloTables.CombatID = nil
- end
- end
- end
-
- Details:GetOrSetCombatId(-1)
- end
-
- Details.host_of = nil
- Details.host_by = nil
-
- if (Details.cloud_process) then
- Details:CancelTimer(Details.cloud_process)
- end
-
- Details.in_combat = false
- Details.leaving_combat = false
-
- Details:OnCombatPhaseChanged()
-
- Details:Destroy(Details.tabela_vigente.PhaseData.damage_section)
- Details:Destroy(Details.tabela_vigente.PhaseData.heal_section)
- Details:Destroy(Details.cache_damage_group)
- Details:Destroy(Details.cache_healing_group)
-
- Details:UpdateParserGears()
-
- --hide / alpha in combat
- for index, instance in ipairs(Details.tabela_instancias) do
- if (instance.ativa) then
- if (instance.auto_switch_to_old) then
- instance:CheckSwitchOnCombatEnd()
- end
- end
- end
-
- Details.pre_pot_used = nil
-
- --do not wipe the encounter table if is in the argus encounter ~REMOVE on 8.0
- if (Details.encounter_table and Details.encounter_table.id ~= 2092) then
- Details:Destroy(Details.encounter_table)
- else
- if (Details.debug) then
- Details:Msg("(debug) in argus encounter, cannot wipe the encounter table.")
- end
- end
-
- Details:InstanceCall(Details.CheckPsUpdate)
-
- if (invalidCombat) then
- Details:SendEvent("COMBAT_INVALID")
- Details:SendEvent("COMBAT_PLAYER_LEAVE", nil, invalidCombat)
- else
- Details:SendEvent("COMBAT_PLAYER_LEAVE", nil, Details.tabela_vigente)
- end
-
- Details:CheckForTextTimeCounter()
- Details.StoreSpells()
- Details:RunScheduledEventsAfterCombat()
-
- --issue: invalidCombat will be just floating around in memory if not destroyed
- end --end of leaving combat function
-
- function Details:GetPlayersInArena()
- local aliados = GetNumGroupMembers() -- LE_PARTY_CATEGORY_HOME
- for i = 1, aliados-1 do
- local role = UnitGroupRolesAssigned and UnitGroupRolesAssigned("party" .. i) or "DAMAGER"
- if (role ~= "NONE" and UnitExists("party" .. i)) then
- local name = GetUnitName("party" .. i, true)
- Details.arena_table [name] = {role = role}
- end
- end
-
- local role = UnitGroupRolesAssigned and UnitGroupRolesAssigned("player") or "DAMAGER"
- if (role ~= "NONE") then
- local name = GetUnitName("player", true)
- Details.arena_table [name] = {role = role}
- end
-
- --enemies
- local enemiesAmount = GetNumArenaOpponentSpecs and GetNumArenaOpponentSpecs() or 5
- Details:Destroy(_detalhes.arena_enemies)
-
- for i = 1, enemiesAmount do
- local enemyName = _G.GetUnitName("arena" .. i, true)
- if (enemyName) then
- _detalhes.arena_enemies[enemyName] = "arena" .. i
- end
- end
- end
-
- --attempt to get the arena unitId for an actor
- function Details:GuessArenaEnemyUnitId(unitName)
- for i = 1, 5 do
- local unitId = "arena" .. i
- local enemyName = _G.GetUnitName(unitId, true)
- if (enemyName == unitName) then
- _detalhes.arena_enemies[enemyName] = unitId
- return unitId
- end
- end
- end
-
- local string_arena_enemyteam_damage = [[
- local combat = Details:GetCombat("current")
- local total = 0
-
- for _, actor in combat[1]:ListActors() do
- if (actor.arena_enemy) then
- total = total + actor.total
- end
- end
-
- return total
- ]]
-
- local string_arena_myteam_damage = [[
- local combat = Details:GetCombat("current")
- local total = 0
-
- for _, actor in combat[1]:ListActors() do
- if (actor.arena_ally) then
- total = total + actor.total
- end
- end
-
- return total
- ]]
-
- local string_arena_enemyteam_heal = [[
- local combat = Details:GetCombat("current")
- local total = 0
-
- for _, actor in combat[2]:ListActors() do
- if (actor.arena_enemy) then
- total = total + actor.total
- end
- end
-
- return total
- ]]
-
- local string_arena_myteam_heal = [[
- local combat = Details:GetCombat("current")
- local total = 0
-
- for _, actor in combat[2]:ListActors() do
- if (actor.arena_ally) then
- total = total + actor.total
- end
- end
-
- return total
- ]]
-
- function Details:CreateArenaSegment()
- Details:GetPlayersInArena()
-
- Details.arena_begun = true
- Details.start_arena = nil
-
- if (Details.in_combat) then
- Details:SairDoCombate()
- end
-
- --registra os gr�ficos
- Details:TimeDataRegister ("Your Team Damage", string_arena_myteam_damage, nil, "Details!", "v1.0", [[Interface\ICONS\Ability_DualWield]], true, true)
- Details:TimeDataRegister ("Enemy Team Damage", string_arena_enemyteam_damage, nil, "Details!", "v1.0", [[Interface\ICONS\Ability_DualWield]], true, true)
-
- Details:TimeDataRegister ("Your Team Healing", string_arena_myteam_heal, nil, "Details!", "v1.0", [[Interface\ICONS\Ability_DualWield]], true, true)
- Details:TimeDataRegister ("Enemy Team Healing", string_arena_enemyteam_heal, nil, "Details!", "v1.0", [[Interface\ICONS\Ability_DualWield]], true, true)
-
- Details.lastArenaStartTime = GetTime()
-
- --inicia um novo combate
- Details:EntrarEmCombate()
-
- --sinaliza que esse combate � arena
- Details.tabela_vigente.arena = true
- Details.tabela_vigente.is_arena = {name = Details.zone_name, zone = Details.zone_name, mapid = Details.zone_id}
-
- Details:SendEvent("COMBAT_ARENA_START")
- end
-
- --return the GetTime() of the current or latest arena match
- function Details:GetArenaStartTime()
- return Details.lastArenaStartTime
- end
-
- function Details:GetBattlegroundStartTime()
- return Details.lastBattlegroundStartTime
- end
-
- function Details:StartArenaSegment(...)
- if (Details.debug) then
- Details:Msg("(debug) starting a new arena segment.")
- end
-
- local _, timeSeconds = select(1, ...)
-
- if (Details.start_arena) then
- Details:CancelTimer(Details.start_arena, true)
- end
- Details.start_arena = Details:ScheduleTimer("CreateArenaSegment", timeSeconds)
- Details:GetPlayersInArena()
-
- --CHAT_MSG_BG_SYSTEM_NEUTRAL - "The Arena battle has begun!""
- end
-
- function Details:EnteredInArena()
- if (Details.debug) then
- Details:Msg("(debug) the player EnteredInArena().")
- end
-
- Details.arena_begun = false
-
- Details:GetPlayersInArena()
- end
-
- function Details:LeftArena()
- if (Details.debug) then
- Details:Msg("(debug) player LeftArena().")
- end
-
- Details.is_in_arena = false
- Details.arena_begun = false
-
- if (Details.start_arena) then
- Details:CancelTimer(Details.start_arena, true)
- end
-
- Details:TimeDataUnregister ("Your Team Damage")
- Details:TimeDataUnregister ("Enemy Team Damage")
-
- Details:TimeDataUnregister ("Your Team Healing")
- Details:TimeDataUnregister ("Enemy Team Healing")
-
- Details:SendEvent("COMBAT_ARENA_END")
- end
-
- local validSpells = {
- [220893] = {class = "ROGUE", spec = 261, maxPercent = 0.075, container = 1, commID = "MISSDATA_ROGUE_SOULRIP"},
- --[11366] = {class = "MAGE", spec = 63, maxPercent = 0.9, container = 1, commID = "MISSDATA_ROGUE_SOULRIP"},
- }
-
- function Details:CanSendMissData()
- if (not IsInRaid() and not IsInGroup()) then
- return
- end
- local _, playerClass = UnitClass("player")
- local specIndex = DetailsFramework.GetSpecialization()
- local playerSpecID
- if (specIndex) then
- playerSpecID = DetailsFramework.GetSpecializationInfo(specIndex)
- end
-
- if (playerSpecID and playerClass) then
- for spellID, t in pairs(validSpells) do
- if (playerClass == t.class and playerSpecID == t.spec) then
- Details:SendMissData (spellID, t.container, Details.network.ids [t.commID])
- end
- end
- end
- return false
- end
-
- function Details:SendMissData (spellID, containerType, commID)
- local combat = Details.tabela_vigente
- if (combat) then
- local damageActor = combat (containerType, Details.playername)
- if (damageActor) then
- local spell = damageActor.spells:GetSpell (spellID)
- if (spell) then
- local data = {
- [1] = containerType,
- [2] = spellID,
- [3] = spell.total,
- [4] = spell.counter
- }
-
- if (Details.debug) then
- Details:Msg("(debug) sending miss data packet:", spellID, containerType, commID)
- end
-
- Details:SendRaidOrPartyData (commID, data)
- end
- end
- end
- end
-
- function Details.HandleMissData (playerName, data)
- local combat = Details.tabela_vigente
-
- if (Details.debug) then
- Details:Msg("(debug) miss data received from:", playerName, "spellID:", data [2], data [3], data [4])
- end
-
- if (combat) then
- local containerType = data[1]
- if (type(containerType) ~= "number" or containerType < 1 or containerType > 4) then
- return
- end
-
- local damageActor = combat (containerType, playerName)
- if (damageActor) then
- local spellID = data[2] --a spellID has been passed?
- if (not spellID or type(spellID) ~= "number") then
- return
- end
-
- local validateSpell = validSpells [spellID]
- if (not validateSpell) then --is a valid spell?
- return
- end
-
- --does the target player fit in the spell requirement on OUR end?
- local class, spec, maxPercent = validateSpell.class, validateSpell.spec, validateSpell.maxPercent
- if (class ~= damageActor.classe or spec ~= damageActor.spec) then
- return
- end
-
- local total, counter = data[3], data[4]
- if (type(total) ~= "number" or type(counter) ~= "number") then
- return
- end
-
- if (total > (damageActor.total * maxPercent)) then
- return
- end
-
- local spellObject = damageActor.spells:PegaHabilidade (spellID, true)
- if (spellObject) then
- if (spellObject.total < total and total > 0 and damageActor.nome ~= Details.playername) then
- local difference = total - spellObject.total
- if (difference > 0) then
- spellObject.total = total
- spellObject.counter = counter
- damageActor.total = damageActor.total + difference
-
- combat [containerType].need_refresh = true
-
- if (Details.debug) then
- Details:Msg("(debug) miss data successful added from:", playerName, data [2], "difference:", difference)
- end
+ --encounter boss function
+ local bossFunction, bossFunctionType = Details:GetBossFunction (Details.tabela_vigente.is_boss.mapid or 0, Details.tabela_vigente.is_boss.index or 0)
+ if (bossFunction) then
+ if (bitBand(bossFunctionType, 0x2) ~= 0) then --end of combat
+ if (not Details.logoff_saving_data) then
+ local successful, errortext = pcall(bossFunction, Details.tabela_vigente)
+ if (not successful) then
+ Details:Msg("error occurred on Encounter Boss Function:", errortext)
end
end
end
end
- end
- end
- function Details:MakeEqualizeOnActor (player, realm, receivedActor)
+ if (Details.tabela_vigente.instance_type == "raid") then
+ --schedule captures off
- if (true) then --disabled for testing
- return
- end
+ Details:CaptureSet (false, "damage", false, 15)
+ Details:CaptureSet (false, "energy", false, 15)
+ Details:CaptureSet (false, "aura", false, 15)
+ Details:CaptureSet (false, "energy", false, 15)
+ Details:CaptureSet (false, "spellcast", false, 15)
- local combat = Details:GetCombat("current")
- local damage, heal, energy, misc = Details:GetAllActors("current", player)
-
- if (not damage and not heal and not energy and not misc) then
-
- --try adding server name
- damage, heal, energy, misc = Details:GetAllActors("current", player.."-"..realm)
-
- if (not damage and not heal and not energy and not misc) then
- --not found any actor object, so we need to create
-
- local actorName
-
- if (realm ~= GetRealmName()) then
- actorName = player.."-"..realm
- else
- actorName = player
- end
-
- local guid = Details:FindGUIDFromName (player)
-
- -- 0x512 normal party
- -- 0x514 normal raid
-
- if (guid) then
- damage = combat [1]:PegarCombatente (guid, actorName, 0x514, true)
- heal = combat [2]:PegarCombatente (guid, actorName, 0x514, true)
- energy = combat [3]:PegarCombatente (guid, actorName, 0x514, true)
- misc = combat [4]:PegarCombatente (guid, actorName, 0x514, true)
-
- if (Details.debug) then
- Details:Msg("(debug) equalize received actor:", actorName, damage, heal)
- end
- else
- if (Details.debug) then
- Details:Msg("(debug) equalize couldn't get guid for player ",player)
- end
- end
- end
- end
-
- combat[1].need_refresh = true
- combat[2].need_refresh = true
- combat[3].need_refresh = true
- combat[4].need_refresh = true
-
- if (damage) then
- if (damage.total < receivedActor [1][1]) then
if (Details.debug) then
- Details:Msg(player .. " damage before: " .. damage.total .. " damage received: " .. receivedActor [1][1])
- end
- damage.total = receivedActor [1][1]
- end
- if (damage.damage_taken < receivedActor [1][2]) then
- damage.damage_taken = receivedActor [1][2]
- end
- if (damage.friendlyfire_total < receivedActor [1][3]) then
- damage.friendlyfire_total = receivedActor [1][3]
- end
- end
-
- if (heal) then
- if (heal.total < receivedActor [2][1]) then
- heal.total = receivedActor [2][1]
- end
- if (heal.totalover < receivedActor [2][2]) then
- heal.totalover = receivedActor [2][2]
- end
- if (heal.healing_taken < receivedActor [2][3]) then
- heal.healing_taken = receivedActor [2][3]
- end
- end
-
- if (energy) then
- if (energy.mana and (receivedActor [3][1] > 0 and energy.mana < receivedActor [3][1])) then
- energy.mana = receivedActor [3][1]
- end
- if (energy.e_rage and (receivedActor [3][2] > 0 and energy.e_rage < receivedActor [3][2])) then
- energy.e_rage = receivedActor [3][2]
- end
- if (energy.e_energy and (receivedActor [3][3] > 0 and energy.e_energy < receivedActor [3][3])) then
- energy.e_energy = receivedActor [3][3]
- end
- if (energy.runepower and (receivedActor [3][4] > 0 and energy.runepower < receivedActor [3][4])) then
- energy.runepower = receivedActor [3][4]
- end
- end
-
- if (misc) then
- if (misc.interrupt and (receivedActor [4][1] > 0 and misc.interrupt < receivedActor [4][1])) then
- misc.interrupt = receivedActor [4][1]
- end
- if (misc.dispell and (receivedActor [4][2] > 0 and misc.dispell < receivedActor [4][2])) then
- misc.dispell = receivedActor [4][2]
- end
- end
- end
-
- function Details:EqualizePets()
- --check for pets without owner
- for _, actor in ipairs(Details.tabela_vigente[1]._ActorTable) do
- --have flag and the flag tell us he is a pet
- if (actor.flag_original and bit.band(actor.flag_original, OBJECT_TYPE_PETS) ~= 0) then
- --do not have owner and he isn't on owner container
- if (not actor.owner and not Details.tabela_pets.pets [actor.serial]) then
- Details:SendPetOwnerRequest (actor.serial, actor.nome)
+ Details:Msg("(debug) freezing parser for 15 seconds.")
end
end
- end
- end
- function Details:EqualizeActorsSchedule (host_of)
+ --schedule sync
+ Details:EqualizeActorsSchedule (Details.host_of)
+ if (Details:GetEncounterEqualize (Details.tabela_vigente.is_boss.mapid, Details.tabela_vigente.is_boss.index)) then
+ Details:ScheduleTimer("DelayedSyncAlert", 3)
+ end
- --store pets sent through 'needpetowner'
- Details.sent_pets = Details.sent_pets or {n = time()}
- if (Details.sent_pets.n+20 < time()) then
- Details:Destroy(Details.sent_pets)
- Details.sent_pets.n = time()
- end
-
- --pet equilize disabled on details 1.4.0
- --Details:ScheduleTimer("EqualizePets", 1+math.random())
-
- --do not equilize if there is any disabled capture
- --if (Details:CaptureIsAllEnabled()) then
- Details:ScheduleTimer("EqualizeActors", 2+math.random()+math.random() , host_of)
+ --else
+ -- if (Details.debug) then
+ -- Details:EqualizeActorsSchedule (Details.host_of)
+ -- end
--end
end
- function Details:EqualizeActors (host_of)
+ if (Details.solo) then
+ --debuffs need a checkup, not well functional right now
+ Details.CloseSoloDebuffs()
+ end
- --Disabling the sync. Since WoD combatlog are sent between player on phased zones during encounters.
- if (not host_of or true) then --full disabled for testing
+ local tempo_do_combate = Details.tabela_vigente:GetCombatTime()
+
+ ---@type combat
+ local invalidCombat
+
+ local segmentsTable = Details:GetCombatSegments()
+
+ --to force discard, the segmentsTable must have at least on segment
+ local bShouldForceDiscard = Details222.discardSegment and segmentsTable[1] and true
+
+ local zoneName, zoneType = GetInstanceInfo()
+ if (not bShouldForceDiscard and (zoneType == "none" or tempo_do_combate >= Details.minimum_combat_time or not segmentsTable[1])) then
+ --combat accepted
+ Details.tabela_historico:AddCombat(Details.tabela_vigente) --move a tabela atual para dentro do hist�rico
+ if (Details.tabela_vigente.is_boss) then
+ if (IsInRaid()) then
+ local cleuID = Details.tabela_vigente.is_boss.id
+ local diff = Details.tabela_vigente.is_boss.diff
+ if (cleuID and diff == 16) then -- 16 mythic
+ local raidData = Details.raid_data
+
+ --get or build mythic raid data table
+ local mythicRaidData = raidData.mythic_raid_data
+ if (not mythicRaidData) then
+ mythicRaidData = {}
+ raidData.mythic_raid_data = mythicRaidData
+ end
+
+ --get or build a table for this cleuID
+ mythicRaidData [cleuID] = mythicRaidData [cleuID] or {wipes = 0, kills = 0, best_try = 1, longest = 0, try_history = {}}
+ local cleuIDData = mythicRaidData [cleuID]
+
+ --store encounter data for plugins and weakauras
+ if (Details.tabela_vigente:GetCombatTime() > cleuIDData.longest) then
+ cleuIDData.longest = Details.tabela_vigente:GetCombatTime()
+ end
+
+ if (Details.tabela_vigente.is_boss.killed) then
+ cleuIDData.kills = cleuIDData.kills + 1
+ cleuIDData.best_try = 0
+ table.insert(cleuIDData.try_history, {0, Details.tabela_vigente:GetCombatTime()})
+ --print("KILL", "best try", cleuIDData.best_try, "amt kills", cleuIDData.kills, "wipes", cleuIDData.wipes, "longest", cleuIDData.longest)
+ else
+ cleuIDData.wipes = cleuIDData.wipes + 1
+ if (Details.boss1_health_percent and Details.boss1_health_percent < cleuIDData.best_try) then
+ cleuIDData.best_try = Details.boss1_health_percent
+ table.insert(cleuIDData.try_history, {Details.boss1_health_percent, Details.tabela_vigente:GetCombatTime()})
+ end
+ --print("WIPE", "best try", cleuIDData.best_try, "amt kills", cleuIDData.kills, "wipes", cleuIDData.wipes, "longest", cleuIDData.longest)
+ end
+ end
+ end
+ --
+ end
+
+ --the combat is valid, see if the user is sharing data with somebody
+ if (Details.shareData) then
+ local zipData = Details:CompressData (Details.tabela_vigente, "comm")
+ if (zipData) then
+ print("has zip data")
+ end
+ end
+
+ else
+ --combat denied: combat did not pass the filter and cannot be added into the segment history
+ showTutorialForDiscardedSegment()
+
+ --change the current combat to the latest combat available in the segment table
+ invalidCombat = Details.tabela_vigente
+ Details.tabela_vigente = segmentsTable[1]
+
+ if (Details.tabela_vigente:GetStartTime() == 0) then
+ Details.tabela_vigente:SetStartTime(GetTime())
+ Details.tabela_vigente:SetEndTime(GetTime())
+ end
+
+ Details.tabela_vigente.resincked = true
+ Details:InstanciaCallFunction(Details.AtualizarJanela)
+
+ if (Details.solo) then --code to update "solo" plugins, there's no solo plugins for details! at the moment
+ if (Details.SoloTables.CombatID == Details:GetOrSetCombatId()) then --significa que o solo mode validou o combate, como matar um bixo muito low level com uma s� porrada
+ if (Details.SoloTables.CombatIDLast and Details.SoloTables.CombatIDLast ~= 0) then --volta os dados da luta anterior
+ Details.SoloTables.CombatID = Details.SoloTables.CombatIDLast
+ else
+ if (Details.RefreshSolo) then
+ Details:RefreshSolo()
+ end
+ Details.SoloTables.CombatID = nil
+ end
+ end
+ end
+
+ Details:GetOrSetCombatId(-1)
+ end
+
+ Details222.discardSegment = nil
+
+ Details.host_of = nil
+ Details.host_by = nil
+
+ if (Details.cloud_process) then
+ Details:CancelTimer(Details.cloud_process)
+ end
+
+ Details.in_combat = false
+ Details.leaving_combat = false
+
+ Details:OnCombatPhaseChanged() --.PhaseData is nil
+
+ Details:Destroy(Details.tabela_vigente.PhaseData.damage_section)
+ Details:Destroy(Details.tabela_vigente.PhaseData.heal_section)
+ Details:Destroy(Details.cache_damage_group)
+ Details:Destroy(Details.cache_healing_group)
+
+ Details:UpdateParserGears()
+
+ --hide / alpha in combat
+ for index, instance in ipairs(Details.tabela_instancias) do
+ if (instance.ativa) then
+ if (instance.auto_switch_to_old) then
+ instance:CheckSwitchOnCombatEnd()
+ end
+ end
+ end
+
+ Details.pre_pot_used = nil
+
+ --do not wipe the encounter table if is in the argus encounter ~REMOVE on 8.0
+ if (Details.encounter_table and Details.encounter_table.id ~= 2092) then
+ Details:Destroy(Details.encounter_table)
+ else
+ if (Details.debug) then
+ Details:Msg("(debug) in argus encounter, cannot wipe the encounter table.")
+ end
+ end
+
+ Details:InstanceCall(Details.CheckPsUpdate)
+
+ if (invalidCombat) then
+ Details:SendEvent("COMBAT_INVALID")
+ Details:SendEvent("COMBAT_PLAYER_LEAVE", nil, invalidCombat)
+ else
+ Details:SendEvent("COMBAT_PLAYER_LEAVE", nil, Details.tabela_vigente)
+ end
+
+ Details:CheckForTextTimeCounter()
+ Details.StoreSpells()
+ Details:RunScheduledEventsAfterCombat()
+
+ --issue: invalidCombat will be just floating around in memory if not destroyed
+ end --end of leaving combat function
+
+ function Details:GetPlayersInArena()
+ local aliados = GetNumGroupMembers() -- LE_PARTY_CATEGORY_HOME
+ for i = 1, aliados-1 do
+ local role = UnitGroupRolesAssigned and UnitGroupRolesAssigned("party" .. i) or "DAMAGER"
+ if (role ~= "NONE" and UnitExists("party" .. i)) then
+ local name = GetUnitName("party" .. i, true)
+ Details.arena_table [name] = {role = role}
+ end
+ end
+
+ local role = UnitGroupRolesAssigned and UnitGroupRolesAssigned("player") or "DAMAGER"
+ if (role ~= "NONE") then
+ local name = GetUnitName("player", true)
+ Details.arena_table [name] = {role = role}
+ end
+
+ --enemies
+ local enemiesAmount = GetNumArenaOpponentSpecs and GetNumArenaOpponentSpecs() or 5
+ Details:Destroy(_detalhes.arena_enemies)
+
+ for i = 1, enemiesAmount do
+ local enemyName = _G.GetUnitName("arena" .. i, true)
+ if (enemyName) then
+ _detalhes.arena_enemies[enemyName] = "arena" .. i
+ end
+ end
+ end
+
+ --attempt to get the arena unitId for an actor
+ function Details:GuessArenaEnemyUnitId(unitName)
+ for i = 1, 5 do
+ local unitId = "arena" .. i
+ local enemyName = _G.GetUnitName(unitId, true)
+ if (enemyName == unitName) then
+ _detalhes.arena_enemies[enemyName] = unitId
+ return unitId
+ end
+ end
+ end
+
+ local string_arena_enemyteam_damage = [[
+ local combat = Details:GetCombat("current")
+ local total = 0
+
+ for _, actor in combat[1]:ListActors() do
+ if (actor.arena_enemy) then
+ total = total + actor.total
+ end
+ end
+
+ return total
+ ]]
+
+ local string_arena_myteam_damage = [[
+ local combat = Details:GetCombat("current")
+ local total = 0
+
+ for _, actor in combat[1]:ListActors() do
+ if (actor.arena_ally) then
+ total = total + actor.total
+ end
+ end
+
+ return total
+ ]]
+
+ local string_arena_enemyteam_heal = [[
+ local combat = Details:GetCombat("current")
+ local total = 0
+
+ for _, actor in combat[2]:ListActors() do
+ if (actor.arena_enemy) then
+ total = total + actor.total
+ end
+ end
+
+ return total
+ ]]
+
+ local string_arena_myteam_heal = [[
+ local combat = Details:GetCombat("current")
+ local total = 0
+
+ for _, actor in combat[2]:ListActors() do
+ if (actor.arena_ally) then
+ total = total + actor.total
+ end
+ end
+
+ return total
+ ]]
+
+ function Details:CreateArenaSegment()
+ Details:GetPlayersInArena()
+
+ Details.arena_begun = true
+ Details.start_arena = nil
+
+ if (Details.in_combat) then
+ Details:SairDoCombate()
+ end
+
+ --registra os gr�ficos
+ Details:TimeDataRegister ("Your Team Damage", string_arena_myteam_damage, nil, "Details!", "v1.0", [[Interface\ICONS\Ability_DualWield]], true, true)
+ Details:TimeDataRegister ("Enemy Team Damage", string_arena_enemyteam_damage, nil, "Details!", "v1.0", [[Interface\ICONS\Ability_DualWield]], true, true)
+
+ Details:TimeDataRegister ("Your Team Healing", string_arena_myteam_heal, nil, "Details!", "v1.0", [[Interface\ICONS\Ability_DualWield]], true, true)
+ Details:TimeDataRegister ("Enemy Team Healing", string_arena_enemyteam_heal, nil, "Details!", "v1.0", [[Interface\ICONS\Ability_DualWield]], true, true)
+
+ Details.lastArenaStartTime = GetTime()
+
+ --inicia um novo combate
+ Details:EntrarEmCombate()
+
+ --sinaliza que esse combate � arena
+ Details.tabela_vigente.arena = true
+ Details.tabela_vigente.is_arena = {name = Details.zone_name, zone = Details.zone_name, mapid = Details.zone_id}
+
+ Details:SendEvent("COMBAT_ARENA_START")
+ end
+
+ --return the GetTime() of the current or latest arena match
+ function Details:GetArenaStartTime()
+ return Details.lastArenaStartTime
+ end
+
+ function Details:GetBattlegroundStartTime()
+ return Details.lastBattlegroundStartTime
+ end
+
+ function Details:StartArenaSegment(...)
+ if (Details.debug) then
+ Details:Msg("(debug) starting a new arena segment.")
+ end
+
+ local _, timeSeconds = select(1, ...)
+
+ if (Details.start_arena) then
+ Details:CancelTimer(Details.start_arena, true)
+ end
+ Details.start_arena = Details:ScheduleTimer("CreateArenaSegment", timeSeconds)
+ Details:GetPlayersInArena()
+
+ --CHAT_MSG_BG_SYSTEM_NEUTRAL - "The Arena battle has begun!""
+ end
+
+ function Details:EnteredInArena()
+ if (Details.debug) then
+ Details:Msg("(debug) the player EnteredInArena().")
+ end
+
+ Details.arena_begun = false
+
+ Details:GetPlayersInArena()
+ end
+
+ function Details:LeftArena()
+ if (Details.debug) then
+ Details:Msg("(debug) player LeftArena().")
+ end
+
+ Details.is_in_arena = false
+ Details.arena_begun = false
+
+ if (Details.start_arena) then
+ Details:CancelTimer(Details.start_arena, true)
+ end
+
+ Details:TimeDataUnregister ("Your Team Damage")
+ Details:TimeDataUnregister ("Enemy Team Damage")
+
+ Details:TimeDataUnregister ("Your Team Healing")
+ Details:TimeDataUnregister ("Enemy Team Healing")
+
+ Details:SendEvent("COMBAT_ARENA_END")
+ end
+
+ local validSpells = {
+ [220893] = {class = "ROGUE", spec = 261, maxPercent = 0.075, container = 1, commID = "MISSDATA_ROGUE_SOULRIP"},
+ --[11366] = {class = "MAGE", spec = 63, maxPercent = 0.9, container = 1, commID = "MISSDATA_ROGUE_SOULRIP"},
+ }
+
+ function Details:CanSendMissData()
+ if (not IsInRaid() and not IsInGroup()) then
+ return
+ end
+ local _, playerClass = UnitClass("player")
+ local specIndex = DetailsFramework.GetSpecialization()
+ local playerSpecID
+ if (specIndex) then
+ playerSpecID = DetailsFramework.GetSpecializationInfo(specIndex)
+ end
+
+ if (playerSpecID and playerClass) then
+ for spellID, t in pairs(validSpells) do
+ if (playerClass == t.class and playerSpecID == t.spec) then
+ Details:SendMissData (spellID, t.container, Details.network.ids [t.commID])
+ end
+ end
+ end
+ return false
+ end
+
+ function Details:SendMissData (spellID, containerType, commID)
+ local combat = Details.tabela_vigente
+ if (combat) then
+ local damageActor = combat (containerType, Details.playername)
+ if (damageActor) then
+ local spell = damageActor.spells:GetSpell (spellID)
+ if (spell) then
+ local data = {
+ [1] = containerType,
+ [2] = spellID,
+ [3] = spell.total,
+ [4] = spell.counter
+ }
+
+ if (Details.debug) then
+ Details:Msg("(debug) sending miss data packet:", spellID, containerType, commID)
+ end
+
+ Details:SendRaidOrPartyData (commID, data)
+ end
+ end
+ end
+ end
+
+ function Details.HandleMissData (playerName, data)
+ local combat = Details.tabela_vigente
+
+ if (Details.debug) then
+ Details:Msg("(debug) miss data received from:", playerName, "spellID:", data [2], data [3], data [4])
+ end
+
+ if (combat) then
+ local containerType = data[1]
+ if (type(containerType) ~= "number" or containerType < 1 or containerType > 4) then
return
end
- if (Details.debug) then
- Details:Msg("(debug) sending equilize actor data")
- end
-
- local damage, heal, energy, misc
-
- if (host_of) then
- damage, heal, energy, misc = Details:GetAllActors("current", host_of)
- else
- damage, heal, energy, misc = Details:GetAllActors("current", Details.playername)
- end
-
- if (damage) then
- damage = {damage.total or 0, damage.damage_taken or 0, damage.friendlyfire_total or 0}
- else
- damage = {0, 0, 0}
- end
-
- if (heal) then
- heal = {heal.total or 0, heal.totalover or 0, heal.healing_taken or 0}
- else
- heal = {0, 0, 0}
- end
-
- if (energy) then
- energy = {energy.mana or 0, energy.e_rage or 0, energy.e_energy or 0, energy.runepower or 0}
- else
- energy = {0, 0, 0, 0}
- end
-
- if (misc) then
- misc = {misc.interrupt or 0, misc.dispell or 0}
- else
- misc = {0, 0}
- end
-
- local data = {damage, heal, energy, misc}
-
- --envia os dados do proprio host pra ele antes
- if (host_of) then
- Details:SendRaidDataAs (Details.network.ids.CLOUD_EQUALIZE, host_of, nil, data)
- Details:EqualizeActors()
- else
- Details:SendRaidData (Details.network.ids.CLOUD_EQUALIZE, data)
- end
-
- end
-
- function Details:FlagActorsOnPvPCombat()
- for class_type, container in ipairs(Details.tabela_vigente) do
- for _, actor in ipairs(container._ActorTable) do
- actor.pvp_component = true
+ local damageActor = combat (containerType, playerName)
+ if (damageActor) then
+ local spellID = data[2] --a spellID has been passed?
+ if (not spellID or type(spellID) ~= "number") then
+ return
end
- end
- end
- function Details:FlagActorsOnBossFight()
- for class_type, container in ipairs(Details.tabela_vigente) do
- for _, actor in ipairs(container._ActorTable) do
- actor.boss_fight_component = true
+ local validateSpell = validSpells [spellID]
+ if (not validateSpell) then --is a valid spell?
+ return
end
- end
- end
- local fight_component = function(energy_container, misc_container, name)
- local on_energy = energy_container._ActorTable [energy_container._NameIndexTable [name]]
- if (on_energy) then
- on_energy.fight_component = true
- end
- local on_misc = misc_container._ActorTable [misc_container._NameIndexTable [name]]
- if (on_misc) then
- on_misc.fight_component = true
- end
- end
+ --does the target player fit in the spell requirement on OUR end?
+ local class, spec, maxPercent = validateSpell.class, validateSpell.spec, validateSpell.maxPercent
+ if (class ~= damageActor.classe or spec ~= damageActor.spec) then
+ return
+ end
- function Details:FlagActorsOnCommonFight()
+ local total, counter = data[3], data[4]
+ if (type(total) ~= "number" or type(counter) ~= "number") then
+ return
+ end
- local damage_container = Details.tabela_vigente [1]
- local healing_container = Details.tabela_vigente [2]
- local energy_container = Details.tabela_vigente [3]
- local misc_container = Details.tabela_vigente [4]
+ if (total > (damageActor.total * maxPercent)) then
+ return
+ end
- local mythicDungeonRun = Details.tabela_vigente.is_mythic_dungeon_segment
+ local spellObject = damageActor.spells:PegaHabilidade (spellID, true)
+ if (spellObject) then
+ if (spellObject.total < total and total > 0 and damageActor.nome ~= Details.playername) then
+ local difference = total - spellObject.total
+ if (difference > 0) then
+ spellObject.total = total
+ spellObject.counter = counter
+ damageActor.total = damageActor.total + difference
- for class_type, container in ipairs({damage_container, healing_container}) do
+ combat [containerType].need_refresh = true
- for _, actor in ipairs(container._ActorTable) do
-
- if (mythicDungeonRun) then
- actor.fight_component = true
+ if (Details.debug) then
+ Details:Msg("(debug) miss data successful added from:", playerName, data [2], "difference:", difference)
+ end
+ end
end
+ end
+ end
+ end
+ end
- if (actor.grupo) then
- if (class_type == 1 or class_type == 2) then
- for target_name, amount in pairs(actor.targets) do
- local target_object = container._ActorTable [container._NameIndexTable [target_name]]
+ function Details:MakeEqualizeOnActor (player, realm, receivedActor)
+
+ if (true) then --disabled for testing
+ return
+ end
+
+ local combat = Details:GetCombat("current")
+ local damage, heal, energy, misc = Details:GetAllActors("current", player)
+
+ if (not damage and not heal and not energy and not misc) then
+
+ --try adding server name
+ damage, heal, energy, misc = Details:GetAllActors("current", player.."-"..realm)
+
+ if (not damage and not heal and not energy and not misc) then
+ --not found any actor object, so we need to create
+
+ local actorName
+
+ if (realm ~= GetRealmName()) then
+ actorName = player.."-"..realm
+ else
+ actorName = player
+ end
+
+ local guid = Details:FindGUIDFromName (player)
+
+ -- 0x512 normal party
+ -- 0x514 normal raid
+
+ if (guid) then
+ damage = combat [1]:PegarCombatente (guid, actorName, 0x514, true)
+ heal = combat [2]:PegarCombatente (guid, actorName, 0x514, true)
+ energy = combat [3]:PegarCombatente (guid, actorName, 0x514, true)
+ misc = combat [4]:PegarCombatente (guid, actorName, 0x514, true)
+
+ if (Details.debug) then
+ Details:Msg("(debug) equalize received actor:", actorName, damage, heal)
+ end
+ else
+ if (Details.debug) then
+ Details:Msg("(debug) equalize couldn't get guid for player ",player)
+ end
+ end
+ end
+ end
+
+ combat[1].need_refresh = true
+ combat[2].need_refresh = true
+ combat[3].need_refresh = true
+ combat[4].need_refresh = true
+
+ if (damage) then
+ if (damage.total < receivedActor [1][1]) then
+ if (Details.debug) then
+ Details:Msg(player .. " damage before: " .. damage.total .. " damage received: " .. receivedActor [1][1])
+ end
+ damage.total = receivedActor [1][1]
+ end
+ if (damage.damage_taken < receivedActor [1][2]) then
+ damage.damage_taken = receivedActor [1][2]
+ end
+ if (damage.friendlyfire_total < receivedActor [1][3]) then
+ damage.friendlyfire_total = receivedActor [1][3]
+ end
+ end
+
+ if (heal) then
+ if (heal.total < receivedActor [2][1]) then
+ heal.total = receivedActor [2][1]
+ end
+ if (heal.totalover < receivedActor [2][2]) then
+ heal.totalover = receivedActor [2][2]
+ end
+ if (heal.healing_taken < receivedActor [2][3]) then
+ heal.healing_taken = receivedActor [2][3]
+ end
+ end
+
+ if (energy) then
+ if (energy.mana and (receivedActor [3][1] > 0 and energy.mana < receivedActor [3][1])) then
+ energy.mana = receivedActor [3][1]
+ end
+ if (energy.e_rage and (receivedActor [3][2] > 0 and energy.e_rage < receivedActor [3][2])) then
+ energy.e_rage = receivedActor [3][2]
+ end
+ if (energy.e_energy and (receivedActor [3][3] > 0 and energy.e_energy < receivedActor [3][3])) then
+ energy.e_energy = receivedActor [3][3]
+ end
+ if (energy.runepower and (receivedActor [3][4] > 0 and energy.runepower < receivedActor [3][4])) then
+ energy.runepower = receivedActor [3][4]
+ end
+ end
+
+ if (misc) then
+ if (misc.interrupt and (receivedActor [4][1] > 0 and misc.interrupt < receivedActor [4][1])) then
+ misc.interrupt = receivedActor [4][1]
+ end
+ if (misc.dispell and (receivedActor [4][2] > 0 and misc.dispell < receivedActor [4][2])) then
+ misc.dispell = receivedActor [4][2]
+ end
+ end
+ end
+
+ function Details:EqualizePets()
+ --check for pets without owner
+ for _, actor in ipairs(Details.tabela_vigente[1]._ActorTable) do
+ --have flag and the flag tell us he is a pet
+ if (actor.flag_original and bit.band(actor.flag_original, OBJECT_TYPE_PETS) ~= 0) then
+ --do not have owner and he isn't on owner container
+ if (not actor.owner and not Details.tabela_pets.pets [actor.serial]) then
+ Details:SendPetOwnerRequest (actor.serial, actor.nome)
+ end
+ end
+ end
+ end
+
+ function Details:EqualizeActorsSchedule (host_of)
+
+ --store pets sent through 'needpetowner'
+ Details.sent_pets = Details.sent_pets or {n = time()}
+ if (Details.sent_pets.n+20 < time()) then
+ Details:Destroy(Details.sent_pets)
+ Details.sent_pets.n = time()
+ end
+
+ --pet equilize disabled on details 1.4.0
+ --Details:ScheduleTimer("EqualizePets", 1+math.random())
+
+ --do not equilize if there is any disabled capture
+ --if (Details:CaptureIsAllEnabled()) then
+ Details:ScheduleTimer("EqualizeActors", 2+math.random()+math.random() , host_of)
+ --end
+ end
+
+ function Details:EqualizeActors (host_of)
+
+ --Disabling the sync. Since WoD combatlog are sent between player on phased zones during encounters.
+ if (not host_of or true) then --full disabled for testing
+ return
+ end
+
+ if (Details.debug) then
+ Details:Msg("(debug) sending equilize actor data")
+ end
+
+ local damage, heal, energy, misc
+
+ if (host_of) then
+ damage, heal, energy, misc = Details:GetAllActors("current", host_of)
+ else
+ damage, heal, energy, misc = Details:GetAllActors("current", Details.playername)
+ end
+
+ if (damage) then
+ damage = {damage.total or 0, damage.damage_taken or 0, damage.friendlyfire_total or 0}
+ else
+ damage = {0, 0, 0}
+ end
+
+ if (heal) then
+ heal = {heal.total or 0, heal.totalover or 0, heal.healing_taken or 0}
+ else
+ heal = {0, 0, 0}
+ end
+
+ if (energy) then
+ energy = {energy.mana or 0, energy.e_rage or 0, energy.e_energy or 0, energy.runepower or 0}
+ else
+ energy = {0, 0, 0, 0}
+ end
+
+ if (misc) then
+ misc = {misc.interrupt or 0, misc.dispell or 0}
+ else
+ misc = {0, 0}
+ end
+
+ local data = {damage, heal, energy, misc}
+
+ --envia os dados do proprio host pra ele antes
+ if (host_of) then
+ Details:SendRaidDataAs (Details.network.ids.CLOUD_EQUALIZE, host_of, nil, data)
+ Details:EqualizeActors()
+ else
+ Details:SendRaidData (Details.network.ids.CLOUD_EQUALIZE, data)
+ end
+
+ end
+
+ function Details:FlagActorsOnPvPCombat()
+ for class_type, container in ipairs(Details.tabela_vigente) do
+ for _, actor in ipairs(container._ActorTable) do
+ actor.pvp_component = true
+ end
+ end
+ end
+
+ function Details:FlagActorsOnBossFight()
+ for class_type, container in ipairs(Details.tabela_vigente) do
+ for _, actor in ipairs(container._ActorTable) do
+ actor.boss_fight_component = true
+ end
+ end
+ end
+
+ local fight_component = function(energy_container, misc_container, name)
+ local on_energy = energy_container._ActorTable [energy_container._NameIndexTable [name]]
+ if (on_energy) then
+ on_energy.fight_component = true
+ end
+ local on_misc = misc_container._ActorTable [misc_container._NameIndexTable [name]]
+ if (on_misc) then
+ on_misc.fight_component = true
+ end
+ end
+
+ function Details:FlagActorsOnCommonFight()
+
+ local damage_container = Details.tabela_vigente [1]
+ local healing_container = Details.tabela_vigente [2]
+ local energy_container = Details.tabela_vigente [3]
+ local misc_container = Details.tabela_vigente [4]
+
+ local mythicDungeonRun = Details.tabela_vigente.is_mythic_dungeon_segment
+
+ for class_type, container in ipairs({damage_container, healing_container}) do
+
+ for _, actor in ipairs(container._ActorTable) do
+
+ if (mythicDungeonRun) then
+ actor.fight_component = true
+ end
+
+ if (actor.grupo) then
+ if (class_type == 1 or class_type == 2) then
+ for target_name, amount in pairs(actor.targets) do
+ local target_object = container._ActorTable [container._NameIndexTable [target_name]]
+ if (target_object) then
+ target_object.fight_component = true
+ fight_component (energy_container, misc_container, target_name)
+ end
+ end
+ if (class_type == 1) then
+ for damager_actor, _ in pairs(actor.damage_from) do
+ local target_object = container._ActorTable [container._NameIndexTable [damager_actor]]
if (target_object) then
target_object.fight_component = true
- fight_component (energy_container, misc_container, target_name)
+ fight_component (energy_container, misc_container, damager_actor)
end
end
- if (class_type == 1) then
- for damager_actor, _ in pairs(actor.damage_from) do
- local target_object = container._ActorTable [container._NameIndexTable [damager_actor]]
- if (target_object) then
- target_object.fight_component = true
- fight_component (energy_container, misc_container, damager_actor)
- end
- end
- elseif (class_type == 2) then
- for healer_actor, _ in pairs(actor.healing_from) do
- local target_object = container._ActorTable [container._NameIndexTable [healer_actor]]
- if (target_object) then
- target_object.fight_component = true
- fight_component (energy_container, misc_container, healer_actor)
- end
+ elseif (class_type == 2) then
+ for healer_actor, _ in pairs(actor.healing_from) do
+ local target_object = container._ActorTable [container._NameIndexTable [healer_actor]]
+ if (target_object) then
+ target_object.fight_component = true
+ fight_component (energy_container, misc_container, healer_actor)
end
end
end
end
end
+ end
+ end
+ end
+
+ function Details:AtualizarJanela (instancia, _segmento)
+ if (_segmento) then --apenas atualizar janelas que estejam mostrando o segmento solicitado
+ if (_segmento == instancia.segmento) then
+ instancia:TrocaTabela(instancia, instancia.segmento, instancia.atributo, instancia.sub_atributo, true)
+ end
+ else
+ if (instancia.modo == modo_GROUP or instancia.modo == modo_ALL) then
+ instancia:TrocaTabela(instancia, instancia.segmento, instancia.atributo, instancia.sub_atributo, true)
end
end
+ end
- function Details:AtualizarJanela (instancia, _segmento)
- if (_segmento) then --apenas atualizar janelas que estejam mostrando o segmento solicitado
- if (_segmento == instancia.segmento) then
- instancia:TrocaTabela(instancia, instancia.segmento, instancia.atributo, instancia.sub_atributo, true)
- end
+ function Details:PostponeInstanceToCurrent (instance)
+ if (
+ not instance.last_interaction or
+ (
+ (instance.ativa) and
+ (instance.last_interaction+3 < _tempo) and
+ (not DetailsReportWindow or not DetailsReportWindow:IsShown()) and
+ (not Details.BreakdownWindowFrame:IsShown())
+ )
+ ) then
+ instance._postponing_current = nil
+ if (instance.segmento == 0) then
+ return Details:TrocaSegmentoAtual (instance)
else
- if (instancia.modo == modo_GROUP or instancia.modo == modo_ALL) then
- instancia:TrocaTabela(instancia, instancia.segmento, instancia.atributo, instancia.sub_atributo, true)
- end
+ return
end
end
+ if (instance.is_interacting and instance.last_interaction < _tempo) then
+ instance.last_interaction = _tempo
+ end
+ instance._postponing_current = Details:ScheduleTimer("PostponeInstanceToCurrent", 1, instance)
+ end
- function Details:PostponeInstanceToCurrent (instance)
- if (
- not instance.last_interaction or
- (
- (instance.ativa) and
- (instance.last_interaction+3 < _tempo) and
- (not DetailsReportWindow or not DetailsReportWindow:IsShown()) and
- (not Details.BreakdownWindowFrame:IsShown())
- )
- ) then
- instance._postponing_current = nil
- if (instance.segmento == 0) then
- return Details:TrocaSegmentoAtual (instance)
- else
+ function Details:TrocaSegmentoAtual (instancia, is_encounter)
+ if (instancia.segmento == 0 and instancia.baseframe and instancia.ativa) then
+
+ if (not is_encounter) then
+ if (instancia.is_interacting) then
+ if (not instancia.last_interaction or instancia.last_interaction < _tempo) then
+ instancia.last_interaction = _tempo or time()
+ end
+ end
+
+ if ((instancia.last_interaction and (instancia.last_interaction+3 > Details._tempo)) or (DetailsReportWindow and DetailsReportWindow:IsShown()) or (Details.BreakdownWindowFrame:IsShown())) then
+ --postpone
+ instancia._postponing_current = Details:ScheduleTimer("PostponeInstanceToCurrent", 1, instancia)
return
end
end
- if (instance.is_interacting and instance.last_interaction < _tempo) then
- instance.last_interaction = _tempo
- end
- instance._postponing_current = Details:ScheduleTimer("PostponeInstanceToCurrent", 1, instance)
+
+ --print("==> Changing the Segment now! - control.lua 1220")
+
+ instancia.last_interaction = _tempo - 4 --pode setar, completou o ciclo
+ instancia._postponing_current = nil
+ instancia.showing = Details.tabela_vigente
+ instancia:ResetaGump()
+ Details.FadeHandler.Fader(instancia, "in", nil, "barras")
end
+ end
- function Details:TrocaSegmentoAtual (instancia, is_encounter)
- if (instancia.segmento == 0 and instancia.baseframe and instancia.ativa) then
-
- if (not is_encounter) then
- if (instancia.is_interacting) then
- if (not instancia.last_interaction or instancia.last_interaction < _tempo) then
- instancia.last_interaction = _tempo or time()
- end
- end
-
- if ((instancia.last_interaction and (instancia.last_interaction+3 > Details._tempo)) or (DetailsReportWindow and DetailsReportWindow:IsShown()) or (Details.BreakdownWindowFrame:IsShown())) then
- --postpone
- instancia._postponing_current = Details:ScheduleTimer("PostponeInstanceToCurrent", 1, instancia)
- return
- end
- end
-
- --print("==> Changing the Segment now! - control.lua 1220")
-
- instancia.last_interaction = _tempo - 4 --pode setar, completou o ciclo
- instancia._postponing_current = nil
- instancia.showing = Details.tabela_vigente
- instancia:ResetaGump()
- Details.FadeHandler.Fader(instancia, "in", nil, "barras")
+ function Details:SetTrashSuppression (n)
+ assert(type(n) == "number", "SetTrashSuppression expects a number on index 1.")
+ if (n < 0) then
+ n = 0
+ end
+ Details.instances_suppress_trash = n
+ end
+ function Details:CheckFor_SuppressedWindowsOnEncounterFound()
+ for _, instance in Details:ListInstances() do
+ if (instance.ativa and instance.baseframe and (not instance.last_interaction or instance.last_interaction > _tempo) and instance.segmento == 0) then
+ Details:TrocaSegmentoAtual (instance, true)
end
end
-
- function Details:SetTrashSuppression (n)
- assert(type(n) == "number", "SetTrashSuppression expects a number on index 1.")
- if (n < 0) then
- n = 0
- end
- Details.instances_suppress_trash = n
+ end
+ function Details:CheckFor_EnabledTrashSuppression()
+ if (Details.HasTrashSuppression and Details.HasTrashSuppression > _tempo) then
+ self.last_interaction = Details.HasTrashSuppression
end
- function Details:CheckFor_SuppressedWindowsOnEncounterFound()
- for _, instance in Details:ListInstances() do
- if (instance.ativa and instance.baseframe and (not instance.last_interaction or instance.last_interaction > _tempo) and instance.segmento == 0) then
- Details:TrocaSegmentoAtual (instance, true)
- end
- end
- end
- function Details:CheckFor_EnabledTrashSuppression()
- if (Details.HasTrashSuppression and Details.HasTrashSuppression > _tempo) then
- self.last_interaction = Details.HasTrashSuppression
- end
- end
- function Details:SetTrashSuppressionAfterEncounter()
- Details:InstanceCall("CheckFor_EnabledTrashSuppression")
- end
- function Details:CheckFor_TrashSuppressionOnEncounterEnd()
- if (Details.instances_suppress_trash > 0) then
- Details.HasTrashSuppression = _tempo + Details.instances_suppress_trash
- --delaying in 3 seconds for other stuff like auto open windows after combat.
- Details:ScheduleTimer("SetTrashSuppressionAfterEncounter", 3)
- end
+ end
+ function Details:SetTrashSuppressionAfterEncounter()
+ Details:InstanceCall("CheckFor_EnabledTrashSuppression")
+ end
+ function Details:CheckFor_TrashSuppressionOnEncounterEnd()
+ if (Details.instances_suppress_trash > 0) then
+ Details.HasTrashSuppression = _tempo + Details.instances_suppress_trash
+ --delaying in 3 seconds for other stuff like auto open windows after combat.
+ Details:ScheduleTimer("SetTrashSuppressionAfterEncounter", 3)
end
+ end
---internal GetCombatId() version
---@param self details
@@ -1576,331 +1579,330 @@
end
--tooltip fork / search key: ~tooltip
- local avatarPoint = {"bottomleft", "topleft", -3, -4}
- local backgroundPoint = {{"bottomleft", "topleft", 0, -3}, {"bottomright", "topright", 0, -3}}
- local textPoint = {"left", "right", -11, -5}
- local avatarTexCoord = {0, 1, 0, 1}
- local backgroundColor = {0, 0, 0, 0.6}
- local avatarTextColor = {1, 1, 1, 1}
+ local avatarPoint = {"bottomleft", "topleft", -3, -4}
+ local backgroundPoint = {{"bottomleft", "topleft", 0, -3}, {"bottomright", "topright", 0, -3}}
+ local textPoint = {"left", "right", -11, -5}
+ local avatarTexCoord = {0, 1, 0, 1}
+ local backgroundColor = {0, 0, 0, 0.6}
+ local avatarTextColor = {1, 1, 1, 1}
- function Details:AddTooltipReportLineText()
- GameCooltip:AddLine (Loc ["STRING_CLICK_REPORT_LINE1"], Loc ["STRING_CLICK_REPORT_LINE2"])
- GameCooltip:AddStatusBar (100, 1, 0, 0, 0, 0.8)
+ function Details:AddTooltipReportLineText()
+ GameCooltip:AddLine (Loc ["STRING_CLICK_REPORT_LINE1"], Loc ["STRING_CLICK_REPORT_LINE2"])
+ GameCooltip:AddStatusBar (100, 1, 0, 0, 0, 0.8)
+ end
+
+ function Details:AddTooltipBackgroundStatusbar (side, value, useSpark)
+ Details.tooltip.background [4] = 0.8
+ Details.tooltip.icon_size.W = Details.tooltip.line_height
+ Details.tooltip.icon_size.H = Details.tooltip.line_height
+
+ --[[spark options
+ ["SparkTexture"] = true,
+ ["SparkHeightOffset"] = true,
+ ["SparkWidthOffset"] = true,
+ ["SparkHeight"] = true,
+ ["SparkWidth"] = true,
+ ["SparkAlpha"] = true,
+ ["SparkColor"] = true,
+ ["SparkPositionXOffset"] = true,
+ ["SparkPositionYOffset"] = true,
+ --]]
+
+ useSpark = true
+ --GameCooltip:SetOption("SparkHeightOffset", 6)
+ GameCooltip:SetOption("SparkTexture", [[Interface\Buttons\WHITE8X8]])
+ GameCooltip:SetOption("SparkWidth", 1)
+ GameCooltip:SetOption("SparkHeight", 20)
+ GameCooltip:SetOption("SparkColor", Details.tooltip.divisor_color)
+ GameCooltip:SetOption("SparkAlpha", 0.15)
+ GameCooltip:SetOption("SparkPositionXOffset", 5)
+ --GameCooltip:SetOption("SparkAlpha", 0.3)
+ --GameCooltip:SetOption("SparkPositionXOffset", -2)
+
+ value = value or 100
+
+ if (not side) then
+ local r, g, b, a = unpack(Details.tooltip.bar_color)
+ local rBG, gBG, bBG, aBG = unpack(Details.tooltip.background)
+ GameCooltip:AddStatusBar (value, 1, r, g, b, a, useSpark, {value = 100, color = {rBG, gBG, bBG, aBG}, texture = [[Interface\AddOns\Details\images\bar_serenity]]})
+
+ else
+ GameCooltip:AddStatusBar (value, 2, unpack(Details.tooltip.bar_color))
end
+ end
- function Details:AddTooltipBackgroundStatusbar (side, value, useSpark)
- Details.tooltip.background [4] = 0.8
- Details.tooltip.icon_size.W = Details.tooltip.line_height
- Details.tooltip.icon_size.H = Details.tooltip.line_height
-
- --[[spark options
- ["SparkTexture"] = true,
- ["SparkHeightOffset"] = true,
- ["SparkWidthOffset"] = true,
- ["SparkHeight"] = true,
- ["SparkWidth"] = true,
- ["SparkAlpha"] = true,
- ["SparkColor"] = true,
- ["SparkPositionXOffset"] = true,
- ["SparkPositionYOffset"] = true,
- --]]
-
- useSpark = true
- --GameCooltip:SetOption("SparkHeightOffset", 6)
- GameCooltip:SetOption("SparkTexture", [[Interface\Buttons\WHITE8X8]])
- GameCooltip:SetOption("SparkWidth", 1)
- GameCooltip:SetOption("SparkHeight", 20)
- GameCooltip:SetOption("SparkColor", Details.tooltip.divisor_color)
- GameCooltip:SetOption("SparkAlpha", 0.15)
- GameCooltip:SetOption("SparkPositionXOffset", 5)
- --GameCooltip:SetOption("SparkAlpha", 0.3)
- --GameCooltip:SetOption("SparkPositionXOffset", -2)
-
- value = value or 100
-
- if (not side) then
- local r, g, b, a = unpack(Details.tooltip.bar_color)
- local rBG, gBG, bBG, aBG = unpack(Details.tooltip.background)
- GameCooltip:AddStatusBar (value, 1, r, g, b, a, useSpark, {value = 100, color = {rBG, gBG, bBG, aBG}, texture = [[Interface\AddOns\Details\images\bar_serenity]]})
-
- else
- GameCooltip:AddStatusBar (value, 2, unpack(Details.tooltip.bar_color))
- end
- end
-
- function Details:AddTooltipHeaderStatusbar (r, g, b, a)
- local r, g, b, a, statusbarGlow, backgroundBar = unpack(Details.tooltip.header_statusbar)
- GameCooltip:AddStatusBar (100, 1, r, g, b, a, statusbarGlow, backgroundBar, "Skyline")
- end
+ function Details:AddTooltipHeaderStatusbar (r, g, b, a)
+ local r, g, b, a, statusbarGlow, backgroundBar = unpack(Details.tooltip.header_statusbar)
+ GameCooltip:AddStatusBar (100, 1, r, g, b, a, statusbarGlow, backgroundBar, "Skyline")
+ end
-- /run local a,b=Details.tooltip.header_statusbar,0.3;a[1]=b;a[2]=b;a[3]=b;a[4]=0.8;
- function Details:AddTooltipSpellHeaderText (headerText, headerColor, amount, iconTexture, L, R, T, B, separator, iconSize)
- if (separator and separator == true) then
- GameCooltip:AddLine ("", "", nil, nil, 1, 1, 1, 1, 8)
- return
- end
-
- if (type(iconSize) ~= "number") then
- iconSize = 14
- end
-
- if (Details.tooltip.show_amount) then
- GameCooltip:AddLine (headerText, "x" .. amount .. "", nil, headerColor, 1, 1, 1, .4, Details.tooltip.fontsize_title)
- else
- GameCooltip:AddLine (headerText, nil, nil, headerColor, nil, Details.tooltip.fontsize_title)
- end
-
- if (iconTexture) then
- GameCooltip:AddIcon (iconTexture, 1, 1, iconSize, iconSize, L or 0, R or 1, T or 0, B or 1)
- end
+ function Details:AddTooltipSpellHeaderText (headerText, headerColor, amount, iconTexture, L, R, T, B, separator, iconSize)
+ if (separator and separator == true) then
+ GameCooltip:AddLine ("", "", nil, nil, 1, 1, 1, 1, 8)
+ return
end
- local bgColor, borderColor = {0, 0, 0, 0.8}, {0, 0, 0, 0} --{0.37, 0.37, 0.37, .75}, {.30, .30, .30, .3}
-
- function Details:FormatCooltipForSpells()
- local GameCooltip = GameCooltip
-
- GameCooltip:Reset()
- GameCooltip:SetType ("tooltip")
-
- GameCooltip:SetOption("StatusBarTexture", [[Interface\AddOns\Details\images\bar_background_dark_withline]])
-
- GameCooltip:SetOption("TextSize", Details.tooltip.fontsize)
- GameCooltip:SetOption("TextFont", Details.tooltip.fontface)
- GameCooltip:SetOption("TextColor", Details.tooltip.fontcolor)
- GameCooltip:SetOption("TextColorRight", Details.tooltip.fontcolor_right)
- GameCooltip:SetOption("TextShadow", Details.tooltip.fontshadow and "OUTLINE")
-
- GameCooltip:SetOption("LeftBorderSize", -5)
- GameCooltip:SetOption("RightBorderSize", 5)
- GameCooltip:SetOption("RightTextMargin", 0)
- GameCooltip:SetOption("VerticalOffset", 9)
- GameCooltip:SetOption("AlignAsBlizzTooltip", true)
- GameCooltip:SetOption("AlignAsBlizzTooltipFrameHeightOffset", -8)
- GameCooltip:SetOption("LineHeightSizeOffset", 4)
- GameCooltip:SetOption("VerticalPadding", -4)
-
- GameCooltip:SetBackdrop(1, Details.cooltip_preset2_backdrop, bgColor, borderColor)
+ if (type(iconSize) ~= "number") then
+ iconSize = 14
end
- function Details:BuildInstanceBarTooltip (frame)
- local GameCooltip = GameCooltip
- Details:FormatCooltipForSpells()
- GameCooltip:SetOption("MinWidth", _math_max (230, self.baseframe:GetWidth()*0.98))
-
- local myPoint = Details.tooltip.anchor_point
- local anchorPoint = Details.tooltip.anchor_relative
- local x_Offset = Details.tooltip.anchor_offset[1]
- local y_Offset = Details.tooltip.anchor_offset[2]
-
- if (Details.tooltip.anchored_to == 1) then
-
- GameCooltip:SetHost (frame, myPoint, anchorPoint, x_Offset, y_Offset)
- else
- GameCooltip:SetHost (DetailsTooltipAnchor, myPoint, anchorPoint, x_Offset, y_Offset)
- end
+ if (Details.tooltip.show_amount) then
+ GameCooltip:AddLine (headerText, "x" .. amount .. "", nil, headerColor, 1, 1, 1, .4, Details.tooltip.fontsize_title)
+ else
+ GameCooltip:AddLine (headerText, nil, nil, headerColor, nil, Details.tooltip.fontsize_title)
end
- function Details:MontaTooltip(frame, whichRowLine, keydown)
+ if (iconTexture) then
+ GameCooltip:AddIcon (iconTexture, 1, 1, iconSize, iconSize, L or 0, R or 1, T or 0, B or 1)
+ end
+ end
- self:BuildInstanceBarTooltip (frame)
+ local bgColor, borderColor = {0, 0, 0, 0.8}, {0, 0, 0, 0} --{0.37, 0.37, 0.37, .75}, {.30, .30, .30, .3}
- local GameCooltip = GameCooltip
+ function Details:FormatCooltipForSpells()
+ local GameCooltip = GameCooltip
- local esta_barra = self.barras [whichRowLine] --barra que o mouse passou em cima e ir� mostrar o tooltip
- local objeto = esta_barra.minha_tabela --pega a referencia da tabela --retorna a classe_damage ou classe_heal
- if (not objeto) then --a barra n�o possui um objeto
- return false
- end
+ GameCooltip:Reset()
+ GameCooltip:SetType ("tooltip")
- --verifica por tooltips especiais:
- if (objeto.dead) then --� uma barra de dead
- return Details:ToolTipDead (self, objeto, esta_barra, keydown) --inst�ncia, [morte], barra
- elseif (objeto.byspell) then
- return Details:ToolTipBySpell (self, objeto, esta_barra, keydown)
- elseif (objeto.frags) then
- return Details:ToolTipFrags (self, objeto, esta_barra, keydown)
- elseif (objeto.boss_debuff) then
- return Details:ToolTipVoidZones (self, objeto, esta_barra, keydown)
- end
+ GameCooltip:SetOption("StatusBarTexture", [[Interface\AddOns\Details\images\bar_background_dark_withline]])
- local t = objeto:ToolTip (self, whichRowLine, esta_barra, keydown) --inst�ncia, n� barra, objeto barra, keydown
+ GameCooltip:SetOption("TextSize", Details.tooltip.fontsize)
+ GameCooltip:SetOption("TextFont", Details.tooltip.fontface)
+ GameCooltip:SetOption("TextColor", Details.tooltip.fontcolor)
+ GameCooltip:SetOption("TextColorRight", Details.tooltip.fontcolor_right)
+ GameCooltip:SetOption("TextShadow", Details.tooltip.fontshadow and "OUTLINE")
- if (t) then
+ GameCooltip:SetOption("LeftBorderSize", -5)
+ GameCooltip:SetOption("RightBorderSize", 5)
+ GameCooltip:SetOption("RightTextMargin", 0)
+ GameCooltip:SetOption("VerticalOffset", 9)
+ GameCooltip:SetOption("AlignAsBlizzTooltip", true)
+ GameCooltip:SetOption("AlignAsBlizzTooltipFrameHeightOffset", -8)
+ GameCooltip:SetOption("LineHeightSizeOffset", 4)
+ GameCooltip:SetOption("VerticalPadding", -4)
- if (objeto.serial and objeto.serial ~= "") then
- local avatar = NickTag:GetNicknameTable (objeto.serial, true)
- if (avatar and not Details.ignore_nicktag) then
- if (avatar [2] and avatar [4] and avatar [1]) then
- GameCooltip:SetBannerImage (1, 1, avatar [2], 80, 40, avatarPoint, avatarTexCoord, nil) --overlay [2] avatar path
- GameCooltip:SetBannerImage (1, 2, avatar [4], 200, 55, backgroundPoint, avatar [5], avatar [6]) --background
- GameCooltip:SetBannerText (1, 1, (not Details.ignore_nicktag and avatar [1]) or objeto.nome, textPoint, avatarTextColor, 14, SharedMedia:Fetch ("font", Details.tooltip.fontface)) --text [1] nickname
- end
+ GameCooltip:SetBackdrop(1, Details.cooltip_preset2_backdrop, bgColor, borderColor)
+ end
+
+ function Details:BuildInstanceBarTooltip (frame)
+ local GameCooltip = GameCooltip
+ Details:FormatCooltipForSpells()
+ GameCooltip:SetOption("MinWidth", _math_max (230, self.baseframe:GetWidth()*0.98))
+
+ local myPoint = Details.tooltip.anchor_point
+ local anchorPoint = Details.tooltip.anchor_relative
+ local x_Offset = Details.tooltip.anchor_offset[1]
+ local y_Offset = Details.tooltip.anchor_offset[2]
+
+ if (Details.tooltip.anchored_to == 1) then
+
+ GameCooltip:SetHost (frame, myPoint, anchorPoint, x_Offset, y_Offset)
+ else
+ GameCooltip:SetHost (DetailsTooltipAnchor, myPoint, anchorPoint, x_Offset, y_Offset)
+ end
+ end
+
+ function Details:MontaTooltip(frame, whichRowLine, keydown)
+
+ self:BuildInstanceBarTooltip (frame)
+
+ local GameCooltip = GameCooltip
+
+ local esta_barra = self.barras [whichRowLine] --barra que o mouse passou em cima e ir� mostrar o tooltip
+ local objeto = esta_barra.minha_tabela --pega a referencia da tabela --retorna a classe_damage ou classe_heal
+ if (not objeto) then --a barra n�o possui um objeto
+ return false
+ end
+
+ --verifica por tooltips especiais:
+ if (objeto.dead) then --� uma barra de dead
+ return Details:ToolTipDead (self, objeto, esta_barra, keydown) --inst�ncia, [morte], barra
+ elseif (objeto.byspell) then
+ return Details:ToolTipBySpell (self, objeto, esta_barra, keydown)
+ elseif (objeto.frags) then
+ return Details:ToolTipFrags (self, objeto, esta_barra, keydown)
+ elseif (objeto.boss_debuff) then
+ return Details:ToolTipVoidZones (self, objeto, esta_barra, keydown)
+ end
+
+ local t = objeto:ToolTip (self, whichRowLine, esta_barra, keydown) --inst�ncia, n� barra, objeto barra, keydown
+
+ if (t) then
+
+ if (objeto.serial and objeto.serial ~= "") then
+ local avatar = NickTag:GetNicknameTable (objeto.serial, true)
+ if (avatar and not Details.ignore_nicktag) then
+ if (avatar [2] and avatar [4] and avatar [1]) then
+ GameCooltip:SetBannerImage (1, 1, avatar [2], 80, 40, avatarPoint, avatarTexCoord, nil) --overlay [2] avatar path
+ GameCooltip:SetBannerImage (1, 2, avatar [4], 200, 55, backgroundPoint, avatar [5], avatar [6]) --background
+ GameCooltip:SetBannerText (1, 1, (not Details.ignore_nicktag and avatar [1]) or objeto.nome, textPoint, avatarTextColor, 14, SharedMedia:Fetch ("font", Details.tooltip.fontface)) --text [1] nickname
end
end
-
- GameCooltip:ShowCooltip()
end
- end
- function Details.gump:UpdateTooltip (whichRowLine, esta_barra, instancia)
- if (IsShiftKeyDown()) then
- return instancia:MontaTooltip(esta_barra, whichRowLine, "shift")
- elseif (IsControlKeyDown()) then
- return instancia:MontaTooltip(esta_barra, whichRowLine, "ctrl")
- elseif (IsAltKeyDown()) then
- return instancia:MontaTooltip(esta_barra, whichRowLine, "alt")
- else
- return instancia:MontaTooltip(esta_barra, whichRowLine)
- end
+ GameCooltip:ShowCooltip()
end
+ end
- function Details:EndRefresh (instancia, total, combatTable, showing)
- Details:EsconderBarrasNaoUsadas (instancia, showing)
+ function Details.gump:UpdateTooltip (whichRowLine, esta_barra, instancia)
+ if (IsShiftKeyDown()) then
+ return instancia:MontaTooltip(esta_barra, whichRowLine, "shift")
+ elseif (IsControlKeyDown()) then
+ return instancia:MontaTooltip(esta_barra, whichRowLine, "ctrl")
+ elseif (IsAltKeyDown()) then
+ return instancia:MontaTooltip(esta_barra, whichRowLine, "alt")
+ else
+ return instancia:MontaTooltip(esta_barra, whichRowLine)
end
+ end
- function Details:EsconderBarrasNaoUsadas (instancia, showing)
- --primeira atualiza��o ap�s uma mudan�a de segmento -- verifica se h� mais barras sendo mostradas do que o necess�rio
- --------------------
- if (instancia.v_barras) then
- --print("mostrando", instancia.rows_showing, instancia.rows_created)
- for barra_numero = instancia.rows_showing+1, instancia.rows_created do
- Details.FadeHandler.Fader(instancia.barras[barra_numero], "in")
+ function Details:EndRefresh (instancia, total, combatTable, showing)
+ Details:EsconderBarrasNaoUsadas (instancia, showing)
+ end
+
+ function Details:EsconderBarrasNaoUsadas (instancia, showing)
+ --primeira atualiza��o ap�s uma mudan�a de segmento -- verifica se h� mais barras sendo mostradas do que o necess�rio
+ --------------------
+ if (instancia.v_barras) then
+ --print("mostrando", instancia.rows_showing, instancia.rows_created)
+ for barra_numero = instancia.rows_showing+1, instancia.rows_created do
+ Details.FadeHandler.Fader(instancia.barras[barra_numero], "in")
+ end
+ instancia.v_barras = false
+
+ if (instancia.rows_showing == 0 and instancia:GetSegment() == -1) then -- -1 overall data
+ if (not instancia:IsShowingOverallDataWarning()) then
+ local tutorial = Details:GetTutorialCVar("OVERALLDATA_WARNING1") or 0
+ if ((type(tutorial) == "number") and (tutorial < 60)) then
+ Details:SetTutorialCVar ("OVERALLDATA_WARNING1", tutorial + 1)
+ instancia:ShowOverallDataWarning (true)
+ end
end
- instancia.v_barras = false
-
- if (instancia.rows_showing == 0 and instancia:GetSegment() == -1) then -- -1 overall data
- if (not instancia:IsShowingOverallDataWarning()) then
- local tutorial = Details:GetTutorialCVar("OVERALLDATA_WARNING1") or 0
- if ((type(tutorial) == "number") and (tutorial < 60)) then
- Details:SetTutorialCVar ("OVERALLDATA_WARNING1", tutorial + 1)
- instancia:ShowOverallDataWarning (true)
- end
- end
- else
- if (instancia:IsShowingOverallDataWarning()) then
- instancia:ShowOverallDataWarning (false)
- end
+ else
+ if (instancia:IsShowingOverallDataWarning()) then
+ instancia:ShowOverallDataWarning (false)
end
end
+ end
- return showing
- end
+ return showing
+ end
--call update functions
- function Details:RefreshAllMainWindows(bForceRefresh) --getting deprecated soon
- local combatObject = self.showing
+ function Details:RefreshAllMainWindows(bForceRefresh) --getting deprecated soon
+ local combatObject = self.showing
- --the the segment does not have a valid combat, freeze the window
- if (not combatObject) then
- if (not self.freezed) then
- return self:Freeze()
+ --the the segment does not have a valid combat, freeze the window
+ if (not combatObject) then
+ if (not self.freezed) then
+ return self:Freeze()
+ end
+ return
+ end
+
+ local needRefresh = combatObject[self.atributo].need_refresh --erro de index nil value
+ if (not needRefresh and not bForceRefresh) then
+ return
+ end
+
+ --measure the cpu time spent on this function
+ --local startTime = debugprofilestop()
+
+ if (self.atributo == 1) then --damage
+ --[[return]] atributo_damage:RefreshWindow(self, combatObject, bForceRefresh, nil, needRefresh)
+
+ elseif (self.atributo == 2) then --heal
+ --[[return]] atributo_heal:RefreshWindow(self, combatObject, bForceRefresh, nil, needRefresh)
+
+ elseif (self.atributo == 3) then --energy
+ --[[return]] atributo_energy:RefreshWindow(self, combatObject, bForceRefresh, nil, needRefresh)
+
+ elseif (self.atributo == 4) then --outros
+ --[[return]] atributo_misc:RefreshWindow(self, combatObject, bForceRefresh, nil, needRefresh)
+
+ elseif (self.atributo == 5) then --ocustom
+ --[[return]] atributo_custom:RefreshWindow(self, combatObject, bForceRefresh, nil, needRefresh)
+ end
+
+ --[[if (Details222.Perf.WindowUpdateC) then
+ local elapsedTime = debugprofilestop() - startTime
+ if (Details222.Perf.WindowUpdate) then
+ Details222.Perf.WindowUpdate = Details222.Perf.WindowUpdate + elapsedTime
+ end
+ end--]]
+ end
+
+ --["1"] = "WindowUpdate",
+ --["2"] = 308.6662000129,
+ function Details:DumpPerf()
+ local t = {}
+ for name, value in pairs(Details222.Perf) do
+ t[#t+1] = {name, value}
+ end
+ dumpt(t)
+ end
+
+ function Details:ForceRefresh()
+ self:RefreshMainWindow(true)
+ end
+
+ function Details:RefreshMainWindow(instanceObject, bForceRefresh) --getting deprecated soon
+ if (not instanceObject or type(instanceObject) == "boolean") then
+ bForceRefresh = instanceObject
+ instanceObject = self
+ end
+
+ if (not bForceRefresh) then
+ Details.LastUpdateTick = Details._tempo
+ end
+
+ if (instanceObject == -1) then
+ --update
+ for index, thisInstance in ipairs(Details.tabela_instancias) do
+ ---@cast thisInstance instance
+ if (thisInstance:IsEnabled()) then
+ if (thisInstance:GetMode() == DETAILS_MODE_GROUP or thisInstance:GetMode() == DETAILS_MODE_ALL) then
+ thisInstance:RefreshData(bForceRefresh)
+ end
end
- return
end
- local needRefresh = combatObject[self.atributo].need_refresh --erro de index nil value
- if (not needRefresh and not bForceRefresh) then
- return
- end
-
- --measure the cpu time spent on this function
- --local startTime = debugprofilestop()
-
- if (self.atributo == 1) then --damage
- --[[return]] atributo_damage:RefreshWindow(self, combatObject, bForceRefresh, nil, needRefresh)
-
- elseif (self.atributo == 2) then --heal
- --[[return]] atributo_heal:RefreshWindow(self, combatObject, bForceRefresh, nil, needRefresh)
-
- elseif (self.atributo == 3) then --energy
- --[[return]] atributo_energy:RefreshWindow(self, combatObject, bForceRefresh, nil, needRefresh)
-
- elseif (self.atributo == 4) then --outros
- --[[return]] atributo_misc:RefreshWindow(self, combatObject, bForceRefresh, nil, needRefresh)
-
- elseif (self.atributo == 5) then --ocustom
- --[[return]] atributo_custom:RefreshWindow(self, combatObject, bForceRefresh, nil, needRefresh)
- end
-
- --[[if (Details222.Perf.WindowUpdateC) then
- local elapsedTime = debugprofilestop() - startTime
- if (Details222.Perf.WindowUpdate) then
- Details222.Perf.WindowUpdate = Details222.Perf.WindowUpdate + elapsedTime
- end
- end--]]
- end
-
- --["1"] = "WindowUpdate",
- --["2"] = 308.6662000129,
- function Details:DumpPerf()
- local t = {}
- for name, value in pairs(Details222.Perf) do
- t[#t+1] = {name, value}
- end
- dumpt(t)
- end
-
- function Details:ForceRefresh()
- self:RefreshMainWindow(true)
- end
-
- function Details:RefreshMainWindow(instanceObject, bForceRefresh) --getting deprecated soon
- if (not instanceObject or type(instanceObject) == "boolean") then
- bForceRefresh = instanceObject
- instanceObject = self
- end
-
- if (not bForceRefresh) then
- Details.LastUpdateTick = Details._tempo
- end
-
- if (instanceObject == -1) then
- --update
- for index, thisInstance in ipairs(Details.tabela_instancias) do
- ---@cast thisInstance instance
- if (thisInstance:IsEnabled()) then
- if (thisInstance:GetMode() == DETAILS_MODE_GROUP or thisInstance:GetMode() == DETAILS_MODE_ALL) then
- thisInstance:RefreshData(bForceRefresh)
+ --flag windows as no need update next tick
+ for index, thisInstance in ipairs(Details.tabela_instancias) do
+ if (thisInstance:IsEnabled() and thisInstance.showing) then
+ if (thisInstance:GetMode() == DETAILS_MODE_GROUP or thisInstance:GetMode() == DETAILS_MODE_ALL) then
+ if (thisInstance.atributo <= 4) then
+ thisInstance.showing[thisInstance.atributo].need_refresh = false
end
end
end
-
- --flag windows as no need update next tick
- for index, thisInstance in ipairs(Details.tabela_instancias) do
- if (thisInstance:IsEnabled() and thisInstance.showing) then
- if (thisInstance:GetMode() == DETAILS_MODE_GROUP or thisInstance:GetMode() == DETAILS_MODE_ALL) then
- if (thisInstance.atributo <= 4) then
- thisInstance.showing[thisInstance.atributo].need_refresh = false
- end
- end
- end
- end
-
- if (not bForceRefresh) then --update player details window if opened
- if (breakdownWindowFrame.ativo) then
- return breakdownWindowFrame.jogador:MontaInfo()
- end
- end
- return
- else
- if (not instanceObject.ativa) then
- return
- end
end
- local currentMode = instanceObject:GetMode()
- if (currentMode == DETAILS_MODE_ALL or currentMode == DETAILS_MODE_GROUP) then
- return instanceObject:RefreshAllMainWindows(bForceRefresh)
+ if (not bForceRefresh) then --update player details window if opened
+ if (breakdownWindowFrame.ativo) then
+ return breakdownWindowFrame.jogador:MontaInfo()
+ end
+ end
+ return
+ else
+ if (not instanceObject.ativa) then
+ return
end
end
+ local currentMode = instanceObject:GetMode()
+ if (currentMode == DETAILS_MODE_ALL or currentMode == DETAILS_MODE_GROUP) then
+ return instanceObject:RefreshAllMainWindows(bForceRefresh)
+ end
+ end
+
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--core
function Details:AutoEraseConfirm()
-
local panel = _G.DetailsEraseDataConfirmation
if (not panel) then
panel = CreateFrame("frame", "DetailsEraseDataConfirmation", UIParent, "BackdropTemplate")
diff --git a/core/gears.lua b/core/gears.lua
index 949bd908..670d5d31 100644
--- a/core/gears.lua
+++ b/core/gears.lua
@@ -401,7 +401,8 @@ function _detalhes:TrackSpecsNow (track_everything)
end
else
local combatlist = {}
- for _, combat in ipairs(_detalhes.tabela_historico.tabelas) do
+ local segmentsTable = Details:GetCombatSegments()
+ for _, combat in ipairs(segmentsTable) do
tinsert(combatlist, combat)
end
tinsert(combatlist, _detalhes.tabela_vigente)
diff --git a/core/meta.lua b/core/meta.lua
index f8b7e142..f89c2f61 100644
--- a/core/meta.lua
+++ b/core/meta.lua
@@ -98,10 +98,10 @@ local classTypeUtility = Details.atributos.misc
local overallCombatObject = Details.tabela_overall
---@type combat[]
- local allSegments = Details.tabela_historico.tabelas
+ local segmentsTable = Details:GetCombatSegments()
--retore the call "combat()" functionality
- for _, combatObject in ipairs(allSegments) do
+ for _, combatObject in ipairs(segmentsTable) do
combatObject.__call = Details.call_combate
end
@@ -118,8 +118,8 @@ local classTypeUtility = Details.atributos.misc
local bIsInInstance = IsInInstance()
--inicia a recupera��o das tabelas e montagem do overall
- if (#allSegments > 0) then
- for index, thisCombatObject in ipairs(allSegments) do
+ if (#segmentsTable > 0) then
+ for index, thisCombatObject in ipairs(segmentsTable) do
---@cast thisCombatObject combat
--set the metatable, __call and __index
@@ -338,14 +338,15 @@ local classTypeUtility = Details.atributos.misc
---remove all .owner references from actors, this unlink pets from owners but still leave the actor.ownerName member to rebuild later
function Details:RemoveOwnerFromPets()
---@type combat[]
- local combatTables = Details.tabela_historico.tabelas or {}
+ local segmentsTable = Details:GetCombatSegments() or {}
+
local bOverallAdded
if (not Details.overall_clear_logout) then
- table.insert(combatTables, Details.tabela_overall)
+ table.insert(segmentsTable, Details.tabela_overall)
bOverallAdded = true
end
- for _, combatObject in ipairs(combatTables) do
+ for _, combatObject in ipairs(segmentsTable) do
---@cast combatObject combat
for _, actorContainer in ipairs(combatObject) do
---@cast actorContainer actorcontainer
@@ -357,22 +358,22 @@ local classTypeUtility = Details.atributos.misc
end
if (bOverallAdded) then
- table.remove(combatTables, #combatTables)
+ table.remove(segmentsTable, #segmentsTable)
end
end
function Details:DoClassesCleanup()
---@type combat[]
- local combatTables = Details.tabela_historico.tabelas or {}
+ local segmentsTable = Details:GetCombatSegments() or {}
local bOverallAdded = false
if (not Details.overall_clear_logout) then
--add the overall segment to the cleanup within the other segments
--it is removed after the cleanup
- table.insert(combatTables, Details.tabela_overall)
+ table.insert(segmentsTable, Details.tabela_overall)
bOverallAdded = true
end
- for index, combatObject in ipairs(combatTables) do
+ for index, combatObject in ipairs(segmentsTable) do
---@cast combatObject combat
for classType, actorContainer in ipairs(combatObject) do
---@cast actorContainer actorcontainer
@@ -400,20 +401,20 @@ local classTypeUtility = Details.atributos.misc
if (bOverallAdded) then
--remove the overall segment from the regular segments
- table.remove(combatTables, #combatTables)
+ table.remove(segmentsTable, #segmentsTable)
end
end
function Details:DoContainerCleanup()
---@type combat[]
- local combatTables = Details.tabela_historico.tabelas or {}
+ local segmentsTable = Details:GetCombatSegments() or {}
local bOverallAdded
if (not Details.overall_clear_logout) then
- table.insert(combatTables, Details.tabela_overall)
+ table.insert(segmentsTable, Details.tabela_overall)
bOverallAdded = true
end
- for _, combatObject in ipairs(combatTables) do
+ for _, combatObject in ipairs(segmentsTable) do
---@cast combatObject combat
Details.clear:c_combate(combatObject)
for _, actorContainer in ipairs(combatObject) do
@@ -423,27 +424,27 @@ local classTypeUtility = Details.atributos.misc
end
if (bOverallAdded) then
- table.remove(combatTables, #combatTables)
+ table.remove(segmentsTable, #segmentsTable)
end
end
function Details:DoContainerIndexCleanup()
---@type combat[]
- local allSegments = Details.tabela_historico.tabelas or {}
+ local segmentsTable = Details:GetCombatSegments() or {}
local bOverallAdded
if (not Details.overall_clear_logout) then
- table.insert(allSegments, Details.tabela_overall)
+ table.insert(segmentsTable, Details.tabela_overall)
bOverallAdded = true
end
- for _, combatObject in ipairs(allSegments) do
+ for _, combatObject in ipairs(segmentsTable) do
for _, actorContainer in ipairs(combatObject) do
Details.clear:c_container_combatentes_index(actorContainer)
end
end
if (bOverallAdded) then
- table.remove(allSegments, #allSegments)
+ table.remove(segmentsTable, #segmentsTable)
end
end
@@ -460,26 +461,32 @@ local classTypeUtility = Details.atributos.misc
---@type combat[]
local combatTables = {}
---@type combat[]
- local allSegments = Details.tabela_historico.tabelas or {}
+ local segmentsTable = Details:GetCombatSegments() or {}
- --remove segments marked as 'trash'
- for i = #allSegments, 1, -1 do
+ for i = #segmentsTable, 1, -1 do
---@type combat
- local combatObject = allSegments[i]
- if (combatObject:IsTrash()) then --error, IsTrash is not a function, probably because the combat got destroyed
- table.remove(allSegments, i)
- Details:DestroyCombat(combatObject) --no need to send DETAILS_DATA_SEGMENTREMOVED due to this be in the logout process
+ local combatObject = segmentsTable[i]
+ if (combatObject.__destroyed) then
+ table.remove(segmentsTable, i)
end
end
+ --remove segments marked as 'trash'
+ for i = #segmentsTable, 1, -1 do
+ ---@type combat
+ local combatObject = segmentsTable[i]
+ if (combatObject:IsTrash()) then
+ table.remove(segmentsTable, i)
+ end
+ end
+
+ segmentsTable = Details:GetCombatSegments() or {}
+
--remove segments > of the segment limit to save
if (Details.segments_amount_to_save and Details.segments_amount_to_save < Details.segments_amount) then
for i = Details.segments_amount, Details.segments_amount_to_save + 1, -1 do
- if (Details.tabela_historico.tabelas[i]) then
- ---@type combat
- local combatObject = Details.tabela_historico.tabelas[i]
- table.remove(Details.tabela_historico.tabelas, i)
- Details:DestroyCombat(combatObject)
+ if (segmentsTable[i]) then
+ table.remove(segmentsTable, i)
end
end
end
@@ -488,7 +495,6 @@ local classTypeUtility = Details.atributos.misc
if (Details.overall_clear_logout) then
Details.tabela_overall = nil
_detalhes_database.tabela_overall = nil
- Details:DestroyCombat(Details.tabela_overall)
else
---@type combat
local overallCombatObject = Details.tabela_overall
@@ -538,7 +544,7 @@ local classTypeUtility = Details.atributos.misc
end
end
- for i, combatObject in ipairs(allSegments) do
+ for i, combatObject in ipairs(segmentsTable) do
---@cast combatObject combat
combatTables[#combatTables+1] = combatObject
end
@@ -805,21 +811,38 @@ local classTypeUtility = Details.atributos.misc
---@type number
local amountRemoved = 0
- --create a list of all combats except the current one
- ---@type table
- local allSegments = Details:GetCombatSegments()
- ---@type table
- local segmentsList = {}
-
---@type combat
local currentCombat = Details:GetCurrentCombat()
- for _, combatObject in ipairs(allSegments) do
+ --create a list of all combats except the current one
+ ---@type table
+ local segmentsTable = Details:GetCombatSegments()
+
+ --collect destroyed combat objects
+ local bGotSegmentsRemoved = false
+ for i = #segmentsTable, 1, -1 do
+ local combatObject = segmentsTable[i]
+ if (combatObject ~= currentCombat) then
+ if (combatObject.__destroyed) then
+ table.remove(segmentsTable, i)
+ bGotSegmentsRemoved = true
+ end
+ end
+ end
+
+ if (bGotSegmentsRemoved) then
+ Details:SendEvent("DETAILS_DATA_SEGMENTREMOVED")
+ end
+
+ ---@type table
+ local segmentsList = {}
+
+ --add all segments except the current one
+ for _, combatObject in ipairs(segmentsTable) do
if (combatObject ~= currentCombat) then
segmentsList[#segmentsList+1] = combatObject
end
end
-
--add the current segment at the end of the list
segmentsList[#segmentsList+1] = currentCombat
diff --git a/core/parser.lua b/core/parser.lua
index 1094c226..f345fcb2 100755
--- a/core/parser.lua
+++ b/core/parser.lua
@@ -1062,10 +1062,10 @@
--~activity time
if (not sourceActor.dps_started) then
--register on time machine
- sourceActor:Iniciar(true)
+ sourceActor:GetOrChangeActivityStatus(true)
if (ownerActor and not ownerActor.dps_started) then
- ownerActor:Iniciar(true)
+ ownerActor:GetOrChangeActivityStatus(true)
if (ownerActor.end_time) then
ownerActor.end_time = nil
else
@@ -1983,7 +1983,7 @@
local jogador_alvo, alvo_dono = healing_cache [alvo_serial]
if (not jogador_alvo) then
jogador_alvo, alvo_dono, alvo_name = _current_heal_container:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true)
- if (not alvo_dono and alvo_flags and also_serial ~= "") then
+ if (not alvo_dono and alvo_flags and alvo_serial ~= "") then
healing_cache [alvo_serial] = jogador_alvo
end
end
@@ -2261,10 +2261,10 @@
------------------------------------------------------------------------------------------------
--~activity time
if (not sourceActor.iniciar_hps) then
- sourceActor:Iniciar (true) --inicia o hps do jogador
+ sourceActor:GetOrChangeActivityStatus (true) --inicia o hps do jogador
if (ownerActor and not ownerActor.iniciar_hps) then
- ownerActor:Iniciar (true)
+ ownerActor:GetOrChangeActivityStatus (true)
if (ownerActor.end_time) then
ownerActor.end_time = nil
else
@@ -4898,7 +4898,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
--end
end
- Details:DispatchAutoRunCode("on_zonechanged")
+ Details222.AutoRunCode.DispatchAutoRunCode("on_zonechanged")
Details:SchedulePetUpdate(7)
Details:CheckForPerformanceProfile()
end
@@ -5183,7 +5183,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
end
- Details:DispatchAutoRunCode("on_entercombat")
+ Details222.AutoRunCode.DispatchAutoRunCode("on_entercombat")
Details.tabela_vigente.CombatStartedAt = GetTime()
end
@@ -5284,7 +5284,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
if (not OnRegenEnabled) then
Details:Destroy(bitfield_swap_cache)
Details:Destroy(empower_cache)
- Details:DispatchAutoRunCode("on_leavecombat")
+ Details222.AutoRunCode.DispatchAutoRunCode("on_leavecombat")
end
if (Details.solo and Details.PluginCount.SOLO > 0) then --code too old and I don't have documentation for it
@@ -5596,7 +5596,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
Details:CheckVersion()
Details:SendEvent("GROUP_ONENTER")
- Details:DispatchAutoRunCode("on_groupchange")
+ Details222.AutoRunCode.DispatchAutoRunCode("on_groupchange")
Details:Destroy(Details.trusted_characters)
C_Timer.After(5, Details.ScheduleSyncPlayerActorData)
@@ -5614,7 +5614,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
Details:InstanceCall(Details.AdjustAlphaByContext)
Details:CheckSwitchOnLogon()
Details:SendEvent("GROUP_ONLEAVE")
- Details:DispatchAutoRunCode("on_groupchange")
+ Details222.AutoRunCode.DispatchAutoRunCode("on_groupchange")
Details:Destroy(Details.trusted_characters)
else
--player is still in a group
@@ -5670,7 +5670,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
function Details:CreateBattlegroundSegment()
if (_in_combat) then
- Details.tabela_vigente.discard_segment = true
+ Details222.discardSegment = true
Details:EndCombat()
end
@@ -5693,6 +5693,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
return
end
+ Details222.AutoRunCode.Code = {}
+
Details.popup = _G.GameCooltip
Details.in_group = IsInGroup() or IsInRaid()
Details.temp_table1 = {}
@@ -5731,7 +5733,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
Details:UpdateParserGears()
--load auto run code
- Details:StartAutoRun()
+ Details222.AutoRunCode.StartAutoRun()
Details.isLoaded = true
end
@@ -5856,6 +5858,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
---@type string current step of the logout process, used to log which is the current step when an error happens
local currentStep = ""
+ Details222.AutoRunCode.OnLogout()
+
--save the time played on this class, run protected
local savePlayTimeClass, savePlayTimeErrorText = pcall(function() Details.SavePlayTimeOnClass() end)
@@ -6037,6 +6041,12 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
return damage_cache[value] or damage_cache_pets[value] or damage_cache_petsOwners[value]
end
+ ---return tables containing the cache of actors
+ ---@return table damageCache, table damageCachePets, table damageCachePetOwners, table healingCache
+ function Details222.Cache.GetParserCacheTables()
+ return damage_cache, damage_cache_pets, damage_cache_petsOwners, healing_cache
+ end
+
function Details:PrintParserCacheIndexes()
local amount = 0
for n, nn in pairs(damage_cache) do
@@ -6455,9 +6465,9 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
--get an actor
- function Details:GetActor(combat, attribute, actorName)
- if (not combat) then
- combat = "current" --current combat
+ function Details:GetActor(combatId, attribute, actorName)
+ if (not combatId) then
+ combatId = "current" --current combat
end
if (not attribute) then
@@ -6468,7 +6478,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
actorName = Details.playername
end
- if (combat == 0 or combat == "current") then
+ if (combatId == 0 or combatId == "current") then
local actor = Details.tabela_vigente(attribute, actorName)
if (actor) then
return actor
@@ -6476,7 +6486,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
return nil
end
- elseif (combat == -1 or combat == "overall") then
+ elseif (combatId == -1 or combatId == "overall") then
local actor = Details.tabela_overall(attribute, actorName)
if (actor) then
return actor
@@ -6484,12 +6494,16 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
return nil
end
- elseif (type(combat) == "number") then
- local combatTables = Details.tabela_historico.tabelas[combat]
- if (combatTables) then
- local actor = combatTables(attribute, actorName)
- if (actor) then
- return actor
+ elseif (type(combatId) == "number") then
+ local segmentsTable = Details:GetCombatSegments()
+ ---@type combat
+ local combatObject = segmentsTable[combatId]
+
+ if (combatObject) then
+ ---@type actor
+ local actorObject = combatObject(attribute, actorName)
+ if (actorObject) then
+ return actorObject
else
return nil
end
diff --git a/frames/window_breakdown/window_playerbreakdown_charts b/frames/window_breakdown/window_playerbreakdown_charts
index cf368f10..682806b9 100644
--- a/frames/window_breakdown/window_playerbreakdown_charts
+++ b/frames/window_breakdown/window_playerbreakdown_charts
@@ -108,7 +108,7 @@ function chartsObject.Ticker()
--data set to capture data of some combat attribute or totals
local combatTotalCaptures = configsForCaptureData.totals
- local currentSegmentData = chartsObject.GetCurrentSegmentData()
+ local currentSegmentData = chartsObject.GetCurrentCombatData()
local chartData = currentSegmentData.ChartData
if (#playerCaptures > 0) then
@@ -244,7 +244,7 @@ function chartsObject.HasValidAndOpenCombat()
local bCombatState = chartsObject.GetCombatState()
if (bCombatState) then
local detaisCurrentCombat = Details:GetCurrentCombat()
- local chartCurrentSegmentData = chartsObject.GetCurrentSegmentData()
+ local chartCurrentSegmentData = chartsObject.GetCurrentCombatData()
if (detaisCurrentCombat:GetCombatId() == chartCurrentSegmentData:GetCombatId()) then
--it's all good
return true
@@ -266,7 +266,7 @@ function chartsObject.GetNumSegments()
return #chartsObject.SegmentsData
end
-function chartsObject.GetCurrentSegmentData()
+function chartsObject.GetCurrentCombatData()
return chartsObject.segmentData
end
diff --git a/frames/window_breakdown/window_playerbreakdown_list.lua b/frames/window_breakdown/window_playerbreakdown_list.lua
index 69c81eba..c87bcc34 100644
--- a/frames/window_breakdown/window_playerbreakdown_list.lua
+++ b/frames/window_breakdown/window_playerbreakdown_list.lua
@@ -47,6 +47,7 @@ function breakdownWindowPlayerList.CreatePlayerListFrame()
---@type button
local pluginButton = breakdownWindowFrame.RegisteredPluginButtons[i]
pluginButton:Show()
+ pluginButton:Hide() --not ready yet
pluginButton:ClearAllPoints()
if (i == 1) then
@@ -451,7 +452,7 @@ function breakdownWindowPlayerList.CreatePlayerListFrame()
end)
local gradientStartColor = Details222.ColorScheme.GetColorFor("gradient-background")
- local gradientBelow = DetailsFramework:CreateTexture(breakdownWindowFrame.playerScrollBox,
+ local gradientBelow = DetailsFramework:CreateTexture(breakdownWindowFrame.playerScrollBox,
{gradient = "vertical", fromColor = gradientStartColor, toColor = "transparent"}, 1, 90, "artwork", {0, 1, 0, 1})
gradientBelow:SetPoint("bottoms", 1, 1)
end
diff --git a/frames/window_main.lua b/frames/window_main.lua
index 97d659ce..1f5f3077 100644
--- a/frames/window_main.lua
+++ b/frames/window_main.lua
@@ -6206,7 +6206,8 @@ function Details:GetSegmentInfo(index)
elseif (index == 0 or index == "current") then
combat = Details.tabela_vigente
else
- combat = Details.tabela_historico.tabelas[index]
+ local segmentsTable = Details:GetCombatSegments()
+ combat = segmentsTable[index]
end
if (combat) then
@@ -6319,8 +6320,10 @@ local buildSegmentTooltip = function(self, deltaTime)
local amountOfSegments = 0
local segmentsWithACombat = 0
+ local segmentsTable = Details:GetCombatSegments()
+
for i = 1, Details.segments_amount do
- if (Details.tabela_historico.tabelas[i]) then
+ if (segmentsTable[i]) then
segmentsWithACombat = segmentsWithACombat + 1
else
break
@@ -6339,7 +6342,7 @@ local buildSegmentTooltip = function(self, deltaTime)
local isMythicDungeon = false
for i = Details.segments_amount, 1, -1 do
if (i <= fill) then
- local thisCombat = Details.tabela_historico.tabelas[i]
+ local thisCombat = segmentsTable[i]
if (thisCombat and not thisCombat.__destroyed) then
local enemy = thisCombat.is_boss and thisCombat.is_boss.name
local segmentInfoAdded = false
diff --git a/frames/window_options2.lua b/frames/window_options2.lua
index f2a6a25b..b4093d61 100644
--- a/frames/window_options2.lua
+++ b/frames/window_options2.lua
@@ -195,6 +195,7 @@ function Details.options.InitializeOptionsWindow(instance)
--search field
local searchBox = detailsFramework:CreateTextEntry(footerFrame, function()end, 140, 20, _, _, _, options_dropdown_template)
searchBox:SetPoint("left", changelog, "right", 10, 0)
+ searchBox:SetAsSearchBox()
local searchLabel = detailsFramework:CreateLabel(footerFrame, "Search:") --localize-me
searchLabel:SetPoint("bottomleft", searchBox, "topleft", 0, 2)
diff --git a/frames/window_runcode.lua b/frames/window_runcode.lua
index 218c0c65..870b1ade 100644
--- a/frames/window_runcode.lua
+++ b/frames/window_runcode.lua
@@ -1,189 +1,213 @@
local Details = _G.Details
-local DF = _G.DetailsFramework
+local detailsFramework = _G.DetailsFramework
local _
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- ~run ~runcode
+local addonName, Details222 = ...
+local CreateFrame = CreateFrame
+local UIParent = UIParent
+local load = loadstring
function Details:InitializeRunCodeWindow()
- local DetailsRunCodePanel = DF:CreateSimplePanel(UIParent, 700, 480, "Details! Run Code", "DetailsRunCodePanel")
- DetailsRunCodePanel.Frame = DetailsRunCodePanel
- DetailsRunCodePanel.__name = "Auto Run Code"
- DetailsRunCodePanel.real_name = "DETAILS_RUNCODEWINDOW"
+ local detailsRunCodePanel = detailsFramework:CreateSimplePanel(UIParent, 700, 480, "Details! Run Code Automation", "DetailsRunCodePanel")
+ detailsRunCodePanel.Frame = detailsRunCodePanel
+ detailsRunCodePanel.__name = "Auto Run Code"
+ detailsRunCodePanel.real_name = "DETAILS_RUNCODEWINDOW"
--DetailsRunCodePanel.__icon = [[Interface\AddOns\Details\images\lua_logo]]
- DetailsRunCodePanel.__icon = [[Interface\AddOns\Details\images\run_code]]
+ detailsRunCodePanel.__icon = [[Interface\AddOns\Details\images\run_code]]
--DetailsRunCodePanel.__iconcoords = {0, 1, 0, 1}
- DetailsRunCodePanel.__iconcoords = {0, 30/32, 0, 25/32}
- DetailsRunCodePanel.__iconcoords = {0, 1, 0, 1}
- DetailsRunCodePanel.__iconcolor = "white"
- DetailsPluginContainerWindow.EmbedPlugin (DetailsRunCodePanel, DetailsRunCodePanel, true)
-
- function DetailsRunCodePanel.RefreshWindow()
- Details.OpenRunCodeWindow()
+ detailsRunCodePanel.__iconcoords = {0, 30/32, 0, 25/32}
+ detailsRunCodePanel.__iconcoords = {0, 1, 0, 1}
+ detailsRunCodePanel.__iconcolor = "white"
+ DetailsPluginContainerWindow.EmbedPlugin(detailsRunCodePanel, detailsRunCodePanel, true)
+
+ function detailsRunCodePanel.RefreshWindow()
+ Details222.AutoRunCode.OpenRunCodeWindow()
end
-
- DetailsRunCodePanel:Hide()
+
+ detailsRunCodePanel:Hide()
+
+ Details222.AutoRunCode.DetailsRunCodePanel = detailsRunCodePanel
end
-function Details.OpenRunCodeWindow()
- if (not DetailsRunCodePanel or not DetailsRunCodePanel.Initialized) then
-
- DetailsRunCodePanel.Initialized = true
-
- local f = DetailsRunCodePanel or DF:CreateSimplePanel(UIParent, 700, 480, "Details! Run Code", "DetailsRunCodePanel")
+function Details222.AutoRunCode.OpenRunCodeWindow()
+ local detailsRunCodePanel = Details222.AutoRunCode.DetailsRunCodePanel
+
+ if (not detailsRunCodePanel or not detailsRunCodePanel.Initialized) then
+ detailsRunCodePanel.Initialized = true
+
+ local autoRunCodeFrame = detailsRunCodePanel or detailsFramework:CreateSimplePanel(UIParent, 700, 480, "Details! Run Code", "DetailsRunCodePanel")
--lua editor
- local code_editor = DF:NewSpecialLuaEditorEntry(f, 885, 510, "text", "$parentCodeEditorWindow")
- f.CodeEditor = code_editor
- code_editor:SetPoint("topleft", f, "topleft", 20, -56)
-
- --code editor appearance
- code_editor.scroll:SetBackdrop(nil)
- code_editor.editbox:SetBackdrop(nil)
- code_editor:SetBackdrop(nil)
-
- DF:ReskinSlider(code_editor.scroll)
-
- if (not code_editor.__background) then
- code_editor.__background = code_editor:CreateTexture(nil, "background")
- end
-
- code_editor:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
- code_editor:SetBackdropBorderColor(0, 0, 0, 1)
-
- code_editor.__background:SetColorTexture(0.2317647, 0.2317647, 0.2317647)
- code_editor.__background:SetVertexColor(0.27, 0.27, 0.27)
- code_editor.__background:SetAlpha(0.8)
- code_editor.__background:SetVertTile(true)
- code_editor.__background:SetHorizTile(true)
- code_editor.__background:SetAllPoints()
-
- --code compile error warning
- local errortext_frame = CreateFrame("frame", nil, code_editor,"BackdropTemplate")
- errortext_frame:SetPoint("bottomleft", code_editor, "bottomleft", 1, 1)
- errortext_frame:SetPoint("bottomright", code_editor, "bottomright", -1, 1)
- errortext_frame:SetHeight(20)
- errortext_frame:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
- errortext_frame:SetBackdropBorderColor(0, 0, 0, 1)
- errortext_frame:SetBackdropColor(0, 0, 0)
-
- DF:CreateFlashAnimation (errortext_frame)
-
- local errortext_label = DF:CreateLabel(errortext_frame, "", DF:GetTemplate("font", "ORANGE_FONT_TEMPLATE"))
- errortext_label.textcolor = "red"
- errortext_label:SetPoint("left", errortext_frame, "left", 3, 0)
- code_editor.NextCodeCheck = 0.33
-
- code_editor:HookScript ("OnUpdate", function(self, deltaTime)
- code_editor.NextCodeCheck = code_editor.NextCodeCheck - deltaTime
+ local codeEditor = detailsFramework:NewSpecialLuaEditorEntry(UIParent, 885, 510, nil, nil, false, true, true)
+ codeEditor:SetPoint("topleft", autoRunCodeFrame, "topleft", 20, -56)
+ codeEditor:SetFrameStrata(autoRunCodeFrame:GetFrameStrata())
+ codeEditor:SetFrameLevel(autoRunCodeFrame:GetFrameLevel()+1)
- if (code_editor.NextCodeCheck < 0) then
- local script = code_editor:GetText()
- local func, errortext = loadstring (script, "Q")
- if (not func) then
- local firstLine = strsplit("\n", script, 2)
- errortext = errortext:gsub(firstLine, "")
- errortext = errortext:gsub("%[string \"", "")
- errortext = errortext:gsub("...\"]:", "")
- errortext = errortext:gsub("Q\"]:", "")
- errortext = "Line " .. errortext
- errortext_label.text = errortext
- else
- errortext_label.text = ""
- end
-
- code_editor.NextCodeCheck = 0.33
+ function Details222.AutoRunCode.CodeEditorSetText(codeKey)
+ local text = Details222.AutoRunCode.CodeTable[codeKey]
+ return codeEditor:SetText(text)
+ end
+
+ detailsRunCodePanel:HookScript("OnShow", function()
+ codeEditor:Show()
+ end)
+ detailsRunCodePanel:SetScript("OnHide", function()
+ codeEditor:Hide()
+ end)
+
+ --code editor appearance
+ codeEditor.scroll:SetBackdrop(nil)
+ codeEditor.editbox:SetBackdrop(nil)
+ codeEditor:SetBackdrop(nil)
+
+ detailsFramework:ReskinSlider(codeEditor.scroll)
+
+ if (not codeEditor.__background) then
+ codeEditor.__background = codeEditor:CreateTexture(nil, "background")
+ end
+
+ codeEditor:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
+ codeEditor:SetBackdropBorderColor(0, 0, 0, 1)
+
+ codeEditor.__background:SetColorTexture(0.2317647, 0.2317647, 0.2317647)
+ codeEditor.__background:SetVertexColor(0.27, 0.27, 0.27)
+ codeEditor.__background:SetAlpha(0.8)
+ codeEditor.__background:SetVertTile(true)
+ codeEditor.__background:SetHorizTile(true)
+ codeEditor.__background:SetAllPoints()
+
+ --code compile error warning
+ local errortext_frame = CreateFrame("frame", nil, codeEditor, "BackdropTemplate")
+ errortext_frame:SetPoint("bottomleft", codeEditor, "bottomleft", 1, 1)
+ errortext_frame:SetPoint("bottomright", codeEditor, "bottomright", -1, 1)
+ errortext_frame:SetHeight(20)
+ errortext_frame:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
+ errortext_frame:SetBackdropBorderColor(0, 0, 0, 1)
+ errortext_frame:SetBackdropColor(0, 0, 0)
+
+ detailsFramework:CreateFlashAnimation (errortext_frame)
+
+ local errortext_label = detailsFramework:CreateLabel(errortext_frame, "", detailsFramework:GetTemplate("font", "ORANGE_FONT_TEMPLATE"))
+ errortext_label.textcolor = "red"
+ errortext_label:SetPoint("left", errortext_frame, "left", 3, 0)
+ codeEditor.NextCodeCheck = 0.33
+
+ codeEditor:HookScript ("OnUpdate", function(self, deltaTime)
+ codeEditor.NextCodeCheck = codeEditor.NextCodeCheck - deltaTime
+
+ if (codeEditor.NextCodeCheck < 0) then
+ local script = codeEditor:GetText()
+ local func, errortext = load(script, "Q")
+ if (not func) then
+ local firstLine = strsplit("\n", script, 2)
+ errortext = errortext:gsub(firstLine, "")
+ errortext = errortext:gsub("%[string \"", "")
+ errortext = errortext:gsub("...\"]:", "")
+ errortext = errortext:gsub("Q\"]:", "")
+ errortext = "Line " .. errortext
+ errortext_label.text = errortext
+ else
+ errortext_label.text = ""
end
- end)
-
+
+ codeEditor.NextCodeCheck = 0.33
+ end
+ end)
+
--script selector
local on_select_CodeType_option = function(self, fixedParameter, value)
--set the current editing code type
- f.EditingCode = Details.RunCodeTypes [value].Value
- f.EditingCodeKey = Details.RunCodeTypes [value].ProfileKey
-
+ autoRunCodeFrame.EditingCode = Details.RunCodeTypes[value].Value
+ autoRunCodeFrame.EditingCodeKey = Details.RunCodeTypes[value].ProfileKey
+
--load the code for the event
- local code = Details.run_code [f.EditingCodeKey]
- code_editor:SetText(code)
+ Details222.AutoRunCode.CodeEditorSetText(autoRunCodeFrame.EditingCodeKey)
end
-
+
local build_CodeType_dropdown_options = function()
local t = {}
-
+
for i = 1, #Details.RunCodeTypes do
local option = Details.RunCodeTypes [i]
t [#t + 1] = {label = option.Name, value = option.Value, onclick = on_select_CodeType_option, desc = option.Desc}
end
-
+
return t
end
-
- local code_type_label = DF:CreateLabel(f, "Event:", DF:GetTemplate("font", "ORANGE_FONT_TEMPLATE"))
- local code_type_dropdown = DF:CreateDropDown (f, build_CodeType_dropdown_options, 1, 160, 20, "CodeTypeDropdown", _, DF:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
+
+ local code_type_label = detailsFramework:CreateLabel(autoRunCodeFrame, "Event:", detailsFramework:GetTemplate("font", "ORANGE_FONT_TEMPLATE"))
+ local code_type_dropdown = detailsFramework:CreateDropDown(autoRunCodeFrame, build_CodeType_dropdown_options, 1, 160, 20, "CodeTypeDropdown", _, detailsFramework:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
code_type_dropdown:SetPoint("left", code_type_label, "right", 2, 0)
- code_type_dropdown:SetFrameLevel(code_editor:GetFrameLevel() + 10)
- code_type_label:SetPoint("bottomleft", code_editor, "topleft", 0, 8)
-
+ code_type_dropdown:SetFrameLevel(codeEditor:GetFrameLevel() + 10)
+ code_type_label:SetPoint("bottomleft", codeEditor, "topleft", 0, 8)
+
--create save button
local save_script = function()
- local code = code_editor:GetText()
- local func, errortext = loadstring (code, "Q")
-
+ local code = codeEditor:GetText()
+ local func, errortext = load(code, "Q")
+
if (func) then
- Details.run_code [f.EditingCodeKey] = code
- Details:RecompileAutoRunCode()
+ Details222.AutoRunCode.CodeTable[autoRunCodeFrame.EditingCodeKey] = code
+ Details222.AutoRunCode.RecompileAutoRunCode()
Details:Msg("Code saved!")
- code_editor:ClearFocus()
+ codeEditor:ClearFocus()
else
errortext_frame:Flash(0.2, 0.2, 0.4, true, nil, nil, "NONE")
Details:Msg("Can't save the code: it has errors.")
end
end
-
- local button_y = -6
-
- local save_script_button = DF:CreateButton(f, save_script, 120, 20, "Save", -1, nil, nil, nil, nil, nil, DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"), DF:GetTemplate("font", "PLATER_BUTTON"))
- save_script_button:SetIcon ([[Interface\BUTTONS\UI-Panel-ExpandButton-Up]], 20, 20, "overlay", {0.1, .9, 0.1, .9})
- save_script_button:SetPoint("topright", code_editor, "bottomright", 0, button_y)
-
- --create cancel button
+
local cancel_script = function()
- code_editor:SetText(Details.run_code [f.EditingCodeKey])
- Details:Msg("Code cancelled!")
- code_editor:ClearFocus()
+ Details222.AutoRunCode.CodeEditorSetText(autoRunCodeFrame.EditingCodeKey)
+ codeEditor:ClearFocus()
end
-
- local cancel_script_button = DF:CreateButton(f, cancel_script, 120, 20, "Cancel", -1, nil, nil, nil, nil, nil, DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"), DF:GetTemplate("font", "PLATER_BUTTON"))
- cancel_script_button:SetIcon ([[Interface\BUTTONS\UI-Panel-MinimizeButton-Up]], 20, 20, "overlay", {0.1, .9, 0.1, .9})
- cancel_script_button:SetPoint("topleft", code_editor, "bottomleft", 0, button_y)
-
- --create run now button
-
+
local execute_script = function()
- local script = code_editor:GetText()
- local func, errortext = loadstring (script, "Q")
-
+ local script = codeEditor:GetText()
+ local func, errortext = load(script, "Q")
+
if (func) then
- DF:SetEnvironment(func)
- DF:QuickDispatch(func)
+ detailsFramework:SetEnvironment(func)
+ detailsFramework:QuickDispatch(func)
else
errortext_frame:Flash(0.2, 0.2, 0.4, true, nil, nil, "NONE")
end
end
-
- local run_script_button = DF:CreateButton(f, execute_script, 120, 20, "Test Code", -1, nil, nil, nil, nil, nil, DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"), DF:GetTemplate("font", "PLATER_BUTTON"))
- run_script_button:SetIcon ([[Interface\BUTTONS\UI-SpellbookIcon-NextPage-Up]], 20, 20, "overlay", {0.05, 0.95, 0.05, 0.95})
- run_script_button:SetPoint("bottomright", code_editor, "topright", 0, 3)
-
- end
-
- DetailsPluginContainerWindow.OpenPlugin (DetailsRunCodePanel)
- DetailsRunCodePanel.CodeTypeDropdown:Select(1, true)
-
- --show the initialization code when showing up this window
- DetailsRunCodePanel.EditingCode = Details.RunCodeTypes [1].Value
- DetailsRunCodePanel.EditingCodeKey = Details.RunCodeTypes [1].ProfileKey
- local code = Details.run_code [DetailsRunCodePanel.EditingCodeKey]
- DetailsRunCodePanel.CodeEditor:SetText(code)
+ local button_y = -6
+
+ local saveButton = CreateFrame("button", nil, codeEditor)
+ detailsFramework:ApplyStandardBackdrop(saveButton)
+ saveButton:SetSize(120, 20)
+ saveButton:SetText("Save")
+ saveButton:SetScript("OnClick", save_script)
+ saveButton:SetPoint("topright", codeEditor, "bottomright", 0, button_y)
+ saveButton:SetNormalFontObject("GameFontNormal")
+
+ local cancelButton = CreateFrame("button", nil, codeEditor)
+ detailsFramework:ApplyStandardBackdrop(cancelButton)
+ cancelButton:SetSize(120, 20)
+ cancelButton:SetText("Cancel")
+ cancelButton:SetScript("OnClick", cancel_script)
+ cancelButton:SetPoint("topleft", codeEditor, "bottomleft", 0, button_y)
+ cancelButton:SetNormalFontObject("GameFontNormal")
+
+ --create run now button
+ local runButton = CreateFrame("button", nil, codeEditor)
+ detailsFramework:ApplyStandardBackdrop(runButton)
+ runButton:SetSize(120, 20)
+ runButton:SetText("Test Code")
+ runButton:SetScript("OnClick", execute_script)
+ runButton:SetPoint("bottomright", codeEditor, "topright", 0, 3)
+ runButton:SetNormalFontObject("GameFontNormal")
+ end
+
+ DetailsPluginContainerWindow.OpenPlugin(detailsRunCodePanel)
+ detailsRunCodePanel.CodeTypeDropdown:Select(1, true)
+
+ --show the initialization code when showing up this window
+ detailsRunCodePanel.EditingCode = Details.RunCodeTypes[1].Value
+ detailsRunCodePanel.EditingCodeKey = Details.RunCodeTypes[1].ProfileKey
+
+ Details222.AutoRunCode.CodeEditorSetText(detailsRunCodePanel.EditingCodeKey)
end
diff --git a/frames/window_switch.lua b/frames/window_switch.lua
index 81451ef3..8790c33a 100644
--- a/frames/window_switch.lua
+++ b/frames/window_switch.lua
@@ -9,6 +9,7 @@ local _
local unpack = unpack
local floor = math.floor
local gameCooltip = GameCooltip
+local CreateFrame = CreateFrame
--api locals
do
@@ -164,7 +165,7 @@ do
self.MainFrame.texture:SetBlendMode("BLEND")
on_leave_all_switch_button(self.MainFrame)
end
-
+
allDisplaysFrame.check_text_size = function(font_string)
local text_width = font_string:GetStringWidth()
while (text_width > 104) do
@@ -174,20 +175,20 @@ do
text_width = font_string:GetStringWidth()
end
end
-
+
local create_all_switch_button = function(attribute, sub_attribute, x, y)
local button = CreateFrame("button", "DetailsAllAttributesFrame" .. attribute .. sub_attribute, allDisplaysFrame)
button:SetSize(130, 16)
button.texture = button:CreateTexture(nil, "overlay")
button.texture:SetPoint("left", 0, 0)
button.texture:SetSize(icon_size, icon_size)
-
+
local texture_highlight_frame = CreateFrame("button", "DetailsAllAttributesFrame" .. attribute .. sub_attribute .. "IconFrame", button)
texture_highlight_frame:SetSize(icon_size, icon_size)
texture_highlight_frame:SetPoint("left", 0, 0)
texture_highlight_frame.texture = button.texture
texture_highlight_frame.MainFrame = button
-
+
button.text = button:CreateFontString(nil, "overlay", "GameFontNormal")
button.text:SetPoint("left", button.texture, "right", 2, 0)
button.attribute = attribute
@@ -195,22 +196,22 @@ do
button:SetPoint("topleft", x, y)
Details:SetFontSize(button.text, Details.all_switch_config.font_size)
Details:SetFontColor(button.text, text_color)
-
+
button:SetScript("OnClick", on_click_all_switch_button)
button:SetScript("OnEnter", on_enter_all_switch_button)
button:SetScript("OnLeave", on_leave_all_switch_button)
-
+
texture_highlight_frame:SetScript("OnClick", on_click_all_switch_button)
texture_highlight_frame:SetScript("OnEnter", on_enter_all_switch_button_icon)
texture_highlight_frame:SetScript("OnLeave", on_leave_all_switch_button_icon)
-
+
button:RegisterForClicks ("LeftButtonDown", "RightButtonDown")
return button
end
-
+
allDisplaysFrame:SetScript("OnShow", function()
-
+
if (not allDisplaysFrame.already_built) then
local x, y = 8, -8
allDisplaysFrame.higher_counter = 0
@@ -228,9 +229,9 @@ do
local title_str = allDisplaysFrame:CreateFontString(nil, "overlay", "GameFontNormal")
title_str:SetPoint("left", title_icon, "right", 2, 0)
title_str:SetText(loc_attribute_name)
-
+
y = y - 20
-
+
allDisplaysFrame.buttons [attribute] = {}
for i = 1, #Details.sub_atributos [attribute].lista do
--localized sub attribute name
@@ -246,20 +247,20 @@ do
tinsert(allDisplaysFrame.buttons [attribute], button)
y = y - 17
end
-
+
if (#Details.sub_atributos [attribute].lista > allDisplaysFrame.higher_counter) then
allDisplaysFrame.higher_counter = #Details.sub_atributos [attribute].lista
end
-
+
x = x + 130
y = -8
end
-
+
--prepare for scripts
allDisplaysFrame.x = x
allDisplaysFrame.y = -8
allDisplaysFrame.buttons [Details.atributos[0]+1] = {}
-
+
local title_icon = allDisplaysFrame:CreateTexture(nil, "overlay")
local texture, l, r, t, b = Details:GetAttributeIcon (Details.atributos[0]+1)
title_icon:SetTexture([[Interface\AddOns\Details\images\icons]])
@@ -269,11 +270,11 @@ do
local title_str = allDisplaysFrame:CreateFontString(nil, "overlay", "GameFontNormal")
title_str:SetPoint("left", title_icon, "right", 2, 0)
title_str:SetText("Scripts")
-
+
title_icon:SetPoint("topleft", allDisplaysFrame.x, allDisplaysFrame.y)
allDisplaysFrame.y = allDisplaysFrame.y - 20
allDisplaysFrame.title_custom = title_icon
-
+
allDisplaysFrame.already_built = true
--prepare for plugins
@@ -289,13 +290,13 @@ do
title_icon:SetPoint("topleft", allDisplaysFrame.x + 130, -8)
allDisplaysFrame.title_scripts = title_icon
end
-
+
--update scripts
local custom_index = Details.atributos[0]+1
for _, button in ipairs(allDisplaysFrame.buttons [custom_index]) do
button:Hide()
end
-
+
local button_index = 1
for i = #Details.custom, 1, -1 do
local button = allDisplaysFrame.buttons [custom_index] [button_index]
@@ -304,7 +305,7 @@ do
tinsert(allDisplaysFrame.buttons [custom_index], button)
allDisplaysFrame.y = allDisplaysFrame.y - 17
end
-
+
local custom = Details.custom [i]
button.text:SetText(custom.name)
Details:SetFontSize(button.text, Details.all_switch_config.font_size)
@@ -313,10 +314,10 @@ do
button.texture:SetTexture(custom.icon)
button.texture:SetTexCoord(0.078125, 0.921875, 0.078125, 0.921875)
button:Show()
-
+
button_index = button_index + 1
end
-
+
if (#Details.custom > allDisplaysFrame.higher_counter) then
allDisplaysFrame.higher_counter = #Details.custom
end
@@ -351,12 +352,12 @@ do
button.text:SetText(ptable[1])
Details:SetFontSize(button.text, Details.all_switch_config.font_size)
-
+
allDisplaysFrame.check_text_size(button.text)
button.texture:SetTexture(ptable[2])
button.texture:SetTexCoord(0.078125, 0.921875, 0.078125, 0.921875)
button:Show()
-
+
button_index = button_index + 1
end
end
@@ -496,42 +497,42 @@ function Details.switch:ShowMe(instancia)
Details.switch.CloseMe()
end
end
-
+
local hide_label = function(self)
self.texture:Hide()
self.button:Hide()
self.background:Hide()
self:Hide()
end
-
+
local show_label = function(self)
self.texture:Show()
self.button:Show()
self.background:Show()
self:Show()
end
-
+
local on_enter = function(self)
--self.MyObject.this_background:SetBlendMode("ADD")
--self.MyObject.boss_texture:SetBlendMode("ADD")
end
-
+
local on_leave = function(self)
self.MyObject.this_background:SetBlendMode("BLEND")
self.MyObject.boss_texture:SetBlendMode("BLEND")
end
-
+
function Details.switch:CreateSegmentBlock()
local s = gump:CreateLabel(Details.switch.frame)
Details:SetFontSize(s, 9)
-
+
local index = #Details.switch.segments_blocks
if (index == 1) then --overall button
index = -1
elseif (index >= 2) then
index = index - 1
end
-
+
local button = gump:CreateButton(Details.switch.frame, segment_switch, 100, 20, "", index)
button:SetPoint("topleft", s, "topleft", -17, 0)
button:SetPoint("bottomright", s, "bottomright", 0, 0)
@@ -546,24 +547,24 @@ function Details.switch:ShowMe(instancia)
background:SetWidth(85)
background:SetPoint("topleft", s.widget, "topleft", -16, 3)
background:SetPoint("bottomright", s.widget, "bottomright", -3, -5)
-
+
button.this_background = background
button.boss_texture = boss_texture.widget
-
+
s.texture = boss_texture
s.button = button
s.background = background
-
+
button:SetScript("OnEnter", on_enter)
button:SetScript("OnLeave", on_leave)
-
+
s.HideMe = hide_label
s.ShowMe = show_label
-
+
tinsert(Details.switch.segments_blocks, s)
return s
end
-
+
function Details.switch:GetSegmentBlock (index)
local block = Details.switch.segments_blocks [index]
if (not block) then
@@ -572,38 +573,38 @@ function Details.switch:ShowMe(instancia)
return block
end
end
-
+
function Details.switch:ClearSegmentBlocks()
for _, block in ipairs(Details.switch.segments_blocks) do
block:HideMe()
end
end
-
+
function Details.switch:ResizeSegmentBlocks()
local x = 7
local y = 5
-
+
local window_width, window_height = Details.switch.current_instancia:GetSize()
-
+
local horizontal_amt = floor(math.max(window_width / 100, 2))
local vertical_amt = floor((window_height - y) / 20)
local size = window_width / horizontal_amt
-
+
local frame = Details.switch.frame
-
+
Details.switch:ClearSegmentBlocks()
-
+
local i = 1
for vertical = 1, vertical_amt do
x = 7
for horizontal = 1, horizontal_amt do
local button = Details.switch:GetSegmentBlock (i)
-
+
button:SetPoint("topleft", frame, "topleft", x + 16, -y)
button:SetSize(size - 22, 12)
button:ShowMe()
-
+
i = i + 1
x = x + size
if (i > 40) then
@@ -613,37 +614,39 @@ function Details.switch:ShowMe(instancia)
y = y + 20
end
end
-
+
Details.switch.segments_blocks = {}
--current and overall
Details.switch:CreateSegmentBlock()
Details.switch:CreateSegmentBlock()
-
+
local block1 = Details.switch:GetSegmentBlock (1)
block1:SetText(Loc["STRING_CURRENTFIGHT"])
block1.texture:SetTexture([[Interface\Scenarios\ScenariosParts]])
block1.texture:SetTexCoord(55/512, 81/512, 368/512, 401/512)
-
+
local block2 = Details.switch:GetSegmentBlock (2)
block2:SetText(Loc["STRING_SEGMENT_OVERALL"])
block2.texture:SetTexture([[Interface\Scenarios\ScenariosParts]])
block2.texture:SetTexCoord(55/512, 81/512, 368/512, 401/512)
end
-
+
Details.switch:ClearSegmentBlocks()
Details.switch:HideAllBookmarks()
-
- local segment_index = 1
- for i = 3, #Details.tabela_historico.tabelas + 2 do
-
- local combat = Details.tabela_historico.tabelas [segment_index]
-
- local block = Details.switch:GetSegmentBlock (i)
- local enemy, color, raid_type, killed, is_trash, portrait, background, background_coords = Details:GetSegmentInfo (segment_index)
- block:SetText("#" .. segment_index .. " " .. enemy)
-
+ local segmentsTable = Details:GetCombatSegments()
+
+ local segmentIndex = 1
+ for i = 3, #segmentsTable + 2 do
+ ---@type combat
+ local combat = segmentsTable[segmentIndex]
+
+ local block = Details.switch:GetSegmentBlock(i)
+ local enemy, color, raid_type, killed, is_trash, portrait, background, background_coords = Details:GetSegmentInfo(segmentIndex)
+
+ block:SetText("#" .. segmentIndex .. " " .. enemy)
+
if (combat.is_boss and combat.instance_type == "raid") then
local L, R, T, B, Texture = Details:GetBossIcon (combat.is_boss.mapid, combat.is_boss.index)
if (L) then
@@ -655,30 +658,30 @@ function Details.switch:ShowMe(instancia)
else
block.texture:SetTexture([[Interface\Scenarios\ScenarioIcon-Boss]])
end
-
+
block:ShowMe()
- segment_index = segment_index + 1
+ segmentIndex = segmentIndex + 1
end
-
+
Details.switch.frame:SetScale(instancia.window_scale)
Details.switch:ResizeSegmentBlocks()
-
- for i = segment_index+2, #Details.switch.segments_blocks do
+
+ for i = segmentIndex+2, #Details.switch.segments_blocks do
Details.switch.segments_blocks [i]:HideMe()
end
-
+
Details.switch.frame:SetPoint("topleft", instancia.baseframe, "topleft", 0, 1)
Details.switch.frame:SetPoint("bottomright", instancia.baseframe, "bottomright", 0, 1)
Details.switch.frame:Show()
-
+
return
-
+
else
if (Details.switch.segments_blocks) then
Details.switch:ClearSegmentBlocks()
end
end
-
+
--check if there is some custom contidional
if (instancia.atributo == 5) then
local custom_object = instancia:GetCustomObject()
@@ -689,13 +692,13 @@ function Details.switch:ShowMe(instancia)
end
end
end
-
+
Details.switch.frame:SetPoint("topleft", instancia.baseframe, "topleft", 0, 1)
Details.switch.frame:SetPoint("bottomright", instancia.baseframe, "bottomright", 0, 1)
local altura = instancia.baseframe:GetHeight()
local mostrar_quantas = floor(altura / Details.switch.button_height) * 2
-
+
local precisa_mostrar = 0
for i = 1, #Details.switch.table do
local slot = Details.switch.table [i]
@@ -709,31 +712,31 @@ function Details.switch:ShowMe(instancia)
break
end
end
-
- if (Details.switch.mostrar_quantas ~= mostrar_quantas) then
+
+ if (Details.switch.mostrar_quantas ~= mostrar_quantas) then
for i = 1, #Details.switch.buttons do
- if (i <= mostrar_quantas) then
+ if (i <= mostrar_quantas) then
Details.switch.buttons [i]:Show()
else
Details.switch.buttons [i]:Hide()
end
end
-
+
if (#Details.switch.buttons < mostrar_quantas) then
Details.switch.slots = mostrar_quantas
end
-
+
Details.switch.mostrar_quantas = mostrar_quantas
end
-
+
Details.switch:Resize (precisa_mostrar)
Details.switch:Update()
-
+
Details.switch.frame:SetScale(instancia.window_scale)
Details.switch.frame:Show()
-
+
Details.switch:Resize (precisa_mostrar)
-
+
if (DetailsSwitchPanel.all_switch:IsShown()) then
return DetailsSwitchPanel.all_switch:Hide()
end
@@ -927,7 +930,7 @@ function Details.switch:Update()
for i = 1, slots_shown do
--bookmark index
local index = (offset * Details.switch.vertical_amt) + i
-
+
--button
local button = Details.switch.buttons [i]
if (not button) then
@@ -937,21 +940,21 @@ function Details.switch:Update()
end
local options = Details.switch.table [index]
- if (not options and index <= 40) then
+ if (not options and index <= 40) then
options = {}
Details.switch.table [index] = options
end
-
+
button.bookmark_number = index --button on icon
button.button2.bookmark_number = index --button on text
-
+
local icone
local coords
local name
local vcolor
local add
local textColor = "white"
-
+
if (options and options.sub_atributo) then
if (options.atributo == 5) then --custom
local CustomObject = Details.custom [options.sub_atributo]
@@ -967,7 +970,7 @@ function Details.switch:Update()
name = CustomObject.name
vcolor = vertex_color_default
end
-
+
elseif (options.atributo == "plugin") then --plugin
local plugin = Details:GetPlugin (options.sub_atributo)
diff --git a/functions/api2.lua b/functions/api2.lua
index 146bf84f..fb1ef278 100644
--- a/functions/api2.lua
+++ b/functions/api2.lua
@@ -11,6 +11,7 @@ local addonName, Details222 = ...
--local helpers
local getCombatObject = function(segmentNumber)
+ ---@type combat
local combatObject
--select which segment to use, use low level variables for performance
@@ -19,7 +20,8 @@ local getCombatObject = function(segmentNumber)
elseif (segmentNumber == 0) then
combatObject = Details.tabela_vigente
else
- combatObject = Details.tabela_historico.tabelas [segmentNumber]
+ local segmentsTable = Details:GetCombatSegments()
+ combatObject = segmentsTable[segmentNumber]
end
return combatObject
diff --git a/functions/autorun.lua b/functions/autorun.lua
index ab35cf87..b16d245e 100644
--- a/functions/autorun.lua
+++ b/functions/autorun.lua
@@ -1,29 +1,29 @@
local Details = _G.Details
-local DF = _G.DetailsFramework
+local detailsFramework = _G.DetailsFramework
local C_Timer = _G.C_Timer
local addonName, Details222 = ...
+local load = loadstring
--auto run scripts
-Details.AutoRunCode = {}
-local codeTable
+local functionCache = {}
--compile and store code
-function Details:RecompileAutoRunCode()
- for codeKey, code in pairs(codeTable) do
- local func, errorText = _G.loadstring(code)
+function Details222.AutoRunCode.RecompileAutoRunCode()
+ for codeKey, code in pairs(Details222.AutoRunCode.CodeTable) do
+ local func, errorText = load(code)
if (func) then
- DetailsFramework:SetEnvironment(func)
- Details.AutoRunCode[codeKey] = func
+ detailsFramework:SetEnvironment(func)
+ functionCache[codeKey] = func
else
--if the code didn't pass, create a dummy function for it without triggering errors
- Details.AutoRunCode[codeKey] = function() end
+ functionCache[codeKey] = function() end
end
end
end
--function to dispatch events
-function Details:DispatchAutoRunCode(codeKey)
- local func = Details.AutoRunCode[codeKey]
+function Details222.AutoRunCode.DispatchAutoRunCode(codeKey)
+ local func = functionCache[codeKey]
if (type(func) ~= "function") then
Details:Msg("error running function for auto run script", codeKey)
@@ -39,15 +39,15 @@ function Details:DispatchAutoRunCode(codeKey)
end
--auto run frame to dispatch scrtips for some events that details! doesn't handle
-local autoRunCodeEventFrame = _G.CreateFrame("frame")
+local autoRunCodeEventFrame = CreateFrame("frame")
-if (not _G.DetailsFramework.IsTimewalkWoW()) then
+if (not detailsFramework.IsTimewalkWoW()) then
autoRunCodeEventFrame:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED")
end
autoRunCodeEventFrame.OnEventFunc = function(self, event)
--ignore events triggered more than once in a small time window
- if (autoRunCodeEventFrame [event] and not autoRunCodeEventFrame [event]:IsCancelled()) then
+ if (autoRunCodeEventFrame[event] and not autoRunCodeEventFrame[event]:IsCancelled()) then
return
end
@@ -55,13 +55,13 @@ autoRunCodeEventFrame.OnEventFunc = function(self, event)
--create a trigger for the event, many times it is triggered more than once
--so if the event is triggered a second time, it will be ignored
local newTimer = C_Timer.NewTimer(1, function()
- Details:DispatchAutoRunCode("on_specchanged")
-
+ Details222.AutoRunCode.DispatchAutoRunCode("on_specchanged")
+
--clear and invalidate the timer
autoRunCodeEventFrame[event]:Cancel()
autoRunCodeEventFrame[event] = nil
end)
-
+
--store the trigger
autoRunCodeEventFrame[event] = newTimer
end
@@ -71,21 +71,26 @@ autoRunCodeEventFrame:SetScript("OnEvent", autoRunCodeEventFrame.OnEventFunc)
--dispatch scripts at startup
C_Timer.After(2, function()
- Details:DispatchAutoRunCode("on_init")
- Details:DispatchAutoRunCode("on_specchanged")
- Details:DispatchAutoRunCode("on_zonechanged")
+ Details222.AutoRunCode.DispatchAutoRunCode("on_init")
+ Details222.AutoRunCode.DispatchAutoRunCode("on_specchanged")
+ Details222.AutoRunCode.DispatchAutoRunCode("on_zonechanged")
if (_G.InCombatLockdown()) then
- Details:DispatchAutoRunCode("on_entercombat")
+ Details222.AutoRunCode.DispatchAutoRunCode("on_entercombat")
else
- Details:DispatchAutoRunCode("on_leavecombat")
+ Details222.AutoRunCode.DispatchAutoRunCode("on_leavecombat")
end
- Details:DispatchAutoRunCode("on_groupchange")
+ Details222.AutoRunCode.DispatchAutoRunCode("on_groupchange")
end)
-function Details:StartAutoRun()
- --compile code
- codeTable = Details.run_code
- Details:RecompileAutoRunCode()
+function Details222.AutoRunCode.StartAutoRun()
+ local newData = detailsFramework.table.copy({}, Details.run_code)
+ Details.run_code = nil
+ Details222.AutoRunCode.CodeTable = newData
+ Details222.AutoRunCode.RecompileAutoRunCode()
end
+
+function Details222.AutoRunCode.OnLogout()
+ Details.run_code = Details222.AutoRunCode.CodeTable
+end
\ No newline at end of file
diff --git a/functions/deathrecap.lua b/functions/deathrecap.lua
index b10c5ed3..b02b6476 100644
--- a/functions/deathrecap.lua
+++ b/functions/deathrecap.lua
@@ -36,7 +36,7 @@ local create_deathrecap_line = function(parent, n)
line:SetPoint("topright", parent, "topright", -10, (-24 * n) - 17)
line:SetScript("OnEnter", on_deathrecap_line_enter)
line:SetScript("OnLeave", on_deathrecap_line_leave)
-
+
line:SetSize(300, 21)
local timeAt = line:CreateFontString(nil, "overlay", "GameFontNormal")
@@ -50,14 +50,14 @@ local create_deathrecap_line = function(parent, n)
local amount = line:CreateFontString(nil, "overlay", "GameFontNormal")
local lifePercent = line:CreateFontString(nil, "overlay", "GameFontNormal")
local lifeStatusBar = line:CreateTexture(nil, "border", nil, -3)
-
+
--grave icon
local graveIcon = line:CreateTexture(nil, "overlay")
graveIcon:SetTexture([[Interface\MINIMAP\POIIcons]])
graveIcon:SetTexCoord(146/256, 160/256, 0/512, 18/512)
graveIcon:SetPoint("left", line, "left", 11, 0)
graveIcon:SetSize(14, 18)
-
+
--spell icon
spellIcon:SetSize(19, 19)
spellIconBorder:SetTexture([[Interface\ENCOUNTERJOURNAL\LootTab]])
@@ -71,12 +71,12 @@ local create_deathrecap_line = function(parent, n)
sourceName:SetPoint("left", line, "left", 82, 0)
amount:SetPoint("left", line, "left", 240, 0)
lifePercent:SetPoint("left", line, "left", 320, 0)
-
+
--text colors
Details.gump:SetFontColor(amount, "red")
Details.gump:SetFontColor(timeAt, "gray")
Details.gump:SetFontColor(sourceName, "yellow")
-
+
Details.gump:SetFontSize(sourceName, 10)
--text alpha
@@ -84,13 +84,13 @@ local create_deathrecap_line = function(parent, n)
sourceName:SetAlpha(textAlpha)
amount:SetAlpha(textAlpha)
lifePercent:SetAlpha(textAlpha)
-
+
--text setup
amount:SetWidth(85)
amount:SetJustifyH("right")
lifePercent:SetWidth(42)
lifePercent:SetJustifyH("right")
-
+
--life statusbar
lifeStatusBar:SetPoint("topleft", line, "topleft")
lifeStatusBar:SetPoint("bottomleft", line, "bottomleft")
@@ -99,7 +99,7 @@ local create_deathrecap_line = function(parent, n)
backgroundTexture:SetTexture([[Interface\AddOns\Details\images\deathrecap_background]])
backgroundTexture:SetTexCoord(0, 1, 0, 1)
backgroundTexture:SetVertexColor(.1, .1, .1, .3)
-
+
--top border
local TopFader = line:CreateTexture(nil, "border")
TopFader:SetTexture([[Interface\AddOns\Details\images\deathrecap_background_top]])
@@ -110,13 +110,13 @@ local create_deathrecap_line = function(parent, n)
TopFader:SetHeight(32)
TopFader:Hide()
line.TopFader = TopFader
-
+
if (n == 10) then
--bottom fader
local backgroundTexture2 = line:CreateTexture(nil, "border")
backgroundTexture2:SetTexture([[Interface\AddOns\Details\images\deathrecap_background_bottom]])
backgroundTexture2:SetTexCoord(0, 1, 0, 1)
- backgroundTexture2:SetVertexColor(.1, .1, .1, .3)
+ backgroundTexture2:SetVertexColor(.1, .1, .1, .3)
backgroundTexture2:SetPoint("topleft", backgroundTexture, "bottomleft", 0, 0)
backgroundTexture2:SetPoint("topright", backgroundTexture, "bottomright", 0, 0)
backgroundTexture2:SetHeight(32)
@@ -125,7 +125,7 @@ local create_deathrecap_line = function(parent, n)
Details.gump:SetFontSize(lifePercent, 14)
backgroundTexture:SetVertexColor(.2, .1, .1, .3)
end
-
+
backgroundTexture:SetPoint("topleft", 0, 1)
backgroundTexture:SetPoint("bottomright", 0, -1)
backgroundTexture:SetDesaturated(true)
@@ -135,7 +135,7 @@ local create_deathrecap_line = function(parent, n)
backgroundTextureOverlay:SetDesaturated(true)
backgroundTextureOverlay:SetAlpha(0.5)
backgroundTextureOverlay:Hide()
-
+
line.timeAt = timeAt
line.spellIcon = spellIcon
line.sourceName = sourceName
@@ -145,14 +145,14 @@ local create_deathrecap_line = function(parent, n)
line.backgroundTextureOverlay = backgroundTextureOverlay
line.graveIcon = graveIcon
line.lifeStatusBar = lifeStatusBar
-
+
if (n == 10) then
graveIcon:Show()
line.timeAt:Hide()
else
graveIcon:Hide()
end
-
+
return line
end
@@ -162,13 +162,13 @@ end
function Details.BuildDeathTableFromRecap (recapID)
local events = DeathRecap_GetEvents (recapID)
-
+
--check if it is a valid recap
if (not events or #events <= 0) then
DeathRecapFrame.Unavailable:Show()
return
end
-
+
--build an death log using details format
ArtificialDeathLog = {
{}, --deathlog events
@@ -200,11 +200,11 @@ function Details.BuildDeathTableFromRecap (recapID)
evtData.overkill,
not spellId and {spellId, spellName, texture},
}
-
+
tinsert(ArtificialDeathLog[1], ev)
ArtificialDeathLog.n = ArtificialDeathLog.n + 1
end
-
+
return ArtificialDeathLog
end
@@ -226,7 +226,7 @@ function Details.GetDeathRecapFromChat()
end
end
end
-
+
if (recapIDFromChat) then
Details.OpenDetailsDeathRecap (nil, recapIDFromChat, true)
return
@@ -258,29 +258,29 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat)
if (not Details.DeathRecap) then
Details.DeathRecap = CreateFrame("frame", "DetailsDeathRecap", DeathRecapFrame, "BackdropTemplate")
Details.DeathRecap:SetAllPoints()
-
+
DeathRecapFrame.Title:SetText(DeathRecapFrame.Title:GetText() .. " (by Details!)")
-
+
--lines
Details.DeathRecap.Lines = {}
for i = 1, 10 do
Details.DeathRecap.Lines [i] = create_deathrecap_line (Details.DeathRecap, i)
end
-
+
--segments
Details.DeathRecap.Segments = {}
for i = 5, 1, -1 do
local segmentButton = CreateFrame("button", "DetailsDeathRecapSegmentButton" .. i, Details.DeathRecap, "BackdropTemplate")
-
+
segmentButton:SetSize(16, 20)
segmentButton:SetPoint("topright", DeathRecapFrame, "topright", (-abs(i-6) * 22) - 10, -5)
-
+
local text = segmentButton:CreateFontString(nil, "overlay", "GameFontNormal")
segmentButton.text = text
text:SetText("#" .. i)
text:SetPoint("center")
Details.gump:SetFontColor(text, "silver")
-
+
segmentButton:SetScript("OnClick", function()
OpenDetailsDeathRecapAtSegment (i)
end)
@@ -306,9 +306,9 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat)
--in case a combat has been created after the player death, the death won't be at the current segment
if (not foundPlayer) then
- local segmentHistory = Details:GetCombatSegments()
+ local segmentsTable = Details:GetCombatSegments()
for i = 1, 2 do
- local segment = segmentHistory [1]
+ local segment = segmentsTable [1]
if (segment and segment ~= Details.tabela_vigente) then
if (Details.tabela_vigente.start_time - 3 < segment.end_time) then
death = segment.last_events_tables
@@ -321,34 +321,35 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat)
if (Details.death_recap.show_segments) then
local last_index = 0
local buttonsInUse = {}
+ local segmentsTable = Details:GetCombatSegments()
+
for i, button in ipairs(Details.DeathRecap.Segments) do
- if (Details.tabela_historico.tabelas [i]) then
+ if (segmentsTable[i]) then
button:Show()
- tinsert(buttonsInUse, button)
+ table.insert(buttonsInUse, button)
Details.gump:SetFontColor(button.text, "silver")
last_index = i
else
button:Hide()
end
end
-
+
local buttonsInUse2 = {}
for i = #buttonsInUse, 1, -1 do
- tinsert(buttonsInUse2, buttonsInUse[i])
+ table.insert(buttonsInUse2, buttonsInUse[i])
end
for i = 1, #buttonsInUse2 do
local button = buttonsInUse2 [i]
button:ClearAllPoints()
button:SetPoint("topright", DeathRecapFrame, "topright", (-i * 22) - 10, -5)
end
-
+
if (not segment) then
Details.gump:SetFontColor(Details.DeathRecap.Segments [1].text, "orange")
else
Details.gump:SetFontColor(Details.DeathRecap.Segments [segment].text, "orange")
- death = Details.tabela_historico.tabelas [segment] and Details.tabela_historico.tabelas [segment].last_events_tables
+ death = segmentsTable[segment] and segmentsTable[segment].last_events_tables
end
-
else
for i, button in ipairs(Details.DeathRecap.Segments) do
button:Hide()
@@ -368,9 +369,9 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat)
--get the death events from the blizzard's recap
ArtificialDeathLog = Details.BuildDeathTableFromRecap (RecapID)
end
-
+
DeathRecapFrame.Unavailable:Hide()
-
+
--get the relevance config
local relevanceTime = Details.death_recap.relevance_time
@@ -389,12 +390,12 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat)
if (t) then
local events = t [1]
local timeOfDeath = t [2]
-
+
local BiggestDamageHits = {}
for i = #events, 1, -1 do
tinsert(BiggestDamageHits, events [i])
end
- table.sort (BiggestDamageHits, function(t1, t2)
+ table.sort (BiggestDamageHits, function(t1, t2)
return t1[3] > t2[3]
end)
for i = #BiggestDamageHits, 1, -1 do
@@ -402,7 +403,7 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat)
tremove(BiggestDamageHits, i)
end
end
-
+
--check if the event which killed the player is in the list, or addit to BiggestDamageHits
local hitKill
for i = #events, 1, -1 do
@@ -449,7 +450,7 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat)
end
else
--cut table to show only 10 events
- while (#BiggestDamageHits > 10) do
+ while (#BiggestDamageHits > 10) do
tremove(BiggestDamageHits, 11)
end
end
@@ -459,21 +460,21 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat)
Details.GetDeathRecapFromChat()
return
end
- end
+ end
- table.sort (BiggestDamageHits, function(t1, t2)
+ table.sort (BiggestDamageHits, function(t1, t2)
return t1[4] > t2[4]
end)
local events = BiggestDamageHits
-
+
local maxHP = t [5]
local lineIndex = 10
-
+
--for i = #events, 1, -1 do
- for i, event in ipairs(events) do
+ for i, event in ipairs(events) do
local event = events [i]
-
+
local evType = event [1]
local hp = min (floor(event [5] / maxHP * 100), 100)
local spellName, _, spellIcon = Details.GetSpellInfo(event [2])
@@ -481,11 +482,11 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat)
local eventTime = event [4]
local source = event [6]
local overkill = event [10] or 0
-
+
local customSpellInfo = event [11]
-
+
if (type(evType) == "boolean" and evType) then
-
+
local line = Details.DeathRecap.Lines [lineIndex]
if (line) then
line.timeAt:SetText(format("%.1f", eventTime - timeOfDeath) .. "s")
@@ -493,11 +494,11 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat)
line.TopFader:Hide()
--line.spellIcon:SetTexCoord(.1, .9, .1, .9)
--line.sourceName:SetText("|cFFC6B0D9" .. source .. "|r")
-
+
--parse source and cut the length of the string after setting the spellname and source
local sourceClass = Details:GetClass(source)
local sourceSpec = Details:GetSpec(source)
-
+
if (not sourceClass) then
local combat = Details:GetCurrentCombat()
if (combat) then
@@ -507,7 +508,7 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat)
end
end
end
-
+
if (not sourceSpec) then
local combat = Details:GetCurrentCombat()
if (combat) then
@@ -517,19 +518,19 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat)
end
end
end
-
+
--remove real name or owner name
source = Details:GetOnlyName(source)
--remove owner name
source = source:gsub((" <.*"), "")
-
+
--if a player?
if (Details.player_class [sourceClass]) then
source = Details:AddClassOrSpecIcon (source, sourceClass, sourceSpec, 16, true)
-
+
elseif (sourceClass == "PET") then
source = Details:AddClassOrSpecIcon (source, sourceClass)
-
+
end
--remove the dot signal from the spell name
@@ -545,14 +546,14 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat)
--/run for a,b in pairs(_G) do if (type(b)=="string" and b:find("Falling")) then print(a,b) end end
end
end
-
+
spellName = spellName:gsub(L["STRING_DOT"], "")
spellName = spellName:gsub("[*] ", "")
source = source or ""
-
+
line.sourceName:SetText(spellName .. " (" .. "|cFFC6B0D9" .. source .. "|r" .. ")")
DetailsFramework:TruncateText (line.sourceName, 185)
-
+
if (amount > 1000) then
--line.amount:SetText("-" .. Details:ToK (amount))
line.amount:SetText("-" .. Details:comma_value(floor(amount)))
@@ -560,14 +561,14 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat)
--line.amount:SetText("-" .. floor(amount))
line.amount:SetText("-" .. floor(amount))
end
-
+
line.lifePercent:SetText(hp .. "%")
line.lifeStatusBar:SetWidth(line:GetWidth() * (hp/100))
line.spellid = event [2]
-
+
line:Show()
-
+
if (Details.death_recap.show_life_percent) then
line.lifePercent:Show()
line.amount:SetPoint("left", line, "left", 240, 0)
@@ -578,16 +579,16 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat)
--line.lifePercent:SetPoint("left", line, "left", 320, 0)
end
end
-
+
lineIndex = lineIndex - 1
end
end
-
+
local lastLine = Details.DeathRecap.Lines [lineIndex + 1]
if (lastLine) then
lastLine.TopFader:Show()
end
-
+
DeathRecapFrame.Unavailable:Hide()
else
if (not fromChat) then
@@ -674,7 +675,7 @@ end)
--[=[ hooks not loaded at this point
Details:InstallHook(DETAILS_HOOK_DEATH, function(_, _, _, _, _, _, _, targetName)
if (targetName == UnitName("player")) then
-
+
end
end)
--]=]
diff --git a/functions/loaddata.lua b/functions/loaddata.lua
index f6c07710..89ad080f 100644
--- a/functions/loaddata.lua
+++ b/functions/loaddata.lua
@@ -105,6 +105,7 @@ end
--load previous saved combat data
function Details222.LoadSavedVariables.CombatSegments()
+ --this is the table where the character data is saved as well the combat data
local currentCharacterData = _G["_detalhes_database"] --no need to check if it exists, it's already checked
if (currentCharacterData == nil) then
currentCharacterData = {}
@@ -189,7 +190,7 @@ function Details222.LoadSavedVariables.CombatSegments()
end
--get the first segment saved and use it as current segment
- Details.tabela_vigente = Details.tabela_historico.tabelas[1]
+ Details.tabela_vigente = Details.tabela_historico.tabelas[1] --only low level access to this table allowed
--need refresh for all containers
for _, actorContainer in ipairs(Details.tabela_overall) do
diff --git a/functions/mythicdungeon.lua b/functions/mythicdungeon.lua
index ba810828..d2f397a4 100644
--- a/functions/mythicdungeon.lua
+++ b/functions/mythicdungeon.lua
@@ -64,7 +64,7 @@ function DetailsMythicPlusFrame.MergeSegmentsOnEnd()
--get the current combat just created and the table with all past segments
local newCombat = Details:GetCurrentCombat()
- local segmentHistory = Details:GetCombatSegments()
+ local segmentsTable = Details:GetCombatSegments()
local totalTime = 0
local startDate, endDate = "", ""
@@ -73,14 +73,14 @@ function DetailsMythicPlusFrame.MergeSegmentsOnEnd()
if (Details.mythic_plus.reverse_death_log) then
for i = 1, 40 do --copy the deaths from the first segment to the last one
- local thisCombat = segmentHistory[i]
+ local thisCombat = segmentsTable[i]
if (thisCombat and thisCombat.is_mythic_dungeon_run_id == Details.mythic_dungeon_id) then
newCombat:CopyDeathsFrom(thisCombat, true)
end
end
else
for i = 40, 1, -1 do --copy the deaths from the last segment to the new segment
- local thisCombat = segmentHistory[i]
+ local thisCombat = segmentsTable[i]
if (thisCombat) then
if (thisCombat.is_mythic_dungeon_run_id == Details.mythic_dungeon_id) then
newCombat:CopyDeathsFrom(thisCombat, true)
@@ -91,7 +91,7 @@ function DetailsMythicPlusFrame.MergeSegmentsOnEnd()
--add all boss segments from this run to this new segment
for i = 1, 40 do --from the newer combat to the oldest
- local thisCombat = segmentHistory[i]
+ local thisCombat = segmentsTable[i]
if (thisCombat and thisCombat.is_mythic_dungeon_run_id == Details.mythic_dungeon_id) then
local canAddThisSegment = true
if (Details.mythic_plus.make_overall_boss_only) then
@@ -255,11 +255,11 @@ function DetailsMythicPlusFrame.MergeTrashCleanup (isFromSchedule)
end
--delete all segments that were merged
- local segmentHistory = Details:GetCombatSegments()
- for segmentId = #segmentHistory, 1, -1 do
- local segment = segmentHistory[segmentId]
+ local segmentsTable = Details:GetCombatSegments()
+ for segmentId = #segmentsTable, 1, -1 do
+ local segment = segmentsTable[segmentId]
if (segment and segment._trashoverallalreadyadded) then
- tremove(segmentHistory, segmentId)
+ tremove(segmentsTable, segmentId)
end
end
@@ -342,16 +342,16 @@ function DetailsMythicPlusFrame.MergeRemainingTrashAfterAllBossesDone()
--remove trash segments from the segment history after the merge
local removedCurrentSegment = false
- local segmentHistory = Details:GetCombatSegments()
+ local segmentsTable = Details:GetCombatSegments()
for _, pastCombat in ipairs(segmentsToMerge) do
- for i = #segmentHistory, 1, -1 do
- local segment = segmentHistory [i]
+ for i = #segmentsTable, 1, -1 do
+ local segment = segmentsTable [i]
if (segment == pastCombat) then
--remove the segment
if (Details.tabela_vigente == segment) then
removedCurrentSegment = true
end
- tremove(segmentHistory, i)
+ tremove(segmentsTable, i)
break
end
end
@@ -363,8 +363,8 @@ function DetailsMythicPlusFrame.MergeRemainingTrashAfterAllBossesDone()
if (removedCurrentSegment) then
--find another current segment
- local segmentHistory = Details:GetCombatSegments()
- Details.tabela_vigente = segmentHistory [1]
+ local segmentsTable = Details:GetCombatSegments()
+ Details.tabela_vigente = segmentsTable [1]
if (not Details.tabela_vigente) then
--assuming there's no segment from the dungeon run
@@ -425,11 +425,11 @@ function DetailsMythicPlusFrame.BossDefeated(this_is_end_end, encounterID, encou
local segmentsToMerge = DetailsMythicPlusFrame.TrashMergeScheduled or {}
--table with all past semgnets
- local segmentHistory = Details:GetCombatSegments()
+ local segmentsTable = Details:GetCombatSegments()
--iterate among segments
for i = 1, 25 do --from the newer combat to the oldest
- local pastCombat = segmentHistory [i]
+ local pastCombat = segmentsTable [i]
--does the combat exists
if (pastCombat and not pastCombat._trashoverallalreadyadded and pastCombat.is_mythic_dungeon_trash) then
--is the combat a mythic segment from this run?
@@ -522,10 +522,10 @@ function DetailsMythicPlusFrame.MythicDungeonFinished (fromZoneLeft)
end
--table with all past semgnets
- local segmentHistory = Details:GetCombatSegments()
+ local segmentsTable = Details:GetCombatSegments()
- for i = 1, #segmentHistory do
- local pastCombat = segmentHistory [i]
+ for i = 1, #segmentsTable do
+ local pastCombat = segmentsTable [i]
--does the combat exists
if (pastCombat and not pastCombat._trashoverallalreadyadded and pastCombat:GetCombatTime() > 5) then
@@ -562,10 +562,10 @@ function DetailsMythicPlusFrame.MythicDungeonFinished (fromZoneLeft)
end
--find the latest trash overall
- local segmentHistory = Details:GetCombatSegments()
+ local segmentsTable = Details:GetCombatSegments()
local latestTrashOverall
- for i = 1, #segmentHistory do
- local pastCombat = segmentHistory [i]
+ for i = 1, #segmentsTable do
+ local pastCombat = segmentsTable [i]
if (pastCombat and pastCombat.is_mythic_dungeon and pastCombat.is_mythic_dungeon.SegmentID == "trashoverall") then
latestTrashOverall = pastCombat
break
diff --git a/functions/slash.lua b/functions/slash.lua
index 736cb414..ac641a6d 100644
--- a/functions/slash.lua
+++ b/functions/slash.lua
@@ -273,7 +273,8 @@ function SlashCmdList.DETAILS (msg, editbox)
local segmentId = rest and tonumber(rest)
if (segmentId and segmentId ~= 1) then
local segmentToErase = tonumber(segmentId)
- local combatObject = tremove(Details.tabela_historico.tabelas, segmentToErase)
+ local combatObject = table.remove(Details:GetCombatSegments(), segmentToErase)
+
if (combatObject) then
Details:DestroyCombat(combatObject)
Details:SendEvent("DETAILS_DATA_SEGMENTREMOVED")
diff --git a/plugins/Details_EncounterDetails/frames.lua b/plugins/Details_EncounterDetails/frames.lua
index 4b176be0..5204f8b6 100644
--- a/plugins/Details_EncounterDetails/frames.lua
+++ b/plugins/Details_EncounterDetails/frames.lua
@@ -2562,8 +2562,8 @@ end
function PhaseFrame:UpdateSegmentCompareBars (phase)
--segmento atual (numero)
local segmentNumber = EncounterDetails._segment
- local segmentTable = PhaseFrame.CurrentSegment
- local bossID = segmentTable:GetBossInfo() and segmentTable:GetBossInfo().id
+ local segmentsTable = PhaseFrame.CurrentSegment
+ local bossID = segmentsTable:GetBossInfo() and segmentsTable:GetBossInfo().id
local index = 1
for i, segment in ipairs (_detalhes:GetCombatSegments()) do
@@ -2573,7 +2573,7 @@ function PhaseFrame:UpdateSegmentCompareBars (phase)
local timers = PhaseFrame:GetPhaseTimers (segment)
if (timers [phase]) then
- if (segment ~= segmentTable) then
+ if (segment ~= segmentsTable) then
bar.name:SetText ("Segment " .. i .. ":")
_detalhes.gump:SetFontColor (bar.name, "orange")
bar.done:SetText (_detalhes.gump:IntegerToTimer (timers [phase]))