Code cleanups, Bug Fixes, Show plugins in the breakdown window, added damage taken and friendly fire tp breakdown
This commit is contained in:
@@ -12,5 +12,588 @@ local _GetSpellInfo = Details.GetSpellInfo
|
||||
local GameTooltip = GameTooltip
|
||||
local IsShiftKeyDown = IsShiftKeyDown
|
||||
local DF = DetailsFramework
|
||||
local tinsert = tinsert
|
||||
local tinsert = table.insert
|
||||
|
||||
local damageClass = Details.atributo_damage
|
||||
|
||||
local spellsTab = DetailsSpellBreakdownTab
|
||||
local headerContainerType = spellsTab.headerContainerType
|
||||
|
||||
local CONST_BAR_HEIGHT = 20
|
||||
local CONST_SPELLSCROLL_LINEHEIGHT = 20
|
||||
local CONST_TARGET_TEXTURE = [[Interface\MINIMAP\TRACKING\Target]]
|
||||
local CONST_SPELLBLOCK_DEFAULT_COLOR = {.4, .4, .4, 1}
|
||||
local CONST_SPELLBLOCK_HEADERTEXT_COLOR = {.9, .8, 0, 1}
|
||||
local CONST_SPELLBLOCK_HEADERTEXT_SIZE = 11
|
||||
|
||||
---onEnter function for the generic bars, set the alpha of the bar to one
|
||||
---@param self breakdowngenericbar
|
||||
local onEnterGenericBar = function(self) --~onenter ~genericbaronenter
|
||||
self:SetAlpha(1)
|
||||
|
||||
if (self.bIsFromLeftScroll) then
|
||||
---@type instance
|
||||
local instanceObject = spellsTab.GetInstance()
|
||||
local mainAttribute, subAttribute = instanceObject:GetDisplay()
|
||||
|
||||
---@type actordamage
|
||||
local currentActor = spellsTab.GetActor()
|
||||
|
||||
---@type combat
|
||||
local currentCombat = instanceObject:GetCombat()
|
||||
|
||||
---@type actorcontainer
|
||||
local actorContainer = currentCombat:GetContainer(DETAILS_ATTRIBUTE_DAMAGE)
|
||||
|
||||
if (mainAttribute == DETAILS_ATTRIBUTE_DAMAGE) then
|
||||
if (subAttribute == DETAILS_SUBATTRIBUTE_DAMAGETAKEN) then
|
||||
local aggressorActor = actorContainer:GetActor(self.actorName)
|
||||
---@type {topValue: number, data: {key1: spellid, key2: number, key3: actorname}[]}
|
||||
local spellList = damageClass.BuildDamageTakenSpellListFromAgressor(currentActor, aggressorActor)
|
||||
spellsTab.GenericScrollFrameRight:RefreshMe(spellList)
|
||||
|
||||
elseif (subAttribute == DETAILS_SUBATTRIBUTE_FRIENDLYFIRE) then
|
||||
--currentActor is the player which inflicted the damage to other players
|
||||
--self.actorName is the name of the actor in the hovered bar
|
||||
local spellList = damageClass.BuildFriendlySpellListFromAgressor(currentActor, self.actorName)
|
||||
spellsTab.GenericScrollFrameRight:RefreshMe(spellList)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--when hovered over, it need to detect which data is shown and call a function within a class to generate the data to show in the right scroll
|
||||
end
|
||||
|
||||
--onLeave function for the generic bars, set the alpha of the bar to 0.9
|
||||
---@param self breakdowngenericbar
|
||||
local onLeaveGenericBar = function(self) --~onleave ~genericbaronleave
|
||||
self:SetAlpha(0.9)
|
||||
end
|
||||
|
||||
---get a generic bar from the scroll box, if it doesn't exist, return nil
|
||||
---@param scrollFrame table
|
||||
---@param lineIndex number
|
||||
---@return breakdownphasebar
|
||||
local getGenericBar = function(scrollFrame, lineIndex)
|
||||
---@type breakdowngenericbar
|
||||
local genericBar = scrollFrame:GetLine(lineIndex)
|
||||
|
||||
--reset header alignment
|
||||
genericBar:ResetFramesToHeaderAlignment()
|
||||
|
||||
--reset columns, hiding them
|
||||
genericBar.Icon:Hide()
|
||||
for inLineIndex = 1, #genericBar.InLineTexts do
|
||||
genericBar.InLineTexts[inLineIndex]:SetText("")
|
||||
end
|
||||
|
||||
return genericBar
|
||||
end
|
||||
|
||||
---@param scrollFrame table
|
||||
---@param scrollData table
|
||||
---@param offset number
|
||||
---@param totalLines number
|
||||
local refreshGenericRightScrollFunc = function(scrollFrame, scrollData, offset, totalLines) --~refreshgeneric ~refreshfunc ~refresh ~refreshg ~updategenericbar
|
||||
local lineIndex = 1
|
||||
local combatTime = scrollData.combatTime
|
||||
local totalValue = scrollData.totalValue
|
||||
|
||||
for i = 1, totalLines do
|
||||
local index = i + offset
|
||||
local spellData = scrollData[index]
|
||||
|
||||
if (spellData) then
|
||||
local spellId = spellData.spellId
|
||||
local spellTotal = spellData.total
|
||||
local petName = spellData.petName
|
||||
local spellSchool = spellData.spellScholl
|
||||
|
||||
local spellName, _, spellIcon = _GetSpellInfo(spellId)
|
||||
|
||||
--get a bar from the second generic scroll frame
|
||||
local genericBar = getGenericBar(scrollFrame, i)
|
||||
genericBar.statusBar:SetValue(spellTotal / scrollFrame.topValue * 100)
|
||||
|
||||
local r, g, b = Details:GetSpellSchoolColor(spellSchool)
|
||||
genericBar.statusBar:SetStatusBarColor(r, g, b, 1)
|
||||
|
||||
---@type number
|
||||
local textIndex = 1
|
||||
|
||||
if (scrollData.headersAllowed.icon) then
|
||||
---@type texturetable
|
||||
genericBar.Icon:Show()
|
||||
genericBar.Icon:SetTexture(spellIcon)
|
||||
genericBar.Icon:SetTexCoord(.1, .9, .1, .9)
|
||||
genericBar.Icon:SetSize(CONST_SPELLSCROLL_LINEHEIGHT-2, CONST_SPELLSCROLL_LINEHEIGHT-2)
|
||||
genericBar:AddFrameToHeaderAlignment(genericBar.Icon)
|
||||
end
|
||||
|
||||
if (scrollData.headersAllowed.rank) then
|
||||
---@type fontstring
|
||||
local fontString = genericBar.InLineTexts[textIndex]
|
||||
genericBar:AddFrameToHeaderAlignment(fontString)
|
||||
fontString:SetText(index)
|
||||
textIndex = textIndex + 1
|
||||
end
|
||||
|
||||
if (scrollData.headersAllowed.name) then
|
||||
---@type fontstring
|
||||
local fontString = genericBar.InLineTexts[textIndex]
|
||||
genericBar:AddFrameToHeaderAlignment(fontString)
|
||||
if (petName ~= "") then
|
||||
--remove the owner name from the pet name
|
||||
petName = petName:gsub((" <.*"), "")
|
||||
spellName = spellName .. " (" .. petName .. ")"
|
||||
end
|
||||
fontString:SetText(spellName)
|
||||
textIndex = textIndex + 1
|
||||
genericBar.actorName = spellName
|
||||
end
|
||||
|
||||
if (scrollData.headersAllowed.amount) then
|
||||
---@type fontstring
|
||||
local fontString = genericBar.InLineTexts[textIndex]
|
||||
genericBar:AddFrameToHeaderAlignment(fontString)
|
||||
fontString:SetText(Details:Format(spellTotal))
|
||||
textIndex = textIndex + 1
|
||||
end
|
||||
|
||||
if (scrollData.headersAllowed.persecond) then
|
||||
---@type fontstring
|
||||
local fontString = genericBar.InLineTexts[textIndex]
|
||||
genericBar:AddFrameToHeaderAlignment(fontString)
|
||||
fontString:SetText(Details:Format(spellTotal / combatTime))
|
||||
textIndex = textIndex + 1
|
||||
end
|
||||
|
||||
if (scrollData.headersAllowed.percent) then
|
||||
---@type fontstring
|
||||
local fontString = genericBar.InLineTexts[textIndex]
|
||||
genericBar:AddFrameToHeaderAlignment(fontString)
|
||||
fontString:SetText(string.format("%.1f", spellTotal / totalValue * 100) .. "%")
|
||||
textIndex = textIndex + 1
|
||||
end
|
||||
|
||||
genericBar:Show()
|
||||
|
||||
genericBar:AlignWithHeader(scrollFrame.Header, "left")
|
||||
|
||||
lineIndex = lineIndex + 1
|
||||
if (lineIndex > totalLines) then
|
||||
break
|
||||
end
|
||||
|
||||
--set the amount
|
||||
--genericBar.InLineTexts[2]:SetText(Details:ToK(spellTotal))
|
||||
|
||||
--set the amount percent
|
||||
--genericBar.InLineTexts[3]:SetText(Details:ToK(spellTotal / totalValue * 100))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---@param scrollFrame table
|
||||
---@param scrollData table
|
||||
---@param offset number
|
||||
---@param totalLines number
|
||||
local refreshGenericLeftScrollFunc = function(scrollFrame, scrollData, offset, totalLines) --~refreshgeneric ~refreshfunc ~refresh ~refreshg ~updategenericbar
|
||||
local lineIndex = 1
|
||||
local combatTime = scrollData.combatTime
|
||||
local totalValue = scrollData.totalValue
|
||||
|
||||
for i = 1, totalLines do
|
||||
local index = i + offset
|
||||
local dataTable = scrollData[index]
|
||||
|
||||
if (dataTable) then
|
||||
local genericBar = getGenericBar(scrollFrame, lineIndex)
|
||||
genericBar.statusBar:SetValue(dataTable.total / scrollFrame.topValue * 100)
|
||||
|
||||
local spellSchool = dataTable.spellScholl
|
||||
local className = dataTable.class
|
||||
|
||||
if (spellSchool) then
|
||||
local r, g, b = Details:GetSpellSchoolColor(spellSchool)
|
||||
genericBar.statusBar:SetStatusBarColor(r, g, b, 1)
|
||||
|
||||
else
|
||||
local red, green, blue = Details:GetClassColor(className)
|
||||
genericBar.statusBar:SetStatusBarColor(red, green, blue, 1)
|
||||
end
|
||||
|
||||
---@type number
|
||||
local textIndex = 1
|
||||
|
||||
if (scrollData.headersAllowed.icon) then
|
||||
---@type texturetable
|
||||
local dataIcon = dataTable.icon
|
||||
genericBar.Icon:Show()
|
||||
genericBar.Icon:SetTexture(dataIcon.texture)
|
||||
genericBar.Icon:SetTexCoord(dataIcon.coords.left, dataIcon.coords.right, dataIcon.coords.top, dataIcon.coords.bottom)
|
||||
genericBar.Icon:SetSize(CONST_SPELLSCROLL_LINEHEIGHT-2, CONST_SPELLSCROLL_LINEHEIGHT-2)
|
||||
genericBar:AddFrameToHeaderAlignment(genericBar.Icon)
|
||||
end
|
||||
|
||||
if (scrollData.headersAllowed.rank) then
|
||||
---@type fontstring
|
||||
local fontString = genericBar.InLineTexts[textIndex]
|
||||
genericBar:AddFrameToHeaderAlignment(fontString)
|
||||
fontString:SetText(index)
|
||||
textIndex = textIndex + 1
|
||||
end
|
||||
|
||||
if (scrollData.headersAllowed.name) then
|
||||
---@type fontstring
|
||||
local fontString = genericBar.InLineTexts[textIndex]
|
||||
genericBar:AddFrameToHeaderAlignment(fontString)
|
||||
local nameWithoutRealm = DF:RemoveRealmName(dataTable.name)
|
||||
fontString:SetText(nameWithoutRealm or dataTable.name)
|
||||
textIndex = textIndex + 1
|
||||
genericBar.actorName = dataTable.name
|
||||
end
|
||||
|
||||
if (scrollData.headersAllowed.amount) then
|
||||
---@type fontstring
|
||||
local fontString = genericBar.InLineTexts[textIndex]
|
||||
genericBar:AddFrameToHeaderAlignment(fontString)
|
||||
fontString:SetText(Details:Format(dataTable.total))
|
||||
textIndex = textIndex + 1
|
||||
end
|
||||
|
||||
if (scrollData.headersAllowed.persecond) then
|
||||
---@type fontstring
|
||||
local fontString = genericBar.InLineTexts[textIndex]
|
||||
genericBar:AddFrameToHeaderAlignment(fontString)
|
||||
fontString:SetText(Details:Format(dataTable.total / combatTime))
|
||||
textIndex = textIndex + 1
|
||||
end
|
||||
|
||||
if (scrollData.headersAllowed.percent) then
|
||||
---@type fontstring
|
||||
local fontString = genericBar.InLineTexts[textIndex]
|
||||
genericBar:AddFrameToHeaderAlignment(fontString)
|
||||
fontString:SetText(string.format("%.1f", dataTable.total / totalValue * 100) .. "%")
|
||||
textIndex = textIndex + 1
|
||||
end
|
||||
|
||||
genericBar:AlignWithHeader(scrollFrame.Header, "left")
|
||||
|
||||
lineIndex = lineIndex + 1
|
||||
if (lineIndex > totalLines) then
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---create a genericbar within the generic scroll
|
||||
---@param self breakdowngenericscrollframe
|
||||
---@param index number
|
||||
---@return breakdowngenericbar
|
||||
local createGenericBar = function(self, index) --~create ~generic ~creategeneric ~genericbar
|
||||
---@type breakdowngenericbar
|
||||
local genericBar = CreateFrame("button", self:GetName() .. "GenericBarButton" .. index, self)
|
||||
genericBar.index = index
|
||||
|
||||
--size and positioning
|
||||
genericBar:SetHeight(CONST_SPELLSCROLL_LINEHEIGHT)
|
||||
local y = (index-1) * CONST_SPELLSCROLL_LINEHEIGHT * -1 + (1 * -index) - 15
|
||||
genericBar:SetPoint("topleft", self, "topleft", 0, y)
|
||||
genericBar:SetPoint("topright", self, "topright", 0, y)
|
||||
|
||||
genericBar:EnableMouse(true)
|
||||
|
||||
genericBar:SetAlpha(0.9)
|
||||
genericBar:SetFrameStrata("HIGH")
|
||||
genericBar:SetScript("OnEnter", onEnterGenericBar)
|
||||
genericBar:SetScript("OnLeave", onLeaveGenericBar)
|
||||
|
||||
DF:Mixin(genericBar, DF.HeaderFunctions)
|
||||
|
||||
---@type breakdownspellbarstatusbar
|
||||
local statusBar = CreateFrame("StatusBar", "$parentStatusBar", genericBar)
|
||||
statusBar:SetAllPoints()
|
||||
statusBar:SetAlpha(0.8)
|
||||
statusBar:SetMinMaxValues(0, 100)
|
||||
statusBar:SetValue(50)
|
||||
statusBar:EnableMouse(false)
|
||||
statusBar:SetFrameLevel(genericBar:GetFrameLevel() - 1)
|
||||
genericBar.statusBar = statusBar
|
||||
|
||||
---@type texture this is the statusbar texture
|
||||
local statusBarTexture = statusBar:CreateTexture("$parentTexture", "artwork")
|
||||
statusBarTexture:SetTexture(SharedMedia:Fetch("statusbar", "Details Hyanda"))
|
||||
statusBar:SetStatusBarTexture(statusBarTexture)
|
||||
statusBar:SetStatusBarColor(1, 1, 1, 1)
|
||||
|
||||
---@type texture shown when the mouse hoverover this bar
|
||||
local hightlightTexture = statusBar:CreateTexture("$parentTextureHighlight", "highlight")
|
||||
hightlightTexture:SetColorTexture(1, 1, 1, 0.2)
|
||||
hightlightTexture:SetAllPoints()
|
||||
statusBar.highlightTexture = hightlightTexture
|
||||
|
||||
---@type texture background texture
|
||||
local backgroundTexture = statusBar:CreateTexture("$parentTextureBackground", "border")
|
||||
backgroundTexture:SetAllPoints()
|
||||
backgroundTexture:SetColorTexture(.05, .05, .05)
|
||||
backgroundTexture:SetAlpha(1)
|
||||
statusBar.backgroundTexture = backgroundTexture
|
||||
|
||||
--create an icon
|
||||
---@type texture
|
||||
local icon = statusBar:CreateTexture("$parentTexture", "overlay")
|
||||
icon:SetPoint("left", statusBar, "left", 0, 0)
|
||||
icon:SetSize(CONST_SPELLSCROLL_LINEHEIGHT-2, CONST_SPELLSCROLL_LINEHEIGHT-2)
|
||||
icon:SetTexCoord(.1, .9, .1, .9)
|
||||
genericBar.Icon = icon
|
||||
|
||||
genericBar:AddFrameToHeaderAlignment(icon)
|
||||
|
||||
genericBar.InLineTexts = {}
|
||||
|
||||
for i = 1, 5 do
|
||||
---@type fontstring
|
||||
local fontString = genericBar:CreateFontString("$parentFontString" .. i, "overlay", "GameFontHighlightSmall")
|
||||
fontString:SetJustifyH("left")
|
||||
fontString:SetTextColor(1, 1, 1, 1)
|
||||
fontString:SetNonSpaceWrap(true)
|
||||
fontString:SetWordWrap(false)
|
||||
genericBar["lineText" .. i] = fontString
|
||||
genericBar.InLineTexts[i] = fontString
|
||||
fontString:SetTextColor(1, 1, 1, 1)
|
||||
genericBar:AddFrameToHeaderAlignment(fontString)
|
||||
end
|
||||
|
||||
genericBar:AlignWithHeader(self.Header, "left")
|
||||
|
||||
return genericBar
|
||||
end
|
||||
|
||||
---create two generic containers, these containers hold bars that can show any type of data
|
||||
---an example is damage taken in the left container and the spells which caused the damage in the right container
|
||||
---@param tabFrame tabframe
|
||||
---@return breakdowngenericscrollframe, breakdowngenericscrollframe
|
||||
function spellsTab.CreateGenericContainers(tabFrame) --~create ~generic ~creategenericcontainer ~creategenericscroll ~creategeneric
|
||||
local defaultAmountOfLines = 50
|
||||
|
||||
--create a container for the scrollframe
|
||||
local optionsLeftScroll = {
|
||||
width = Details.breakdown_spell_tab.genericcontainer_width,
|
||||
height = Details.breakdown_spell_tab.genericcontainer_height,
|
||||
is_locked = Details.breakdown_spell_tab.genericcontainer_islocked,
|
||||
can_move = false,
|
||||
can_move_children = false,
|
||||
use_top_resizer = true,
|
||||
use_right_resizer = true,
|
||||
use_bottom_resizer = true,
|
||||
use_left_resizer = true,
|
||||
}
|
||||
|
||||
--create a container for the scrollframe
|
||||
local optionsRightScroll = {
|
||||
width = Details.breakdown_spell_tab.genericcontainer_right_width,
|
||||
height = Details.breakdown_spell_tab.genericcontainer_right_height,
|
||||
is_locked = Details.breakdown_spell_tab.genericcontainer_islocked,
|
||||
can_move = false,
|
||||
can_move_children = false,
|
||||
use_top_resizer = true,
|
||||
use_right_resizer = true,
|
||||
use_bottom_resizer = true,
|
||||
use_left_resizer = true,
|
||||
}
|
||||
|
||||
---@type df_framecontainer
|
||||
local leftContainer = DF:CreateFrameContainer(tabFrame, optionsLeftScroll, tabFrame:GetName() .. "GenericScrollContainerLeft")
|
||||
leftContainer:SetPoint("topleft", tabFrame, "topleft", 0, 0)
|
||||
leftContainer:SetFrameLevel(tabFrame:GetFrameLevel()+1)
|
||||
spellsTab.GenericContainerFrameLeft = leftContainer
|
||||
|
||||
---@type df_framecontainer
|
||||
local rightContainer = DF:CreateFrameContainer(tabFrame, optionsRightScroll, tabFrame:GetName() .. "GenericScrollContainerRight")
|
||||
rightContainer:SetPoint("topleft", leftContainer, "topright", 30, 0)
|
||||
rightContainer:SetFrameLevel(tabFrame:GetFrameLevel()+1)
|
||||
spellsTab.GenericContainerFrameRight = rightContainer
|
||||
|
||||
--when a setting is changed in the container, it will call this function, it is registered below with SetSettingChangedCallback()
|
||||
local settingChangedCallbackFunction_Left = function(frameContainer, settingName, settingValue)
|
||||
if (frameContainer:IsShown()) then
|
||||
if (settingName == "height") then
|
||||
---@type number
|
||||
local currentHeight = frameContainer.ScrollFrame:GetHeight()
|
||||
Details.breakdown_spell_tab.genericcontainer_height = settingValue
|
||||
frameContainer.ScrollFrame:SetNumFramesShown(math.floor(currentHeight / CONST_SPELLSCROLL_LINEHEIGHT) - 2)
|
||||
|
||||
elseif (settingName == "width") then
|
||||
Details.breakdown_spell_tab.genericcontainer_width = settingValue
|
||||
|
||||
elseif (settingName == "is_locked") then
|
||||
Details.breakdown_spell_tab.genericcontainer_islocked = settingValue
|
||||
end
|
||||
end
|
||||
end
|
||||
leftContainer:SetSettingChangedCallback(settingChangedCallbackFunction_Left)
|
||||
|
||||
--when a setting is changed in the container, it will call this function, it is registered below with SetSettingChangedCallback()
|
||||
local settingChangedCallbackFunction_Right = function(frameContainer, settingName, settingValue)
|
||||
if (frameContainer:IsShown()) then
|
||||
if (settingName == "height") then
|
||||
---@type number
|
||||
local currentHeight = frameContainer.ScrollFrame:GetHeight()
|
||||
Details.breakdown_spell_tab.genericcontainer_right_height = settingValue
|
||||
frameContainer.ScrollFrame:SetNumFramesShown(math.floor(currentHeight / CONST_SPELLSCROLL_LINEHEIGHT) - 2)
|
||||
|
||||
elseif (settingName == "width") then
|
||||
Details.breakdown_spell_tab.genericcontainer_right_width = settingValue
|
||||
|
||||
elseif (settingName == "is_locked") then
|
||||
Details.breakdown_spell_tab.genericcontainer_islocked = settingValue
|
||||
end
|
||||
end
|
||||
end
|
||||
rightContainer:SetSettingChangedCallback(settingChangedCallbackFunction_Right)
|
||||
|
||||
--create the left scrollframe
|
||||
local genericScrollFrameLeft = DF:CreateScrollBox(leftContainer, "$parentGenericScrollLeft", refreshGenericLeftScrollFunc, {}, Details.breakdown_spell_tab.genericcontainer_width, Details.breakdown_spell_tab.genericcontainer_height, defaultAmountOfLines, CONST_SPELLSCROLL_LINEHEIGHT)
|
||||
DF:ReskinSlider(genericScrollFrameLeft)
|
||||
genericScrollFrameLeft:SetBackdrop({})
|
||||
genericScrollFrameLeft:SetAllPoints()
|
||||
leftContainer:RegisterChildForDrag(genericScrollFrameLeft)
|
||||
leftContainer.ScrollFrame = genericScrollFrameLeft
|
||||
genericScrollFrameLeft.DontHideChildrenOnPreRefresh = false
|
||||
tabFrame.GenericScrollFrameLeft = genericScrollFrameLeft
|
||||
spellsTab.GenericScrollFrameLeft = genericScrollFrameLeft
|
||||
|
||||
--create the right scrollframe
|
||||
local genericScrollFrameRight = DF:CreateScrollBox(rightContainer, "$parentGenericScrollRight", refreshGenericRightScrollFunc, {}, Details.breakdown_spell_tab.genericcontainer_right_width, Details.breakdown_spell_tab.genericcontainer_right_height, defaultAmountOfLines, CONST_SPELLSCROLL_LINEHEIGHT)
|
||||
DF:ReskinSlider(genericScrollFrameRight)
|
||||
genericScrollFrameRight:SetBackdrop({})
|
||||
genericScrollFrameRight:SetAllPoints()
|
||||
rightContainer:RegisterChildForDrag(genericScrollFrameRight)
|
||||
rightContainer.ScrollFrame = genericScrollFrameRight
|
||||
genericScrollFrameRight.DontHideChildrenOnPreRefresh = false
|
||||
tabFrame.GenericScrollFrameRight = genericScrollFrameRight
|
||||
spellsTab.GenericScrollFrameRight = genericScrollFrameRight
|
||||
|
||||
function genericScrollFrameLeft:RefreshMe(data) --~refreshme (generic) ~refreshg
|
||||
--get which column is currently selected and the sort order
|
||||
local columnIndex, order, key = genericScrollFrameLeft.Header:GetSelectedColumn()
|
||||
genericScrollFrameLeft.SortKey = key
|
||||
|
||||
---@type string
|
||||
local keyToSort = key
|
||||
|
||||
if (order == "DESC") then
|
||||
table.sort(data,
|
||||
function(t1, t2)
|
||||
return t1[keyToSort] > t2[keyToSort]
|
||||
end)
|
||||
genericScrollFrameLeft.topValue = data[1] and data[1][keyToSort] or 0.00001
|
||||
else
|
||||
table.sort(data,
|
||||
function(t1, t2)
|
||||
return t1[keyToSort] < t2[keyToSort]
|
||||
end)
|
||||
genericScrollFrameLeft.topValue = data[#data] and data[#data][keyToSort] or 0.00001
|
||||
end
|
||||
|
||||
genericScrollFrameLeft:SetData(data)
|
||||
genericScrollFrameLeft:Refresh()
|
||||
|
||||
--clear the right scrollframe
|
||||
genericScrollFrameRight:SetData({})
|
||||
genericScrollFrameRight:Refresh()
|
||||
end
|
||||
|
||||
function genericScrollFrameRight:RefreshMe(data) --~refreshme (generic) ~refreshg
|
||||
--get which column is currently selected and the sort order
|
||||
local columnIndex, order, key = genericScrollFrameRight.Header:GetSelectedColumn()
|
||||
genericScrollFrameRight.SortKey = key
|
||||
|
||||
---@type string
|
||||
local keyToSort = key
|
||||
|
||||
if (order == "DESC") then
|
||||
table.sort(data,
|
||||
function(t1, t2)
|
||||
return t1[keyToSort] > t2[keyToSort]
|
||||
end)
|
||||
genericScrollFrameRight.topValue = data[1] and data[1][keyToSort] or 0.00001
|
||||
else
|
||||
table.sort(data,
|
||||
function(t1, t2)
|
||||
return t1[keyToSort] < t2[keyToSort]
|
||||
end)
|
||||
genericScrollFrameRight.topValue = data[#data] and data[#data][keyToSort] or 0.00001
|
||||
end
|
||||
|
||||
genericScrollFrameRight:SetData(data)
|
||||
genericScrollFrameRight:Refresh()
|
||||
end
|
||||
|
||||
--~header
|
||||
local headerOptions = {
|
||||
padding = 2,
|
||||
header_height = 14,
|
||||
|
||||
reziser_shown = true,
|
||||
reziser_width = 2,
|
||||
reziser_color = {.5, .5, .5, 0.7},
|
||||
reziser_max_width = 246,
|
||||
|
||||
header_click_callback = spellsTab.OnAnyColumnHeaderClickCallback,
|
||||
|
||||
header_backdrop_color = {0.1, 0.1, 0.1, 0.4},
|
||||
text_color = {1, 1, 1, 0.823},
|
||||
}
|
||||
|
||||
local headerOptionsRight = {
|
||||
padding = 2,
|
||||
header_height = 14,
|
||||
|
||||
reziser_shown = true,
|
||||
reziser_width = 2,
|
||||
reziser_color = {.5, .5, .5, 0.7},
|
||||
reziser_max_width = 210,
|
||||
|
||||
header_click_callback = spellsTab.OnAnyColumnHeaderClickCallback,
|
||||
|
||||
header_backdrop_color = {0.1, 0.1, 0.1, 0.4},
|
||||
text_color = {1, 1, 1, 0.823},
|
||||
}
|
||||
|
||||
---@type df_headerframe
|
||||
local headerLeft = DetailsFramework:CreateHeader(leftContainer, spellsTab.genericContainerLeftColumnData, headerOptions)
|
||||
headerLeft:SetPoint("topleft", genericScrollFrameLeft, "topleft", 0, 1)
|
||||
headerLeft:SetColumnSettingChangedCallback(spellsTab.OnHeaderColumnOptionChanged)
|
||||
genericScrollFrameLeft.Header = headerLeft
|
||||
|
||||
---@type df_headerframe
|
||||
local headerRight = DetailsFramework:CreateHeader(rightContainer, spellsTab.genericContainerRightColumnData, headerOptionsRight)
|
||||
headerRight:SetPoint("topleft", genericScrollFrameRight, "topleft", 0, 1)
|
||||
headerRight:SetColumnSettingChangedCallback(spellsTab.OnHeaderColumnOptionChanged)
|
||||
genericScrollFrameRight.Header = headerRight
|
||||
|
||||
--cache the type of these headers
|
||||
headerContainerType[headerLeft] = "generic_left"
|
||||
headerContainerType[headerRight] = "generic_right"
|
||||
|
||||
--create the scroll lines
|
||||
for i = 1, defaultAmountOfLines do
|
||||
local lineFrame = genericScrollFrameLeft:CreateLine(createGenericBar)
|
||||
lineFrame.bIsFromLeftScroll = true
|
||||
end
|
||||
|
||||
--create the scroll lines
|
||||
for i = 1, defaultAmountOfLines do
|
||||
local lineFrame = genericScrollFrameRight:CreateLine(createGenericBar)
|
||||
lineFrame:Hide()
|
||||
lineFrame.bIsFromRightScroll = true
|
||||
end
|
||||
|
||||
--need to create the second scroll frame to show the details about the spelltable/actor hovered over
|
||||
|
||||
return genericScrollFrameLeft, genericScrollFrameRight
|
||||
end
|
||||
@@ -0,0 +1,396 @@
|
||||
|
||||
local addonName, Details222 = ...
|
||||
local breakdownWindow = Details.BreakdownWindow
|
||||
local Loc = LibStub("AceLocale-3.0"):GetLocale("Details")
|
||||
local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0")
|
||||
local unpack = unpack
|
||||
local GetTime = GetTime
|
||||
local CreateFrame = CreateFrame
|
||||
local GetSpellLink = GetSpellLink
|
||||
local GetSpellInfo = GetSpellInfo
|
||||
local _GetSpellInfo = Details.GetSpellInfo
|
||||
local GameTooltip = GameTooltip
|
||||
local IsShiftKeyDown = IsShiftKeyDown
|
||||
local DF = DetailsFramework
|
||||
local tinsert = table.insert
|
||||
|
||||
local spellsTab = DetailsSpellBreakdownTab
|
||||
local headerContainerType = spellsTab.headerContainerType
|
||||
|
||||
local CONST_BAR_HEIGHT = 20
|
||||
local CONST_SPELLSCROLL_LINEHEIGHT = 20
|
||||
local CONST_TARGET_TEXTURE = [[Interface\MINIMAP\TRACKING\Target]]
|
||||
local CONST_SPELLBLOCK_DEFAULT_COLOR = {.4, .4, .4, 1}
|
||||
local CONST_SPELLBLOCK_HEADERTEXT_COLOR = {.9, .8, 0, 1}
|
||||
local CONST_SPELLBLOCK_HEADERTEXT_SIZE = 11
|
||||
|
||||
|
||||
---create a targetbar within the target scroll
|
||||
---@param self breakdownphasescrollframe
|
||||
---@param index number
|
||||
---@return breakdownphasebar
|
||||
function spellsTab.CreatePhaseBar(self, index) --~create ~createphase ~phasebar
|
||||
---@type breakdownphasebar
|
||||
local phaseBar = CreateFrame("button", self:GetName() .. "PhaseBarButton" .. index, self)
|
||||
phaseBar.index = index
|
||||
|
||||
--size and positioning
|
||||
phaseBar:SetHeight(CONST_SPELLSCROLL_LINEHEIGHT)
|
||||
local y = (index-1) * CONST_SPELLSCROLL_LINEHEIGHT * -1 + (1 * -index) - 15
|
||||
phaseBar:SetPoint("topleft", self, "topleft", 1, y)
|
||||
phaseBar:SetPoint("topright", self, "topright", -1, y)
|
||||
|
||||
phaseBar:EnableMouse(true)
|
||||
|
||||
phaseBar:SetAlpha(0.823)
|
||||
phaseBar:SetFrameStrata("HIGH")
|
||||
phaseBar:SetScript("OnEnter", nil)
|
||||
phaseBar:SetScript("OnLeave", nil)
|
||||
|
||||
DF:Mixin(phaseBar, DF.HeaderFunctions)
|
||||
|
||||
---@type breakdownspellbarstatusbar
|
||||
local statusBar = CreateFrame("StatusBar", "$parentStatusBar", phaseBar)
|
||||
statusBar:SetAllPoints()
|
||||
statusBar:SetAlpha(0.5)
|
||||
statusBar:SetMinMaxValues(0, 100)
|
||||
statusBar:SetValue(50)
|
||||
statusBar:EnableMouse(false)
|
||||
statusBar:SetFrameLevel(phaseBar:GetFrameLevel() - 1)
|
||||
phaseBar.statusBar = statusBar
|
||||
|
||||
---@type texture this is the statusbar texture
|
||||
local statusBarTexture = statusBar:CreateTexture("$parentTexture", "artwork")
|
||||
statusBarTexture:SetTexture(SharedMedia:Fetch("statusbar", "Details Hyanda"))
|
||||
statusBar:SetStatusBarTexture(statusBarTexture)
|
||||
statusBar:SetStatusBarColor(1, 1, 1, 1)
|
||||
|
||||
---@type texture shown when the mouse hoverover this bar
|
||||
local hightlightTexture = statusBar:CreateTexture("$parentTextureHighlight", "highlight")
|
||||
hightlightTexture:SetColorTexture(1, 1, 1, 0.2)
|
||||
hightlightTexture:SetAllPoints()
|
||||
statusBar.highlightTexture = hightlightTexture
|
||||
|
||||
---@type texture background texture
|
||||
local backgroundTexture = statusBar:CreateTexture("$parentTextureBackground", "border")
|
||||
backgroundTexture:SetAllPoints()
|
||||
backgroundTexture:SetColorTexture(.05, .05, .05)
|
||||
backgroundTexture:SetAlpha(1)
|
||||
statusBar.backgroundTexture = backgroundTexture
|
||||
|
||||
--create an icon
|
||||
---@type texture
|
||||
local icon = statusBar:CreateTexture("$parentTexture", "overlay")
|
||||
icon:SetPoint("left", statusBar, "left", 0, 0)
|
||||
icon:SetSize(CONST_SPELLSCROLL_LINEHEIGHT-2, CONST_SPELLSCROLL_LINEHEIGHT-2)
|
||||
icon:SetTexCoord(.1, .9, .1, .9)
|
||||
phaseBar.Icon = icon
|
||||
|
||||
phaseBar:AddFrameToHeaderAlignment(icon)
|
||||
|
||||
phaseBar.InLineTexts = {}
|
||||
|
||||
for i = 1, 5 do
|
||||
---@type fontstring
|
||||
local fontString = phaseBar:CreateFontString("$parentFontString" .. i, "overlay", "GameFontHighlightSmall")
|
||||
fontString:SetJustifyH("left")
|
||||
fontString:SetTextColor(1, 1, 1, 1)
|
||||
fontString:SetNonSpaceWrap(true)
|
||||
fontString:SetWordWrap(false)
|
||||
phaseBar["lineText" .. i] = fontString
|
||||
phaseBar.InLineTexts[i] = fontString
|
||||
fontString:SetTextColor(1, 1, 1, 1)
|
||||
phaseBar:AddFrameToHeaderAlignment(fontString)
|
||||
end
|
||||
|
||||
phaseBar:AlignWithHeader(self.Header, "left")
|
||||
|
||||
return phaseBar
|
||||
end
|
||||
|
||||
---get a spell bar from the scroll box, if it doesn't exist, return nil
|
||||
---@param scrollFrame table
|
||||
---@param lineIndex number
|
||||
---@return breakdownphasebar
|
||||
local getPhaseBar = function(scrollFrame, lineIndex)
|
||||
---@type breakdownphasebar
|
||||
local phaseBar = scrollFrame:GetLine(lineIndex)
|
||||
|
||||
--reset header alignment
|
||||
phaseBar:ResetFramesToHeaderAlignment()
|
||||
|
||||
spellsTab.UpdateBarSettings(phaseBar)
|
||||
|
||||
--reset columns, hiding them
|
||||
phaseBar.Icon:Hide()
|
||||
for inLineIndex = 1, #phaseBar.InLineTexts do
|
||||
phaseBar.InLineTexts[inLineIndex]:SetText("")
|
||||
end
|
||||
|
||||
return phaseBar
|
||||
end
|
||||
|
||||
---@param scrollFrame table
|
||||
---@param scrollData table
|
||||
---@param offset number
|
||||
---@param totalLines number
|
||||
local refreshPhaseFunc = function(scrollFrame, scrollData, offset, totalLines) --~refreshphases ~refreshfunc ~refresh ~refreshp ~updatephasebar
|
||||
local lineIndex = 1
|
||||
local formatFunc = Details:GetCurrentToKFunction()
|
||||
local phaseElapsedTime = scrollData.phaseElapsed
|
||||
|
||||
for i = 1, totalLines do
|
||||
local index = i + offset
|
||||
local dataTable = scrollData[index]
|
||||
|
||||
if (dataTable) then
|
||||
local phaseBar = getPhaseBar(scrollFrame, lineIndex)
|
||||
|
||||
phaseBar.statusBar:SetValue(100)
|
||||
|
||||
local totalDone = dataTable.amountDone
|
||||
local phaseName = dataTable.phaseName
|
||||
local phaseNameFormatted = "Phase: " .. phaseName
|
||||
local amountDoneFormatted = formatFunc(nil, totalDone)
|
||||
local positionWithInPhase = math.floor(dataTable.positionWithInPhase)
|
||||
local percentDone = string.format("%.1f", dataTable.percentDone)
|
||||
|
||||
local elapsedTime = phaseElapsedTime[phaseName]
|
||||
local phaseDps = formatFunc(nil, totalDone / elapsedTime)
|
||||
|
||||
phaseBar.Icon:Show()
|
||||
phaseBar.Icon:SetTexture([[Interface\Garrison\orderhall-missions-mechanic9]])
|
||||
phaseBar.Icon:SetTexCoord(11/64, 53/64, 11/64, 53/64)
|
||||
phaseBar.Icon:SetSize(CONST_SPELLSCROLL_LINEHEIGHT-2, CONST_SPELLSCROLL_LINEHEIGHT-2)
|
||||
phaseBar:AddFrameToHeaderAlignment(phaseBar.Icon)
|
||||
|
||||
for inLineIndex = 1, #phaseBar.InLineTexts do
|
||||
phaseBar.InLineTexts[inLineIndex]:SetText("")
|
||||
end
|
||||
|
||||
local text1 = phaseBar.InLineTexts[1]
|
||||
phaseBar:AddFrameToHeaderAlignment(text1)
|
||||
text1:SetText(phaseNameFormatted)
|
||||
|
||||
local text2 = phaseBar.InLineTexts[2]
|
||||
phaseBar:AddFrameToHeaderAlignment(text2)
|
||||
text2:SetText("#" .. positionWithInPhase)
|
||||
|
||||
local text3 = phaseBar.InLineTexts[3]
|
||||
phaseBar:AddFrameToHeaderAlignment(text3)
|
||||
text3:SetText(amountDoneFormatted)
|
||||
|
||||
local text4 = phaseBar.InLineTexts[4]
|
||||
phaseBar:AddFrameToHeaderAlignment(text4)
|
||||
text4:SetText(phaseDps)
|
||||
|
||||
local text5 = phaseBar.InLineTexts[5]
|
||||
phaseBar:AddFrameToHeaderAlignment(text5)
|
||||
text5:SetText(percentDone .. "%")
|
||||
|
||||
lineIndex = lineIndex + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---create a container to show value per phase
|
||||
---@param tabFrame tabframe
|
||||
---@return breakdownphasescrollframe
|
||||
function spellsTab.CreatePhasesContainer(tabFrame) --~phase ~createphasecontainer ~createphasescroll
|
||||
---@type width
|
||||
local width = Details.breakdown_spell_tab.phasecontainer_width
|
||||
---@type height
|
||||
local height = Details.breakdown_spell_tab.phasecontainer_height
|
||||
|
||||
local defaultAmountOfLines = 10
|
||||
|
||||
--create a container for the scrollframe
|
||||
local options = {
|
||||
width = Details.breakdown_spell_tab.phasecontainer_width,
|
||||
height = Details.breakdown_spell_tab.phasecontainer_height,
|
||||
is_locked = Details.breakdown_spell_tab.phasecontainer_islocked,
|
||||
can_move = false,
|
||||
can_move_children = false,
|
||||
use_top_resizer = true,
|
||||
use_right_resizer = true,
|
||||
use_left_resizer = true,
|
||||
use_bottom_resizer = true,
|
||||
}
|
||||
|
||||
---@type df_framecontainer
|
||||
local container = DF:CreateFrameContainer(tabFrame, options, tabFrame:GetName() .. "PhaseScrollContainer")
|
||||
container:SetPoint("topleft", spellsTab.GetTargetScrollContainer(), "topright", 26, 0)
|
||||
container:SetFrameLevel(tabFrame:GetFrameLevel() + 10)
|
||||
spellsTab.PhaseContainerFrame = container
|
||||
|
||||
local settingChangedCallbackFunction = function(frameContainer, settingName, settingValue)
|
||||
if (frameContainer:IsShown()) then
|
||||
if (settingName == "height") then
|
||||
---@type number
|
||||
local currentHeight = spellsTab.GetPhaseScrollFrame():GetHeight()
|
||||
Details.breakdown_spell_tab.phasecontainer_height = settingValue
|
||||
local lineAmount = math.floor(currentHeight / CONST_SPELLSCROLL_LINEHEIGHT)
|
||||
spellsTab.GetPhaseScrollFrame():SetNumFramesShown(lineAmount)
|
||||
|
||||
elseif (settingName == "width") then
|
||||
Details.breakdown_spell_tab.phasecontainer_width = settingValue
|
||||
|
||||
elseif (settingName == "is_locked") then
|
||||
Details.breakdown_spell_tab.phasecontainer_islocked = settingValue
|
||||
end
|
||||
end
|
||||
end
|
||||
container:SetSettingChangedCallback(settingChangedCallbackFunction)
|
||||
|
||||
---@type breakdownphasescrollframe not sure is this is correct
|
||||
local phaseScrollFrame = DF:CreateScrollBox(container, "$parentPhaseScroll", refreshPhaseFunc, {}, width, height, defaultAmountOfLines, CONST_SPELLSCROLL_LINEHEIGHT)
|
||||
DF:ReskinSlider(phaseScrollFrame)
|
||||
|
||||
phaseScrollFrame:SetBackdrop({})
|
||||
phaseScrollFrame:SetAllPoints()
|
||||
|
||||
container:RegisterChildForDrag(phaseScrollFrame)
|
||||
|
||||
phaseScrollFrame.DontHideChildrenOnPreRefresh = false
|
||||
tabFrame.PhaseScrollFrame = phaseScrollFrame
|
||||
spellsTab.PhaseScrollFrame = phaseScrollFrame
|
||||
|
||||
spellsTab.ApplyStandardBackdrop(container, phaseScrollFrame)
|
||||
|
||||
function phaseScrollFrame:RefreshMe() --~refreshme (phases) ~refreshmep
|
||||
--get the value of the top 1 ranking spell
|
||||
---@type actor
|
||||
local actorObject = spellsTab.GetActor()
|
||||
---@type combat
|
||||
local combatObject = spellsTab.GetCombat()
|
||||
local actorName = actorObject:Name()
|
||||
---@type instance
|
||||
local instanceObject = spellsTab.GetInstance()
|
||||
|
||||
local mainAttribute = instanceObject:GetDisplay()
|
||||
|
||||
local data = {
|
||||
--playerObject = playerObject,
|
||||
--attribute = attribute,
|
||||
--combatObject = combatObject,
|
||||
combatTime = combatObject:GetCombatTime(),
|
||||
}
|
||||
|
||||
local playerPhases = {}
|
||||
local totalDamage = 0
|
||||
local phaseElapsed = {}
|
||||
|
||||
local phasesInfo = combatObject:GetPhases()
|
||||
|
||||
if (not phasesInfo) then
|
||||
spellsTab.PhaseContainerFrame:Hide()
|
||||
return
|
||||
end
|
||||
|
||||
if (#phasesInfo == 1) then
|
||||
--if there's only one phase, then there's no need to show phases
|
||||
spellsTab.PhaseContainerFrame:Hide()
|
||||
return
|
||||
else
|
||||
spellsTab.PhaseContainerFrame:Show()
|
||||
end
|
||||
|
||||
if (#phasesInfo >= 1) then
|
||||
--get phase elapsed time
|
||||
for i = 1, #phasesInfo do
|
||||
local thisPhase = phasesInfo[i]
|
||||
local phaseName = thisPhase[1]
|
||||
local startTime = thisPhase[2]
|
||||
|
||||
local nextPhase = phasesInfo[i + 1]
|
||||
if (nextPhase) then
|
||||
--if there's a next phase, use it's start time as end time to calcule elapsed time
|
||||
local endTime = nextPhase[2]
|
||||
local elapsedTime = endTime - startTime
|
||||
phaseElapsed[phaseName] = (phaseElapsed[phaseName] or 0) + elapsedTime
|
||||
else
|
||||
--if there's no next phase, use the combat end time as end time to calcule elapsed time
|
||||
local endTime = combatObject:GetCombatTime()
|
||||
local elapsedTime = endTime - startTime
|
||||
phaseElapsed[phaseName] = (phaseElapsed[phaseName] or 0) + elapsedTime
|
||||
end
|
||||
end
|
||||
|
||||
--get damage info
|
||||
local dataTable = mainAttribute == 1 and phasesInfo.damage or phasesInfo.heal
|
||||
for phaseName, playersTable in pairs(dataTable) do --each phase
|
||||
local allPlayers = {} --all players for this phase
|
||||
for playerName, amount in pairs(playersTable) do
|
||||
tinsert(allPlayers, {playerName, amount})
|
||||
totalDamage = totalDamage + amount
|
||||
end
|
||||
table.sort(allPlayers, function(a, b)
|
||||
return a[2] > b[2]
|
||||
end)
|
||||
|
||||
local myRank = 0
|
||||
for i = 1, #allPlayers do
|
||||
if (allPlayers[i][1] == actorName) then
|
||||
myRank = i
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
tinsert(playerPhases, {phaseName, playersTable[actorName] or 0, myRank, (playersTable[actorName] or 0) / totalDamage * 100})
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(playerPhases, function(a, b) return a[1] < b[1] end)
|
||||
|
||||
for i = 1, #playerPhases do
|
||||
data[#data+1] = {
|
||||
phaseName = playerPhases[i][1],
|
||||
amountDone = playerPhases[i][2],
|
||||
positionWithInPhase = playerPhases[i][3],
|
||||
percentDone = playerPhases[i][4],
|
||||
}
|
||||
end
|
||||
|
||||
data.totalDamage = totalDamage
|
||||
data.phaseElapsed = phaseElapsed
|
||||
|
||||
phaseScrollFrame:SetData(data)
|
||||
phaseScrollFrame:Refresh()
|
||||
end
|
||||
|
||||
--~header
|
||||
local headerOptions = {
|
||||
padding = 2,
|
||||
header_height = 14,
|
||||
|
||||
reziser_shown = true,
|
||||
reziser_width = 2,
|
||||
reziser_color = {.5, .5, .5, 0.7},
|
||||
reziser_max_width = 246,
|
||||
|
||||
header_click_callback = spellsTab.OnAnyColumnHeaderClickCallback,
|
||||
|
||||
header_backdrop_color = {0.1, 0.1, 0.1, 0.4},
|
||||
text_color = {1, 1, 1, 0.823},
|
||||
}
|
||||
|
||||
---@type df_headerframe
|
||||
local header = DetailsFramework:CreateHeader(container, spellsTab.phaseContainerColumnData, headerOptions)
|
||||
phaseScrollFrame.Header = header
|
||||
phaseScrollFrame.Header:SetPoint("topleft", phaseScrollFrame, "topleft", 0, 1)
|
||||
phaseScrollFrame.Header:SetColumnSettingChangedCallback(spellsTab.OnHeaderColumnOptionChanged)
|
||||
|
||||
--cache the type of this container
|
||||
headerContainerType[phaseScrollFrame.Header] = "phases"
|
||||
|
||||
--create the scroll lines
|
||||
for i = 1, defaultAmountOfLines do
|
||||
phaseScrollFrame:CreateLine(spellsTab.CreatePhaseBar)
|
||||
end
|
||||
|
||||
tabFrame.phases = container:CreateFontString(nil, "overlay", "QuestFont_Large")
|
||||
tabFrame.phases:SetPoint("bottomleft", container, "topleft", 2, 2)
|
||||
tabFrame.phases:SetText("Phases:") --localize-me
|
||||
|
||||
return phaseScrollFrame
|
||||
end
|
||||
@@ -12,7 +12,7 @@ local _GetSpellInfo = Details.GetSpellInfo
|
||||
local GameTooltip = GameTooltip
|
||||
local IsShiftKeyDown = IsShiftKeyDown
|
||||
local DF = DetailsFramework
|
||||
local tinsert = tinsert
|
||||
local tinsert = table.insert
|
||||
|
||||
local spellsTab = DetailsSpellBreakdownTab
|
||||
|
||||
@@ -31,7 +31,7 @@ local spellBlockContainerSettings = {
|
||||
local headerContainerType = spellsTab.headerContainerType
|
||||
|
||||
local formatPetName = function(petName, spellName, ownerName)
|
||||
--petName is raw (with the owner name)
|
||||
--remove the owner name from the pet name
|
||||
local petNameWithoutOwner = petName:gsub((" <.*"), "")
|
||||
|
||||
local texture = [[Interface\AddOns\Details\images\classes_small]]
|
||||
@@ -557,7 +557,7 @@ function spellsTab.CreateSpellBlock(spellBlockContainer, index) --~breakdownspel
|
||||
Details.FadeHandler.Fader(spellBlock.overlay, 1) --hide
|
||||
|
||||
--report button, also only shown when the spell block is hovered over
|
||||
spellBlock.reportButton = Details.gump:NewDetailsButton(spellBlock, nil, nil, Details.Reportar, Details.playerDetailWindow, 10 + index, 16, 16,
|
||||
spellBlock.reportButton = Details.gump:NewDetailsButton(spellBlock, nil, nil, Details.Reportar, Details.BreakdownWindowFrame, 10 + index, 16, 16,
|
||||
"Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", nil, "DetailsJanelaInfoReport1")
|
||||
Details.FadeHandler.Fader(spellBlock.reportButton, 1) --hide
|
||||
spellBlock.reportButton:SetScript("OnEnter", onEnterInfoReport)
|
||||
@@ -1146,7 +1146,6 @@ local refreshSpellsFunc = function(scrollFrame, scrollData, offset, totalLines)
|
||||
local headerTable = spellsTab.spellsHeaderData
|
||||
|
||||
--todo: when swapping sort orders, close already expanded spells
|
||||
|
||||
local lineIndex = 1
|
||||
for i = 1, totalLines do
|
||||
local index = i + offset
|
||||
|
||||
@@ -12,4 +12,544 @@ local _GetSpellInfo = Details.GetSpellInfo
|
||||
local GameTooltip = GameTooltip
|
||||
local IsShiftKeyDown = IsShiftKeyDown
|
||||
local DF = DetailsFramework
|
||||
local tinsert = tinsert
|
||||
local tinsert = table.insert
|
||||
|
||||
local spellsTab = DetailsSpellBreakdownTab
|
||||
local headerContainerType = spellsTab.headerContainerType
|
||||
|
||||
local CONST_BAR_HEIGHT = 20
|
||||
local CONST_SPELLSCROLL_LINEHEIGHT = 20
|
||||
local CONST_TARGET_TEXTURE = [[Interface\MINIMAP\TRACKING\Target]]
|
||||
local CONST_SPELLBLOCK_DEFAULT_COLOR = {.4, .4, .4, 1}
|
||||
local CONST_SPELLBLOCK_HEADERTEXT_COLOR = {.9, .8, 0, 1}
|
||||
local CONST_SPELLBLOCK_HEADERTEXT_SIZE = 11
|
||||
|
||||
---get a target bar from the scroll box, if it doesn't exist, return nil
|
||||
---@param scrollFrame table
|
||||
---@param lineIndex number
|
||||
---@return breakdowntargetbar
|
||||
local getTargetBar = function(scrollFrame, lineIndex)
|
||||
---@type breakdowntargetbar
|
||||
local targetBar = scrollFrame:GetLine(lineIndex)
|
||||
|
||||
--reset header alignment
|
||||
targetBar:ResetFramesToHeaderAlignment()
|
||||
|
||||
spellsTab.UpdateBarSettings(targetBar)
|
||||
|
||||
--reset columns, hiding them
|
||||
targetBar.Icon:Hide()
|
||||
for inLineIndex = 1, #targetBar.InLineTexts do
|
||||
targetBar.InLineTexts[inLineIndex]:SetText("")
|
||||
end
|
||||
|
||||
return targetBar
|
||||
end
|
||||
|
||||
|
||||
---update a line using the data passed
|
||||
---@param targetBar breakdowntargetbar
|
||||
---@param index number spell position (from best to wrost)
|
||||
---@param combatObject combat
|
||||
---@param scrollFrame table
|
||||
---@param headerTable table
|
||||
---@param bkTargetData breakdowntargettable
|
||||
---@param totalValue number
|
||||
---@param topValue number the amount done of the first target, used to calculate the length of the statusbar
|
||||
---@param sortKey string
|
||||
local updateTargetBar = function(targetBar, index, combatObject, scrollFrame, headerTable, bkTargetData, totalValue, topValue, sortKey) --~target ~update ~targetbar ~updatetargetbar
|
||||
--scrollFrame is defined as a table which is false, scrollFrame is a frame
|
||||
|
||||
local textIndex = 1
|
||||
|
||||
for headerIndex = 1, #headerTable do
|
||||
---@type number
|
||||
local value
|
||||
|
||||
targetBar.bkTargetData = bkTargetData
|
||||
value = bkTargetData.total
|
||||
|
||||
---@type number
|
||||
local combatTime = combatObject:GetCombatTime()
|
||||
|
||||
local actorContainer = combatObject:GetContainer(spellsTab.mainAttribute)
|
||||
local targetActorObject = actorContainer:GetActor(bkTargetData.name)
|
||||
|
||||
targetBar.statusBar.backgroundTexture:SetAlpha(Details.breakdown_spell_tab.spellbar_background_alpha)
|
||||
|
||||
--statusbar size by percent
|
||||
if (topValue > 0) then
|
||||
targetBar.statusBar:SetValue(bkTargetData[sortKey] / topValue * 100)
|
||||
else
|
||||
targetBar.statusBar:SetValue(0)
|
||||
end
|
||||
|
||||
--statusbar color
|
||||
targetBar.statusBar:SetStatusBarColor(1, 1, 1, 1)
|
||||
targetBar.combatTime = combatTime
|
||||
targetBar.actorName = bkTargetData.name
|
||||
|
||||
---@type fontstring
|
||||
local text = targetBar.InLineTexts[textIndex]
|
||||
local header = headerTable[headerIndex]
|
||||
|
||||
if (header.name == "icon") then --ok
|
||||
targetBar.Icon:Show()
|
||||
|
||||
if (targetActorObject) then
|
||||
Details.SetClassIcon(targetActorObject, targetBar.Icon, spellsTab.GetInstance(), targetActorObject:Class())
|
||||
else
|
||||
targetBar.Icon:SetTexture([[Interface\AddOns\Details\images\classes_small_alpha]])
|
||||
---@type {key1: number, key2: number, key3: number, key4: number}
|
||||
local texCoords = Details.class_coords["ENEMY"]
|
||||
targetBar.Icon:SetTexCoord(unpack(texCoords))
|
||||
end
|
||||
|
||||
targetBar:AddFrameToHeaderAlignment(targetBar.Icon)
|
||||
|
||||
elseif (header.name == "rank") then --ok
|
||||
text:SetText(index)
|
||||
targetBar:AddFrameToHeaderAlignment(text)
|
||||
targetBar.rank = index
|
||||
textIndex = textIndex + 1
|
||||
|
||||
elseif (header.name == "name") then --ok
|
||||
local noRealmName = DF:RemoveRealmName(bkTargetData.name)
|
||||
local noOwnerName = noRealmName:gsub((" <.*"), "")
|
||||
text:SetText(noOwnerName)
|
||||
targetBar.name = bkTargetData.name
|
||||
targetBar:AddFrameToHeaderAlignment(text)
|
||||
textIndex = textIndex + 1
|
||||
|
||||
elseif (header.name == "amount") then --ok
|
||||
text:SetText(Details:Format(value))
|
||||
targetBar:AddFrameToHeaderAlignment(text)
|
||||
textIndex = textIndex + 1
|
||||
|
||||
elseif (header.name == "percent") then --ok
|
||||
targetBar.percent = value / totalValue * 100 --totalValue is nil
|
||||
---@type string
|
||||
local percentFormatted = string.format("%.1f", targetBar.percent) .. "%"
|
||||
text:SetText(percentFormatted)
|
||||
|
||||
targetBar:AddFrameToHeaderAlignment(text)
|
||||
textIndex = textIndex + 1
|
||||
|
||||
elseif (header.name == "overheal" and bkTargetData.overheal) then
|
||||
if (bkTargetData.overheal > 0) then
|
||||
local totalHeal = bkTargetData.overheal + value
|
||||
text:SetText(string.format("%.1f", bkTargetData.overheal / totalHeal * 100) .. "%")
|
||||
else
|
||||
text:SetText("0%")
|
||||
end
|
||||
targetBar:AddFrameToHeaderAlignment(text)
|
||||
textIndex = textIndex + 1
|
||||
|
||||
elseif (header.name == "absorbed") then
|
||||
text:SetText(Details:Format(bkTargetData.absorbed or 0))
|
||||
targetBar:AddFrameToHeaderAlignment(text)
|
||||
textIndex = textIndex + 1
|
||||
end
|
||||
end
|
||||
|
||||
targetBar:AlignWithHeader(scrollFrame.Header, "left")
|
||||
end
|
||||
|
||||
---refresh the data shown in the spells scroll box
|
||||
---@param scrollFrame table
|
||||
---@param scrollData breakdowntargettablelist
|
||||
---@param offset number
|
||||
---@param totalLines number
|
||||
local refreshTargetsFunc = function(scrollFrame, scrollData, offset, totalLines) --~refresh ~target ~refreshtargets
|
||||
---@type number
|
||||
local topValue = scrollFrame.topValue
|
||||
---@type number
|
||||
local totalValue = scrollData.totalValue
|
||||
---@type actor
|
||||
local actorObject = spellsTab.GetActor()
|
||||
---@type string
|
||||
local actorName = actorObject:Name()
|
||||
---@type combat
|
||||
local combatObject = spellsTab.GetCombat()
|
||||
---@type instance
|
||||
local instanceObject = spellsTab.GetInstance()
|
||||
|
||||
---@type number
|
||||
local mainAttribute = spellsTab.mainAttribute
|
||||
|
||||
local sortKey = scrollFrame.SortKey
|
||||
local headerTable = spellsTab.targetsHeaderData
|
||||
|
||||
local lineIndex = 1
|
||||
|
||||
for i = 1, totalLines do
|
||||
local index = i + offset
|
||||
|
||||
---@type breakdowntargettable
|
||||
local bkTargetData = scrollData[index]
|
||||
if (bkTargetData) then
|
||||
---called mainSpellBar because it is the line that shows the sum of all spells merged (if any)
|
||||
---@type breakdowntargetbar
|
||||
local targetBar = getTargetBar(scrollFrame, lineIndex)
|
||||
do
|
||||
if (targetBar) then
|
||||
lineIndex = lineIndex + 1
|
||||
updateTargetBar(targetBar, index, combatObject, scrollFrame, headerTable, bkTargetData, totalValue, topValue, sortKey)
|
||||
end
|
||||
end
|
||||
|
||||
if (lineIndex > totalLines) then
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---create the target container
|
||||
---@param tabFrame tabframe
|
||||
---@return breakdowntargetscrollframe
|
||||
function spellsTab.CreateTargetContainer(tabFrame) --~create ~target ~createtargetcontainer ~createtargetscroll ~createtarget
|
||||
---@type width
|
||||
local width = Details.breakdown_spell_tab.targetcontainer_width
|
||||
---@type height
|
||||
local height = Details.breakdown_spell_tab.targetcontainer_height
|
||||
|
||||
local defaultAmountOfLines = 50
|
||||
|
||||
--create a container for the scrollframe
|
||||
local options = {
|
||||
width = Details.breakdown_spell_tab.targetcontainer_width,
|
||||
height = Details.breakdown_spell_tab.targetcontainer_height,
|
||||
is_locked = Details.breakdown_spell_tab.targetcontainer_islocked,
|
||||
can_move = false,
|
||||
can_move_children = false,
|
||||
use_top_resizer = true,
|
||||
use_right_resizer = true,
|
||||
}
|
||||
|
||||
---@type df_framecontainer
|
||||
local container = DF:CreateFrameContainer(tabFrame, options, tabFrame:GetName() .. "TargetScrollContainer")
|
||||
container:SetPoint("topleft", spellsTab.GetSpellScrollContainer(), "bottomleft", 0, -25)
|
||||
container:SetFrameLevel(tabFrame:GetFrameLevel() + 10)
|
||||
spellsTab.TargetsContainerFrame = container
|
||||
|
||||
local settingChangedCallbackFunction = function(frameContainer, settingName, settingValue)
|
||||
if (frameContainer:IsShown()) then
|
||||
if (settingName == "height") then
|
||||
---@type number
|
||||
local currentHeight = spellsTab.GetTargetScrollFrame():GetHeight()
|
||||
Details.breakdown_spell_tab.targetcontainer_height = settingValue
|
||||
--the -0.1 is the avoid the random fraction of 1.9999999990 to 2.0000000001
|
||||
local lineAmount = currentHeight / CONST_SPELLSCROLL_LINEHEIGHT - 0.1
|
||||
lineAmount = math.floor(lineAmount)
|
||||
spellsTab.GetTargetScrollFrame():SetNumFramesShown(lineAmount)
|
||||
|
||||
elseif (settingName == "width") then
|
||||
Details.breakdown_spell_tab.targetcontainer_width = settingValue
|
||||
|
||||
elseif (settingName == "is_locked") then
|
||||
Details.breakdown_spell_tab.targetcontainer_islocked = settingValue
|
||||
end
|
||||
end
|
||||
end
|
||||
container:SetSettingChangedCallback(settingChangedCallbackFunction)
|
||||
|
||||
--create the scrollframe similar to scrollframe used in the spellscrollframe
|
||||
--replace this with a framework scrollframe
|
||||
---@type breakdowntargetscrollframe
|
||||
local targetScrollFrame = DF:CreateScrollBox(container, "$parentTargetScroll", refreshTargetsFunc, {}, width, height, defaultAmountOfLines, CONST_SPELLSCROLL_LINEHEIGHT)
|
||||
DF:ReskinSlider(targetScrollFrame)
|
||||
targetScrollFrame:SetBackdrop({})
|
||||
targetScrollFrame:SetAllPoints()
|
||||
|
||||
container:RegisterChildForDrag(targetScrollFrame)
|
||||
|
||||
targetScrollFrame.DontHideChildrenOnPreRefresh = false
|
||||
tabFrame.TargetScrollFrame = targetScrollFrame
|
||||
spellsTab.TargetScrollFrame = targetScrollFrame
|
||||
|
||||
spellsTab.ApplyStandardBackdrop(container, targetScrollFrame)
|
||||
|
||||
---@param data breakdowntargettablelist
|
||||
function targetScrollFrame:RefreshMe(data) --~refreshme (targets) ~refreshmet
|
||||
--get which column is currently selected and the sort order
|
||||
local columnIndex, order, key = targetScrollFrame.Header:GetSelectedColumn()
|
||||
targetScrollFrame.SortKey = key
|
||||
|
||||
---@type string
|
||||
local keyToSort = key
|
||||
|
||||
if (order == "DESC") then
|
||||
table.sort(data,
|
||||
function(t1, t2)
|
||||
return t1[keyToSort] > t2[keyToSort]
|
||||
end)
|
||||
targetScrollFrame.topValue = data[1] and data[1][keyToSort]
|
||||
else
|
||||
table.sort(data,
|
||||
function(t1, t2)
|
||||
return t1[keyToSort] < t2[keyToSort]
|
||||
end)
|
||||
targetScrollFrame.topValue = data[#data] and data[#data][keyToSort]
|
||||
end
|
||||
|
||||
if (key == "overheal") then
|
||||
data.totalValue = data.totalValueOverheal
|
||||
end
|
||||
--default: data.totalValue
|
||||
--data.totalValueOverheal
|
||||
|
||||
targetScrollFrame:SetData(data)
|
||||
targetScrollFrame:Refresh()
|
||||
end
|
||||
|
||||
--~header
|
||||
local headerOptions = {
|
||||
padding = 2,
|
||||
header_height = 14,
|
||||
|
||||
reziser_shown = true,
|
||||
reziser_width = 2,
|
||||
reziser_color = {.5, .5, .5, 0.7},
|
||||
reziser_max_width = 246,
|
||||
|
||||
header_click_callback = spellsTab.OnAnyColumnHeaderClickCallback,
|
||||
|
||||
header_backdrop_color = {0.1, 0.1, 0.1, 0.4},
|
||||
text_color = {1, 1, 1, 0.823},
|
||||
}
|
||||
|
||||
---@type df_headerframe
|
||||
local header = DetailsFramework:CreateHeader(container, spellsTab.targetContainerColumnData, headerOptions)
|
||||
targetScrollFrame.Header = header
|
||||
targetScrollFrame.Header:SetPoint("topleft", targetScrollFrame, "topleft", 0, 1)
|
||||
targetScrollFrame.Header:SetColumnSettingChangedCallback(spellsTab.OnHeaderColumnOptionChanged)
|
||||
|
||||
--cache the type of this container
|
||||
headerContainerType[targetScrollFrame.Header] = "targets"
|
||||
|
||||
--create the scroll lines
|
||||
for i = 1, defaultAmountOfLines do
|
||||
targetScrollFrame:CreateLine(spellsTab.CreateTargetBar)
|
||||
end
|
||||
|
||||
tabFrame.targets = targetScrollFrame:CreateFontString(nil, "overlay", "QuestFont_Large")
|
||||
tabFrame.targets:SetPoint("bottomleft", container, "topleft", 2, 2)
|
||||
tabFrame.targets:SetText(Loc ["STRING_TARGETS"] .. ":")
|
||||
|
||||
return targetScrollFrame
|
||||
end
|
||||
|
||||
|
||||
---@param targetBar breakdowntargetbar
|
||||
local onEnterBreakdownTargetBar = function(targetBar)
|
||||
targetBar:SetAlpha(1)
|
||||
|
||||
---@type string @the name of the target
|
||||
local targetName = targetBar.actorName
|
||||
|
||||
Details:FormatCooltipForSpells()
|
||||
GameCooltip:SetOwner(targetBar, "bottom", "top", 4, -5)
|
||||
GameCooltip:SetOption("MinWidth", math.max(230, targetBar:GetWidth() * 0.98))
|
||||
|
||||
--build a list of spells which the target was hit by
|
||||
local spellsSortedResult = {}
|
||||
local total = 0
|
||||
|
||||
---@type actor
|
||||
local actorObject = spellsTab.GetActor()
|
||||
|
||||
---@type combat
|
||||
local combatObject = spellsTab.GetCombat()
|
||||
|
||||
---@type instance
|
||||
local instanceObject = spellsTab.GetInstance()
|
||||
|
||||
---@type number
|
||||
local mainAttribute = instanceObject:GetDisplay()
|
||||
|
||||
---@type spellcontainer
|
||||
local spellContainer = actorObject:GetSpellContainer("spell")
|
||||
|
||||
local targetScrollFrame = spellsTab.GetTargetScrollFrame()
|
||||
|
||||
---@type number, string, string
|
||||
local columnIndex, order, key = targetScrollFrame.Header:GetSelectedColumn()
|
||||
|
||||
---@type string the label shown at the top of the tooltip
|
||||
local labelTooltipTitle = Loc ["STRING_DAMAGE_FROM"]
|
||||
|
||||
local targetTableName = "targets"
|
||||
if (mainAttribute == DETAILS_ATTRIBUTE_HEAL) then
|
||||
if (key == "total") then
|
||||
labelTooltipTitle = Loc ["STRING_HEALING_FROM"]
|
||||
|
||||
elseif (key == "overheal") then
|
||||
targetTableName = "targets_overheal"
|
||||
labelTooltipTitle = Loc ["STRING_OVERHEALED"]
|
||||
end
|
||||
end
|
||||
|
||||
--this part kinda belong top damage or healing class, shouldn't be here
|
||||
|
||||
---@type number, spelltable
|
||||
for spellId, spellTable in spellContainer:ListActors() do
|
||||
if (spellTable.isReflection) then
|
||||
---@type string, number
|
||||
for spellTargetName in pairs(spellTable.targets) do
|
||||
if (spellTargetName == targetName) then
|
||||
for reflectedSpellId, reflectedAmount in pairs(spellTable.extra) do
|
||||
local spellName, _, spellIcon = _GetSpellInfo(reflectedSpellId)
|
||||
table.insert(spellsSortedResult, {reflectedSpellId, reflectedAmount, spellName .. " (|cFFCCBBBBreflected|r)", spellIcon})
|
||||
total = total + reflectedAmount
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
for spellTargetName, amount in pairs(spellTable[targetTableName]) do
|
||||
if (spellTargetName == targetName) then
|
||||
local spellName, _, spellIcon = _GetSpellInfo(spellId)
|
||||
table.insert(spellsSortedResult, {spellId, amount, spellName, spellIcon})
|
||||
total = total + amount
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--add pets
|
||||
local petArray = actorObject:GetPets()
|
||||
for _, petName in ipairs(petArray) do
|
||||
local petActorObject = combatObject(mainAttribute, petName)
|
||||
if (petActorObject) then
|
||||
---@type spellcontainer
|
||||
local petSpellContainer = petActorObject:GetSpellContainer("spell")
|
||||
|
||||
---@type number, spelltable
|
||||
for spellId, spellTable in petSpellContainer:ListActors() do
|
||||
for spellTargetName, amount in pairs(spellTable[targetTableName]) do
|
||||
if (spellTargetName == targetName) then
|
||||
local spellName, _, spellIcon = _GetSpellInfo(spellId)
|
||||
table.insert(spellsSortedResult, {spellId, amount, spellName .. " (" .. petName:gsub((" <.*"), "") .. ")", spellIcon})
|
||||
total = total + amount
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(spellsSortedResult, Details.Sort2)
|
||||
|
||||
--need to change is this is a healing
|
||||
Details:AddTooltipSpellHeaderText(labelTooltipTitle .. ":", {1, 0.9, 0.0, 1}, 1, Details.tooltip_spell_icon.file, unpack(Details.tooltip_spell_icon.coords))
|
||||
Details:AddTooltipHeaderStatusbar(1, 1, 1, 1)
|
||||
|
||||
---@type tablesize
|
||||
local iconSize = Details.tooltip.icon_size
|
||||
---@type tablecoords
|
||||
local iconBorder = Details.tooltip.icon_border_texcoord
|
||||
|
||||
local topValue = spellsSortedResult[1] and spellsSortedResult[1][2]
|
||||
|
||||
if (topValue) then
|
||||
for index, tabela in ipairs(spellsSortedResult) do
|
||||
local spellId, amount, spellName, spellIcon = unpack(tabela)
|
||||
if (amount < 1) then
|
||||
break
|
||||
end
|
||||
GameCooltip:AddLine(spellName, Details:Format(amount) .. " (" .. string.format("%.1f", amount / total * 100) .. "%)")
|
||||
GameCooltip:AddIcon(spellIcon, nil, nil, iconSize.W + 4, iconSize.H + 4, iconBorder.L, iconBorder.R, iconBorder.T, iconBorder.B)
|
||||
Details:AddTooltipBackgroundStatusbar(false, amount / topValue * 100)
|
||||
end
|
||||
end
|
||||
|
||||
GameCooltip:Show()
|
||||
end
|
||||
|
||||
---@param self breakdowntargetbar
|
||||
local onLeaveBreakdownTargetBar = function(self)
|
||||
self:SetAlpha(0.9)
|
||||
GameCooltip:Hide()
|
||||
end
|
||||
|
||||
---create a targetbar within the target scroll
|
||||
---@param self breakdowntargetscrollframe
|
||||
---@param index number
|
||||
---@return breakdowntargetbar
|
||||
function spellsTab.CreateTargetBar(self, index) --~create ~target ~createtarget ~targetbar
|
||||
---@type breakdowntargetbar
|
||||
local targetBar = CreateFrame("button", self:GetName() .. "TargetBarButton" .. index, self)
|
||||
targetBar.index = index
|
||||
|
||||
--size and positioning
|
||||
targetBar:SetHeight(CONST_SPELLSCROLL_LINEHEIGHT)
|
||||
local y = (index-1) * CONST_SPELLSCROLL_LINEHEIGHT * -1 + (1 * -index) - 15
|
||||
targetBar:SetPoint("topleft", self, "topleft", 1, y)
|
||||
targetBar:SetPoint("topright", self, "topright", -1, y)
|
||||
targetBar:EnableMouse(true)
|
||||
|
||||
targetBar:SetAlpha(0.823)
|
||||
targetBar:SetFrameStrata("HIGH")
|
||||
targetBar:SetScript("OnEnter", onEnterBreakdownTargetBar)
|
||||
targetBar:SetScript("OnLeave", onLeaveBreakdownTargetBar)
|
||||
|
||||
DF:Mixin(targetBar, DF.HeaderFunctions)
|
||||
|
||||
---@type breakdownspellbarstatusbar
|
||||
local statusBar = CreateFrame("StatusBar", "$parentStatusBar", targetBar)
|
||||
statusBar:SetAllPoints()
|
||||
statusBar:SetAlpha(0.5)
|
||||
statusBar:SetMinMaxValues(0, 100)
|
||||
statusBar:SetValue(50)
|
||||
statusBar:EnableMouse(false)
|
||||
statusBar:SetFrameLevel(targetBar:GetFrameLevel() - 1)
|
||||
targetBar.statusBar = statusBar
|
||||
|
||||
---@type texture this is the statusbar texture
|
||||
local statusBarTexture = statusBar:CreateTexture("$parentTexture", "artwork")
|
||||
statusBarTexture:SetTexture(SharedMedia:Fetch("statusbar", "Details Hyanda"))
|
||||
statusBar:SetStatusBarTexture(statusBarTexture)
|
||||
statusBar:SetStatusBarColor(1, 1, 1, 1)
|
||||
|
||||
---@type texture shown when the mouse hoverover this bar
|
||||
local hightlightTexture = statusBar:CreateTexture("$parentTextureHighlight", "highlight")
|
||||
hightlightTexture:SetColorTexture(1, 1, 1, 0.2)
|
||||
hightlightTexture:SetAllPoints()
|
||||
statusBar.highlightTexture = hightlightTexture
|
||||
|
||||
---@type texture background texture
|
||||
local backgroundTexture = statusBar:CreateTexture("$parentTextureBackground", "border")
|
||||
backgroundTexture:SetAllPoints()
|
||||
backgroundTexture:SetColorTexture(.05, .05, .05)
|
||||
backgroundTexture:SetAlpha(1)
|
||||
statusBar.backgroundTexture = backgroundTexture
|
||||
|
||||
--create an icon
|
||||
---@type texture
|
||||
local icon = statusBar:CreateTexture("$parentTexture", "overlay")
|
||||
icon:SetPoint("left", statusBar, "left", 0, 0)
|
||||
icon:SetSize(CONST_SPELLSCROLL_LINEHEIGHT-2, CONST_SPELLSCROLL_LINEHEIGHT-2)
|
||||
icon:SetTexCoord(.1, .9, .1, .9)
|
||||
targetBar.Icon = icon
|
||||
|
||||
targetBar:AddFrameToHeaderAlignment(icon)
|
||||
|
||||
targetBar.InLineTexts = {}
|
||||
|
||||
for i = 1, 5 do
|
||||
---@type fontstring
|
||||
local fontString = targetBar:CreateFontString("$parentFontString" .. i, "overlay", "GameFontHighlightSmall")
|
||||
fontString:SetJustifyH("left")
|
||||
fontString:SetTextColor(1, 1, 1, 1)
|
||||
fontString:SetNonSpaceWrap(true)
|
||||
fontString:SetWordWrap(false)
|
||||
targetBar["lineText" .. i] = fontString
|
||||
targetBar.InLineTexts[i] = fontString
|
||||
fontString:SetTextColor(1, 1, 1, 1)
|
||||
targetBar:AddFrameToHeaderAlignment(fontString)
|
||||
end
|
||||
|
||||
targetBar:AlignWithHeader(self.Header, "left")
|
||||
|
||||
return targetBar
|
||||
end
|
||||
@@ -3,13 +3,12 @@ local Details = _G.Details
|
||||
local Loc = _G.LibStub("AceLocale-3.0"):GetLocale ( "Details" )
|
||||
local SharedMedia = _G.LibStub:GetLibrary("LibSharedMedia-3.0")
|
||||
local UIParent = UIParent
|
||||
local gump = Details.gump
|
||||
local _
|
||||
local addonName, Details222 = ...
|
||||
|
||||
--remove warnings in the code
|
||||
local ipairs = ipairs
|
||||
local tinsert = tinsert
|
||||
local tinsert = table.insert
|
||||
local tremove = tremove
|
||||
local type = type
|
||||
local unpack = _G.unpack
|
||||
@@ -17,20 +16,26 @@ local PixelUtil = PixelUtil
|
||||
local UISpecialFrames = UISpecialFrames
|
||||
local CreateFrame = _G.CreateFrame
|
||||
local detailsFramework = DetailsFramework
|
||||
local breakdownWindowFrame = Details.BreakdownWindowFrame
|
||||
|
||||
local subAttributes = Details.sub_atributos
|
||||
local breakdownWindow = Details.playerDetailWindow
|
||||
---@type button[]
|
||||
breakdownWindowFrame.RegisteredPluginButtons = {}
|
||||
|
||||
local SummaryWidgets = {}
|
||||
local CurrentTab = "Summary"
|
||||
---register a plugin button to be shown in the breakdown window
|
||||
---@param button button
|
||||
function breakdownWindowFrame.RegisterPluginButton(button)
|
||||
table.insert(breakdownWindowFrame.RegisteredPluginButtons, button)
|
||||
end
|
||||
|
||||
local PLAYER_DETAILS_WINDOW_WIDTH = 890
|
||||
local PLAYER_DETAILS_WINDOW_HEIGHT = 574
|
||||
local PLAYER_DETAILS_WINDOW_WIDTH = 925
|
||||
local PLAYER_DETAILS_WINDOW_HEIGHT = 620
|
||||
local PLAYER_DETAILS_STATUSBAR_HEIGHT = 20
|
||||
local PLAYER_DETAILS_STATUSBAR_ALPHA = 1
|
||||
|
||||
---@type button[]
|
||||
Details.player_details_tabs = {}
|
||||
breakdownWindow.currentTabsInUse = {}
|
||||
---@type button[]
|
||||
breakdownWindowFrame.currentTabsInUse = {}
|
||||
|
||||
Details222.BreakdownWindow.BackdropSettings = {
|
||||
backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
|
||||
@@ -38,12 +43,63 @@ Details222.BreakdownWindow.BackdropSettings = {
|
||||
backdropbordercolor = {0, 0, 0, 0.7},
|
||||
}
|
||||
|
||||
--create a base frame which will hold the scrollbox and plugin buttons
|
||||
local breakdownSideMenu = CreateFrame("frame", "DetailsBreakdownLeftMenuFrame", breakdownWindowFrame, "BackdropTemplate")
|
||||
breakdownWindowFrame.BreakdownSideMenuFrame = breakdownSideMenu
|
||||
|
||||
--create a frame to hold plugin buttons
|
||||
local pluginsFrame = CreateFrame("frame", "DetailsBreakdownLeftMenuPluginsFrame", breakdownSideMenu, "BackdropTemplate")
|
||||
breakdownWindowFrame.BreakdownPluginSelectionFrame = pluginsFrame
|
||||
|
||||
--create the frame to hold tab buttons
|
||||
local tabButtonsFrame = CreateFrame("frame", "DetailsBreakdownTabsFrame", breakdownWindowFrame, "BackdropTemplate")
|
||||
breakdownWindowFrame.BreakdownTabsFrame = tabButtonsFrame
|
||||
|
||||
local summaryWidgets = {}
|
||||
local currentTab = "Summary"
|
||||
local subAttributes = Details.sub_atributos
|
||||
|
||||
function Details222.BreakdownWindow.OnShowPluginFrame(pluginObject)
|
||||
--need to selected the selected tab and hide its content
|
||||
for index = 1, #Details.player_details_tabs do
|
||||
local tabButton = Details.player_details_tabs[index]
|
||||
tabButton.frame:Hide()
|
||||
end
|
||||
breakdownWindowFrame.BreakdownTabsFrame:Hide()
|
||||
breakdownWindowFrame.shownPluginObject = pluginObject
|
||||
|
||||
breakdownWindowFrame.classIcon:Hide()
|
||||
breakdownWindowFrame.closeButton:Hide()
|
||||
breakdownWindowFrame.actorName:Hide()
|
||||
breakdownWindowFrame.attributeName:Hide()
|
||||
breakdownWindowFrame.avatar:Hide()
|
||||
breakdownWindowFrame.avatar_bg:Hide()
|
||||
breakdownWindowFrame.avatar_attribute:Hide()
|
||||
breakdownWindowFrame.avatar_nick:Hide()
|
||||
end
|
||||
|
||||
function Details222.BreakdownWindow.HidePluginFrame()
|
||||
if (breakdownWindowFrame.shownPluginObject) then
|
||||
breakdownWindowFrame.shownPluginObject.Frame:Hide()
|
||||
breakdownWindowFrame.shownPluginObject = nil
|
||||
end
|
||||
|
||||
breakdownWindowFrame.classIcon:Show()
|
||||
breakdownWindowFrame.closeButton:Show()
|
||||
breakdownWindowFrame.actorName:Show()
|
||||
breakdownWindowFrame.attributeName:Show()
|
||||
breakdownWindowFrame.avatar:Show()
|
||||
breakdownWindowFrame.avatar_bg:Show()
|
||||
breakdownWindowFrame.avatar_attribute:Show()
|
||||
breakdownWindowFrame.avatar_nick:Show()
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------
|
||||
--self = instancia
|
||||
--jogador = classe_damage ou classe_heal
|
||||
|
||||
function Details:GetBreakdownTabsInUse()
|
||||
return breakdownWindow.currentTabsInUse
|
||||
return breakdownWindowFrame.currentTabsInUse
|
||||
end
|
||||
|
||||
function Details:GetBreakdownTabByName(tabName, tablePool)
|
||||
@@ -58,31 +114,33 @@ end
|
||||
|
||||
--return the combat being used to show the data in the opened breakdown window
|
||||
function Details:GetCombatFromBreakdownWindow()
|
||||
return breakdownWindow.instancia and breakdownWindow.instancia.showing
|
||||
---@type instance
|
||||
local instance = breakdownWindowFrame.instancia
|
||||
return instance:GetCombat()
|
||||
end
|
||||
|
||||
---return the window that requested to open the player breakdown window
|
||||
---@return instance
|
||||
function Details:GetActiveWindowFromBreakdownWindow()
|
||||
return breakdownWindow.instancia
|
||||
return breakdownWindowFrame.instancia
|
||||
end
|
||||
|
||||
--return if the breakdown window is showing damage or heal
|
||||
function Details:GetDisplayTypeFromBreakdownWindow()
|
||||
return breakdownWindow.atributo, breakdownWindow.sub_atributo
|
||||
return breakdownWindowFrame.atributo, breakdownWindowFrame.sub_atributo
|
||||
end
|
||||
|
||||
--return the actor object in use by the breakdown window
|
||||
function Details:GetActorObjectFromBreakdownWindow()
|
||||
return breakdownWindow.jogador
|
||||
return breakdownWindowFrame.jogador
|
||||
end
|
||||
|
||||
function Details:GetBreakdownWindow()
|
||||
return Details.playerDetailWindow
|
||||
return Details.BreakdownWindowFrame
|
||||
end
|
||||
|
||||
function Details:IsBreakdownWindowOpen()
|
||||
return breakdownWindow.ativo
|
||||
return breakdownWindowFrame.ativo
|
||||
end
|
||||
|
||||
---open the breakdown window
|
||||
@@ -116,11 +174,14 @@ function Details:OpenBreakdownWindow(instanceObject, actorObject, bFromAttribute
|
||||
end
|
||||
|
||||
--Details.info_jogador armazena o jogador que esta sendo mostrado na janela de detalhes
|
||||
if (breakdownWindow.jogador and breakdownWindow.jogador == actorObject and instanceObject and breakdownWindow.atributo and mainAttribute == breakdownWindow.atributo and subAttribute == breakdownWindow.sub_atributo and not bIsRefresh) then
|
||||
Details:CloseBreakdownWindow() --se clicou na mesma barra ent�o fecha a janela de detalhes
|
||||
return
|
||||
if (breakdownWindowFrame.jogador and breakdownWindowFrame.jogador == actorObject and instanceObject and breakdownWindowFrame.atributo and mainAttribute == breakdownWindowFrame.atributo and subAttribute == breakdownWindowFrame.sub_atributo and not bIsRefresh) then
|
||||
if (not breakdownWindowFrame.shownPluginObject) then
|
||||
Details:CloseBreakdownWindow() --clicked in the same player bar, close the window
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
elseif (not actorObject) then
|
||||
if (not actorObject) then
|
||||
Details:CloseBreakdownWindow()
|
||||
return
|
||||
end
|
||||
@@ -129,115 +190,121 @@ function Details:OpenBreakdownWindow(instanceObject, actorObject, bFromAttribute
|
||||
Details.PlayerBreakdown.CreatePlayerListFrame()
|
||||
Details.PlayerBreakdown.CreateDumpDataFrame()
|
||||
|
||||
if (not breakdownWindow.bHasInitialized) then
|
||||
local infoNumPoints = breakdownWindow:GetNumPoints()
|
||||
--show the frame containing the tab buttons
|
||||
breakdownWindowFrame.BreakdownTabsFrame:Show()
|
||||
|
||||
--hide the plugin if any is shown
|
||||
Details222.BreakdownWindow.HidePluginFrame()
|
||||
|
||||
if (not breakdownWindowFrame.bHasInitialized) then
|
||||
local infoNumPoints = breakdownWindowFrame:GetNumPoints()
|
||||
for i = 1, infoNumPoints do
|
||||
local point1, anchorObject, point2, x, y = breakdownWindow:GetPoint(i)
|
||||
local point1, anchorObject, point2, x, y = breakdownWindowFrame:GetPoint(i)
|
||||
if (not anchorObject) then
|
||||
breakdownWindow:ClearAllPoints()
|
||||
breakdownWindowFrame:ClearAllPoints()
|
||||
end
|
||||
end
|
||||
|
||||
breakdownWindow:SetUserPlaced(false)
|
||||
breakdownWindow:SetDontSavePosition(true)
|
||||
breakdownWindowFrame:SetUserPlaced(false)
|
||||
breakdownWindowFrame:SetDontSavePosition(true)
|
||||
|
||||
local okay, errorText = pcall(function()
|
||||
breakdownWindow:SetPoint("center", UIParent, "center", 0, 0)
|
||||
breakdownWindowFrame:SetPoint("center", UIParent, "center", 0, 0)
|
||||
end)
|
||||
|
||||
if (not okay) then
|
||||
breakdownWindow:ClearAllPoints()
|
||||
breakdownWindow:SetPoint("center", UIParent, "center", 0, 0)
|
||||
breakdownWindowFrame:ClearAllPoints()
|
||||
breakdownWindowFrame:SetPoint("center", UIParent, "center", 0, 0)
|
||||
end
|
||||
|
||||
breakdownWindow.bHasInitialized = true
|
||||
breakdownWindowFrame.bHasInitialized = true
|
||||
end
|
||||
|
||||
if (not breakdownWindow.RightSideBar) then
|
||||
if (not breakdownWindowFrame.RightSideBar) then
|
||||
--breakdownWindow:CreateRightSideBar()
|
||||
end
|
||||
|
||||
--todo: all portuguese keys to english
|
||||
|
||||
breakdownWindow.ativo = true --sinaliza o addon que a janela esta aberta
|
||||
breakdownWindow.atributo = mainAttribute --instancia.atributo -> grava o atributo (damage, heal, etc)
|
||||
breakdownWindow.sub_atributo = subAttribute --instancia.sub_atributo -> grava o sub atributo (damage done, dps, damage taken, etc)
|
||||
breakdownWindow.jogador = actorObject --de qual jogador (objeto classe_damage)
|
||||
breakdownWindow.instancia = instanceObject --salva a refer�ncia da inst�ncia que pediu o breakdownWindow
|
||||
breakdownWindow.target_text = Loc ["STRING_TARGETS"] .. ":"
|
||||
breakdownWindow.target_member = "total"
|
||||
breakdownWindow.target_persecond = false
|
||||
breakdownWindow.mostrando = nil
|
||||
breakdownWindowFrame.ativo = true --sinaliza o addon que a janela esta aberta
|
||||
breakdownWindowFrame.atributo = mainAttribute --instancia.atributo -> grava o atributo (damage, heal, etc)
|
||||
breakdownWindowFrame.sub_atributo = subAttribute --instancia.sub_atributo -> grava o sub atributo (damage done, dps, damage taken, etc)
|
||||
breakdownWindowFrame.jogador = actorObject --de qual jogador (objeto classe_damage)
|
||||
breakdownWindowFrame.instancia = instanceObject --salva a refer�ncia da inst�ncia que pediu o breakdownWindow
|
||||
breakdownWindowFrame.target_text = Loc ["STRING_TARGETS"] .. ":"
|
||||
breakdownWindowFrame.target_member = "total"
|
||||
breakdownWindowFrame.target_persecond = false
|
||||
breakdownWindowFrame.mostrando = nil
|
||||
|
||||
local nome = breakdownWindow.jogador.nome --nome do jogador
|
||||
local atributo_nome = subAttributes[breakdownWindow.atributo].lista [breakdownWindow.sub_atributo] .. " " .. Loc ["STRING_ACTORFRAME_REPORTOF"] --// nome do atributo // precisa ser o sub atributo correto???
|
||||
local playerName = breakdownWindowFrame.jogador:Name()
|
||||
local atributo_nome = subAttributes[breakdownWindowFrame.atributo].lista [breakdownWindowFrame.sub_atributo] .. " " .. Loc ["STRING_ACTORFRAME_REPORTOF"] --// nome do atributo // precisa ser o sub atributo correto???
|
||||
|
||||
--removendo o nome da realm do jogador
|
||||
if (nome:find("-")) then
|
||||
nome = nome:gsub(("-.*"), "")
|
||||
if (playerName:find("-")) then
|
||||
playerName = playerName:gsub(("-.*"), "")
|
||||
end
|
||||
|
||||
if (breakdownWindow.instancia.atributo == 1 and breakdownWindow.instancia.sub_atributo == 6) then --enemy
|
||||
atributo_nome = subAttributes [breakdownWindow.atributo].lista [1] .. " " .. Loc ["STRING_ACTORFRAME_REPORTOF"]
|
||||
if (breakdownWindowFrame.instancia.atributo == 1 and breakdownWindowFrame.instancia.sub_atributo == 6) then --enemy
|
||||
atributo_nome = subAttributes [breakdownWindowFrame.atributo].lista [1] .. " " .. Loc ["STRING_ACTORFRAME_REPORTOF"]
|
||||
end
|
||||
|
||||
breakdownWindow.actorName:SetText(nome) --found it
|
||||
breakdownWindow.attributeName:SetText(atributo_nome)
|
||||
breakdownWindowFrame.actorName:SetText(playerName) --found it
|
||||
breakdownWindowFrame.attributeName:SetText(atributo_nome)
|
||||
|
||||
local serial = actorObject.serial
|
||||
local avatar
|
||||
if (serial ~= "") then
|
||||
avatar = NickTag:GetNicknameTable (serial)
|
||||
avatar = NickTag:GetNicknameTable(serial)
|
||||
end
|
||||
|
||||
if (avatar and avatar [1]) then
|
||||
breakdownWindow.actorName:SetText((not Details.ignore_nicktag and avatar [1]) or nome)
|
||||
if (avatar and avatar[1]) then
|
||||
breakdownWindowFrame.actorName:SetText((not Details.ignore_nicktag and avatar[1]) or playerName)
|
||||
end
|
||||
|
||||
if (avatar and avatar [2]) then
|
||||
breakdownWindow.avatar:SetTexture(avatar [2])
|
||||
breakdownWindow.avatar_bg:SetTexture(avatar [4])
|
||||
if (avatar [5]) then
|
||||
breakdownWindow.avatar_bg:SetTexCoord(unpack(avatar [5]))
|
||||
if (avatar and avatar[2]) then
|
||||
breakdownWindowFrame.avatar:SetTexture(avatar[2])
|
||||
breakdownWindowFrame.avatar_bg:SetTexture(avatar[4])
|
||||
if (avatar[5]) then
|
||||
breakdownWindowFrame.avatar_bg:SetTexCoord(unpack(avatar[5]))
|
||||
end
|
||||
if (avatar [6]) then
|
||||
breakdownWindow.avatar_bg:SetVertexColor(unpack(avatar [6]))
|
||||
if (avatar[6]) then
|
||||
breakdownWindowFrame.avatar_bg:SetVertexColor(unpack(avatar[6]))
|
||||
end
|
||||
|
||||
breakdownWindow.avatar_nick:SetText(avatar [1] or nome)
|
||||
breakdownWindow.avatar_attribute:SetText(atributo_nome)
|
||||
breakdownWindowFrame.avatar_nick:SetText(avatar[1] or playerName)
|
||||
breakdownWindowFrame.avatar_attribute:SetText(atributo_nome)
|
||||
|
||||
breakdownWindow.avatar_attribute:SetPoint("CENTER", breakdownWindow.avatar_nick, "CENTER", 0, 14)
|
||||
breakdownWindow.avatar:Show()
|
||||
breakdownWindow.avatar_bg:Show()
|
||||
breakdownWindow.avatar_bg:SetAlpha(.65)
|
||||
breakdownWindow.avatar_nick:Show()
|
||||
breakdownWindow.avatar_attribute:Show()
|
||||
breakdownWindow.actorName:Hide()
|
||||
breakdownWindow.attributeName:Hide()
|
||||
breakdownWindowFrame.avatar_attribute:SetPoint("CENTER", breakdownWindowFrame.avatar_nick, "CENTER", 0, 14)
|
||||
breakdownWindowFrame.avatar:Show()
|
||||
breakdownWindowFrame.avatar_bg:Show()
|
||||
breakdownWindowFrame.avatar_bg:SetAlpha(.65)
|
||||
breakdownWindowFrame.avatar_nick:Show()
|
||||
breakdownWindowFrame.avatar_attribute:Show()
|
||||
breakdownWindowFrame.actorName:Hide()
|
||||
breakdownWindowFrame.attributeName:Hide()
|
||||
else
|
||||
breakdownWindow.avatar:Hide()
|
||||
breakdownWindow.avatar_bg:Hide()
|
||||
breakdownWindow.avatar_nick:Hide()
|
||||
breakdownWindow.avatar_attribute:Hide()
|
||||
breakdownWindowFrame.avatar:Hide()
|
||||
breakdownWindowFrame.avatar_bg:Hide()
|
||||
breakdownWindowFrame.avatar_nick:Hide()
|
||||
breakdownWindowFrame.avatar_attribute:Hide()
|
||||
|
||||
breakdownWindow.actorName:Show()
|
||||
breakdownWindow.attributeName:Show()
|
||||
breakdownWindowFrame.actorName:Show()
|
||||
breakdownWindowFrame.attributeName:Show()
|
||||
end
|
||||
|
||||
breakdownWindow.attributeName:SetPoint("bottomleft", breakdownWindow.actorName, "topleft", 0, 2)
|
||||
breakdownWindowFrame.attributeName:SetPoint("bottomleft", breakdownWindowFrame.actorName, "topleft", 0, 2)
|
||||
|
||||
---@type string
|
||||
local actorClass = actorObject.classe --classe not registered because it should be renamed to english 'class'
|
||||
local actorClass = actorObject:Class()
|
||||
|
||||
if (not actorClass) then
|
||||
actorClass = "monster"
|
||||
end
|
||||
|
||||
breakdownWindow.classIcon:SetTexture("Interface\\AddOns\\Details\\images\\classes") --top left
|
||||
breakdownWindow.SetClassIcon(actorObject, actorClass)
|
||||
breakdownWindowFrame.classIcon:SetTexture("Interface\\AddOns\\Details\\images\\classes") --top left
|
||||
breakdownWindowFrame.SetClassIcon(actorObject, actorClass)
|
||||
|
||||
Details.FadeHandler.Fader(breakdownWindow, 0)
|
||||
Details.FadeHandler.Fader(breakdownWindowFrame, 0)
|
||||
Details:UpdateBreakdownPlayerList()
|
||||
Details:InitializeAurasTab()
|
||||
Details:InitializeCompareTab()
|
||||
@@ -247,7 +314,7 @@ function Details:OpenBreakdownWindow(instanceObject, actorObject, bFromAttribute
|
||||
local tabsReplaced = {}
|
||||
local tabReplacedAmount = 0
|
||||
|
||||
Details:Destroy(breakdownWindow.currentTabsInUse)
|
||||
Details:Destroy(breakdownWindowFrame.currentTabsInUse)
|
||||
|
||||
for index = 1, #Details.player_details_tabs do
|
||||
local tab = Details.player_details_tabs[index]
|
||||
@@ -261,8 +328,8 @@ function Details:OpenBreakdownWindow(instanceObject, actorObject, bFromAttribute
|
||||
|
||||
if (tab.replaces) then
|
||||
local attributeList = tab.replaces.attributes
|
||||
if (attributeList[breakdownWindow.atributo]) then
|
||||
if (attributeList[breakdownWindow.atributo][breakdownWindow.sub_atributo]) then
|
||||
if (attributeList[breakdownWindowFrame.atributo]) then
|
||||
if (attributeList[breakdownWindowFrame.atributo][breakdownWindowFrame.sub_atributo]) then
|
||||
local tabReplaced, tabIndex = Details:GetBreakdownTabByName(tab.replaces.tabNameToReplace, tabsShown)
|
||||
if (tabReplaced and tabIndex < index) then
|
||||
tabReplaced:Hide()
|
||||
@@ -271,8 +338,8 @@ function Details:OpenBreakdownWindow(instanceObject, actorObject, bFromAttribute
|
||||
tremove(tabsShown, tabIndex)
|
||||
tinsert(tabsShown, tabIndex, tab)
|
||||
|
||||
if (tabReplaced.tabname == breakdownWindow.selectedTab) then
|
||||
breakdownWindow.selectedTab = tab.tabname
|
||||
if (tabReplaced.tabname == breakdownWindowFrame.selectedTab) then
|
||||
breakdownWindowFrame.selectedTab = tab.tabname
|
||||
end
|
||||
|
||||
tabReplaced.replaced = true
|
||||
@@ -294,20 +361,20 @@ function Details:OpenBreakdownWindow(instanceObject, actorObject, bFromAttribute
|
||||
end
|
||||
|
||||
tabsShown = newTabsShown
|
||||
breakdownWindow.currentTabsInUse = newTabsShown
|
||||
breakdownWindowFrame.currentTabsInUse = newTabsShown
|
||||
|
||||
breakdownWindow:ShowTabs()
|
||||
breakdownWindowFrame:ShowTabs()
|
||||
Details222.BreakdownWindow.CurrentDefaultTab = nil
|
||||
|
||||
local shownTab
|
||||
for index = 1, #tabsShown do
|
||||
local tabButton = tabsShown[index]
|
||||
if (tabButton:condition(breakdownWindow.jogador, breakdownWindow.atributo, breakdownWindow.sub_atributo)) then
|
||||
if (tabButton:condition(breakdownWindowFrame.jogador, breakdownWindowFrame.atributo, breakdownWindowFrame.sub_atributo)) then
|
||||
if (tabButton.IsDefaultTab) then
|
||||
Details222.BreakdownWindow.CurrentDefaultTab = tabButton
|
||||
end
|
||||
|
||||
if (breakdownWindow.selectedTab == tabButton.tabname) then
|
||||
if (breakdownWindowFrame.selectedTab == tabButton.tabname) then
|
||||
tabButton:DoClick()
|
||||
tabButton:OnShowFunc()
|
||||
shownTab = tabButton
|
||||
@@ -323,17 +390,17 @@ function Details:OpenBreakdownWindow(instanceObject, actorObject, bFromAttribute
|
||||
end
|
||||
|
||||
function Details:CloseBreakdownWindow()
|
||||
if (breakdownWindow.ativo) then
|
||||
Details.FadeHandler.Fader(breakdownWindow, 1)
|
||||
if (breakdownWindowFrame.ativo) then
|
||||
Details.FadeHandler.Fader(breakdownWindowFrame, 1)
|
||||
|
||||
breakdownWindow.ativo = false --sinaliza o addon que a janela esta agora fechada
|
||||
breakdownWindow.jogador = nil
|
||||
breakdownWindow.atributo = nil
|
||||
breakdownWindow.sub_atributo = nil
|
||||
breakdownWindow.instancia = nil
|
||||
breakdownWindowFrame.ativo = false --sinaliza o addon que a janela esta agora fechada
|
||||
breakdownWindowFrame.jogador = nil
|
||||
breakdownWindowFrame.atributo = nil
|
||||
breakdownWindowFrame.sub_atributo = nil
|
||||
breakdownWindowFrame.instancia = nil
|
||||
|
||||
breakdownWindow.actorName:SetText("")
|
||||
breakdownWindow.attributeName:SetText("")
|
||||
breakdownWindowFrame.actorName:SetText("")
|
||||
breakdownWindowFrame.attributeName:SetText("")
|
||||
|
||||
--iterate all tabs and clear caches
|
||||
local tabsInUse = Details:GetBreakdownTabsInUse()
|
||||
@@ -345,32 +412,33 @@ function Details:CloseBreakdownWindow()
|
||||
end
|
||||
|
||||
function Details.PlayerBreakdown.CreateDumpDataFrame()
|
||||
breakdownWindow.dumpDataFrame = CreateFrame("frame", "$parentDumpTableFrame", DetailsBreakdownWindowPlayerScrollBox, "BackdropTemplate")
|
||||
breakdownWindow.dumpDataFrame:SetPoint("topleft", DetailsBreakdownWindowPlayerScrollBox, "topleft", 0, 0)
|
||||
breakdownWindow.dumpDataFrame:SetPoint("bottomright", DetailsBreakdownWindowPlayerScrollBox, "bottomright", 0, 0)
|
||||
breakdownWindow.dumpDataFrame:SetFrameLevel(DetailsBreakdownWindowPlayerScrollBox:GetFrameLevel() + 10)
|
||||
detailsFramework:ApplyStandardBackdrop(breakdownWindow.dumpDataFrame, true)
|
||||
breakdownWindow.dumpDataFrame:Hide()
|
||||
local playerSelectionScrollFrame = DetailsBreakdownWindowPlayerScrollBox
|
||||
breakdownWindowFrame.dumpDataFrame = CreateFrame("frame", "$parentDumpTableFrame", playerSelectionScrollFrame, "BackdropTemplate")
|
||||
breakdownWindowFrame.dumpDataFrame:SetPoint("topleft", playerSelectionScrollFrame, "topleft", 0, 0)
|
||||
breakdownWindowFrame.dumpDataFrame:SetPoint("bottomright", playerSelectionScrollFrame, "bottomright", 0, 0)
|
||||
breakdownWindowFrame.dumpDataFrame:SetFrameLevel(playerSelectionScrollFrame:GetFrameLevel() + 10)
|
||||
detailsFramework:ApplyStandardBackdrop(breakdownWindowFrame.dumpDataFrame, true)
|
||||
breakdownWindowFrame.dumpDataFrame:Hide()
|
||||
|
||||
--create a details framework special lua editor
|
||||
breakdownWindow.dumpDataFrame.luaEditor = detailsFramework:NewSpecialLuaEditorEntry(breakdownWindow.dumpDataFrame, 1, 1, "text", "$parentCodeEditorWindow")
|
||||
breakdownWindow.dumpDataFrame.luaEditor:SetPoint("topleft", breakdownWindow.dumpDataFrame, "topleft", 2, -2)
|
||||
breakdownWindow.dumpDataFrame.luaEditor:SetPoint("bottomright", breakdownWindow.dumpDataFrame, "bottomright", -2, 2)
|
||||
breakdownWindow.dumpDataFrame.luaEditor:SetFrameLevel(breakdownWindow.dumpDataFrame:GetFrameLevel()+1)
|
||||
breakdownWindow.dumpDataFrame.luaEditor:SetBackdrop({})
|
||||
breakdownWindowFrame.dumpDataFrame.luaEditor = detailsFramework:NewSpecialLuaEditorEntry(breakdownWindowFrame.dumpDataFrame, 1, 1, "text", "$parentCodeEditorWindow")
|
||||
breakdownWindowFrame.dumpDataFrame.luaEditor:SetPoint("topleft", breakdownWindowFrame.dumpDataFrame, "topleft", 2, -2)
|
||||
breakdownWindowFrame.dumpDataFrame.luaEditor:SetPoint("bottomright", breakdownWindowFrame.dumpDataFrame, "bottomright", -2, 2)
|
||||
breakdownWindowFrame.dumpDataFrame.luaEditor:SetFrameLevel(breakdownWindowFrame.dumpDataFrame:GetFrameLevel()+1)
|
||||
breakdownWindowFrame.dumpDataFrame.luaEditor:SetBackdrop({})
|
||||
|
||||
--hide the scroll bar
|
||||
DetailsBreakdownWindowPlayerScrollBoxDumpTableFrameCodeEditorWindowScrollBar:Hide()
|
||||
end
|
||||
|
||||
function breakdownWindow:CreateRightSideBar() --not enabled
|
||||
breakdownWindow.RightSideBar = CreateFrame("frame", nil, breakdownWindow, "BackdropTemplate")
|
||||
breakdownWindow.RightSideBar:SetWidth(20)
|
||||
breakdownWindow.RightSideBar:SetPoint("topleft", breakdownWindow, "topright", 1, 0)
|
||||
breakdownWindow.RightSideBar:SetPoint("bottomleft", breakdownWindow, "bottomright", 1, 0)
|
||||
function breakdownWindowFrame:CreateRightSideBar() --not enabled
|
||||
breakdownWindowFrame.RightSideBar = CreateFrame("frame", nil, breakdownWindowFrame, "BackdropTemplate")
|
||||
breakdownWindowFrame.RightSideBar:SetWidth(20)
|
||||
breakdownWindowFrame.RightSideBar:SetPoint("topleft", breakdownWindowFrame, "topright", 1, 0)
|
||||
breakdownWindowFrame.RightSideBar:SetPoint("bottomleft", breakdownWindowFrame, "bottomright", 1, 0)
|
||||
local rightSideBarAlpha = 0.75
|
||||
|
||||
detailsFramework:ApplyStandardBackdrop(breakdownWindow.RightSideBar)
|
||||
detailsFramework:ApplyStandardBackdrop(breakdownWindowFrame.RightSideBar)
|
||||
|
||||
local toggleMergePlayerSpells = function()
|
||||
Details.merge_player_abilities = not Details.merge_player_abilities
|
||||
@@ -380,11 +448,11 @@ function breakdownWindow:CreateRightSideBar() --not enabled
|
||||
Details:OpenBreakdownWindow(instanceObject, playerObject)
|
||||
end
|
||||
|
||||
local mergePlayerSpellsCheckbox = detailsFramework:CreateSwitch(breakdownWindow, toggleMergePlayerSpells, Details.merge_player_abilities, _, _, _, _, _, _, _, _, _, _, detailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"))
|
||||
local mergePlayerSpellsCheckbox = detailsFramework:CreateSwitch(breakdownWindowFrame, toggleMergePlayerSpells, Details.merge_player_abilities, _, _, _, _, _, _, _, _, _, _, detailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"))
|
||||
mergePlayerSpellsCheckbox:SetAsCheckBox()
|
||||
mergePlayerSpellsCheckbox:SetPoint("bottom", breakdownWindow.RightSideBar, "bottom", 0, 2)
|
||||
mergePlayerSpellsCheckbox:SetPoint("bottom", breakdownWindowFrame.RightSideBar, "bottom", 0, 2)
|
||||
|
||||
local mergePlayerSpellsLabel = breakdownWindow.RightSideBar:CreateFontString(nil, "overlay", "GameFontNormal")
|
||||
local mergePlayerSpellsLabel = breakdownWindowFrame.RightSideBar:CreateFontString(nil, "overlay", "GameFontNormal")
|
||||
mergePlayerSpellsLabel:SetText("Merge Player Spells")
|
||||
detailsFramework:SetFontRotation(mergePlayerSpellsLabel, 90)
|
||||
mergePlayerSpellsLabel:SetPoint("center", mergePlayerSpellsCheckbox.widget, "center", -6, mergePlayerSpellsCheckbox:GetHeight()/2 + mergePlayerSpellsLabel:GetStringWidth() / 2)
|
||||
@@ -398,11 +466,11 @@ function breakdownWindow:CreateRightSideBar() --not enabled
|
||||
Details:OpenBreakdownWindow(instanceObject, playerObject) --toggle
|
||||
Details:OpenBreakdownWindow(instanceObject, playerObject)
|
||||
end
|
||||
local mergePetSpellsCheckbox = detailsFramework:CreateSwitch(breakdownWindow, toggleMergePetSpells, Details.merge_pet_abilities, _, _, _, _, _, _, _, _, _, _, detailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"))
|
||||
local mergePetSpellsCheckbox = detailsFramework:CreateSwitch(breakdownWindowFrame, toggleMergePetSpells, Details.merge_pet_abilities, _, _, _, _, _, _, _, _, _, _, detailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"))
|
||||
mergePetSpellsCheckbox:SetAsCheckBox(true)
|
||||
mergePetSpellsCheckbox:SetPoint("bottom", breakdownWindow.RightSideBar, "bottom", 0, 160)
|
||||
mergePetSpellsCheckbox:SetPoint("bottom", breakdownWindowFrame.RightSideBar, "bottom", 0, 160)
|
||||
|
||||
local mergePetSpellsLabel = breakdownWindow.RightSideBar:CreateFontString(nil, "overlay", "GameFontNormal")
|
||||
local mergePetSpellsLabel = breakdownWindowFrame.RightSideBar:CreateFontString(nil, "overlay", "GameFontNormal")
|
||||
mergePetSpellsLabel:SetText("Merge Pet Spells")
|
||||
detailsFramework:SetFontRotation(mergePetSpellsLabel, 90)
|
||||
mergePetSpellsLabel:SetPoint("center", mergePetSpellsCheckbox.widget, "center", -6, mergePetSpellsCheckbox:GetHeight()/2 + mergePetSpellsLabel:GetStringWidth() / 2)
|
||||
@@ -467,60 +535,60 @@ end
|
||||
---set the class or spec icon for the actor displayed
|
||||
---@param actorObject actor
|
||||
---@param class string
|
||||
function breakdownWindow.SetClassIcon(actorObject, class)
|
||||
function breakdownWindowFrame.SetClassIcon(actorObject, class)
|
||||
if (actorObject.spellicon) then
|
||||
breakdownWindow.classIcon:SetTexture(actorObject.spellicon)
|
||||
breakdownWindow.classIcon:SetTexCoord(.1, .9, .1, .9)
|
||||
breakdownWindowFrame.classIcon:SetTexture(actorObject.spellicon)
|
||||
breakdownWindowFrame.classIcon:SetTexCoord(.1, .9, .1, .9)
|
||||
|
||||
elseif (actorObject.spec) then
|
||||
breakdownWindow.classIcon:SetTexture([[Interface\AddOns\Details\images\spec_icons_normal_alpha]])
|
||||
breakdownWindow.classIcon:SetTexCoord(unpack(_detalhes.class_specs_coords [actorObject.spec]))
|
||||
breakdownWindowFrame.classIcon:SetTexture([[Interface\AddOns\Details\images\spec_icons_normal_alpha]])
|
||||
breakdownWindowFrame.classIcon:SetTexCoord(unpack(_detalhes.class_specs_coords [actorObject.spec]))
|
||||
else
|
||||
local coords = CLASS_ICON_TCOORDS[class]
|
||||
if (coords) then
|
||||
breakdownWindow.classIcon:SetTexture([[Interface\Glues\CHARACTERCREATE\UI-CHARACTERCREATE-CLASSES]])
|
||||
breakdownWindowFrame.classIcon:SetTexture([[Interface\Glues\CHARACTERCREATE\UI-CHARACTERCREATE-CLASSES]])
|
||||
local l, r, t, b = unpack(coords)
|
||||
breakdownWindow.classIcon:SetTexCoord(l+0.01953125, r-0.01953125, t+0.01953125, b-0.01953125)
|
||||
breakdownWindowFrame.classIcon:SetTexCoord(l+0.01953125, r-0.01953125, t+0.01953125, b-0.01953125)
|
||||
else
|
||||
local c = _detalhes.class_coords ["MONSTER"]
|
||||
breakdownWindow.classIcon:SetTexture("Interface\\AddOns\\Details\\images\\classes")
|
||||
breakdownWindow.classIcon:SetTexCoord(c[1], c[2], c[3], c[4])
|
||||
breakdownWindowFrame.classIcon:SetTexture("Interface\\AddOns\\Details\\images\\classes")
|
||||
breakdownWindowFrame.classIcon:SetTexCoord(c[1], c[2], c[3], c[4])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Details:SetBreakdownWindowBackgroundTexture(texture)
|
||||
breakdownWindow.backgroundTexture:SetTexture(texture)
|
||||
breakdownWindowFrame.backgroundTexture:SetTexture(texture)
|
||||
end
|
||||
|
||||
--search key: ~create ~inicio ~start
|
||||
function Details:CreateBreakdownWindow()
|
||||
table.insert(UISpecialFrames, breakdownWindow:GetName())
|
||||
breakdownWindow.extra_frames = {}
|
||||
breakdownWindow.Loaded = true
|
||||
Details.playerDetailWindow = breakdownWindow
|
||||
table.insert(UISpecialFrames, breakdownWindowFrame:GetName())
|
||||
breakdownWindowFrame.extra_frames = {}
|
||||
breakdownWindowFrame.Loaded = true
|
||||
Details.BreakdownWindowFrame = breakdownWindowFrame
|
||||
|
||||
breakdownWindow:SetWidth(PLAYER_DETAILS_WINDOW_WIDTH)
|
||||
breakdownWindow:SetHeight(PLAYER_DETAILS_WINDOW_HEIGHT)
|
||||
breakdownWindow:SetFrameStrata("HIGH")
|
||||
breakdownWindow:SetToplevel(true)
|
||||
breakdownWindow:EnableMouse(true)
|
||||
breakdownWindow:SetResizable(true)
|
||||
breakdownWindow:SetMovable(true)
|
||||
breakdownWindow:SetClampedToScreen(true)
|
||||
breakdownWindowFrame:SetWidth(PLAYER_DETAILS_WINDOW_WIDTH)
|
||||
breakdownWindowFrame:SetHeight(PLAYER_DETAILS_WINDOW_HEIGHT)
|
||||
breakdownWindowFrame:SetFrameStrata("HIGH")
|
||||
breakdownWindowFrame:SetToplevel(true)
|
||||
breakdownWindowFrame:EnableMouse(true)
|
||||
breakdownWindowFrame:SetResizable(true)
|
||||
breakdownWindowFrame:SetMovable(true)
|
||||
breakdownWindowFrame:SetClampedToScreen(true)
|
||||
|
||||
--make the window movable
|
||||
if (not breakdownWindow.registeredLibWindow) then
|
||||
if (not breakdownWindowFrame.registeredLibWindow) then
|
||||
local LibWindow = LibStub("LibWindow-1.1")
|
||||
breakdownWindow.registeredLibWindow = true
|
||||
breakdownWindowFrame.registeredLibWindow = true
|
||||
if (LibWindow) then
|
||||
breakdownWindow.libWindowTable = breakdownWindow.libWindowTable or {}
|
||||
LibWindow.RegisterConfig(breakdownWindow, breakdownWindow.libWindowTable)
|
||||
LibWindow.RestorePosition(breakdownWindow)
|
||||
LibWindow.MakeDraggable(breakdownWindow)
|
||||
LibWindow.SavePosition(breakdownWindow)
|
||||
breakdownWindowFrame.libWindowTable = breakdownWindowFrame.libWindowTable or {}
|
||||
LibWindow.RegisterConfig(breakdownWindowFrame, breakdownWindowFrame.libWindowTable)
|
||||
LibWindow.RestorePosition(breakdownWindowFrame)
|
||||
LibWindow.MakeDraggable(breakdownWindowFrame)
|
||||
LibWindow.SavePosition(breakdownWindowFrame)
|
||||
|
||||
breakdownWindow:SetScript("OnMouseDown", function(self, button)
|
||||
breakdownWindowFrame:SetScript("OnMouseDown", function(self, button)
|
||||
if (button == "RightButton") then
|
||||
Details:CloseBreakdownWindow()
|
||||
end
|
||||
@@ -528,97 +596,96 @@ function Details:CreateBreakdownWindow()
|
||||
end
|
||||
end
|
||||
|
||||
detailsFramework:ApplyStandardBackdrop(breakdownWindow)
|
||||
detailsFramework:ApplyStandardBackdrop(breakdownWindowFrame)
|
||||
|
||||
--background
|
||||
breakdownWindow.backgroundTexture = breakdownWindow:CreateTexture("$parent", "background", nil, -3)
|
||||
breakdownWindow.backgroundTexture:SetAllPoints()
|
||||
breakdownWindow.backgroundTexture:Hide()
|
||||
breakdownWindowFrame.backgroundTexture = breakdownWindowFrame:CreateTexture("$parent", "background", nil, -3)
|
||||
breakdownWindowFrame.backgroundTexture:SetAllPoints()
|
||||
breakdownWindowFrame.backgroundTexture:Hide()
|
||||
|
||||
--host the textures and fontstring of the default frame of the player breakdown window
|
||||
--what is the summary window: is the frame where all the widgets for the summary tab are created
|
||||
breakdownWindow.SummaryWindowWidgets = CreateFrame("frame", "DetailsBreakdownWindowSummaryWidgets", breakdownWindow, "BackdropTemplate")
|
||||
local SWW = breakdownWindow.SummaryWindowWidgets
|
||||
breakdownWindowFrame.SummaryWindowWidgets = CreateFrame("frame", "DetailsBreakdownWindowSummaryWidgets", breakdownWindowFrame, "BackdropTemplate")
|
||||
local SWW = breakdownWindowFrame.SummaryWindowWidgets
|
||||
SWW:SetAllPoints()
|
||||
table.insert(SummaryWidgets, SWW) --where SummaryWidgets is declared: at the header of the file, what is the purpose of this table?
|
||||
breakdownWindow.SummaryWindowWidgets:Hide()
|
||||
table.insert(summaryWidgets, SWW) --where SummaryWidgets is declared: at the header of the file, what is the purpose of this table?
|
||||
breakdownWindowFrame.SummaryWindowWidgets:Hide()
|
||||
|
||||
detailsFramework:CreateScaleBar(breakdownWindow, Details.player_details_window)
|
||||
breakdownWindow:SetScale(Details.player_details_window.scale)
|
||||
detailsFramework:CreateScaleBar(breakdownWindowFrame, Details.player_details_window)
|
||||
breakdownWindowFrame:SetScale(Details.player_details_window.scale)
|
||||
|
||||
--class icon
|
||||
breakdownWindow.classIcon = breakdownWindow:CreateTexture(nil, "overlay", nil, 1)
|
||||
breakdownWindow.classIcon:SetPoint("topleft", breakdownWindow, "topleft", 2, -17)
|
||||
breakdownWindow.classIcon:SetSize(54, 54)
|
||||
breakdownWindow.classIcon:SetAlpha(0.7)
|
||||
breakdownWindowFrame.classIcon = breakdownWindowFrame:CreateTexture(nil, "overlay", nil, 1)
|
||||
breakdownWindowFrame.classIcon:SetPoint("topleft", breakdownWindowFrame, "topleft", 2, -17)
|
||||
breakdownWindowFrame.classIcon:SetSize(54, 54)
|
||||
breakdownWindowFrame.classIcon:SetAlpha(0.7)
|
||||
|
||||
--close button
|
||||
breakdownWindow.closeButton = CreateFrame("Button", nil, breakdownWindow, "UIPanelCloseButton")
|
||||
breakdownWindow.closeButton:SetSize(20, 20)
|
||||
breakdownWindow.closeButton:SetPoint("TOPRIGHT", breakdownWindow, "TOPRIGHT", -5, -4)
|
||||
breakdownWindow.closeButton:SetFrameLevel(breakdownWindow:GetFrameLevel()+5)
|
||||
breakdownWindow.closeButton:GetNormalTexture():SetDesaturated(true)
|
||||
breakdownWindow.closeButton:GetNormalTexture():SetVertexColor(.6, .6, .6)
|
||||
breakdownWindow.closeButton:SetScript("OnClick", function(self)
|
||||
breakdownWindowFrame.closeButton = CreateFrame("Button", nil, breakdownWindowFrame, "UIPanelCloseButton")
|
||||
breakdownWindowFrame.closeButton:SetSize(20, 20)
|
||||
breakdownWindowFrame.closeButton:SetPoint("TOPRIGHT", breakdownWindowFrame, "TOPRIGHT", -5, -4)
|
||||
breakdownWindowFrame.closeButton:SetFrameLevel(breakdownWindowFrame:GetFrameLevel()+5)
|
||||
breakdownWindowFrame.closeButton:GetNormalTexture():SetDesaturated(true)
|
||||
breakdownWindowFrame.closeButton:GetNormalTexture():SetVertexColor(.6, .6, .6)
|
||||
breakdownWindowFrame.closeButton:SetScript("OnClick", function(self)
|
||||
Details:CloseBreakdownWindow()
|
||||
end)
|
||||
|
||||
--title
|
||||
detailsFramework:NewLabel(breakdownWindow, breakdownWindow, nil, "titleText", Loc ["STRING_PLAYER_DETAILS"], "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255})
|
||||
breakdownWindow.titleText:SetPoint("center", breakdownWindow, "center")
|
||||
breakdownWindow.titleText:SetPoint("top", breakdownWindow, "top", 0, -6)
|
||||
detailsFramework:NewLabel(breakdownWindowFrame, breakdownWindowFrame, nil, "titleText", Loc ["STRING_PLAYER_DETAILS"], "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255})
|
||||
breakdownWindowFrame.titleText:SetPoint("center", breakdownWindowFrame, "center")
|
||||
breakdownWindowFrame.titleText:SetPoint("top", breakdownWindowFrame, "top", 0, -6)
|
||||
|
||||
--create the texts shown on the window
|
||||
do
|
||||
breakdownWindow.actorName = breakdownWindow:CreateFontString(nil, "overlay", "QuestFont_Large")
|
||||
breakdownWindow.actorName:SetPoint("left", breakdownWindow.classIcon, "right", 20, -7)
|
||||
breakdownWindowFrame.actorName = breakdownWindowFrame:CreateFontString(nil, "overlay", "QuestFont_Large")
|
||||
breakdownWindowFrame.actorName:SetPoint("left", breakdownWindowFrame.classIcon, "right", 20, -7)
|
||||
|
||||
breakdownWindow.attributeName = breakdownWindow:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
||||
breakdownWindowFrame.attributeName = breakdownWindowFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
||||
breakdownWindowFrame.avatar = breakdownWindowFrame:CreateTexture(nil, "overlay")
|
||||
breakdownWindowFrame.avatar_bg = breakdownWindowFrame:CreateTexture(nil, "overlay")
|
||||
breakdownWindowFrame.avatar_attribute = breakdownWindowFrame:CreateFontString(nil, "overlay", "GameFontHighlightSmall")
|
||||
breakdownWindowFrame.avatar_nick = breakdownWindowFrame:CreateFontString(nil, "overlay", "QuestFont_Large")
|
||||
breakdownWindowFrame.avatar:SetDrawLayer("overlay", 3)
|
||||
breakdownWindowFrame.avatar_bg:SetDrawLayer("overlay", 2)
|
||||
breakdownWindowFrame.avatar_nick:SetDrawLayer("overlay", 4)
|
||||
|
||||
breakdownWindow.avatar = breakdownWindow:CreateTexture(nil, "overlay")
|
||||
breakdownWindow.avatar_bg = breakdownWindow:CreateTexture(nil, "overlay")
|
||||
breakdownWindow.avatar_attribute = breakdownWindow:CreateFontString(nil, "overlay", "GameFontHighlightSmall")
|
||||
breakdownWindow.avatar_nick = breakdownWindow:CreateFontString(nil, "overlay", "QuestFont_Large")
|
||||
breakdownWindow.avatar:SetDrawLayer("overlay", 3)
|
||||
breakdownWindow.avatar_bg:SetDrawLayer("overlay", 2)
|
||||
breakdownWindow.avatar_nick:SetDrawLayer("overlay", 4)
|
||||
breakdownWindowFrame.avatar:SetPoint("TOPLEFT", breakdownWindowFrame, "TOPLEFT", 60, -10)
|
||||
breakdownWindowFrame.avatar_bg:SetPoint("TOPLEFT", breakdownWindowFrame, "TOPLEFT", 60, -12)
|
||||
breakdownWindowFrame.avatar_bg:SetSize(275, 60)
|
||||
|
||||
breakdownWindow.avatar:SetPoint("TOPLEFT", breakdownWindow, "TOPLEFT", 60, -10)
|
||||
breakdownWindow.avatar_bg:SetPoint("TOPLEFT", breakdownWindow, "TOPLEFT", 60, -12)
|
||||
breakdownWindow.avatar_bg:SetSize(275, 60)
|
||||
breakdownWindowFrame.avatar_nick:SetPoint("TOPLEFT", breakdownWindowFrame, "TOPLEFT", 195, -54)
|
||||
|
||||
breakdownWindow.avatar_nick:SetPoint("TOPLEFT", breakdownWindow, "TOPLEFT", 195, -54)
|
||||
|
||||
breakdownWindow.avatar:Hide()
|
||||
breakdownWindow.avatar_bg:Hide()
|
||||
breakdownWindow.avatar_nick:Hide()
|
||||
breakdownWindowFrame.avatar:Hide()
|
||||
breakdownWindowFrame.avatar_bg:Hide()
|
||||
breakdownWindowFrame.avatar_nick:Hide()
|
||||
end
|
||||
|
||||
--statusbar
|
||||
local statusBar = CreateFrame("frame", nil, breakdownWindow, "BackdropTemplate")
|
||||
statusBar:SetPoint("bottomleft", breakdownWindow, "bottomleft")
|
||||
statusBar:SetPoint("bottomright", breakdownWindow, "bottomright")
|
||||
local statusBar = CreateFrame("frame", nil, breakdownWindowFrame, "BackdropTemplate")
|
||||
statusBar:SetPoint("bottomleft", breakdownWindowFrame, "bottomleft")
|
||||
statusBar:SetPoint("bottomright", breakdownWindowFrame, "bottomright")
|
||||
statusBar:SetHeight(PLAYER_DETAILS_STATUSBAR_HEIGHT)
|
||||
detailsFramework:ApplyStandardBackdrop(statusBar)
|
||||
statusBar:SetAlpha(PLAYER_DETAILS_STATUSBAR_ALPHA)
|
||||
breakdownWindow.statusBar = statusBar
|
||||
breakdownWindowFrame.statusBar = statusBar
|
||||
|
||||
statusBar.Text = detailsFramework:CreateLabel(statusBar)
|
||||
statusBar.Text:SetPoint("left", 2, 0)
|
||||
|
||||
--create the gradients in the top and bottom side of the breakdown window
|
||||
local gradientStartColor = Details222.ColorScheme.GetColorFor("gradient-background")
|
||||
local gradientUp = detailsFramework:CreateTexture(breakdownWindow, {gradient = "vertical", fromColor = gradientStartColor, toColor = {0, 0, 0, 0.2}}, 1, 68, "artwork", {0, 1, 0, 1})
|
||||
local gradientUp = detailsFramework:CreateTexture(breakdownWindowFrame, {gradient = "vertical", fromColor = gradientStartColor, toColor = {0, 0, 0, 0.2}}, 1, 68, "artwork", {0, 1, 0, 1})
|
||||
gradientUp:SetPoint("tops", 1, 1)
|
||||
|
||||
local gradientHeight = 481
|
||||
local gradientDown = detailsFramework:CreateTexture(breakdownWindow, {gradient = "vertical", fromColor = "transparent", toColor = {0, 0, 0, 0.7}}, 1, gradientHeight, "border", {0, 1, 0, 1})
|
||||
gradientDown:SetPoint("bottomleft", breakdownWindow.statusBar, "topleft", 1, 1)
|
||||
gradientDown:SetPoint("bottomright", breakdownWindow.statusBar, "topright", -1, 1)
|
||||
local gradientDown = detailsFramework:CreateTexture(breakdownWindowFrame, {gradient = "vertical", fromColor = "transparent", toColor = {0, 0, 0, 0.7}}, 1, gradientHeight, "border", {0, 1, 0, 1})
|
||||
gradientDown:SetPoint("bottomleft", breakdownWindowFrame.statusBar, "topleft", 1, 1)
|
||||
gradientDown:SetPoint("bottomright", breakdownWindowFrame.statusBar, "topright", -1, 1)
|
||||
|
||||
function breakdownWindow:SetStatusbarText(text, fontSize, fontColor)
|
||||
function breakdownWindowFrame:SetStatusbarText(text, fontSize, fontColor)
|
||||
if (not text) then
|
||||
breakdownWindow:SetStatusbarText("Details! Damage Meter | Use '/details stats' for statistics", 10, "gray")
|
||||
breakdownWindowFrame:SetStatusbarText("Details! Damage Meter | Use '/details stats' for statistics", 10, "gray")
|
||||
return
|
||||
end
|
||||
statusBar.Text.text = text
|
||||
@@ -627,28 +694,28 @@ function Details:CreateBreakdownWindow()
|
||||
end
|
||||
|
||||
--set default text
|
||||
breakdownWindow:SetStatusbarText()
|
||||
breakdownWindowFrame:SetStatusbarText()
|
||||
|
||||
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--tabs ~tabs
|
||||
function breakdownWindow:ShowTabs()
|
||||
function breakdownWindowFrame:ShowTabs()
|
||||
local tabsShown = 0
|
||||
local secondRowIndex = 1
|
||||
local breakLine = 6 --the tab it'll start the second line
|
||||
local breakLine = 7 --the tab it'll start the second line
|
||||
|
||||
local tablePool = Details:GetBreakdownTabsInUse()
|
||||
|
||||
for index = 1, #tablePool do
|
||||
local tabButton = tablePool[index]
|
||||
|
||||
if (tabButton:condition(breakdownWindow.jogador, breakdownWindow.atributo, breakdownWindow.sub_atributo) and not tabButton.replaced) then
|
||||
if (tabButton:condition(breakdownWindowFrame.jogador, breakdownWindowFrame.atributo, breakdownWindowFrame.sub_atributo) and not tabButton.replaced) then
|
||||
--test if can show the tutorial for the comparison tab
|
||||
if (tabButton.tabname == "Compare") then
|
||||
--Details:SetTutorialCVar ("DETAILS_INFO_TUTORIAL1", false)
|
||||
if (not Details:GetTutorialCVar("DETAILS_INFO_TUTORIAL1")) then
|
||||
Details:SetTutorialCVar ("DETAILS_INFO_TUTORIAL1", true)
|
||||
|
||||
local alert = CreateFrame("frame", "DetailsInfoPopUp1", breakdownWindow, "DetailsHelpBoxTemplate")
|
||||
local alert = CreateFrame("frame", "DetailsInfoPopUp1", breakdownWindowFrame, "DetailsHelpBoxTemplate")
|
||||
alert.ArrowUP:Show()
|
||||
alert.ArrowGlowUP:Show()
|
||||
alert.Text:SetText(Loc ["STRING_INFO_TUTORIAL_COMPARISON1"])
|
||||
@@ -663,25 +730,25 @@ function Details:CreateBreakdownWindow()
|
||||
tabButton:ClearAllPoints()
|
||||
|
||||
--get the button width
|
||||
local buttonTemplate = gump:GetTemplate("button", "DETAILS_TAB_BUTTON_TEMPLATE")
|
||||
local buttonTemplate = detailsFramework:GetTemplate("button", "DETAILS_TAB_BUTTON_TEMPLATE")
|
||||
local buttonWidth = buttonTemplate.width + 1
|
||||
|
||||
--pixelutil might not be compatible with classic wow
|
||||
if (PixelUtil) then
|
||||
PixelUtil.SetSize(tabButton, buttonTemplate.width, buttonTemplate.height)
|
||||
if (tabsShown >= breakLine) then --next row of icons
|
||||
PixelUtil.SetPoint(tabButton, "bottomright", breakdownWindow, "topright", -514 + (buttonWidth * (secondRowIndex)), -50)
|
||||
PixelUtil.SetPoint(tabButton, "bottomright", breakdownWindowFrame, "topright", -613 + (buttonWidth * (secondRowIndex)), -48)
|
||||
secondRowIndex = secondRowIndex + 1
|
||||
else
|
||||
PixelUtil.SetPoint(tabButton, "bottomright", breakdownWindow, "topright", -514 + (buttonWidth * tabsShown), -69)
|
||||
PixelUtil.SetPoint(tabButton, "bottomright", breakdownWindowFrame, "topright", -613 + (buttonWidth * tabsShown), -69)
|
||||
end
|
||||
else
|
||||
tabButton:SetSize(buttonTemplate.width, buttonTemplate.height)
|
||||
if (tabsShown >= breakLine) then --next row of icons
|
||||
tabButton:SetPoint("bottomright", breakdownWindow, "topright", -514 + (buttonWidth * (secondRowIndex)), -50)
|
||||
tabButton:SetPoint("bottomright", breakdownWindowFrame, "topright", -613 + (buttonWidth * (secondRowIndex)), -48)
|
||||
secondRowIndex = secondRowIndex + 1
|
||||
else
|
||||
tabButton:SetPoint("bottomright", breakdownWindow, "topright", -514 + (buttonWidth * tabsShown), -69)
|
||||
tabButton:SetPoint("bottomright", breakdownWindowFrame, "topright", -613 + (buttonWidth * tabsShown), -69)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -693,14 +760,14 @@ function Details:CreateBreakdownWindow()
|
||||
end
|
||||
|
||||
if (tabsShown < 2) then
|
||||
tablePool[1]:SetPoint("bottomleft", breakdownWindow.container_barras, "topleft", 490 - (94 * (1-0)), 1)
|
||||
tablePool[1]:SetPoint("bottomleft", breakdownWindowFrame.container_barras, "topleft", 490 - (94 * (1-0)), 1)
|
||||
end
|
||||
|
||||
--selected by default
|
||||
tablePool[1]:Click()
|
||||
end
|
||||
|
||||
breakdownWindow:SetScript("OnHide", function(self)
|
||||
breakdownWindowFrame:SetScript("OnHide", function(self)
|
||||
Details:CloseBreakdownWindow()
|
||||
for _, tab in ipairs(Details.player_details_tabs) do
|
||||
tab:Hide()
|
||||
@@ -708,11 +775,11 @@ function Details:CreateBreakdownWindow()
|
||||
end
|
||||
end)
|
||||
|
||||
breakdownWindow.tipo = 1 --tipo da janela // 1 = janela normal
|
||||
return breakdownWindow
|
||||
breakdownWindowFrame.tipo = 1 --tipo da janela // 1 = janela normal
|
||||
return breakdownWindowFrame
|
||||
end
|
||||
|
||||
breakdownWindow.selectedTab = "Summary"
|
||||
breakdownWindowFrame.selectedTab = "Summary"
|
||||
|
||||
function Details:CreatePlayerDetailsTab(tabName, locName, conditionFunc, fillFunc, tabOnClickFunc, onCreateFunc, iconSettings, replace, bIsDefaultTab) --~tab
|
||||
if (not tabName) then
|
||||
@@ -720,8 +787,8 @@ function Details:CreatePlayerDetailsTab(tabName, locName, conditionFunc, fillFun
|
||||
end
|
||||
|
||||
--create a button to select the tab
|
||||
local tabButton = detailsFramework:CreateButton(breakdownWindow, function()end, 20, 20, locName, nil, nil, nil, nil, breakdownWindow:GetName() .. "TabButton" .. tabName .. math.random(1, 1000), nil, "DETAILS_TAB_BUTTON_TEMPLATE")
|
||||
tabButton:SetFrameLevel(breakdownWindow:GetFrameLevel()+1)
|
||||
local tabButton = detailsFramework:CreateButton(breakdownWindowFrame.BreakdownTabsFrame, function()end, 20, 20, locName, nil, nil, nil, nil, breakdownWindowFrame:GetName() .. "TabButton" .. tabName .. math.random(1, 1000), nil, "DETAILS_TAB_BUTTON_TEMPLATE")
|
||||
tabButton:SetFrameLevel(breakdownWindowFrame.BreakdownTabsFrame:GetFrameLevel()+1)
|
||||
tabButton:Hide()
|
||||
|
||||
if (tabName == "Summary") then
|
||||
@@ -737,10 +804,10 @@ function Details:CreatePlayerDetailsTab(tabName, locName, conditionFunc, fillFun
|
||||
tabButton.last_actor = {} --need to double check is this getting cleared
|
||||
|
||||
---@type tabframe
|
||||
local tabFrame = CreateFrame("frame", breakdownWindow:GetName() .. "TabFrame" .. tabName .. math.random(1, 10000), breakdownWindow, "BackdropTemplate")
|
||||
tabFrame:SetFrameLevel(breakdownWindow:GetFrameLevel()+1)
|
||||
tabFrame:SetPoint("topleft", breakdownWindow, "topleft", 0, -70)
|
||||
tabFrame:SetPoint("bottomright", breakdownWindow, "bottomright", -1, 20)
|
||||
local tabFrame = CreateFrame("frame", breakdownWindowFrame:GetName() .. "TabFrame" .. tabName .. math.random(1, 10000), breakdownWindowFrame, "BackdropTemplate")
|
||||
tabFrame:SetFrameLevel(breakdownWindowFrame:GetFrameLevel()+1)
|
||||
tabFrame:SetPoint("topleft", breakdownWindowFrame, "topleft", 1, -70)
|
||||
tabFrame:SetPoint("bottomright", breakdownWindowFrame, "bottomright", -1, 20)
|
||||
tabFrame:Hide()
|
||||
|
||||
DetailsFramework:ApplyStandardBackdrop(tabFrame)
|
||||
@@ -808,7 +875,7 @@ function Details:CreatePlayerDetailsTab(tabName, locName, conditionFunc, fillFun
|
||||
end
|
||||
|
||||
self:SetTemplate("DETAILS_TAB_BUTTONSELECTED_TEMPLATE")
|
||||
breakdownWindow.selectedTab = self.tabname
|
||||
breakdownWindowFrame.selectedTab = self.tabname
|
||||
end
|
||||
|
||||
if (not tabOnClickFunc) then
|
||||
@@ -841,14 +908,14 @@ function Details:CreatePlayerDetailsTab(tabName, locName, conditionFunc, fillFun
|
||||
end
|
||||
|
||||
tabButton:SetScript("PostClick", function(self)
|
||||
CurrentTab = self.tabname or self.MyObject.tabname
|
||||
currentTab = self.tabname or self.MyObject.tabname
|
||||
|
||||
if (CurrentTab ~= "Summary") then
|
||||
for _, widget in ipairs(SummaryWidgets) do
|
||||
if (currentTab ~= "Summary") then
|
||||
for _, widget in ipairs(summaryWidgets) do
|
||||
widget:Hide()
|
||||
end
|
||||
else
|
||||
for _, widget in ipairs(SummaryWidgets) do
|
||||
for _, widget in ipairs(summaryWidgets) do
|
||||
widget:Show()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -34,7 +34,7 @@ local IconTexCoord = {5/64, 59/64, 5/64, 59/64}
|
||||
local Loc = LibStub("AceLocale-3.0"):GetLocale( "Details" )
|
||||
local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0")
|
||||
|
||||
local info = Details.playerDetailWindow
|
||||
local breakdownWindowFrame = Details.BreakdownWindowFrame
|
||||
|
||||
local fill_compare_targets = function(self, player, other_players, target_pool)
|
||||
local offset = _G.FauxScrollFrame_GetOffset(self)
|
||||
@@ -324,7 +324,7 @@ local fill_compare_actors = function(self, player, other_players)
|
||||
|
||||
--main player pets
|
||||
for petIndex, petName in ipairs(player:Pets()) do
|
||||
local petActor = info.instancia.showing [player.tipo]:PegarCombatente (nil, petName)
|
||||
local petActor = breakdownWindowFrame.instancia.showing [player.tipo]:PegarCombatente (nil, petName)
|
||||
if (petActor) then
|
||||
for _spellid, _skill in pairs(petActor:GetActorSpells()) do
|
||||
spells_sorted [#spells_sorted+1] = {_skill, _skill.total, petName}
|
||||
@@ -359,7 +359,7 @@ local fill_compare_actors = function(self, player, other_players)
|
||||
end
|
||||
--player 2 pets
|
||||
for petIndex, petName in ipairs(other_players [1]:Pets()) do
|
||||
local petActor = info.instancia.showing [player.tipo]:PegarCombatente (nil, petName)
|
||||
local petActor = breakdownWindowFrame.instancia.showing [player.tipo]:PegarCombatente (nil, petName)
|
||||
if (petActor) then
|
||||
for _spellid, _skill in pairs(petActor:GetActorSpells()) do
|
||||
player_2_spells_sorted [#player_2_spells_sorted+1] = {_skill, _skill.total, petName}
|
||||
@@ -401,7 +401,7 @@ local fill_compare_actors = function(self, player, other_players)
|
||||
end
|
||||
--player 3 pets
|
||||
for petIndex, petName in ipairs(other_players [2]:Pets()) do
|
||||
local petActor = info.instancia.showing [player.tipo]:PegarCombatente (nil, petName)
|
||||
local petActor = breakdownWindowFrame.instancia.showing [player.tipo]:PegarCombatente (nil, petName)
|
||||
if (petActor) then
|
||||
for _spellid, _skill in pairs(petActor:GetActorSpells()) do
|
||||
player_3_spells_sorted [#player_3_spells_sorted+1] = {_skill, _skill.total, petName}
|
||||
@@ -462,7 +462,7 @@ local fill_compare_actors = function(self, player, other_players)
|
||||
if (not spell and petName and player_2) then
|
||||
for _petIndex, _petName in ipairs(player_2:Pets()) do
|
||||
if (_petName:gsub(" <.*", "") == petName:gsub(" <.*", "")) then
|
||||
local petActor = info.instancia.showing [player.tipo]:PegarCombatente (nil, _petName)
|
||||
local petActor = breakdownWindowFrame.instancia.showing [player.tipo]:PegarCombatente (nil, _petName)
|
||||
spell = petActor and petActor.spells._ActorTable [spellid]
|
||||
name = name .. " (|cFFCCBBBB" .. _petName:gsub(" <.*", "") .. "|r)"
|
||||
end
|
||||
@@ -541,7 +541,7 @@ local fill_compare_actors = function(self, player, other_players)
|
||||
if (not spell and petName and player_3) then
|
||||
for _petIndex, _petName in ipairs(player_3:Pets()) do
|
||||
if (_petName:gsub(" <.*", "") == petName:gsub(" <.*", "")) then
|
||||
local petActor = info.instancia.showing [player.tipo]:PegarCombatente (nil, _petName)
|
||||
local petActor = breakdownWindowFrame.instancia.showing [player.tipo]:PegarCombatente (nil, _petName)
|
||||
spell = petActor and petActor.spells._ActorTable [spellid]
|
||||
local name, _, icon = _GetSpellInfo(spellid)
|
||||
name = name .. " (|cFFCCBBBB" .. _petName:gsub(" <.*", "") .. "|r)"
|
||||
@@ -971,7 +971,7 @@ local on_enter = function(self)
|
||||
local critical = bar1[3][3]
|
||||
|
||||
---@type combat
|
||||
local combatObject = info.instancia.showing
|
||||
local combatObject = breakdownWindowFrame.instancia.showing
|
||||
|
||||
local player1_misc = combatObject(4, player1)
|
||||
local player2_misc = combatObject(4, player2)
|
||||
@@ -1470,7 +1470,7 @@ local compare_create = function(tab, frame)
|
||||
bar.righttext2:SetJustifyH("right")
|
||||
bar.righttext2:SetTextColor(1, 1, 1, 1)
|
||||
|
||||
tinsert(parent.bars, {spellicon, bar, {0, 0, 0}})
|
||||
table.insert(parent.bars, {spellicon, bar, {0, 0, 0}})
|
||||
end
|
||||
|
||||
local create_tooltip = function(name)
|
||||
@@ -1675,7 +1675,7 @@ local compare_create = function(tab, frame)
|
||||
bar.bg = bg_line1
|
||||
|
||||
local object = {spellicon, bar}
|
||||
tinsert(tooltip.bars, object)
|
||||
table.insert(tooltip.bars, object)
|
||||
return object
|
||||
end
|
||||
|
||||
@@ -1899,7 +1899,7 @@ function Details:InitializeCompareTab()
|
||||
Loc ["STRING_INFO_TAB_COMPARISON"], --[2] localized name
|
||||
function(tabOBject, playerObject) --[3] condition
|
||||
|
||||
if (info.atributo > 2) then
|
||||
if (breakdownWindowFrame.atributo > 2) then
|
||||
return false
|
||||
end
|
||||
|
||||
@@ -1917,11 +1917,11 @@ function Details:InitializeCompareTab()
|
||||
tabOBject.player = playerObject
|
||||
tabOBject.spells_amt = my_spells_total
|
||||
|
||||
if (not info.instancia.showing) then
|
||||
if (not breakdownWindowFrame.instancia.showing) then
|
||||
return false
|
||||
end
|
||||
|
||||
for index, actor in ipairs(info.instancia.showing [info.atributo]._ActorTable) do
|
||||
for index, actor in ipairs(breakdownWindowFrame.instancia.showing [breakdownWindowFrame.atributo]._ActorTable) do
|
||||
if (actor.classe == class and actor ~= playerObject) then
|
||||
|
||||
local same_spells = 0
|
||||
@@ -1934,7 +1934,7 @@ function Details:InitializeCompareTab()
|
||||
local match_percentage = same_spells / math.max(my_spells_total, 0.000001) * 100
|
||||
|
||||
if (match_percentage > 30) then
|
||||
tinsert(tabOBject.players, actor)
|
||||
table.insert(tabOBject.players, actor)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,22 +1,223 @@
|
||||
|
||||
local Details = _G.Details
|
||||
local detailsFramework = _G.DetailsFramework
|
||||
local openRaidLib = LibStub:GetLibrary("LibOpenRaid-1.0", true)
|
||||
local addonName, Details222 = ...
|
||||
local Details = _G.Details
|
||||
local detailsFramework = _G.DetailsFramework
|
||||
local openRaidLib = LibStub:GetLibrary("LibOpenRaid-1.0", true)
|
||||
local addonName, Details222 = ...
|
||||
|
||||
local breakdownWindowPlayerList = {}
|
||||
local breakdownWindowPlayerList = {}
|
||||
|
||||
local unpack = table.unpack or unpack
|
||||
local C_Timer = _G.C_Timer
|
||||
local tinsert = _G.tinsert
|
||||
local unpack = table.unpack or unpack
|
||||
local C_Timer = _G.C_Timer
|
||||
local tinsert = table.insert
|
||||
local CreateFrame = CreateFrame
|
||||
local GetSpecializationInfoByID = GetSpecializationInfoByID
|
||||
|
||||
local scrollbox_size = {215, 405}
|
||||
local scrollbox_lines = 23
|
||||
local player_line_height = 21.7
|
||||
local scrollbox_line_backdrop_color = {0.2, 0.2, 0.2, 0.5}
|
||||
local scrollbox_line_backdrop_color_selected = {.6, .6, .1, 0.7}
|
||||
local scrollbox_line_backdrop_color_highlight = {.9, .9, .9, 0.5}
|
||||
local player_scroll_size = {195, 288}
|
||||
local scrollbox_size = {215, 405}
|
||||
local scrollbox_lines = 19
|
||||
local player_line_height = 21.7
|
||||
local scrollbox_line_backdrop_color = {0.2, 0.2, 0.2, 0.5}
|
||||
local scrollbox_line_backdrop_color_selected = {.6, .6, .1, 0.7}
|
||||
local scrollbox_line_backdrop_color_highlight = {.9, .9, .9, 0.5}
|
||||
local player_scroll_size = {195, 288}
|
||||
local player_scroll_y = -166
|
||||
|
||||
function breakdownWindowPlayerList.CreatePlayerListFrame()
|
||||
---@type breakdownwindow
|
||||
local breakdownWindowFrame = Details.BreakdownWindowFrame
|
||||
---@type frame
|
||||
local breakdownSideMenu = breakdownWindowFrame.BreakdownSideMenuFrame
|
||||
---@type frame
|
||||
local pluginsFrame = breakdownWindowFrame.BreakdownPluginSelectionFrame
|
||||
|
||||
breakdownSideMenu:SetSize(scrollbox_size[1], scrollbox_size[2])
|
||||
breakdownSideMenu:SetPoint("topright", breakdownWindowFrame, "topleft", 0, 0)
|
||||
breakdownSideMenu:SetPoint("bottomright", breakdownWindowFrame, "bottomleft", 0, 0)
|
||||
detailsFramework:ApplyStandardBackdrop(breakdownSideMenu)
|
||||
breakdownSideMenu.RightEdge:Hide()
|
||||
|
||||
pluginsFrame:SetPoint("topleft", breakdownSideMenu, "topleft", 0, 0)
|
||||
pluginsFrame:SetPoint("bottomright", breakdownSideMenu, "topright", 0, player_scroll_y + 26)
|
||||
|
||||
--pluginsFrame:SetSize(player_scroll_size[1], player_scroll_y + 26)
|
||||
|
||||
detailsFramework:ApplyStandardBackdrop(pluginsFrame)
|
||||
|
||||
local refreshPluginButtons = function()
|
||||
for i = 1, #breakdownWindowFrame.RegisteredPluginButtons do
|
||||
---@type button
|
||||
local pluginButton = breakdownWindowFrame.RegisteredPluginButtons[i]
|
||||
pluginButton:Show()
|
||||
pluginButton:ClearAllPoints()
|
||||
|
||||
if (i == 1) then
|
||||
pluginButton:SetPoint("topleft", pluginsFrame, "topleft", 2, -2)
|
||||
else
|
||||
pluginButton:SetPoint("topleft", breakdownWindowFrame.RegisteredPluginButtons[i - 1], "bottomleft", 0, -2)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
refreshPluginButtons()
|
||||
|
||||
|
||||
local refreshScrollFunc = function(self, data, offset, totalLines)
|
||||
--update the scroll
|
||||
local topResult = data[1]
|
||||
if (topResult) then
|
||||
topResult = topResult.total
|
||||
end
|
||||
|
||||
---@type combat
|
||||
local combatObject = Details:GetCombatFromBreakdownWindow()
|
||||
local encounterId = combatObject:GetEncounterCleuID()
|
||||
local difficultyId = combatObject:GetDifficulty()
|
||||
|
||||
for i = 1, totalLines do --~refresh
|
||||
local index = i + offset
|
||||
local playerObject = data[index]
|
||||
if (playerObject) then
|
||||
local line = self:GetLine(i)
|
||||
line.playerObject = playerObject
|
||||
line.combatObject = combatObject
|
||||
line.index = index
|
||||
line:UpdateLine(topResult, encounterId, difficultyId)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local lineOnClick = function(self)
|
||||
if (self.playerObject ~= Details:GetActorObjectFromBreakdownWindow() or breakdownWindowFrame.shownPluginObject) then
|
||||
Details:OpenBreakdownWindow(Details:GetActiveWindowFromBreakdownWindow(), self.playerObject)
|
||||
breakdownWindowFrame.playerScrollBox:Refresh()
|
||||
end
|
||||
end
|
||||
|
||||
local lineOnEnter = function(self)
|
||||
self:SetBackdropColor(unpack(scrollbox_line_backdrop_color_highlight))
|
||||
self.specIcon:SetBlendMode("ADD")
|
||||
self.roleIcon:SetBlendMode("ADD")
|
||||
end
|
||||
|
||||
local lineOnLeave = function(self)
|
||||
if (self.isSelected) then
|
||||
self:SetBackdropColor(unpack(scrollbox_line_backdrop_color_selected))
|
||||
else
|
||||
self:SetBackdropColor(unpack(scrollbox_line_backdrop_color))
|
||||
end
|
||||
self.specIcon:SetBlendMode("BLEND")
|
||||
self.roleIcon:SetBlendMode("BLEND")
|
||||
end
|
||||
|
||||
local updatePlayerLine = function(self, topResult, encounterId, difficultyId) --~update
|
||||
local playerSelected = Details:GetActorObjectFromBreakdownWindow()
|
||||
if (playerSelected and playerSelected == self.playerObject) then
|
||||
self:SetBackdropColor(unpack(scrollbox_line_backdrop_color_selected))
|
||||
self.isSelected = true
|
||||
else
|
||||
self:SetBackdropColor(unpack(scrollbox_line_backdrop_color))
|
||||
self.isSelected = nil
|
||||
end
|
||||
|
||||
local specRole
|
||||
|
||||
--adjust the player icon
|
||||
if (self.playerObject.spellicon) then
|
||||
self.specIcon:SetTexture(self.playerObject.spellicon)
|
||||
self.specIcon:SetTexCoord(.1, .9, .1, .9)
|
||||
else
|
||||
local specIcon, L, R, T, B = Details:GetSpecIcon(self.playerObject.spec, false)
|
||||
|
||||
if (specIcon) then
|
||||
self.specIcon:SetTexture(specIcon)
|
||||
self.specIcon:SetTexCoord(L, R, T, B)
|
||||
|
||||
if (DetailsFramework.IsTimewalkWoW()) then
|
||||
specRole = "NONE"
|
||||
else
|
||||
---@type number
|
||||
local spec = self.playerObject.spec
|
||||
if (spec) then
|
||||
specRole = select(5, GetSpecializationInfoByID(self.playerObject.spec))
|
||||
end
|
||||
end
|
||||
else
|
||||
self.specIcon:SetTexture("")
|
||||
end
|
||||
end
|
||||
|
||||
--adjust the role icon
|
||||
if (specRole) then
|
||||
local roleIcon, L, R, T, B = Details:GetRoleIcon(specRole)
|
||||
if (roleIcon) then
|
||||
self.roleIcon:SetTexture(roleIcon)
|
||||
self.roleIcon:SetTexCoord(L, R, T, B)
|
||||
else
|
||||
self.roleIcon:SetTexture("")
|
||||
end
|
||||
else
|
||||
self.roleIcon:SetTexture("")
|
||||
end
|
||||
|
||||
local playerGear = openRaidLib and openRaidLib.GetUnitGear(self.playerObject.nome)
|
||||
|
||||
--do not show the role icon
|
||||
self.roleIcon:SetTexture("") --not in use
|
||||
|
||||
--set the player name
|
||||
self.playerName:SetText(Details:GetOnlyName(self.playerObject.nome))
|
||||
self.rankText:SetText(self.index) --not in use
|
||||
|
||||
--set the player class name
|
||||
--self.className:SetText(string.lower(_G.UnitClass(self.playerObject.nome) or self.playerObject:Class())) --not in use
|
||||
|
||||
--item level
|
||||
self.itemLevelText:SetText(self.playerObject.ilvl or (playerGear and playerGear.ilevel) or "0")
|
||||
|
||||
local actorSpecId = self.playerObject.spec
|
||||
local actorTotal = self.playerObject.total
|
||||
local combatObject = self.combatObject
|
||||
|
||||
--warcraftlogs percentile
|
||||
if (self.playerObject.tipo == DETAILS_ATTRIBUTE_DAMAGE) then
|
||||
local actorDPS = self.playerObject.total / combatObject:GetCombatTime()
|
||||
|
||||
local parsePercent = Details222.WarcraftLogs.GetDamageParsePercent(encounterId, difficultyId, actorSpecId, actorDPS)
|
||||
if (parsePercent) then
|
||||
parsePercent = math.floor(parsePercent)
|
||||
local colorName = Details222.WarcraftLogs.GetParseColor(parsePercent)
|
||||
self.percentileText:SetTextColor(detailsFramework:ParseColors(colorName))
|
||||
self.percentileText:SetText(math.floor(parsePercent))
|
||||
self.percentileText.alpha = 1
|
||||
else
|
||||
parsePercent = Details222.ParsePercent.GetPercent(DETAILS_ATTRIBUTE_DAMAGE, difficultyId, encounterId, actorSpecId, actorDPS)
|
||||
if (parsePercent) then
|
||||
parsePercent = math.floor(parsePercent)
|
||||
local colorName = Details222.WarcraftLogs.GetParseColor(parsePercent)
|
||||
self.percentileText:SetTextColor(detailsFramework:ParseColors(colorName))
|
||||
self.percentileText:SetText(math.floor(parsePercent))
|
||||
self.percentileText.alpha = 1
|
||||
else
|
||||
self.percentileText:SetText("#.def")
|
||||
self.percentileText:SetAlpha(0.25)
|
||||
end
|
||||
end
|
||||
else
|
||||
self.percentileText:SetText("#.def")
|
||||
self.percentileText:SetAlpha(0.25)
|
||||
end
|
||||
|
||||
--set the statusbar
|
||||
local r, g, b = self.playerObject:GetClassColor()
|
||||
self.totalStatusBar:SetStatusBarColor(r, g, b, 1)
|
||||
self.totalStatusBar:SetMinMaxValues(0, topResult)
|
||||
self.totalStatusBar:SetValue(actorTotal)
|
||||
end
|
||||
|
||||
--get a Details! window
|
||||
local lowerInstanceId = Details:GetLowerInstanceNumber()
|
||||
local fontFile
|
||||
local fontSize
|
||||
local fontOutline
|
||||
|
||||
--header setup
|
||||
local headerTable = {
|
||||
@@ -29,385 +230,235 @@
|
||||
padding = 2,
|
||||
}
|
||||
|
||||
function breakdownWindowPlayerList.CreatePlayerListFrame()
|
||||
local f = _G.DetailsBreakdownWindow
|
||||
if (lowerInstanceId) then
|
||||
local instance = Details:GetInstance(lowerInstanceId)
|
||||
if (instance) then
|
||||
fontFile = instance.row_info.font_face
|
||||
fontSize = instance.row_info.font_size
|
||||
fontOutline = instance.row_info.textL_outline
|
||||
end
|
||||
end
|
||||
|
||||
local refreshScrollFunc = function(self, data, offset, totalLines)
|
||||
--update the scroll
|
||||
local topResult = data[1]
|
||||
if (topResult) then
|
||||
topResult = topResult.total
|
||||
end
|
||||
local createPlayerLine = function(self, index)
|
||||
--create a new line
|
||||
local line = CreateFrame("button", "$parentLine" .. index, self, "BackdropTemplate")
|
||||
detailsFramework:Mixin(line, detailsFramework.HeaderFunctions)
|
||||
|
||||
---@type combat
|
||||
local combatObject = Details:GetCombatFromBreakdownWindow()
|
||||
local encounterId = combatObject:GetEncounterCleuID()
|
||||
local difficultyId = combatObject:GetDifficulty()
|
||||
local upFrame = CreateFrame("frame", nil, line)
|
||||
upFrame:SetFrameLevel(line:GetFrameLevel()+2)
|
||||
upFrame:SetAllPoints()
|
||||
|
||||
for i = 1, totalLines do --~refresh
|
||||
local index = i + offset
|
||||
local playerObject = data[index]
|
||||
if (playerObject) then
|
||||
local line = self:GetLine(i)
|
||||
line.playerObject = playerObject
|
||||
line.combatObject = combatObject
|
||||
line.index = index
|
||||
line:UpdateLine(topResult, encounterId, difficultyId)
|
||||
--set its parameters
|
||||
line:SetPoint("topleft", self, "topleft", 1, -((index) * (player_line_height+1)) - 1)
|
||||
line:SetSize(scrollbox_size[1]-2, player_line_height)
|
||||
--line:SetSize(scrollbox_size[1]-19, player_line_height)
|
||||
line:RegisterForClicks("LeftButtonDown", "RightButtonDown")
|
||||
|
||||
line:SetScript("OnEnter", lineOnEnter)
|
||||
line:SetScript("OnLeave", lineOnLeave)
|
||||
line:SetScript("OnClick", lineOnClick)
|
||||
|
||||
detailsFramework:ApplyStandardBackdrop(line)
|
||||
|
||||
local specIcon = upFrame:CreateTexture("$parentSpecIcon", "artwork")
|
||||
specIcon:SetSize(headerTable[1].width - 1, headerTable[1].width - 1)
|
||||
specIcon:SetAlpha(0.71)
|
||||
|
||||
local roleIcon = upFrame:CreateTexture("$parentRoleIcon", "overlay")
|
||||
roleIcon:SetSize((player_line_height-2) / 2, (player_line_height-2) / 2)
|
||||
roleIcon:SetAlpha(0.71)
|
||||
|
||||
local playerName = detailsFramework:CreateLabel(upFrame, "", 11, "white", "GameFontNormal")
|
||||
if (fontFile) then
|
||||
playerName.fontface = fontFile
|
||||
end
|
||||
if (fontSize) then
|
||||
playerName.fontsize = fontSize
|
||||
end
|
||||
if (fontOutline) then
|
||||
playerName.outline = fontOutline
|
||||
end
|
||||
|
||||
--~create
|
||||
playerName.textcolor = {1, 1, 1, .9}
|
||||
|
||||
local className = detailsFramework:CreateLabel(upFrame, "", "GameFontNormal")
|
||||
className.textcolor = {.95, .8, .2, 0}
|
||||
className.textsize = 9
|
||||
|
||||
local itemLevelText = detailsFramework:CreateLabel(upFrame, "", "GameFontNormal")
|
||||
itemLevelText.textcolor = {1, 1, 1, .7}
|
||||
itemLevelText.textsize = 11
|
||||
|
||||
local percentileText = detailsFramework:CreateLabel(upFrame, "", "GameFontNormal")
|
||||
percentileText.textcolor = {1, 1, 1, .7}
|
||||
percentileText.textsize = 11
|
||||
|
||||
local rankText = detailsFramework:CreateLabel(upFrame, "", "GameFontNormal")
|
||||
rankText.textcolor = {.3, .3, .3, .7}
|
||||
rankText.textsize = fontSize
|
||||
|
||||
local totalStatusBar = CreateFrame("statusbar", nil, line)
|
||||
totalStatusBar:SetSize(scrollbox_size[1]-player_line_height, 4)
|
||||
totalStatusBar:SetMinMaxValues(0, 100)
|
||||
totalStatusBar:SetStatusBarTexture([[Interface\AddOns\Details\images\bar_skyline]])
|
||||
totalStatusBar:SetFrameLevel(line:GetFrameLevel()+1)
|
||||
totalStatusBar:SetAlpha(0.5)
|
||||
|
||||
--setup anchors
|
||||
--specIcon:SetPoint("topleft", line, "topleft", 0, 0)
|
||||
--roleIcon:SetPoint("topleft", specIcon, "topright", 2, 0)
|
||||
--playerName:SetPoint("topleft", specIcon, "topright", 2, -3)
|
||||
--className:SetPoint("topleft", roleIcon, "bottomleft", 0, -2)
|
||||
--rankText:SetPoint("right", line, "right", -2, 0)
|
||||
totalStatusBar:SetPoint("bottomleft", specIcon, "bottomright", 0, 0)
|
||||
|
||||
line.specIcon = specIcon
|
||||
line.roleIcon = roleIcon
|
||||
line.playerName = playerName
|
||||
line.className = className
|
||||
line.rankText = rankText
|
||||
line.totalStatusBar = totalStatusBar
|
||||
line.itemLevelText = itemLevelText
|
||||
line.percentileText = percentileText
|
||||
|
||||
line:AddFrameToHeaderAlignment(specIcon)
|
||||
line:AddFrameToHeaderAlignment(playerName)
|
||||
line:AddFrameToHeaderAlignment(itemLevelText)
|
||||
line:AddFrameToHeaderAlignment(percentileText)
|
||||
|
||||
line:AlignWithHeader(breakdownWindowFrame.Header, "left")
|
||||
|
||||
line.UpdateLine = updatePlayerLine
|
||||
|
||||
return line
|
||||
end
|
||||
|
||||
---@type width
|
||||
local width = player_scroll_size[1] + 22
|
||||
---@type height
|
||||
local height = player_scroll_size[2]
|
||||
|
||||
local playerScroll = detailsFramework:CreateScrollBox(breakdownSideMenu, "DetailsBreakdownWindowPlayerScrollBox", refreshScrollFunc, {}, width, height, scrollbox_lines, player_line_height)
|
||||
detailsFramework:ReskinSlider(playerScroll)
|
||||
playerScroll.ScrollBar:ClearAllPoints()
|
||||
playerScroll.ScrollBar:SetPoint("topright", playerScroll, "topright", -2, -37)
|
||||
playerScroll.ScrollBar:SetPoint("bottomright", playerScroll, "bottomright", -2, 17)
|
||||
playerScroll.ScrollBar:Hide()
|
||||
playerScroll:SetPoint("topleft", breakdownSideMenu, "topleft", 0, player_scroll_y)
|
||||
playerScroll:SetPoint("bottomright", breakdownSideMenu, "bottomright", -1, 0)
|
||||
playerScroll:SetBackdrop({})
|
||||
playerScroll:SetBackdropColor(0, 0, 0, 0)
|
||||
playerScroll:SetBackdropBorderColor(0, 0, 0, 0)
|
||||
breakdownWindowFrame.playerScrollBox = playerScroll
|
||||
|
||||
--need to be created before
|
||||
breakdownWindowFrame.Header = DetailsFramework:CreateHeader(playerScroll, headerTable, headerOptions)
|
||||
breakdownWindowFrame.Header:SetPoint("topleft", playerScroll, "topleft", 0, -1)
|
||||
breakdownWindowFrame.Header:SetPoint("topright", playerScroll, "topright", 0, -1)
|
||||
breakdownWindowFrame.Header:SetAlpha(0.823)
|
||||
|
||||
detailsFramework:ApplyStandardBackdrop(breakdownWindowFrame.Header)
|
||||
breakdownWindowFrame.Header.__background:SetColorTexture(.60, .60, .60)
|
||||
|
||||
local playerSelectionLabel = detailsFramework:CreateLabel(playerScroll, "Click to select a player", 14)
|
||||
playerSelectionLabel:SetPoint("bottom", breakdownWindowFrame.Header, "top", 0, 1)
|
||||
|
||||
--create the scrollbox lines
|
||||
for i = 1, scrollbox_lines do
|
||||
playerScroll:CreateLine(createPlayerLine)
|
||||
end
|
||||
|
||||
local classIds = {
|
||||
WARRIOR = 1,
|
||||
PALADIN = 2,
|
||||
HUNTER = 3,
|
||||
ROGUE = 4,
|
||||
PRIEST = 5,
|
||||
DEATHKNIGHT = 6,
|
||||
SHAMAN = 7,
|
||||
MAGE = 8,
|
||||
WARLOCK = 9,
|
||||
MONK = 10,
|
||||
DRUID = 11,
|
||||
DEMONHUNTER = 12,
|
||||
EVOKER = 13,
|
||||
}
|
||||
|
||||
---get the player list from the segment and build a table compatible with the scroll box
|
||||
---@return actor[]
|
||||
function breakdownWindowPlayerList.BuildPlayerList()
|
||||
---@type combat
|
||||
local combatObject = Details:GetCombatFromBreakdownWindow()
|
||||
---@type {key1: actor, key2: number, key3: number}[]
|
||||
local playerTable = {}
|
||||
|
||||
if (combatObject) then
|
||||
local displayType = Details:GetDisplayTypeFromBreakdownWindow()
|
||||
local containerType = displayType == 1 and DETAILS_ATTRIBUTE_DAMAGE or DETAILS_ATTRIBUTE_HEAL
|
||||
---@type actorcontainer
|
||||
local actorContainer = combatObject:GetContainer(containerType)
|
||||
|
||||
for index, actorObject in actorContainer:ListActors() do
|
||||
---@cast actorObject actor
|
||||
if (actorObject:IsPlayer() and actorObject:IsGroupPlayer()) then
|
||||
local unitClassID = classIds[actorObject:Class()] or 13
|
||||
local unitName = actorObject:Name()
|
||||
local playerPosition = (((unitClassID or 0) + 128) ^ 4) + tonumber(string.byte(unitName, 1) .. "" .. string.byte(unitName, 2))
|
||||
|
||||
---@type {key1: actor, key2: number, key3: number}
|
||||
local data = {actorObject, playerPosition, actorObject.total}
|
||||
tinsert(playerTable, data)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local lineOnClick = function(self)
|
||||
if (self.playerObject ~= Details:GetActorObjectFromBreakdownWindow()) then
|
||||
Details:OpenBreakdownWindow(Details:GetActiveWindowFromBreakdownWindow(), self.playerObject)
|
||||
f.playerScrollBox:Refresh()
|
||||
end
|
||||
table.sort(playerTable, detailsFramework.SortOrder3)
|
||||
|
||||
---@type actor[]
|
||||
local resultTable = {}
|
||||
for i = 1, #playerTable do
|
||||
---@type actor
|
||||
local actor = playerTable[i][1]
|
||||
resultTable[#resultTable+1] = actor
|
||||
end
|
||||
|
||||
local lineOnEnter = function(self)
|
||||
self:SetBackdropColor(unpack(scrollbox_line_backdrop_color_highlight))
|
||||
self.specIcon:SetBlendMode("ADD")
|
||||
self.roleIcon:SetBlendMode("ADD")
|
||||
return resultTable
|
||||
end
|
||||
|
||||
local updatePlayerList = function()
|
||||
---@type actor[]
|
||||
local playerList = breakdownWindowPlayerList.BuildPlayerList()
|
||||
playerScroll:SetData(playerList)
|
||||
playerScroll:Refresh()
|
||||
playerScroll:Show()
|
||||
end
|
||||
|
||||
function Details:UpdateBreakdownPlayerList()
|
||||
--run the update on the next tick
|
||||
C_Timer.After(0, updatePlayerList)
|
||||
end
|
||||
|
||||
breakdownWindowFrame:HookScript("OnShow", function()
|
||||
Details:UpdateBreakdownPlayerList()
|
||||
end)
|
||||
|
||||
breakdownWindowFrame:HookScript("OnHide", function()
|
||||
for lineIndex, line in ipairs(breakdownWindowFrame.playerScrollBox:GetLines()) do
|
||||
line.playerObject = nil
|
||||
line.combatObject = nil
|
||||
end
|
||||
end)
|
||||
|
||||
local lineOnLeave = function(self)
|
||||
if (self.isSelected) then
|
||||
self:SetBackdropColor(unpack(scrollbox_line_backdrop_color_selected))
|
||||
else
|
||||
self:SetBackdropColor(unpack(scrollbox_line_backdrop_color))
|
||||
end
|
||||
self.specIcon:SetBlendMode("BLEND")
|
||||
self.roleIcon:SetBlendMode("BLEND")
|
||||
end
|
||||
local gradientStartColor = Details222.ColorScheme.GetColorFor("gradient-background")
|
||||
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
|
||||
|
||||
local updatePlayerLine = function(self, topResult, encounterId, difficultyId) --~update
|
||||
local playerSelected = Details:GetActorObjectFromBreakdownWindow()
|
||||
if (playerSelected and playerSelected == self.playerObject) then
|
||||
self:SetBackdropColor(unpack(scrollbox_line_backdrop_color_selected))
|
||||
self.isSelected = true
|
||||
else
|
||||
self:SetBackdropColor(unpack(scrollbox_line_backdrop_color))
|
||||
self.isSelected = nil
|
||||
end
|
||||
|
||||
local specRole
|
||||
|
||||
--adjust the player icon
|
||||
if (self.playerObject.spellicon) then
|
||||
self.specIcon:SetTexture(self.playerObject.spellicon)
|
||||
self.specIcon:SetTexCoord(.1, .9, .1, .9)
|
||||
else
|
||||
local specIcon, L, R, T, B = Details:GetSpecIcon(self.playerObject.spec, false)
|
||||
|
||||
if (specIcon) then
|
||||
self.specIcon:SetTexture(specIcon)
|
||||
self.specIcon:SetTexCoord(L, R, T, B)
|
||||
|
||||
if (DetailsFramework.IsTimewalkWoW()) then
|
||||
specRole = "NONE"
|
||||
else
|
||||
---@type number
|
||||
local spec = self.playerObject.spec
|
||||
if (spec) then
|
||||
specRole = select(5, _G.GetSpecializationInfoByID(self.playerObject.spec))
|
||||
end
|
||||
end
|
||||
else
|
||||
self.specIcon:SetTexture("")
|
||||
end
|
||||
end
|
||||
|
||||
--adjust the role icon
|
||||
if (specRole) then
|
||||
local roleIcon, L, R, T, B = Details:GetRoleIcon(specRole)
|
||||
if (roleIcon) then
|
||||
self.roleIcon:SetTexture(roleIcon)
|
||||
self.roleIcon:SetTexCoord(L, R, T, B)
|
||||
else
|
||||
self.roleIcon:SetTexture("")
|
||||
end
|
||||
else
|
||||
self.roleIcon:SetTexture("")
|
||||
end
|
||||
|
||||
local playerGear = openRaidLib and openRaidLib.GetUnitGear(self.playerObject.nome)
|
||||
|
||||
--do not show the role icon
|
||||
self.roleIcon:SetTexture("") --not in use
|
||||
|
||||
--set the player name
|
||||
self.playerName:SetText(Details:GetOnlyName(self.playerObject.nome))
|
||||
self.rankText:SetText(self.index) --not in use
|
||||
|
||||
--set the player class name
|
||||
--self.className:SetText(string.lower(_G.UnitClass(self.playerObject.nome) or self.playerObject:Class())) --not in use
|
||||
|
||||
--item level
|
||||
self.itemLevelText:SetText(self.playerObject.ilvl or (playerGear and playerGear.ilevel) or "0")
|
||||
|
||||
local actorSpecId = self.playerObject.spec
|
||||
local actorTotal = self.playerObject.total
|
||||
local combatObject = self.combatObject
|
||||
|
||||
--warcraftlogs percentile
|
||||
if (self.playerObject.tipo == DETAILS_ATTRIBUTE_DAMAGE) then
|
||||
local actorDPS = self.playerObject.total / combatObject:GetCombatTime()
|
||||
|
||||
local parsePercent = Details222.WarcraftLogs.GetDamageParsePercent(encounterId, difficultyId, actorSpecId, actorDPS)
|
||||
if (parsePercent) then
|
||||
parsePercent = math.floor(parsePercent)
|
||||
local colorName = Details222.WarcraftLogs.GetParseColor(parsePercent)
|
||||
self.percentileText:SetTextColor(detailsFramework:ParseColors(colorName))
|
||||
self.percentileText:SetText(math.floor(parsePercent))
|
||||
self.percentileText.alpha = 1
|
||||
else
|
||||
parsePercent = Details222.ParsePercent.GetPercent(DETAILS_ATTRIBUTE_DAMAGE, difficultyId, encounterId, actorSpecId, actorDPS)
|
||||
if (parsePercent) then
|
||||
parsePercent = math.floor(parsePercent)
|
||||
local colorName = Details222.WarcraftLogs.GetParseColor(parsePercent)
|
||||
self.percentileText:SetTextColor(detailsFramework:ParseColors(colorName))
|
||||
self.percentileText:SetText(math.floor(parsePercent))
|
||||
self.percentileText.alpha = 1
|
||||
else
|
||||
self.percentileText:SetText("#.def")
|
||||
self.percentileText:SetAlpha(0.25)
|
||||
end
|
||||
end
|
||||
else
|
||||
self.percentileText:SetText("#.def")
|
||||
self.percentileText:SetAlpha(0.25)
|
||||
end
|
||||
|
||||
--set the statusbar
|
||||
local r, g, b = self.playerObject:GetClassColor()
|
||||
self.totalStatusBar:SetStatusBarColor(r, g, b, 1)
|
||||
self.totalStatusBar:SetMinMaxValues(0, topResult)
|
||||
self.totalStatusBar:SetValue(actorTotal)
|
||||
end
|
||||
|
||||
--get a Details! window
|
||||
local lowerInstanceId = Details:GetLowerInstanceNumber()
|
||||
local fontFile
|
||||
local fontSize
|
||||
local fontOutline
|
||||
|
||||
if (lowerInstanceId) then
|
||||
local instance = Details:GetInstance(lowerInstanceId)
|
||||
if (instance) then
|
||||
fontFile = instance.row_info.font_face
|
||||
fontSize = instance.row_info.font_size
|
||||
fontOutline = instance.row_info.textL_outline
|
||||
end
|
||||
end
|
||||
|
||||
local createPlayerLine = function(self, index)
|
||||
--create a new line
|
||||
local line = _G.CreateFrame("button", "$parentLine" .. index, self, "BackdropTemplate")
|
||||
detailsFramework:Mixin(line, detailsFramework.HeaderFunctions)
|
||||
|
||||
local upFrame = CreateFrame("frame", nil, line)
|
||||
upFrame:SetFrameLevel(line:GetFrameLevel()+2)
|
||||
upFrame:SetAllPoints()
|
||||
|
||||
--set its parameters
|
||||
line:SetPoint("topleft", self, "topleft", 1, -((index) * (player_line_height+1)) - 1)
|
||||
line:SetSize(scrollbox_size[1], player_line_height)
|
||||
--line:SetSize(scrollbox_size[1]-19, player_line_height)
|
||||
line:RegisterForClicks("LeftButtonDown", "RightButtonDown")
|
||||
|
||||
line:SetScript("OnEnter", lineOnEnter)
|
||||
line:SetScript("OnLeave", lineOnLeave)
|
||||
line:SetScript("OnClick", lineOnClick)
|
||||
|
||||
detailsFramework:ApplyStandardBackdrop(line)
|
||||
|
||||
local specIcon = upFrame:CreateTexture("$parentSpecIcon", "artwork")
|
||||
specIcon:SetSize(headerTable[1].width - 1, headerTable[1].width - 1)
|
||||
specIcon:SetAlpha(0.71)
|
||||
|
||||
local roleIcon = upFrame:CreateTexture("$parentRoleIcon", "overlay")
|
||||
roleIcon:SetSize((player_line_height-2) / 2, (player_line_height-2) / 2)
|
||||
roleIcon:SetAlpha(0.71)
|
||||
|
||||
local playerName = detailsFramework:CreateLabel(upFrame, "", 11, "white", "GameFontNormal")
|
||||
if (fontFile) then
|
||||
playerName.fontface = fontFile
|
||||
end
|
||||
if (fontSize) then
|
||||
playerName.fontsize = fontSize
|
||||
end
|
||||
if (fontOutline) then
|
||||
playerName.outline = fontOutline
|
||||
end
|
||||
|
||||
--~create
|
||||
playerName.textcolor = {1, 1, 1, .9}
|
||||
|
||||
local className = detailsFramework:CreateLabel(upFrame, "", "GameFontNormal")
|
||||
className.textcolor = {.95, .8, .2, 0}
|
||||
className.textsize = 9
|
||||
|
||||
local itemLevelText = detailsFramework:CreateLabel(upFrame, "", "GameFontNormal")
|
||||
itemLevelText.textcolor = {1, 1, 1, .7}
|
||||
itemLevelText.textsize = 11
|
||||
|
||||
local percentileText = detailsFramework:CreateLabel(upFrame, "", "GameFontNormal")
|
||||
percentileText.textcolor = {1, 1, 1, .7}
|
||||
percentileText.textsize = 11
|
||||
|
||||
local rankText = detailsFramework:CreateLabel(upFrame, "", "GameFontNormal")
|
||||
rankText.textcolor = {.3, .3, .3, .7}
|
||||
rankText.textsize = fontSize
|
||||
|
||||
local totalStatusBar = CreateFrame("statusbar", nil, line)
|
||||
totalStatusBar:SetSize(scrollbox_size[1]-player_line_height, 4)
|
||||
totalStatusBar:SetMinMaxValues(0, 100)
|
||||
totalStatusBar:SetStatusBarTexture([[Interface\AddOns\Details\images\bar_skyline]])
|
||||
totalStatusBar:SetFrameLevel(line:GetFrameLevel()+1)
|
||||
totalStatusBar:SetAlpha(0.5)
|
||||
|
||||
--setup anchors
|
||||
--specIcon:SetPoint("topleft", line, "topleft", 0, 0)
|
||||
--roleIcon:SetPoint("topleft", specIcon, "topright", 2, 0)
|
||||
--playerName:SetPoint("topleft", specIcon, "topright", 2, -3)
|
||||
--className:SetPoint("topleft", roleIcon, "bottomleft", 0, -2)
|
||||
--rankText:SetPoint("right", line, "right", -2, 0)
|
||||
totalStatusBar:SetPoint("bottomleft", specIcon, "bottomright", 0, 0)
|
||||
|
||||
line.specIcon = specIcon
|
||||
line.roleIcon = roleIcon
|
||||
line.playerName = playerName
|
||||
line.className = className
|
||||
line.rankText = rankText
|
||||
line.totalStatusBar = totalStatusBar
|
||||
line.itemLevelText = itemLevelText
|
||||
line.percentileText = percentileText
|
||||
|
||||
line:AddFrameToHeaderAlignment(specIcon)
|
||||
line:AddFrameToHeaderAlignment(playerName)
|
||||
line:AddFrameToHeaderAlignment(itemLevelText)
|
||||
line:AddFrameToHeaderAlignment(percentileText)
|
||||
|
||||
line:AlignWithHeader(f.Header, "left")
|
||||
|
||||
line.UpdateLine = updatePlayerLine
|
||||
|
||||
return line
|
||||
end
|
||||
|
||||
local playerScroll = detailsFramework:CreateScrollBox(f, "$parentPlayerScrollBox", refreshScrollFunc, {}, player_scroll_size[1] + 22, player_scroll_size[2], scrollbox_lines, player_line_height)
|
||||
detailsFramework:ReskinSlider(playerScroll)
|
||||
playerScroll.ScrollBar:ClearAllPoints()
|
||||
playerScroll.ScrollBar:SetPoint("topright", playerScroll, "topright", -2, -37)
|
||||
playerScroll.ScrollBar:SetPoint("bottomright", playerScroll, "bottomright", -2, 17)
|
||||
playerScroll.ScrollBar:Hide()
|
||||
playerScroll:SetPoint("topright", f, "topleft", -1, 0)
|
||||
playerScroll:SetPoint("bottomright", f, "bottomleft", -1, 0)
|
||||
playerScroll:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
|
||||
playerScroll:SetBackdropColor(0, 0, 0, 0.2)
|
||||
playerScroll:SetBackdropBorderColor(0, 0, 0, 1)
|
||||
f.playerScrollBox = playerScroll
|
||||
|
||||
--need to be created before
|
||||
f.Header = DetailsFramework:CreateHeader(f, headerTable, headerOptions)
|
||||
f.Header:SetPoint("topleft", playerScroll, "topleft", 0, -1)
|
||||
f.Header:SetPoint("topright", playerScroll, "topright", 0, -1)
|
||||
|
||||
detailsFramework:ApplyStandardBackdrop(f.Header)
|
||||
f.Header.__background:SetColorTexture(.60, .60, .60)
|
||||
|
||||
local playerSelectionLabel = detailsFramework:CreateLabel(playerScroll, "Click to select a player", 14)
|
||||
playerSelectionLabel:SetPoint("bottom", playerScroll, "bottom", 0, 7)
|
||||
|
||||
--create the scrollbox lines
|
||||
for i = 1, scrollbox_lines do
|
||||
playerScroll:CreateLine(createPlayerLine)
|
||||
end
|
||||
|
||||
local classIds = {
|
||||
WARRIOR = 1,
|
||||
PALADIN = 2,
|
||||
HUNTER = 3,
|
||||
ROGUE = 4,
|
||||
PRIEST = 5,
|
||||
DEATHKNIGHT = 6,
|
||||
SHAMAN = 7,
|
||||
MAGE = 8,
|
||||
WARLOCK = 9,
|
||||
MONK = 10,
|
||||
DRUID = 11,
|
||||
DEMONHUNTER = 12,
|
||||
EVOKER = 13,
|
||||
}
|
||||
|
||||
--get the player list from the segment and build a table compatible with the scroll box
|
||||
function breakdownWindowPlayerList.BuildPlayerList()
|
||||
---@type combat
|
||||
local combatObject = Details:GetCombatFromBreakdownWindow()
|
||||
local playerTable = {}
|
||||
|
||||
if (combatObject) then
|
||||
local displayType = Details:GetDisplayTypeFromBreakdownWindow()
|
||||
local containerType = displayType == 1 and DETAILS_ATTRIBUTE_DAMAGE or DETAILS_ATTRIBUTE_HEAL
|
||||
---@type actorcontainer
|
||||
local actorContainer = combatObject:GetContainer(containerType)
|
||||
|
||||
for index, actorObject in actorContainer:ListActors() do
|
||||
if (actorObject:IsPlayer() and actorObject:IsGroupPlayer()) then
|
||||
local unitClassID = classIds[actorObject:Class()] or 13
|
||||
local unitName = actorObject:Name()
|
||||
local playerPosition = (((unitClassID or 0) + 128) ^ 4) + tonumber(string.byte(unitName, 1) .. "" .. string.byte(unitName, 2))
|
||||
|
||||
---@type {key1: actor, key2: number, key3: number}
|
||||
local data = {actorObject, playerPosition, actorObject.total}
|
||||
tinsert(playerTable, data)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(playerTable, detailsFramework.SortOrder3)
|
||||
|
||||
local resultTable = {}
|
||||
for i = 1, #playerTable do
|
||||
resultTable[#resultTable+1] = playerTable[i][1]
|
||||
end
|
||||
|
||||
return resultTable
|
||||
end
|
||||
|
||||
local updatePlayerList = function()
|
||||
local playerList = breakdownWindowPlayerList.BuildPlayerList()
|
||||
playerScroll:SetData(playerList)
|
||||
playerScroll:Refresh()
|
||||
playerScroll:Show()
|
||||
end
|
||||
|
||||
function Details:UpdateBreakdownPlayerList()
|
||||
--run the update on the next tick
|
||||
C_Timer.After(0, updatePlayerList)
|
||||
--DF.Schedules.RunNextTick(updatePlayerList)
|
||||
end
|
||||
|
||||
f:HookScript("OnShow", function()
|
||||
Details:UpdateBreakdownPlayerList()
|
||||
end)
|
||||
|
||||
f:HookScript("OnHide", function()
|
||||
for lineIndex, line in ipairs(f.playerScrollBox:GetLines()) do
|
||||
line.playerObject = nil
|
||||
line.combatObject = nil
|
||||
end
|
||||
end)
|
||||
|
||||
local gradientStartColor = Details222.ColorScheme.GetColorFor("gradient-background")
|
||||
local gradientBelow = DetailsFramework:CreateTexture(f.playerScrollBox,
|
||||
{gradient = "vertical", fromColor = gradientStartColor, toColor = "transparent"}, 1, 90, "artwork", {0, 1, 0, 1})
|
||||
gradientBelow:SetPoint("bottoms", 1, 1)
|
||||
end
|
||||
|
||||
function Details.PlayerBreakdown.CreatePlayerListFrame()
|
||||
if (not Details.PlayerBreakdown.playerListFrameCreated) then
|
||||
breakdownWindowPlayerList.CreatePlayerListFrame()
|
||||
Details.PlayerBreakdown.playerListFrameCreated = true
|
||||
end
|
||||
end
|
||||
function Details.PlayerBreakdown.CreatePlayerListFrame()
|
||||
if (not Details.PlayerBreakdown.playerListFrameCreated) then
|
||||
breakdownWindowPlayerList.CreatePlayerListFrame()
|
||||
Details.PlayerBreakdown.playerListFrameCreated = true
|
||||
end
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
@@ -44,6 +44,7 @@ function Details.options.InitializeOptionsWindow(instance)
|
||||
f.real_name = "DETAILS_OPTIONS"
|
||||
f.__icon = [[Interface\Scenarios\ScenarioIcon-Interact]]
|
||||
_G.DetailsPluginContainerWindow.EmbedPlugin(f, f, true)
|
||||
|
||||
f.sectionFramesContainer = {}
|
||||
|
||||
DF:ApplyStandardBackdrop(f)
|
||||
|
||||
@@ -37,13 +37,11 @@ local LDBIcon = LDB and _G.LibStub("LibDBIcon-1.0", true)
|
||||
local addonName, Details222 = ...
|
||||
local _ = nil
|
||||
local unpack = _G.unpack
|
||||
local tinsert = _G.tinsert
|
||||
local tinsert = table.insert
|
||||
|
||||
local startX = 200
|
||||
local startY = -40
|
||||
local heightSize = 540
|
||||
local optionsWidth, optionsHeight = 1100, 650
|
||||
local mainHeightSize = 800
|
||||
local presetVersion = 3
|
||||
|
||||
--templates
|
||||
@@ -56,7 +54,6 @@ local options_button_template = DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLAT
|
||||
local subSectionTitleTextTemplate = DF:GetTemplate("font", "ORANGE_FONT_TEMPLATE")
|
||||
|
||||
local font_select_icon, font_select_texcoord = [[Interface\AddOns\Details\images\icons]], {472/512, 513/512, 186/512, 230/512}
|
||||
local texture_select_icon, texture_select_texcoord = [[Interface\AddOns\Details\images\icons]], {472/512, 513/512, 186/512, 230/512}
|
||||
|
||||
--store the current instance being edited
|
||||
local currentInstance
|
||||
|
||||
Reference in New Issue
Block a user