Bug fixes, some breakdown settings remove due to their values be auto calculated now

This commit is contained in:
Tercio Jose
2023-05-11 22:34:11 -03:00
parent bb62a4c70c
commit 90c26332ff
8 changed files with 250 additions and 298 deletions
+116
View File
@@ -0,0 +1,116 @@
local detailsFramework = _G ["DetailsFramework"]
if (not detailsFramework) then
return
end
local IS_WOW_PROJECT_MAINLINE = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE
local IS_WOW_PROJECT_NOT_MAINLINE = WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE
local IS_WOW_PROJECT_CLASSIC_ERA = WOW_PROJECT_ID == WOW_PROJECT_CLASSIC
detailsFramework.CastInfo = detailsFramework.CastInfo or {}
--NOTE: This NEEDs a chance to run, as Plater is depending on this working and LibCC is not bundled neccessarily in other addons.
-- for classic era use LibClassicCasterino:
--in vanilla wow, other addons might load the framework before an addon with libCasterino loads
--check here if libCasterino is loaded, if is, check if the framework is already using libCasterino, if not, make it use
function detailsFramework:LoadLCC(LibCC)
local fCast = CreateFrame("frame")
local getCastBar = function(unitId)
local plateFrame = C_NamePlate.GetNamePlateForUnit (unitId)
if (not plateFrame) then
return
end
local castBar = plateFrame.unitFrame and plateFrame.unitFrame.castBar
if (not castBar) then
return
end
return castBar
end
local triggerCastEvent = function(castBar, event, unitId, ...)
if (castBar and castBar.OnEvent) then
return castBar.OnEvent (castBar, event, unitId)
end
end
local funcCast = function(event, unitId, ...)
local castBar = getCastBar (unitId)
if (castBar) then
return triggerCastEvent (castBar, event, unitId)
end
end
fCast.UNIT_SPELLCAST_START = function(self, event, unitId, ...)
return triggerCastEvent (getCastBar (unitId), event, unitId)
end
fCast.UNIT_SPELLCAST_STOP = function(self, event, unitId, ...)
return triggerCastEvent (getCastBar (unitId), event, unitId)
end
fCast.UNIT_SPELLCAST_DELAYED = function(self, event, unitId, ...)
return triggerCastEvent (getCastBar (unitId), event, unitId)
end
fCast.UNIT_SPELLCAST_FAILED = function(self, event, unitId, ...)
return triggerCastEvent (getCastBar (unitId), event, unitId)
end
fCast.UNIT_SPELLCAST_INTERRUPTED = function(self, event, unitId, ...)
return triggerCastEvent (getCastBar (unitId), event, unitId)
end
fCast.UNIT_SPELLCAST_CHANNEL_START = function(self, event, unitId, ...)
return triggerCastEvent (getCastBar (unitId), event, unitId)
end
fCast.UNIT_SPELLCAST_CHANNEL_UPDATE = function(self, event, unitId, ...)
return triggerCastEvent (getCastBar (unitId), event, unitId)
end
fCast.UNIT_SPELLCAST_CHANNEL_STOP = function(self, event, unitId, ...)
return triggerCastEvent (getCastBar (unitId), event, unitId)
end
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_START", funcCast)
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_DELAYED", funcCast) -- only for player
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_STOP", funcCast)
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_FAILED", funcCast)
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_INTERRUPTED", funcCast)
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_CHANNEL_START", funcCast)
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_CHANNEL_UPDATE", funcCast) -- only for player
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_CHANNEL_STOP", funcCast)
detailsFramework.CastInfo.UnitCastingInfo = function(unit)
return LibCC:UnitCastingInfo (unit)
end
detailsFramework.CastInfo.UnitChannelInfo = function(unit)
return LibCC:UnitChannelInfo (unit)
end
end
if IS_WOW_PROJECT_CLASSIC_ERA then
local LibCC = LibStub("LibClassicCasterino", true)
if (LibCC and not _G.DetailsFrameworkLCCLoaded) then
detailsFramework:LoadLCC(LibCC)
_G.DetailsFrameworkLCCLoaded = true
elseif not LibCC then
detailsFramework.CastInfo.UnitCastingInfo = CastingInfo
detailsFramework.CastInfo.UnitChannelInfo = ChannelInfo
end
else -- end classic era
detailsFramework.CastInfo.UnitCastingInfo = UnitCastingInfo
detailsFramework.CastInfo.UnitChannelInfo = UnitChannelInfo
end
if (not DetailsFrameworkCanLoad) then
return
end
+52 -2
View File
@@ -1,6 +1,6 @@
local dversion = 426
local dversion = 427
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)
@@ -4215,6 +4215,12 @@ function DF:ReskinSlider(slider, heightOffset)
--up button
local offset = 1 --space between the scrollbox and the scrollar
local backgroundColor_Red = 0.1
local backgroundColor_Green = 0.1
local backgroundColor_Blue = 0.1
local backgroundColor_Alpha = 1
local backdrop_Alpha = 0.3
do
local normalTexture = slider.ScrollBar.ScrollUpButton.Normal
normalTexture:SetTexture([[Interface\Buttons\Arrow-Up-Up]])
@@ -4239,6 +4245,21 @@ function DF:ReskinSlider(slider, heightOffset)
disabledTexture:SetPoint("bottomright", slider.ScrollBar.ScrollUpButton, "bottomright", offset, 0)
slider.ScrollBar.ScrollUpButton:SetSize(16, 16)
if (not slider.ScrollBar.ScrollUpButton.BackgroundTexture) then
local backgroundTexture = slider.ScrollBar.ScrollUpButton:CreateTexture(nil, "border")
slider.ScrollBar.ScrollUpButton.BackgroundTexture = backgroundTexture
backgroundTexture:SetColorTexture(backgroundColor_Red, backgroundColor_Green, backgroundColor_Blue)
backgroundTexture:SetAlpha(backgroundColor_Alpha)
backgroundTexture:SetPoint("topleft", slider.ScrollBar.ScrollUpButton, "topleft", 1, 0)
backgroundTexture:SetPoint("bottomright", slider.ScrollBar.ScrollUpButton, "bottomright", -1, 0)
end
DF:Mixin(slider.ScrollBar.ScrollUpButton, BackdropTemplateMixin)
slider.ScrollBar.ScrollUpButton:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
slider.ScrollBar.ScrollUpButton:SetBackdropBorderColor(0, 0, 0, backdrop_Alpha)
end
--down button
@@ -4266,6 +4287,21 @@ function DF:ReskinSlider(slider, heightOffset)
disabledTexture:SetPoint("bottomright", slider.ScrollBar.ScrollDownButton, "bottomright", offset, -4)
slider.ScrollBar.ScrollDownButton:SetSize(16, 16)
if (not slider.ScrollBar.ScrollDownButton.BackgroundTexture) then
local backgroundTexture = slider.ScrollBar.ScrollDownButton:CreateTexture(nil, "border")
slider.ScrollBar.ScrollDownButton.BackgroundTexture = backgroundTexture
backgroundTexture:SetColorTexture(backgroundColor_Red, backgroundColor_Green, backgroundColor_Blue)
backgroundTexture:SetAlpha(backgroundColor_Alpha)
backgroundTexture:SetPoint("topleft", slider.ScrollBar.ScrollDownButton, "topleft", 1, 0)
backgroundTexture:SetPoint("bottomright", slider.ScrollBar.ScrollDownButton, "bottomright", -1, 0)
end
DF:Mixin(slider.ScrollBar.ScrollDownButton, BackdropTemplateMixin)
slider.ScrollBar.ScrollDownButton:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
slider.ScrollBar.ScrollDownButton:SetBackdropBorderColor(0, 0, 0, backdrop_Alpha)
end
--if the parent has a editbox, this is a code editor
@@ -4279,7 +4315,21 @@ function DF:ReskinSlider(slider, heightOffset)
end
slider.ScrollBar.ThumbTexture:SetColorTexture(.5, .5, .5, .3)
slider.ScrollBar.ThumbTexture:SetSize(12, 8)
slider.ScrollBar.ThumbTexture:SetSize(14, 8)
if (not slider.ScrollBar.SliderTexture) then
local alpha = 1
local offset = 1
slider.ScrollBar.SliderTexture = slider.ScrollBar:CreateTexture(nil, "background")
slider.ScrollBar.SliderTexture:SetColorTexture(backgroundColor_Red, backgroundColor_Green, backgroundColor_Blue)
slider.ScrollBar.SliderTexture:SetAlpha(backgroundColor_Alpha)
slider.ScrollBar.SliderTexture:SetPoint("TOPLEFT", slider.ScrollBar, "TOPLEFT", offset, -2)
slider.ScrollBar.SliderTexture:SetPoint("BOTTOMRIGHT", slider.ScrollBar, "BOTTOMRIGHT", -offset, 2)
end
DF:Mixin(slider.ScrollBar, BackdropTemplateMixin)
slider.ScrollBar:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
slider.ScrollBar:SetBackdropBorderColor(0, 0, 0, backdrop_Alpha)
end
end
+1
View File
@@ -21,6 +21,7 @@
<Script file="languages.lua"/>
<Script file="timebar.lua"/>
<Script file="charts.lua"/>
<Script file="externals.lua"/>
<Include file="tutorial_alert.xml"/>
<Include file="split_bar.xml"/>
+9 -99
View File
@@ -18,13 +18,7 @@ local IS_WOW_PROJECT_MAINLINE = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE
local IS_WOW_PROJECT_NOT_MAINLINE = WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE
local IS_WOW_PROJECT_CLASSIC_ERA = WOW_PROJECT_ID == WOW_PROJECT_CLASSIC
local UnitCastingInfo = UnitCastingInfo
local UnitChannelInfo = UnitChannelInfo
if IS_WOW_PROJECT_CLASSIC_ERA then
UnitCastingInfo = CastingInfo
UnitChannelInfo = ChannelInfo
end
local CastInfo = detailsFramework.CastInfo
local PixelUtil = PixelUtil or DFPixelUtil
@@ -7610,7 +7604,7 @@ detailsFramework.CastFrameFunctions = {
if (self.unit) then
if (self.casting) then
local name, text, texture, startTime = UnitCastingInfo (self.unit)
local name, text, texture, startTime = CastInfo.UnitCastingInfo (self.unit)
if (name) then
--[[if not self.spellStartTime then
self:UpdateCastingInfo(self.unit)
@@ -7621,7 +7615,7 @@ detailsFramework.CastFrameFunctions = {
self:RunHooksForWidget("OnShow", self, self.unit)
elseif (self.channeling) then
local name, text, texture, endTime = UnitChannelInfo (self.unit)
local name, text, texture, endTime = CastInfo.UnitChannelInfo (self.unit)
if (name) then
--[[if not self.spellEndTime then
self:UpdateChannelInfo(self.unit)
@@ -7817,8 +7811,8 @@ detailsFramework.CastFrameFunctions = {
end,
PLAYER_ENTERING_WORLD = function(self, unit, arg1)
local isChannel = UnitChannelInfo (unit)
local isRegularCast = UnitCastingInfo (unit)
local isChannel = CastInfo.UnitChannelInfo (unit)
local isRegularCast = CastInfo.UnitCastingInfo (unit)
if (isChannel) then
self.channeling = true
@@ -7842,7 +7836,7 @@ detailsFramework.CastFrameFunctions = {
end,
UpdateCastingInfo = function(self, unit)
local name, text, texture, startTime, endTime, isTradeSkill, castID, notInterruptible, spellID = UnitCastingInfo (unit)
local name, text, texture, startTime, endTime, isTradeSkill, castID, notInterruptible, spellID = CastInfo.UnitCastingInfo (unit)
--is valid?
if (not self:IsValid (unit, name, isTradeSkill, true)) then
@@ -7958,7 +7952,7 @@ detailsFramework.CastFrameFunctions = {
UpdateChannelInfo = function(self, unit, ...)
local unitID, castID, spellID = ...
local name, text, texture, startTime, endTime, isTradeSkill, notInterruptible, spellID, _, numStages = UnitChannelInfo (unit)
local name, text, texture, startTime, endTime, isTradeSkill, notInterruptible, spellID, _, numStages = CastInfo.UnitChannelInfo (unit)
--is valid?
if (not self:IsValid (unit, name, isTradeSkill, true)) then
@@ -8204,7 +8198,7 @@ detailsFramework.CastFrameFunctions = {
end,
UNIT_SPELLCAST_DELAYED = function(self, unit, ...)
local name, text, texture, startTime, endTime, isTradeSkill, castID, notInterruptible = UnitCastingInfo (unit)
local name, text, texture, startTime, endTime, isTradeSkill, castID, notInterruptible = CastInfo.UnitCastingInfo (unit)
if (not self:IsValid (unit, name, isTradeSkill)) then
return
@@ -8219,7 +8213,7 @@ detailsFramework.CastFrameFunctions = {
end,
UNIT_SPELLCAST_CHANNEL_UPDATE = function(self, unit, ...)
local name, text, texture, startTime, endTime, isTradeSkill, notInterruptible, spellID, _, numStages = UnitChannelInfo (unit)
local name, text, texture, startTime, endTime, isTradeSkill, notInterruptible, spellID, _, numStages = CastInfo.UnitChannelInfo (unit)
if (not self:IsValid (unit, name, isTradeSkill)) then
return
@@ -8257,90 +8251,6 @@ detailsFramework.CastFrameFunctions = {
detailsFramework:Mixin(detailsFramework.CastFrameFunctions, detailsFramework.ScriptHookMixin)
-- for classic era use LibClassicCasterino:
local LibCC = LibStub("LibClassicCasterino", true)
if IS_WOW_PROJECT_CLASSIC_ERA and LibCC then
local fCast = CreateFrame("frame")
local getCastBar = function(unitId)
local plateFrame = C_NamePlate.GetNamePlateForUnit (unitId)
if (not plateFrame) then
return
end
local castBar = plateFrame.unitFrame and plateFrame.unitFrame.castBar
if (not castBar) then
return
end
return castBar
end
local triggerCastEvent = function(castBar, event, unitId, ...)
if (castBar and castBar.OnEvent) then
castBar.OnEvent (castBar, event, unitId)
end
end
local funcCast = function(event, unitId, ...)
local castBar = getCastBar (unitId)
if (castBar) then
triggerCastEvent (castBar, event, unitId)
end
end
fCast.UNIT_SPELLCAST_START = function(self, event, unitId, ...)
triggerCastEvent (getCastBar (unitId), event, unitId)
end
fCast.UNIT_SPELLCAST_STOP = function(self, event, unitId, ...)
triggerCastEvent (getCastBar (unitId), event, unitId)
end
fCast.UNIT_SPELLCAST_DELAYED = function(self, event, unitId, ...)
triggerCastEvent (getCastBar (unitId), event, unitId)
end
fCast.UNIT_SPELLCAST_FAILED = function(self, event, unitId, ...)
triggerCastEvent (getCastBar (unitId), event, unitId)
end
fCast.UNIT_SPELLCAST_INTERRUPTED = function(self, event, unitId, ...)
triggerCastEvent (getCastBar (unitId), event, unitId)
end
fCast.UNIT_SPELLCAST_CHANNEL_START = function(self, event, unitId, ...)
triggerCastEvent (getCastBar (unitId), event, unitId)
end
fCast.UNIT_SPELLCAST_CHANNEL_UPDATE = function(self, event, unitId, ...)
triggerCastEvent (getCastBar (unitId), event, unitId)
end
fCast.UNIT_SPELLCAST_CHANNEL_STOP = function(self, event, unitId, ...)
triggerCastEvent (getCastBar (unitId), event, unitId)
end
if LibCC then
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_START", funcCast)
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_DELAYED", funcCast) -- only for player
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_STOP", funcCast)
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_FAILED", funcCast)
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_INTERRUPTED", funcCast)
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_CHANNEL_START", funcCast)
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_CHANNEL_UPDATE", funcCast) -- only for player
LibCC.RegisterCallback(fCast,"UNIT_SPELLCAST_CHANNEL_STOP", funcCast)
UnitCastingInfo = function(unit)
return LibCC:UnitCastingInfo (unit)
end
UnitChannelInfo = function(unit)
return LibCC:UnitChannelInfo (unit)
end
end
end -- end classic era
-- ~castbar
function detailsFramework:CreateCastBar(parent, name, settingsOverride)
-44
View File
@@ -4310,50 +4310,6 @@ function damageClass:MontaInfoDamageTaken()
local formated_value = SelectedToKFunction(_, _math_floor(tabela[2]))
self:UpdadeInfoBar(barra, index, tabela[1], tabela[1], tabela[2], formated_value, max_, tabela[3], "Interface\\AddOns\\Details\\images\\classes_small_alpha", true, texCoords, nil, tabela[4])
end
--[=[
---@type number, spelltable
for spellId, spellTable in pairs(actorSpells) do
spellTable.ChartData = nil
---@type string
local spellName = _GetSpellInfo(spellId)
if (spellName) then
---@type number in which index the spell with the same name was stored
local index = alreadyAdded[spellName]
if (index) then
---@type spelltableadv
local bkSpellData = breakdownSpellDataList[index]
bkSpellData.spellTables[#bkSpellData.spellTables+1] = spellTable
---@type bknesteddata
local nestedData = {spellId = spellId, spellTable = spellTable, petName = "", value = 0}
bkSpellData.nestedData[#bkSpellData.nestedData+1] = nestedData
bkSpellData.bCanExpand = true
else
---@type spelltableadv
local bkSpellData = {
id = spellId,
spellschool = spellTable.spellschool,
bIsExpanded = Details222.BreakdownWindow.IsSpellExpanded(spellId),
bCanExpand = false,
spellTables = {spellTable},
nestedData = {{spellId = spellId, spellTable = spellTable, petName = "", value = 0}},
}
detailsFramework:Mixin(bkSpellData, Details.SpellTableMixin)
breakdownSpellDataList[#breakdownSpellDataList+1] = bkSpellData
alreadyAdded[spellName] = #breakdownSpellDataList
end
end
end
--]=]
end
--[[exported]] function Details:UpdadeInfoBar(row, index, spellId, name, value, formattedValue, max, percent, icon, detalhes, texCoords, spellSchool, class)
+72 -58
View File
@@ -1,4 +1,6 @@
--note: do maintenance on spelltable.ChartData
local addonName, Details222 = ...
local breakdownWindow = Details.BreakdownWindow
local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" )
@@ -33,8 +35,6 @@ local spellBlockContainerSettings = {
lineAmount = 3, --amount of line each block have
}
local spellBreakdownSettings = {}
local CONST_BAR_HEIGHT = 20
local CONST_SPELLSCROLL_LINEHEIGHT = 20
local CONST_TARGET_TEXTURE = [[Interface\MINIMAP\TRACKING\Target]]
@@ -524,8 +524,6 @@ end
---@param tabButton button
---@param tabFrame breakdownspellstab
function spellsTab.OnCreateTabCallback(tabButton, tabFrame) --~init
spellBreakdownSettings = Details.breakdown_spell_tab
spellsTab.TabFrame = tabFrame
--initialize the allowed headers for generic data container
@@ -716,7 +714,7 @@ local onEnterSpellBar = function(spellBar, motion) --parei aqui: precisa por nom
local percent = normalHitsAmt / math.max(totalHits, 0.0001) * 100
normalHitsBlock:SetValue(percent)
normalHitsBlock.sparkTexture:SetPoint("left", normalHitsBlock, "left", percent / 100 * normalHitsBlock:GetWidth() + spellBreakdownSettings.blockspell_spark_offset, 0)
normalHitsBlock.sparkTexture:SetPoint("left", normalHitsBlock, "left", percent / 100 * normalHitsBlock:GetWidth() + Details.breakdown_spell_tab.blockspell_spark_offset, 0)
local blockLine1, blockLine2, blockLine3 = normalHitsBlock:GetLines()
blockLine1.leftText:SetText(Loc ["STRING_NORMAL_HITS"])
@@ -744,7 +742,7 @@ local onEnterSpellBar = function(spellBar, motion) --parei aqui: precisa por nom
local percent = criticalHitsAmt / math.max(totalHits, 0.0001) * 100
critHitsBlock:SetValue(percent)
critHitsBlock.sparkTexture:SetPoint("left", critHitsBlock, "left", percent / 100 * critHitsBlock:GetWidth() + spellBreakdownSettings.blockspell_spark_offset, 0)
critHitsBlock.sparkTexture:SetPoint("left", critHitsBlock, "left", percent / 100 * critHitsBlock:GetWidth() + Details.breakdown_spell_tab.blockspell_spark_offset, 0)
local blockLine1, blockLine2, blockLine3 = critHitsBlock:GetLines()
blockLine1.leftText:SetText(Loc ["STRING_CRITICAL_HITS"])
@@ -780,7 +778,7 @@ local onEnterSpellBar = function(spellBar, motion) --parei aqui: precisa por nom
local percent = overheal / (overheal + spellTable.total) * 100
overhealBlock:SetValue(percent)
overhealBlock.sparkTexture:SetPoint("left", overhealBlock, "left", percent / 100 * overhealBlock:GetWidth() + spellBreakdownSettings.blockspell_spark_offset, 0)
overhealBlock.sparkTexture:SetPoint("left", overhealBlock, "left", percent / 100 * overhealBlock:GetWidth() + Details.breakdown_spell_tab.blockspell_spark_offset, 0)
overhealBlock:SetColor(1, 0, 0, 0.4)
@@ -998,21 +996,23 @@ local spellBlockContainerMixin = {
spellBlock:SetPoint("topleft", self, "topleft", 1, (blockHeight * (i - 1) - i) * -1 - (i*2) + ((i-1) * padding))
spellBlock:SetPoint("topright", self, "topright", 1, (blockHeight * (i - 1) - i) * -1 - (i*2) + ((i-1) * padding))
spellBlock.sparkTexture:SetSize(spellBreakdownSettings.blockspell_spark_width, blockHeight)
spellBlock.sparkTexture:SetShown(spellBreakdownSettings.blockspell_spark_show)
spellBlock.sparkTexture:SetVertexColor(unpack(spellBreakdownSettings.blockspell_spark_color))
spellBlock.sparkTexture:SetSize(Details.breakdown_spell_tab.blockspell_spark_width, blockHeight)
spellBlock.sparkTexture:SetShown(Details.breakdown_spell_tab.blockspell_spark_show)
spellBlock.sparkTexture:SetVertexColor(unpack(Details.breakdown_spell_tab.blockspell_spark_color))
spellBlock.reportButton:SetPoint("bottomright", spellBlock.overlay, "bottomright", -2, 2)
spellBlock.gradientTexture:SetHeight(blockHeight)
spellBlock:SetBackdropBorderColor(unpack(borderColor)) --border color
spellBlock.statusBarTexture:SetVertexColor(unpack(Details.breakdown_spell_tab.blockspell_color)) --bar color
local lineHeight = blockHeight * 0.2687
--update the lines
local previousLine
for o = 1, spellBlockContainerSettings.lineAmount do
---@type breakdownspellblockline
local line = spellBlock.Lines[o]
line:SetSize(width - 2, spellBreakdownSettings.blockspellline_height)
line:SetSize(width - 2, lineHeight)
if (previousLine) then
line:SetPoint("topleft", previousLine, "bottomleft", 0, -2)
else
@@ -1693,7 +1693,9 @@ function spellsTab.CreatePhasesContainer(tabFrame) --~phase ~createphasecontaine
---@type breakdowntargetscrollframe not sure is this is correct
local phaseScrollFrame = DF:CreateScrollBox(container, "$parentPhaseScroll", refreshPhaseFunc, {}, width, height, defaultAmountOfLines, CONST_SPELLSCROLL_LINEHEIGHT)
dededebug = 1
DF:ReskinSlider(phaseScrollFrame)
dededebug = nil
phaseScrollFrame:SetBackdrop({})
phaseScrollFrame:SetAllPoints()
@@ -1717,64 +1719,76 @@ function spellsTab.CreatePhasesContainer(tabFrame) --~phase ~createphasecontaine
local mainAttribute = instanceObject:GetDisplay()
local data = {
local data = {
--playerObject = playerObject,
--attribute = attribute,
--combatObject = combatObject,
combatTime = combatObject:GetCombatTime(),
}
}
local playerPhases = {}
local totalDamage = 0
local phaseElapsed = {}
local playerPhases = {}
local totalDamage = 0
local phaseElapsed = {}
--local bossInfo = combatObject:GetBossInfo()
local phasesInfo = combatObject:GetPhases()
local phasesInfo = combatObject:GetPhases()
if (phasesInfo) then --bossInfo and
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]
if (not phasesInfo) then
spellsTab.PhaseContainerFrame:Hide()
return
end
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
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
--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)
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 myRank = 0
for i = 1, #allPlayers do
if (allPlayers[i][1] == actorName) then
myRank = i
break
end
end
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
tinsert(playerPhases, {phaseName, playersTable[actorName] or 0, myRank, (playersTable [actorName] or 0) / totalDamage * 100})
end
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)
@@ -61,34 +61,6 @@ local createOptionsPanel = function()
local optionsTable = {
{type = "label", get = function() return "Spell Details Block" end, text_template = subSectionTitleTextTemplate},
{--width
type = "range",
get = function() return Details.breakdown_spell_tab.blockcontainer_width end,
set = function(self, fixedparam, value)
Details.breakdown_spell_tab.blockcontainer_width = value
DetailsSpellBreakdownTab.GetSpellBlockFrame():UpdateBlocks()
end,
min = 150,
max = 450,
step = 1,
name = "Width",
desc = "Width",
hidden = true,
},
{--height
type = "range",
get = function() return Details.breakdown_spell_tab.blockcontainer_height end,
set = function(self, fixedparam, value)
Details.breakdown_spell_tab.blockcontainer_height = value
DetailsSpellBreakdownTab.GetSpellBlockFrame():UpdateBlocks()
end,
min = 150,
max = 450,
step = 1,
name = "Height",
desc = "Height",
hidden = true,
},
{--block height
type = "range",
get = function() return Details.breakdown_spell_tab.blockspell_height end,
@@ -102,71 +74,6 @@ local createOptionsPanel = function()
name = "Block Height",
desc = "Block Height",
},
{--line height
type = "range",
get = function() return Details.breakdown_spell_tab.blockspellline_height end,
set = function(self, fixedparam, value)
Details.breakdown_spell_tab.blockspellline_height = value
DetailsSpellBreakdownTab.GetSpellBlockFrame():UpdateBlocks()
end,
min = 10,
max = 30,
step = 1,
name = "Line Height",
desc = "Line Height",
},
{--show spark
type = "toggle",
get = function() return Details.breakdown_spell_tab.blockspell_spark_show end,
set = function(self, fixedparam, value)
Details.breakdown_spell_tab.blockspell_spark_show = value
DetailsSpellBreakdownTab.GetSpellBlockFrame():UpdateBlocks()
end,
name = "Show Spark",
desc = "Show Spark",
},
{--spark width
type = "range",
get = function() return Details.breakdown_spell_tab.blockspell_spark_width end,
set = function(self, fixedparam, value)
Details.breakdown_spell_tab.blockspell_spark_width = value
DetailsSpellBreakdownTab.GetSpellBlockFrame():UpdateBlocks()
end,
min = 1,
max = 24,
step = 1,
name = "Spark Width",
desc = "Spark Width",
},
{--spark offset
type = "range",
get = function() return Details.breakdown_spell_tab.blockspell_spark_offset end,
set = function(self, fixedparam, value)
Details.breakdown_spell_tab.blockspell_spark_offset = value
DetailsSpellBreakdownTab.GetSpellBlockFrame():UpdateBlocks()
DetailsSpellBreakdownTab.UpdateShownSpellBlock()
end,
min = -12,
max = 12,
step = 1,
name = "Spark Offset",
desc = "Spark Offset",
},
{--spark color
type = "color",
get = function()
return Details.breakdown_spell_tab.blockspell_spark_color
end,
set = function(self, r, g, b, a)
Details.breakdown_spell_tab.blockspell_spark_color[1] = r
Details.breakdown_spell_tab.blockspell_spark_color[2] = g
Details.breakdown_spell_tab.blockspell_spark_color[3] = b
Details.breakdown_spell_tab.blockspell_spark_color[4] = a
DetailsSpellBreakdownTab.GetSpellBlockFrame():UpdateBlocks()
end,
name = "Spark Color",
desc = "Spark Color",
},
{type = "blank"},
{type = "blank"},
-2
View File
@@ -1430,8 +1430,6 @@ local default_global_data = {
blockspell_spark_show = true,
blockspell_spark_color = {1, 1, 1, 0.7},
blockspellline_height = 18,
spellcontainer_width = 429,
spellcontainer_height = 311,
spellcontainer_islocked = true,