Release Candidate 1
This commit is contained in:
@@ -0,0 +1,552 @@
|
||||
--próximo: ao criar uma janela AllInOne, precisa criar uma nova instancia no Details!
|
||||
--na tabela de configuração precisa dizer que é uma all in one e o details vai chamar esse arquivo pra atualizar
|
||||
|
||||
--(ainda aqui) parei atualizando o height da titlebar
|
||||
--proximo passo: atualizar o resto das propriedade da title bar
|
||||
--fazer as funcções para setar os valores na titleBar
|
||||
--verificar se precisa adicionar funcções no mixin dos bottões como SetTexture, SetVertexColor
|
||||
|
||||
--tem que fazer a função de ShowWindow() e ToggleWindows()
|
||||
--fazer a criação do header e fazer o header ser redirecionado (aumentar ou diminuir o tamanho by dragging)
|
||||
|
||||
local LibWindow = LibStub("LibWindow-1.1")
|
||||
local df = DetailsFramework
|
||||
local detailsFramework = DetailsFramework
|
||||
|
||||
local textureCoords = {
|
||||
show_mainmenu = {0/256, 32/256, 0, 1},
|
||||
show_segments = {32/256, 64/256, 0, 1},
|
||||
show_report = {96/256, 128/256, 0, 1},
|
||||
show_reset = {128/256, 160/256, 0, 1},
|
||||
show_displays = {66/256, 93/256, 0, 1},
|
||||
show_close = {160/256, 192/256, 0, 1},
|
||||
}
|
||||
|
||||
--namespace
|
||||
Details.AllInOneWindow = {
|
||||
--store the frame of all AllInOne windows, this table does not same with the addon
|
||||
FramesCreated = {},
|
||||
WindowsOpened = 0,
|
||||
|
||||
--return a table: {{settings}, {settings}, {settings}, {settings}, ...}
|
||||
GetAllSettings = function()
|
||||
--setting within profile
|
||||
return Details.all_in_one_windows
|
||||
end,
|
||||
|
||||
--return the amount of settings by calling the above function and returning the amount of indexes
|
||||
GetNumSettings = function()
|
||||
return #Details.AllInOneWindow.GetAllSettings()
|
||||
end,
|
||||
|
||||
--return which will be the next settingID if a new setting is added
|
||||
GetNextSettingID = function()
|
||||
return #Details.all_in_one_windows + 1
|
||||
end,
|
||||
|
||||
--return the settingTable of a settingID
|
||||
GetSettingsByID = function(ID)
|
||||
return Details.AllInOneWindow.GetAllSettings()[ID]
|
||||
end,
|
||||
|
||||
--add a setting and return the settingID
|
||||
AddSetting = function(newSettingTable)
|
||||
local allSettings = Details.AllInOneWindow.GetAllSettings()
|
||||
allSettings[#allSettings+1] = newSettingTable
|
||||
return #allSettings
|
||||
end,
|
||||
|
||||
--frames already created on this session
|
||||
GetAllFrames = function()
|
||||
return Details.AllInOneWindow.FramesCreated
|
||||
end,
|
||||
|
||||
GetNumFrames = function()
|
||||
return #Details.AllInOneWindow.GetAllFrames()
|
||||
end,
|
||||
|
||||
GetFrameBySettingID = function(settingId)
|
||||
local numFramesCreated = Details.AllInOneWindow.GetNumFrames()
|
||||
for id = 1, numFramesCreated do
|
||||
local window = Details.AllInOneWindow.GetFrameByID(id)
|
||||
if (window:GetSettingsID() == settingId) then
|
||||
return window:GetSettings()
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
AddFrame = function(frame)
|
||||
Details.AllInOneWindow.FramesCreated[#Details.AllInOneWindow.FramesCreated+1] = frame
|
||||
return #Details.AllInOneWindow.FramesCreated+1
|
||||
end,
|
||||
|
||||
GetFrameByID = function(ID)
|
||||
return Details.AllInOneWindow.FramesCreated[ID]
|
||||
end,
|
||||
|
||||
RestoreAllWindows = function()
|
||||
|
||||
end,
|
||||
|
||||
ShowWindow = function(settingId)
|
||||
|
||||
end,
|
||||
|
||||
HideWindow = function(settingId)
|
||||
assert(type(settingId) ~= "number", "Details.AllInOneWindow.HideWindow require a number on 'settingId'")
|
||||
local settings = Details.AllInOneWindow.GetAllSettings()
|
||||
local windowSetting = settings[settingId]
|
||||
assert(type(windowSetting) ~= "table", "Details.AllInOneWindow.HideWindow settings not found for settingId: " .. settingId)
|
||||
|
||||
if (windowSetting) then
|
||||
if (windowSetting.isOpened) then
|
||||
windowSetting.isOpened = false
|
||||
--get the window being used by this setting
|
||||
local window = Details.AllInOneWindow.GetFrameBySettingID(settingId)
|
||||
if (window) then
|
||||
window:Hide()
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
HideAllWindows = function()
|
||||
local numSettings = Details.AllInOneWindow.GetNumSettings()
|
||||
--table with all the settings for all AllInOne windows in the current profile
|
||||
local settings = Details.AllInOneWindow.GetAllSettings()
|
||||
for settingId = 1, numSettings do
|
||||
local windowSetting = Details.AllInOneWindow.GetSettingsByID(settingId)
|
||||
if (windowSetting.isOpened) then
|
||||
Details.AllInOneWindow.HideWindow(settingId)
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
ToggleWindows = function()
|
||||
|
||||
end,
|
||||
}
|
||||
|
||||
local menuButtonMixin = {
|
||||
GetSettingName = function(button)
|
||||
return button.settingName
|
||||
end,
|
||||
}
|
||||
|
||||
local menuSupportFrameMixin = {
|
||||
Constructor = function(menuSupportFrame)
|
||||
menuSupportFrame:SetSize(1, 1)
|
||||
menuSupportFrame.allButtons = {}
|
||||
|
||||
menuSupportFrame:CreateMenuButton("CloseMenu", "show_close")
|
||||
menuSupportFrame:CreateMenuButton("MainMenu", "show_mainmenu")
|
||||
menuSupportFrame:CreateMenuButton("SegmentsMenu", "show_segments")
|
||||
menuSupportFrame:CreateMenuButton("DisplaysMenu", "show_report")
|
||||
menuSupportFrame:CreateMenuButton("ReportMenu", "show_reset")
|
||||
menuSupportFrame:CreateMenuButton("ResetMenu", "show_displays")
|
||||
end,
|
||||
|
||||
GetNumButtons = function(supportFrame)
|
||||
return #supportFrame.allButtons
|
||||
end,
|
||||
|
||||
GetButtonByIndex = function(supportFrame, buttonIndex)
|
||||
return supportFrame.allButtons[buttonIndex]
|
||||
end,
|
||||
|
||||
CreateMenuButton = function(supportFrame, name, settingName)
|
||||
local newButton = CreateFrame("button", "$parent" .. name, supportFrame)
|
||||
newButton:SetSize(20, 20)
|
||||
newButton:SetScale(1)
|
||||
supportFrame.allButtons[#supportFrame.allButtons+1] = newButton
|
||||
df:Mixin(newButton, menuButtonMixin)
|
||||
newButton.settingName = settingName
|
||||
return newButton
|
||||
end,
|
||||
|
||||
Refresh = function(supportFrame)
|
||||
local window = supportFrame:GetParent():GetParent()
|
||||
--problem: it is getting the settings from the AllInOneWindow settings, it should get from Details! default window settings
|
||||
--this settings should return the regular window setting from Details! on _detalhes.tabela_instancias[windowId]
|
||||
local settings = window:GetSettings().titlebar.menu_buttons
|
||||
|
||||
supportFrame:ClearAllPoints()
|
||||
supportFrame:SetSize(1, 1)
|
||||
supportFrame:SetScale(settings.scale)
|
||||
supportFrame:SetAlpha(settings.alpha)
|
||||
|
||||
--buttons currently allowed to show by the user settings
|
||||
local allShownButtons = {}
|
||||
for i = 1, supportFrame:GetNumButtons() do
|
||||
local button = supportFrame:GetButtonByIndex(i)
|
||||
if (settings[button:GetSettingName()]) then
|
||||
allShownButtons[#allShownButtons+1] = button
|
||||
button:Show()
|
||||
df:SetRegularButtonTexture(button, settings.texture_file, textureCoords[button:GetSettingName()])
|
||||
df:SetRegularButtonVertexColor(button, settings.color)
|
||||
else
|
||||
button:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
--hardcoded to place the menu buttons in the left side of the window
|
||||
--if needed this can be "right" with the header leave space for it
|
||||
local attachPoint = "left"
|
||||
|
||||
if (settings.alignment == "horizontal") then
|
||||
--make it attach to the left side of the title bar or the right side of the title bar
|
||||
supportFrame:SetPoint(attachPoint, window.TitleBar, attachPoint, settings.x_offset, settings.y_offset)
|
||||
|
||||
local paddingAmount = attachPoint == "left" and settings.padding or (settings.padding * -1)
|
||||
for i = 1, #allShownButtons do
|
||||
local button = allShownButtons[i]
|
||||
if (i ==1) then
|
||||
button:SetPoint(attachPoint, supportFrame, attachPoint, 0, 0)
|
||||
else
|
||||
local previousButton = allShownButtons[i - 1]
|
||||
local sideToAttach = attachPoint == "left" and "right" or "left"
|
||||
button:SetPoint(attachPoint, previousButton, sideToAttach, paddingAmount, 0)
|
||||
end
|
||||
end
|
||||
|
||||
elseif (settings.alignment == "vertical") then
|
||||
if (attachPoint == "left") then
|
||||
supportFrame:SetPoint("topright", window.TitleBar, "topleft", settings.x_offset, settings.y_offset)
|
||||
else
|
||||
supportFrame:SetPoint("topleft", window.TitleBar, "topright", settings.x_offset, settings.y_offset)
|
||||
end
|
||||
|
||||
--here left == top to bottom | right = bottom to top
|
||||
local paddingAmount = attachPoint == "left" and settings.padding or (settings.padding * -1)
|
||||
local attachTo = attachPoint == "left" and "top" or "bottom"
|
||||
for i = 1, #allShownButtons do
|
||||
local button = allShownButtons[i]
|
||||
if (i ==1) then
|
||||
button:SetPoint(attachTo, supportFrame, attachTo, 0, 0)
|
||||
else
|
||||
local previousButton = allShownButtons[i - 1]
|
||||
local sideToAttach = attachTo == "left" and "bottom" or "top"
|
||||
button:SetPoint(attachTo, previousButton, sideToAttach, paddingAmount, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
local titleBarMixin = {
|
||||
--run when the title bar is created
|
||||
Constructor = function(titleBar)
|
||||
titleBar:EnableMouse(false)
|
||||
|
||||
--create support frame for control buttons, it also will create the control buttons as children
|
||||
titleBar:CreateMenuSupportFrame()
|
||||
|
||||
--create the elapsed time string
|
||||
titleBar:CreateCombatTimeString()
|
||||
titleBar:SetCombatTimeText("02:36") --debug
|
||||
end,
|
||||
|
||||
GetSettings = function(titleBar)
|
||||
--get the settings from the main window
|
||||
return titleBar:GetParent():GetSettings()
|
||||
end,
|
||||
|
||||
SetSetting = function()
|
||||
--this function exists and get overriden by the SetSetting of the window mixin
|
||||
end,
|
||||
|
||||
SetTitleBarHeight = function(titleBar, height)
|
||||
assert(type(height) == "number", "Invalid height, usage: TitleBar:SetTitleBarHeight(height)")
|
||||
titleBar:SetHeight(height)
|
||||
titleBar:SetSetting(height, "titlebar", "height")
|
||||
titleBar:Refresh()
|
||||
end,
|
||||
|
||||
SetTitleBarTextSize = function(window, size)
|
||||
if (not size or type(size) ~= "number") then
|
||||
return
|
||||
end
|
||||
df:SetFontSize(window.TitleBar.CombatTime, size)
|
||||
|
||||
end,
|
||||
|
||||
SetTitleBarTextColor = function(window, color)
|
||||
local r, g, b, a = df:ParseColor(color)
|
||||
df:SetFontColor(window.TitleBar.CombatTime, r, g, b, a)
|
||||
end,
|
||||
|
||||
SetTitleBarTextFont = function(window, font)
|
||||
|
||||
end,
|
||||
|
||||
SetTitleBarTextOutline = function(window, outline)
|
||||
|
||||
end,
|
||||
|
||||
SetTitleBarTextShadow = function(window, shadow, xOffset, yOffset)
|
||||
|
||||
end,
|
||||
|
||||
CreateCombatTimeString = function(titleBar)
|
||||
local combatTimeString = titleBar:CreateFontString("$parentCombatTime", "overlay", "GameFontNormal")
|
||||
titleBar.CombatTime = combatTimeString
|
||||
return titleBar.CombatTime
|
||||
end,
|
||||
|
||||
GetCombatTimeString = function(titleBar)
|
||||
return titleBar.CombatTime
|
||||
end,
|
||||
|
||||
SetCombatTimeText = function(titleBar, combatTime)
|
||||
local combatTimeString = titleBar:GetCombatTimeString()
|
||||
if (type(combatTime) == "string") then
|
||||
combatTimeString:SetText(combatTime)
|
||||
|
||||
elseif (type(combatTime) == "number") then
|
||||
local timeAsString = DetailsFramework:IntegerToTimer(combatTime)
|
||||
combatTimeString:SetText(timeAsString)
|
||||
else
|
||||
--if no valid time passed, clear the timer
|
||||
combatTimeString:SetText("")
|
||||
end
|
||||
end,
|
||||
|
||||
Refresh = function(titleBar)
|
||||
local config = titleBar:GetSettings()
|
||||
|
||||
--height
|
||||
local height = config.titlebar.height
|
||||
titleBar:SetHeight(height)
|
||||
|
||||
local timerShown = config.timer_show
|
||||
|
||||
local menuSupportFrame = titleBar:GetMenuSupportFrame()
|
||||
menuSupportFrame:Update()
|
||||
|
||||
--[=[
|
||||
--height = 20,
|
||||
timer_show = true,
|
||||
timer_ignore_openworld = true,
|
||||
timer_only_encounters = false,
|
||||
|
||||
text_size = 10,
|
||||
text_font = "Friz Quadrata TT",
|
||||
text_outline = "NONE",
|
||||
text_shadow = {
|
||||
enabled = false,
|
||||
color = {1, 1, 1, 1},
|
||||
x_offset = 1,
|
||||
y_offset = -1,
|
||||
},
|
||||
--]=]
|
||||
|
||||
end,
|
||||
|
||||
GetMenuSupportFrame = function(titleBar)
|
||||
return titleBar.MenuSupportFrame
|
||||
end,
|
||||
|
||||
--menu support frame is the frame which will parent the menu buttons (cogwheel, segments, report button, etc)
|
||||
CreateMenuSupportFrame = function(titleBar)
|
||||
local menuSupportFrame = CreateFrame("frame", "$parentMenuSupportFrame", titleBar, "BackdropTemplate")
|
||||
titleBar.MenuSupportFrame = menuSupportFrame
|
||||
detailsFramework:Mixin(menuSupportFrame, menuSupportFrameMixin)
|
||||
menuSupportFrame:Constructor()
|
||||
return menuSupportFrame
|
||||
end,
|
||||
|
||||
}
|
||||
|
||||
local AllInOneWindowMixin = {
|
||||
SetSetting = function(window, value, ...)
|
||||
local config = window:GetSettings()
|
||||
local currentTable = config
|
||||
local lastKey = ""
|
||||
for index, key in ipairs({...}) do
|
||||
if (type(currentTable[key]) == "table") then
|
||||
currentTable = currentTable[value]
|
||||
else
|
||||
lastKey = key
|
||||
end
|
||||
end
|
||||
currentTable[lastKey] = value
|
||||
end,
|
||||
|
||||
IsOpened = function(window)
|
||||
return Details.AllInOneWindow.GetSettingsByID(window:GetSettingsID()).isOpened
|
||||
end,
|
||||
|
||||
SetWindowSize = function(self, width, height)
|
||||
|
||||
end,
|
||||
|
||||
GetSettings = function(window)
|
||||
return window.settings
|
||||
end,
|
||||
|
||||
SetSettingID = function(window, newSettingId)
|
||||
assert(type(newSettingId) ~= "number", "window.SetSettingID require a number on 'newSettingId'")
|
||||
local settings = Details.AllInOneWindow.GetSettingsByID(newSettingId)
|
||||
if (settings) then
|
||||
window.id = newSettingId
|
||||
window.settings = settings
|
||||
else
|
||||
error("window.SetSettingID could not find a settings for ID " .. newSettingId)
|
||||
end
|
||||
end,
|
||||
|
||||
GetSettingsID = function(window)
|
||||
return window.id
|
||||
end,
|
||||
|
||||
CreateTitleBar = function(window)
|
||||
local titleBar = CreateFrame("frame", "$parentTitleBar", window, "BackdropTemplate")
|
||||
window.TitleBar = titleBar
|
||||
df:Mixin(titleBar, titleBarMixin)
|
||||
titleBar:Constructor()
|
||||
return titleBar
|
||||
end,
|
||||
|
||||
GetTitleBar = function(window)
|
||||
return window.TitleBar
|
||||
end,
|
||||
|
||||
Refresh = function(window)
|
||||
local settingsId = window:GetSettingsID()
|
||||
local settings = window:GetSettings()
|
||||
|
||||
if (not settings.isOpened) then
|
||||
window:Hide()
|
||||
return
|
||||
end
|
||||
|
||||
local titleBar = window:GetTitleBar()
|
||||
titleBar:Refresh()
|
||||
end,
|
||||
}
|
||||
|
||||
--override
|
||||
titleBarMixin.SetSetting = AllInOneWindowMixin.SetSetting
|
||||
|
||||
local defaultWindowSettings = {
|
||||
isOpened = true,
|
||||
|
||||
libwindow = {},
|
||||
width = 350, --
|
||||
height = 150, --
|
||||
|
||||
titlebar = {
|
||||
--done here: all options can be retrived from details! settings
|
||||
menu_buttons = {},
|
||||
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
--create only the frame for a new window ~newwindow ñewwindow
|
||||
function Details.AllInOneWindow.CreateFrame(settingId)
|
||||
--create the new window
|
||||
local newWindowFrame = CreateFrame("frame", "DetailsNewWindow" .. settingId, UIParent, "BackdropTemplate")
|
||||
newWindowFrame.id = settingId
|
||||
df:Mixin(newWindowFrame, AllInOneWindowMixin)
|
||||
|
||||
newWindowFrame:SetPoint("center", UIParent, "center", -400, 0)
|
||||
|
||||
--create the title bar
|
||||
newWindowFrame:CreateTitleBar()
|
||||
|
||||
--creare header
|
||||
|
||||
|
||||
|
||||
--create scroll bar
|
||||
|
||||
|
||||
|
||||
--create resizers
|
||||
|
||||
|
||||
|
||||
--add the frame to the frame pool
|
||||
local frameId = Details.AllInOneWindow.AddFrame(newWindowFrame)
|
||||
return newWindowFrame
|
||||
end
|
||||
|
||||
--[=[
|
||||
lib window need to be on the AllInOneWindow:Update() so it can register the new libwindow table on profile change
|
||||
--register on libwindow
|
||||
LibWindow.RegisterConfig(newWindow, windowSettings.libwindow)
|
||||
LibWindow.RestorePosition(newWindow)
|
||||
LibWindow.MakeDraggable(newWindow)
|
||||
|
||||
--set the size using the settings
|
||||
newWindow:SetSize(windowSettings.width, windowSettings.height)
|
||||
|
||||
--rnable mouse for click through
|
||||
newWindow:EnableMouse(true)
|
||||
--setmovable for locked
|
||||
newWindow:SetMovable(true)
|
||||
|
||||
--title bar position (default on top)
|
||||
titleBar:SetPoint("topleft", newWindow, "topleft", 0, 0)
|
||||
titleBar:SetPoint("topright", newWindow, "topright", 0, 0)
|
||||
--title bar height
|
||||
titleBar:SetHeight(20)
|
||||
|
||||
--combat time position
|
||||
combatTimeString:SetPoint("left", titleBar, "left", 2, 0)
|
||||
--]=]
|
||||
|
||||
--create the settings for a new window plus the frames
|
||||
function Details:CreateNewAllInOneWindow()
|
||||
--get profile settings
|
||||
local profileSettings = Details:GetSettingsForAll_AllInOneWindows()
|
||||
|
||||
--get what is the ID if a new window is added
|
||||
local nextSettingId = Details.AllInOneWindow.GetNextSettingID()
|
||||
|
||||
--copy the settings prototype
|
||||
local windowSettings = df.table.deploy({}, defaultWindowSettings)
|
||||
--add the new settings table into the profile where the new window settings are stored
|
||||
local settingId = Details.AllInOneWindow.AddSetting(windowSettings)
|
||||
|
||||
--create window body
|
||||
local windowFrame = Details.AllInOneWindow.CreateFrame(settingId)
|
||||
|
||||
return windowFrame
|
||||
end
|
||||
|
||||
--assuming this will run when the profile is loaded
|
||||
|
||||
|
||||
--used when a profile finished loading
|
||||
--CURRENT THE ONLY ENTRY POINT
|
||||
function Details.AllInOneWindow.ReloadAll()
|
||||
--get the amount of settings
|
||||
local numSettings = Details.AllInOneWindow.GetNumSettings()
|
||||
|
||||
--table with all window frames already created on this session
|
||||
local framesCreated = Details.AllInOneWindow.GetAllFrames()
|
||||
--next frame to be used
|
||||
local frameIndex = 1
|
||||
|
||||
for settingId = 1, numSettings do
|
||||
local windowSetting = Details.AllInOneWindow.GetSettingsByID(settingId)
|
||||
if (windowSetting.isOpened) then
|
||||
local windowFrame = framesCreated[frameIndex]
|
||||
if (not windowFrame) then
|
||||
windowFrame = Details.AllInOneWindow.CreateFrame(settingId)
|
||||
end
|
||||
frameIndex = frameIndex + 1
|
||||
windowFrame:SetSettingID(settingId)
|
||||
--setup the frame using the settings
|
||||
windowFrame:Refresh()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ function Details.AuraTracker.CreatePanel()
|
||||
local statusBar = DetailsFramework:CreateStatusBar(auraTrackerFrame)
|
||||
statusBar.text = statusBar:CreateFontString(nil, "overlay", "GameFontNormal")
|
||||
statusBar.text:SetPoint("left", statusBar, "left", 5, 0)
|
||||
statusBar.text:SetText("Details! Damage Meter")
|
||||
statusBar.text:SetText("By Terciob | Part of Details! Damage Meter")
|
||||
DetailsFramework:SetFontSize(statusBar.text, 11)
|
||||
DetailsFramework:SetFontColor(statusBar.text, "gray")
|
||||
|
||||
@@ -156,8 +156,8 @@ function Details.AuraTracker.CreatePanel()
|
||||
{text = "", width = 20},
|
||||
{text = "Aura Name", width = 162},
|
||||
{text = "Spell Id", width = 100},
|
||||
{text = "Lua Table", width = 250},
|
||||
{text = "Points", width = 100},
|
||||
{text = "Lua Table", width = 200},
|
||||
{text = "Payload (Points)", width = 296},
|
||||
}
|
||||
local headerOptions = {
|
||||
padding = 2,
|
||||
@@ -260,6 +260,9 @@ local formatToLuaTable = {
|
||||
end,
|
||||
}
|
||||
|
||||
--if you need your own table format, override the function below as: function(auraInfo) return "" end
|
||||
--[[GLOBAL]] DETAILS_AURATRACKER_LUATABLE_FUNC = nil
|
||||
|
||||
--[371354] = {[131] = 1, [151] = 2, [174] = 3, [1] = 131, [2] = 151, [3] = 174}, --Phial of the Eye in the Storm
|
||||
|
||||
function Details.AuraTracker.RefreshScroll(self, data, offset, totalLines)
|
||||
@@ -273,8 +276,13 @@ function Details.AuraTracker.RefreshScroll(self, data, offset, totalLines)
|
||||
line.Icon.texture = auraInfo.icon
|
||||
line.Name.text = auraInfo.name
|
||||
line.SpellId.text = auraInfo.spellId
|
||||
line.LuaTableEntry.text = formatToLuaTable.doFormat5(auraInfo) --doFormat2NoIndex
|
||||
line.Points.text = formatToLuaTable.doFormat2NoIndexFromCache(auraInfo)
|
||||
local globalfunc = DETAILS_AURATRACKER_LUATABLE_FUNC
|
||||
line.LuaTableEntry.text = globalfunc and globalfunc(auraInfo) or formatToLuaTable.doFormat2NoIndex(auraInfo) --doFormat2NoIndex
|
||||
line.Points.text = formatToLuaTable.doFormat5(auraInfo)
|
||||
|
||||
line.Name:SetCursorPosition(0)
|
||||
line.LuaTableEntry:SetCursorPosition(0)
|
||||
line.Points:SetCursorPosition(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+72
-45
@@ -5,13 +5,20 @@ local DF = _G.DetailsFramework
|
||||
local openRaidLib = LibStub:GetLibrary("LibOpenRaid-1.0", true)
|
||||
|
||||
--namespace
|
||||
Details.CooldownTracking = {}
|
||||
Details.CooldownTracking = {
|
||||
cooldownPanels = {},
|
||||
}
|
||||
|
||||
--return if the cooldown tracker is enabled
|
||||
--return truen if the cooldown tracker is enabled
|
||||
function Details.CooldownTracking.IsEnabled()
|
||||
return Details.ocd_tracker.enabled
|
||||
end
|
||||
|
||||
--return a hash table with all cooldown panels created [filterName] = Frame
|
||||
function Details.CooldownTracking.GetAllPanels()
|
||||
return Details.CooldownTracking.cooldownPanels
|
||||
end
|
||||
|
||||
--enable the cooldown tracker
|
||||
function Details.CooldownTracking.EnableTracker()
|
||||
Details.ocd_tracker.enabled = true
|
||||
@@ -31,8 +38,9 @@ function Details.CooldownTracking.DisableTracker()
|
||||
Details.ocd_tracker.enabled = false
|
||||
|
||||
--hide the panel
|
||||
if (DetailsOnlineCDTrackerScreenPanel) then
|
||||
DetailsOnlineCDTrackerScreenPanel:Hide()
|
||||
local allPanels = Details.CooldownTracking.GetAllPanels()
|
||||
for filterName, frameObject in pairs(allPanels) do
|
||||
frameObject:Hide()
|
||||
end
|
||||
|
||||
--unregister callbacks
|
||||
@@ -59,7 +67,13 @@ end
|
||||
--@unitCooldows: a table with [spellId] = cooldownInfo
|
||||
--@allUnitsCooldowns: a table containing all units [unitName] = {[spellId] = cooldownInfo}
|
||||
function Details.CooldownTracking.OnReceiveSingleCooldownUpdate(unitId, spellId, cooldownInfo, unitCooldows, allUnitsCooldowns)
|
||||
local screenPanel = DetailsOnlineCDTrackerScreenPanel
|
||||
--TODO: make a function inside lib open raid to get the filters the cooldown is in
|
||||
--I dont known which panel will be used
|
||||
--need to get the filter name which that spell belong
|
||||
--and then check if that filter is enabled
|
||||
local allPanels = Details.CooldownTracking.GetAllPanels()
|
||||
|
||||
local screenPanel = allPanels["main"] --this should be replaced with the cooldown panel
|
||||
local gotUpdated = false
|
||||
local unitName = GetUnitName(unitId, true)
|
||||
|
||||
@@ -102,8 +116,10 @@ end
|
||||
|
||||
--Frames
|
||||
--hide all bars created
|
||||
function Details.CooldownTracking.HideAllBars()
|
||||
for _, bar in ipairs(DetailsOnlineCDTrackerScreenPanel.bars) do
|
||||
function Details.CooldownTracking.HideAllBars(filterName)
|
||||
filterName = filterName or "main"
|
||||
local allPanels = Details.CooldownTracking.GetAllPanels()
|
||||
for _, bar in ipairs(allPanels[filterName].bars) do
|
||||
bar:ClearAllPoints()
|
||||
bar:Hide()
|
||||
|
||||
@@ -126,49 +142,56 @@ end
|
||||
return cooldownFrame
|
||||
end
|
||||
|
||||
local eventFrame = CreateFrame("frame")
|
||||
eventFrame:RegisterEvent("GROUP_ROSTER_UPDATE")
|
||||
eventFrame:SetScript("OnShow", function()
|
||||
eventFrame:RegisterEvent("GROUP_ROSTER_UPDATE")
|
||||
end)
|
||||
|
||||
eventFrame:SetScript("OnHide", function()
|
||||
eventFrame:UnregisterEvent("GROUP_ROSTER_UPDATE")
|
||||
end)
|
||||
|
||||
eventFrame:SetScript("OnEvent", function(self, event)
|
||||
if (event == "GROUP_ROSTER_UPDATE") then
|
||||
if (eventFrame.scheduleRosterUpdate) then
|
||||
return
|
||||
end
|
||||
eventFrame.scheduleRosterUpdate = C_Timer.NewTimer(1, Details.CooldownTracking.RefreshCooldownFrames)
|
||||
end
|
||||
end)
|
||||
|
||||
--create the screen panel, goes into the UIParent and show cooldowns
|
||||
function Details.CooldownTracking.CreateScreenFrame()
|
||||
DetailsOnlineCDTrackerScreenPanel = CreateFrame("frame", "DetailsOnlineCDTrackerScreenPanel", UIParent, "BackdropTemplate")
|
||||
local screenPanel = DetailsOnlineCDTrackerScreenPanel
|
||||
screenPanel:Hide()
|
||||
screenPanel:SetSize(Details.ocd_tracker.width, Details.ocd_tracker.height)
|
||||
screenPanel:SetPoint("center", 0, 0)
|
||||
screenPanel:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
|
||||
screenPanel:SetBackdropColor(0, 0, 0, .55)
|
||||
screenPanel:SetBackdropBorderColor(0, 0, 0, .3)
|
||||
screenPanel:EnableMouse(true)
|
||||
function Details.CooldownTracking.CreateScreenFrame(filterName)
|
||||
filterName = filterName or "main"
|
||||
local frameName = "DetailsOnlineCDTrackerScreenPanel" .. filterName
|
||||
local cooldownPanel = CreateFrame("frame", frameName, UIParent, "BackdropTemplate")
|
||||
cooldownPanel:Hide()
|
||||
cooldownPanel:SetSize(Details.ocd_tracker.width, Details.ocd_tracker.height)
|
||||
cooldownPanel:SetPoint("center", 0, 0)
|
||||
DetailsFramework:ApplyStandardBackdrop(cooldownPanel)
|
||||
cooldownPanel:EnableMouse(true)
|
||||
|
||||
--register on libwindow
|
||||
local libWindow = LibStub("LibWindow-1.1")
|
||||
libWindow.RegisterConfig(screenPanel, _detalhes.ocd_tracker.pos)
|
||||
libWindow.MakeDraggable(screenPanel)
|
||||
libWindow.RestorePosition(screenPanel)
|
||||
Details.ocd_tracker.frames[filterName] = Details.ocd_tracker.frames[filterName] or {}
|
||||
libWindow.RegisterConfig(cooldownPanel, Details.ocd_tracker.frames[filterName])
|
||||
libWindow.MakeDraggable(cooldownPanel)
|
||||
libWindow.RestorePosition(cooldownPanel)
|
||||
|
||||
screenPanel:RegisterEvent("GROUP_ROSTER_UPDATE")
|
||||
screenPanel:SetScript("OnShow", function()
|
||||
screenPanel:RegisterEvent("GROUP_ROSTER_UPDATE")
|
||||
end)
|
||||
screenPanel:SetScript("OnHide", function()
|
||||
screenPanel:UnregisterEvent("GROUP_ROSTER_UPDATE")
|
||||
end)
|
||||
cooldownPanel.bars = {}
|
||||
cooldownPanel.cooldownCache = Details.ocd_tracker.current_cooldowns
|
||||
cooldownPanel.playerCache = {}
|
||||
cooldownPanel.statusBarFrameIndex = 1
|
||||
|
||||
screenPanel:SetScript("OnEvent", function(self, event)
|
||||
if (event == "GROUP_ROSTER_UPDATE") then
|
||||
if (screenPanel.scheduleRosterUpdate) then
|
||||
return
|
||||
end
|
||||
screenPanel.scheduleRosterUpdate = C_Timer.NewTimer(1, Details.CooldownTracking.RefreshCooldownFrames)
|
||||
end
|
||||
end)
|
||||
local allPanels = Details.CooldownTracking.GetAllPanels()
|
||||
allPanels[filterName] = cooldownPanel
|
||||
|
||||
screenPanel.bars = {}
|
||||
screenPanel.cooldownCache = Details.ocd_tracker.current_cooldowns
|
||||
screenPanel.playerCache = {}
|
||||
screenPanel.statusBarFrameIndex = 1
|
||||
|
||||
return screenPanel
|
||||
return cooldownPanel
|
||||
end
|
||||
|
||||
|
||||
|
||||
function Details.CooldownTracking.SetupCooldownFrame(cooldownFrame)
|
||||
local spellIcon = GetSpellTexture(cooldownFrame.spellId)
|
||||
if (spellIcon) then
|
||||
@@ -184,8 +207,10 @@ end
|
||||
function Details.CooldownTracking.ProcessUnitCooldowns(unitId, unitCooldowns, cooldownsOrganized)
|
||||
if (unitCooldowns) then
|
||||
local unitInfo = openRaidLib.GetUnitInfo(unitId)
|
||||
local filterName = false
|
||||
if (unitInfo) then
|
||||
local screenPanel = DetailsOnlineCDTrackerScreenPanel
|
||||
local allPanels = Details.CooldownTracking.GetAllPanels()
|
||||
local screenPanel = allPanels[filterName or "main"]
|
||||
for spellId, cooldownInfo in pairs(unitCooldowns) do
|
||||
--get a bar
|
||||
local cooldownFrame = Details.CooldownTracking.GetOrCreateNewCooldownFrame(screenPanel, screenPanel.statusBarFrameIndex)
|
||||
@@ -212,8 +237,9 @@ end
|
||||
end
|
||||
|
||||
--update cooldown frames based on the amount of players in the group or raid
|
||||
function Details.CooldownTracking.RefreshCooldownFrames()
|
||||
local screenPanel = DetailsOnlineCDTrackerScreenPanel
|
||||
function Details.CooldownTracking.RefreshCooldownFrames(filterName)
|
||||
local allPanels = Details.CooldownTracking.GetAllPanels()
|
||||
local screenPanel = allPanels[filterName or "main"]
|
||||
|
||||
if (not screenPanel) then
|
||||
screenPanel = Details.CooldownTracking.CreateScreenFrame()
|
||||
@@ -537,7 +563,8 @@ end
|
||||
|
||||
}
|
||||
|
||||
DF:BuildMenu(f, generalOptions, 5, -30, 150, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template)
|
||||
generalOptions.always_boxfirst = true
|
||||
DF:BuildMenu(f, generalOptions, 5, -30, 150, false, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template)
|
||||
|
||||
--cooldown selection
|
||||
local cooldownProfile = Details.ocd_tracker.cooldowns
|
||||
|
||||
@@ -28,6 +28,9 @@ local IsInInstance = _G.IsInInstance
|
||||
|
||||
local tokFunctions = Details.ToKFunctions
|
||||
|
||||
local _, Details222 = ...
|
||||
_ = nil
|
||||
|
||||
--constants
|
||||
local baseframe_strata = "LOW"
|
||||
local defaultBackdropSt = {
|
||||
@@ -7933,7 +7936,10 @@ function Details:RefreshTitleBarText()
|
||||
if (instanceMode == DETAILS_MODE_GROUP or instanceMode == DETAILS_MODE_ALL) then
|
||||
local segment = self:GetSegment()
|
||||
if (segment == DETAILS_SEGMENTID_OVERALL) then
|
||||
sName = sName .. " " .. Loc["STRING_OVERALL"]
|
||||
local dynamicOverallDataCustomID = Details222.GetCustomDisplayIDByName(Loc["STRING_CUSTOM_DYNAMICOVERAL"])
|
||||
if ((dynamicOverallDataCustomID ~= self.sub_atributo) and self.atributo ~= 5) then
|
||||
sName = sName .. " " .. Loc["STRING_OVERALL"]
|
||||
end
|
||||
|
||||
elseif (segment >= 2) then
|
||||
sName = sName .. " [" .. segment .. "]"
|
||||
|
||||
@@ -2,12 +2,17 @@
|
||||
local Details = _G.Details
|
||||
local Loc = LibStub("AceLocale-3.0"):GetLocale( "Details" )
|
||||
local gump = Details.gump
|
||||
local _
|
||||
local _, Details222 = ...
|
||||
_ = nil
|
||||
|
||||
function Details:OpenNewsWindow(textToShow, dumpValues, keeptext)
|
||||
Details.latest_news_saw = Details.userversion
|
||||
|
||||
local newsFrame = Details:CreateOrOpenNewsWindow()
|
||||
local animationHub = DetailsFramework:CreateAnimationHub(newsFrame)
|
||||
local fadeInAnim1 = DetailsFramework:CreateAnimation(animationHub, "alpha", 1, 0.2, 0, 0.2)
|
||||
local fadeInAnim2 = DetailsFramework:CreateAnimation(animationHub, "alpha", 2, 1.5, 0.5, 1)
|
||||
fadeInAnim2:SetStartDelay(1.3)
|
||||
|
||||
if (dumpValues == "change_log" or textToShow == "LeftButton") then
|
||||
newsFrame:Text (Loc ["STRING_VERSION_LOG"])
|
||||
@@ -57,6 +62,7 @@ function Details:OpenNewsWindow(textToShow, dumpValues, keeptext)
|
||||
end
|
||||
|
||||
newsFrame:Show()
|
||||
animationHub:Play()
|
||||
end
|
||||
|
||||
function Details:CreateOrOpenNewsWindow()
|
||||
|
||||
@@ -33,9 +33,9 @@ local Loc = _G.LibStub("AceLocale-3.0"):GetLocale("Details")
|
||||
local SharedMedia = _G.LibStub:GetLibrary("LibSharedMedia-3.0")
|
||||
local LDB = _G.LibStub("LibDataBroker-1.1", true)
|
||||
local LDBIcon = LDB and _G.LibStub("LibDBIcon-1.0", true)
|
||||
local _
|
||||
local addonName, Details222 = ...
|
||||
local _ = nil
|
||||
local unpack = _G.unpack
|
||||
|
||||
local tinsert = _G.tinsert
|
||||
|
||||
local startX = 200
|
||||
@@ -518,6 +518,17 @@ do
|
||||
desc = Loc ["STRING_OPTIONS_OVERALL_LOGOFF_DESC"],
|
||||
boxfirst = true,
|
||||
},
|
||||
{--auto switch to dynamic overall data when selecting overall data
|
||||
type = "toggle",
|
||||
get = function() return _detalhes.auto_swap_to_dynamic_overall end,
|
||||
set = function(self, fixedparam, value)
|
||||
Details.auto_swap_to_dynamic_overall = value
|
||||
afterUpdate()
|
||||
end,
|
||||
name = "Use Dynamic Overall Damage",
|
||||
desc = "When showing Damage Done Overall, swap to Dynamic Overall Damage on entering combat.",
|
||||
boxfirst = true,
|
||||
},
|
||||
|
||||
{type = "blank"},
|
||||
|
||||
|
||||
@@ -0,0 +1,523 @@
|
||||
|
||||
--whenever it say 'CombatID' it is referencing the Details! unique combatId
|
||||
--whenever it say 'SegmentID' it is referencing the internal chart data registered for some details! combat
|
||||
|
||||
local Details = _G.Details
|
||||
local detailsFramework = _G.DetailsFramework
|
||||
local addonName, detailsInternal = ...
|
||||
|
||||
local CONST_LATEST_SEGMENT = 1
|
||||
|
||||
local tinsert = table.insert
|
||||
local tremove = table.remove
|
||||
|
||||
local CONST_TICKER_NAME = "ChartDataTicker"
|
||||
local CONST_TICKER_INTERVAL = 3
|
||||
|
||||
--create the chart object
|
||||
detailsInternal.Charts = {}
|
||||
local chartsObject = detailsInternal.Charts
|
||||
|
||||
--store all segments data
|
||||
chartsObject.SegmentsData = {}
|
||||
--current segment being displayed in the charts
|
||||
chartsObject.SegmentOnVisualization = 0
|
||||
|
||||
--this table will hold the saved variable which tells which infomation to get during combat
|
||||
chartsObject.DataToCapture = {}
|
||||
|
||||
function chartsObject.GetConfigToCaptureData()
|
||||
return chartsObject.DataToCapture
|
||||
end
|
||||
|
||||
function chartsObject.SetConfigToCaptureData(configTable)
|
||||
chartsObject.DataToCapture = configTable
|
||||
end
|
||||
|
||||
function chartsObject.GetSavedVariable()
|
||||
return Details.data_harvested_for_charts
|
||||
end
|
||||
|
||||
function chartsObject.StoreChartsForCurrentCombat()
|
||||
local savedVariableTable = chartsObject.GetSavedVariable()
|
||||
|
||||
--Details.data_harvested_for_charts
|
||||
end
|
||||
|
||||
function chartsObject.BuildPlayersTable(playersTable)
|
||||
if (IsInRaid()) then
|
||||
for i = 1, GetNumGroupMembers() do
|
||||
local unitName = GetUnitName("raid" .. i, true)
|
||||
playersTable[unitName] = {}
|
||||
end
|
||||
|
||||
elseif (InIsParty()) then
|
||||
for i = 1, GetNumGroupMembers() - 1 do
|
||||
local unitName = GetUnitName("party" .. i, true)
|
||||
playersTable[unitName] = {}
|
||||
end
|
||||
playersTable[UnitName("player")] = {}
|
||||
else
|
||||
playersTable[UnitName("player")] = {}
|
||||
end
|
||||
end
|
||||
|
||||
function chartsObject.CreateTableToReceiveChartData()
|
||||
local t = {}
|
||||
|
||||
--get the list of players captures
|
||||
local configsForCaptureData = chartsObject.GetConfigToCaptureData()
|
||||
|
||||
--data set to capture data of each individual player
|
||||
local playerCaptures = configsForCaptureData.players
|
||||
--data set to capture data of some combat attribute or totals
|
||||
local combatTotalCaptures = configsForCaptureData.totals
|
||||
|
||||
if (#playerCaptures > 0) then
|
||||
t.players = {}
|
||||
for i = 1, #playerCaptures do
|
||||
local capturePreset = playerCaptures[i]
|
||||
local playersTable = {}
|
||||
t.players[capturePreset.name] = playersTable
|
||||
chartsObject.BuildPlayersTable(playersTable)
|
||||
end
|
||||
end
|
||||
|
||||
if (#combatTotalCaptures > 0) then
|
||||
t.totals = {}
|
||||
for i = 1, #combatTotalCaptures do
|
||||
local capturePreset = combatTotalCaptures[i]
|
||||
t.totals[capturePreset.name] = {}
|
||||
end
|
||||
end
|
||||
|
||||
return t
|
||||
end
|
||||
|
||||
--function to grab data during combat
|
||||
function chartsObject.Ticker()
|
||||
if (chartsObject.HasValidAndOpenCombat()) then
|
||||
--get Details! combat object
|
||||
local detaisCurrentCombat = Details:GetCurrentCombat()
|
||||
|
||||
--get the list of players captures
|
||||
local configsForCaptureData = chartsObject.GetConfigToCaptureData()
|
||||
|
||||
--data set to capture data of each individual player
|
||||
local playerCaptures = configsForCaptureData.players
|
||||
--data set to capture data of some combat attribute or totals
|
||||
local combatTotalCaptures = configsForCaptureData.totals
|
||||
|
||||
local currentSegmentData = chartsObject.GetCurrentSegmentData()
|
||||
local chartData = currentSegmentData.ChartData
|
||||
|
||||
if (#playerCaptures > 0) then
|
||||
--PAREI AQUI, PRECISA PEGAR O CAPTURE NAME, A TABELA COM OS NOMES DOS JOGADORES E PEGAR OS DADOS DO SEGMENTO DO DETAILS!
|
||||
--DEPOIS TEM QUE FECHAR ISSO AQUI E GRAGAR NO SEGMENT DA CHART
|
||||
--DEPOIS FAZER O MENU DE SELECIONAR O SEGMENTO MOSTRAR OS SEGMENTOS DO DETAILS PARA SELECIONAR
|
||||
--POR FIM PROGRAMAR AS CHARTS PRA MOSTRAR OS GRAFICOS
|
||||
for i = 1, #playerCaptures do
|
||||
local capturePreset = playerCaptures[i]
|
||||
local thisCaptureTable = chartData[capturePreset.Name]
|
||||
t.players[capturePreset.name] = playersTable
|
||||
chartsObject.BuildPlayersTable(playersTable)
|
||||
end
|
||||
end
|
||||
|
||||
if (#combatTotalCaptures > 0) then
|
||||
t.totals = {}
|
||||
for i = 1, #combatTotalCaptures do
|
||||
local capturePreset = combatTotalCaptures[i]
|
||||
t.totals[capturePreset.name] = {}
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, #playerCaptures do
|
||||
local capturePreset = playerCaptures[i]
|
||||
if (capturePreset.combatObjectSubTable) then
|
||||
local subTable = detaisCurrentCombat[capturePreset.combatObjectSubTableName]
|
||||
local value = subTable[capturePreset.combatObjectSubTableKey]
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--[=[]]
|
||||
players = {
|
||||
--damage done by each player
|
||||
{
|
||||
name = "Damage of Each Individual Player",
|
||||
combatObjectContainer = 1,
|
||||
playerOnly = true,
|
||||
playerKey = "total",
|
||||
},
|
||||
|
||||
--total damage done by the raid group
|
||||
{
|
||||
name = "Damage of All Player Combined",
|
||||
combatObjectSubTableName = "totals",
|
||||
combatObjectSubTableKey = 1,
|
||||
},
|
||||
},
|
||||
--]=]
|
||||
|
||||
function chartsObject.GetConfigToDataCaptureFromDetailsOptions()
|
||||
local detailsObject = Details
|
||||
local configTable = detailsObject.data_harvest_for_charsts
|
||||
chartsObject.SetConfigToCaptureData(configTable)
|
||||
end
|
||||
|
||||
function chartsObject.StartCombatDataTicker()
|
||||
detailsInternal.Scheduler.NewTicker(CONST_TICKER_INTERVAL, chartsObject.Ticker, CONST_TICKER_NAME)
|
||||
end
|
||||
|
||||
function chartsObject.StopCombatDataTicker()
|
||||
detailsInternal.Scheduler.Cancel(CONST_TICKER_NAME)
|
||||
end
|
||||
|
||||
--get a segment combat data
|
||||
function chartsObject.GetSegmentsCombatData(combatIndex)
|
||||
return chartsObject.SegmentsData[combatIndex]
|
||||
end
|
||||
|
||||
--get a segment combat data by Details! combatId
|
||||
function chartsObject.GetSegmentCombatDataByDetailsCombatID(detailsCombatId)
|
||||
for i = 1, chartsObject.GetNumSegments() do
|
||||
local thisSegmentCombatData = chartsObject.SegmentsData[i]
|
||||
if (thisSegmentCombatData.detailsCombatID == detailsCombatId) then
|
||||
return thisSegmentCombatData
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--select a combat to make the chart frames show
|
||||
function chartsObject.SelectSegmentDataToShow(segmentId)
|
||||
segmentId = segmentId or CONST_LATEST_SEGMENT
|
||||
local numSegments = chartsObject.GetNumSegments()
|
||||
if (numSegments > 0) then
|
||||
--pre step before calling the function which will signal the frame to update
|
||||
chartsObject.ChartFramesShowSegment(CONST_LATEST_SEGMENT)
|
||||
else
|
||||
chartsObject.ChartFramesClear()
|
||||
end
|
||||
end
|
||||
|
||||
function chartsObject.ChartFramesClear()
|
||||
--pre step before calling the function which will signal the frame to update
|
||||
chartsObject.ChartFramesShowSegment(0)
|
||||
end
|
||||
|
||||
--this function shouldn't be called directly, always call from SelectSegmentDataToShow or ChartFramesClear
|
||||
function chartsObject.ChartFramesShowSegment(segmentId)
|
||||
--set the combat data into the charts
|
||||
chartsObject.SegmentOnVisualization = segmentId
|
||||
--here go into the frames created and call refresh using the segment data
|
||||
|
||||
local segmentCombatData = chartsObject.GetSegmentsCombatData(segmentId)
|
||||
if (segmentCombatData) then
|
||||
--this is the lowest function and will call the frame api to refresh the data
|
||||
else
|
||||
chartsObject.SegmentOnVisualization = 0
|
||||
--this is the lowest function and will call the frame api to refresh the data
|
||||
end
|
||||
end
|
||||
|
||||
--called when Details! reset the data
|
||||
function chartsObject.ResetSegmentData()
|
||||
wipe(chartsObject.SegmentsData)
|
||||
|
||||
--stop the ticker
|
||||
chartsObject.StopCombatDataTicker()
|
||||
--don't allow anything to be process under the start of a new combat
|
||||
chartsObject.SetCombatState(false)
|
||||
--signal the frames to update and shown no data
|
||||
chartsObject.ChartFramesClear()
|
||||
end
|
||||
|
||||
--set the combat state
|
||||
function chartsObject.SetCombatState(state)
|
||||
chartsObject.InCombat = state
|
||||
end
|
||||
|
||||
function chartsObject.HasValidAndOpenCombat()
|
||||
local bCombatState = chartsObject.GetCombatState()
|
||||
if (bCombatState) then
|
||||
local detaisCurrentCombat = Details:GetCurrentCombat()
|
||||
local chartCurrentSegmentData = chartsObject.GetCurrentSegmentData()
|
||||
if (detaisCurrentCombat:GetCombatId() == chartCurrentSegmentData:GetCombatId()) then
|
||||
--it's all good
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--return true if in combat
|
||||
function chartsObject.GetCombatState()
|
||||
return chartsObject.InCombat
|
||||
end
|
||||
|
||||
function chartsObject.RemoveSegmentData(segmentId)
|
||||
tremove(chartsObject.SegmentsData, segmentId)
|
||||
chartsObject.SelectSegmentDataToShow(CONST_LATEST_SEGMENT)
|
||||
end
|
||||
|
||||
function chartsObject.GetNumSegments()
|
||||
return #chartsObject.SegmentsData
|
||||
end
|
||||
|
||||
function chartsObject.GetCurrentSegmentData()
|
||||
return chartsObject.segmentData
|
||||
end
|
||||
|
||||
--add the new combatData into the first index
|
||||
local segmentDataMixin = {
|
||||
GetCombatId = function(self)
|
||||
return self.detailsCombatID
|
||||
end,
|
||||
}
|
||||
|
||||
--this is called when the player enter in combat
|
||||
function chartsObject.CreateNewSegmentData(detailsCombatObject)
|
||||
chartsObject.segmentData = {
|
||||
--players Damage for the segment
|
||||
PlayersDamage = {},
|
||||
--players Healing for the segment
|
||||
PlayersHealing = {},
|
||||
--each index is a boss fight
|
||||
BossTryDamage = 0,
|
||||
--blood lust timer
|
||||
BloodLustTimers = {},
|
||||
--combatId
|
||||
detailsCombatID = detailsCombatObject:GetCombatId(),
|
||||
--charts data captured
|
||||
ChartData = chartsObject.CreateTableToReceiveChartData(),
|
||||
}
|
||||
|
||||
detailsFramework:Mixin(chartsObject.segmentData, segmentDataMixin)
|
||||
tinsert(chartsObject.SegmentsData, 1, chartsObject.segmentData)
|
||||
|
||||
chartsObject.GetConfigToDataCaptureFromDetailsOptions()
|
||||
chartsObject.SetCombatState(true)
|
||||
chartsObject.StartCombatDataTicker()
|
||||
|
||||
return chartsObject.segmentData
|
||||
end
|
||||
|
||||
--when a combat is finished, close and store the current combatData
|
||||
function chartsObject.CloseSegmentData(bIsInvalid)
|
||||
--in case a combat_invalid passed by here first
|
||||
if (not chartsObject.GetCombatState()) then
|
||||
return
|
||||
end
|
||||
|
||||
chartsObject.StopCombatDataTicker()
|
||||
chartsObject.SetCombatState(false)
|
||||
|
||||
local currentCombat = chartsObject.GetSegmentsCombatData(1)
|
||||
currentCombat.Done = true
|
||||
|
||||
if (bIsInvalid) then
|
||||
currentCombat.Invalid = true
|
||||
chartsObject.RemoveSegmentData(1)
|
||||
else
|
||||
--check if the window is opened and update the chart current in sight
|
||||
end
|
||||
end
|
||||
|
||||
--Details Events:
|
||||
function chartsObject.OnDetailsEvent(event, ...)
|
||||
if (event == "COMBAT_PLAYER_ENTER") then --> combat started
|
||||
local combatObject = select(1, ...)
|
||||
if (not combatObject and Details) then
|
||||
combatObject = Details:GetCurrentCombat()
|
||||
if (not combatObject) then
|
||||
return
|
||||
end
|
||||
end
|
||||
chartsObject.CreateNewSegmentData(combatObject)
|
||||
|
||||
elseif (event == "COMBAT_PLAYER_LEAVE") then
|
||||
chartsObject.CloseSegmentData()
|
||||
|
||||
elseif (event == "DETAILS_DATA_RESET") then
|
||||
chartsObject.ResetSegmentData()
|
||||
|
||||
elseif (event == "COMBAT_INVALID") then
|
||||
local bIsInvalid = true
|
||||
chartsObject.CloseSegmentData(bIsInvalid)
|
||||
|
||||
elseif (event == "DETAILS_STARTED") then
|
||||
--install the new tab on the Player Breakdown
|
||||
chartsObject.InstallTab()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local eventListener = Details:CreateEventListener()
|
||||
eventListener:RegisterEvent("COMBAT_PLAYER_ENTER", chartsObject.OnDetailsEvent)
|
||||
eventListener:RegisterEvent("COMBAT_PLAYER_LEAVE", chartsObject.OnDetailsEvent)
|
||||
eventListener:RegisterEvent("DETAILS_DATA_RESET", chartsObject.OnDetailsEvent)
|
||||
eventListener:RegisterEvent("COMBAT_INVALID", chartsObject.OnDetailsEvent)
|
||||
eventListener:RegisterEvent("DETAILS_STARTED", chartsObject.OnDetailsEvent)
|
||||
|
||||
function chartsObject.InstallTab()
|
||||
local tabName = "Charts"
|
||||
local tabNameLoc = "Damage Charts"
|
||||
|
||||
local canShowTab = function(tabOBject, playerObject)
|
||||
local combatObject = Details:GetCombatFromBreakdownWindow()
|
||||
if (combatObject) then
|
||||
local chartsCombatData = chartsObject.GetSegmentCombatDataByDetailsCombatID(combatObject:GetCombatId())
|
||||
if (chartsCombatData) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local fillTab = function(tab, playerObject, combat)
|
||||
--update the tab frame with information
|
||||
|
||||
end
|
||||
|
||||
local createdChartsTab = function(tab, frame)
|
||||
chartsObject.CreateChartFrames(tab, frame)
|
||||
end
|
||||
|
||||
local iconSettings = {
|
||||
texture = [[Interface\BUTTONS\UI-GuildButton-OfficerNote-Disabled]],
|
||||
coords = {0, 1, 0, 1},
|
||||
width = 16,
|
||||
height = 16,
|
||||
}
|
||||
|
||||
Details:CreatePlayerDetailsTab(tabName, tabNameLoc, canShowTab, fillTab, nil, createdChartsTab, iconSettings)
|
||||
end
|
||||
|
||||
|
||||
function chartsObject.CreateChartFrames(tab, tabFrame)
|
||||
|
||||
--First Option: each player dps chart on each segment, this show the evolution of damage of each player
|
||||
--Second Option: Total Damage Done by the entire raid comparing with other segments (one line of raid damage per segment)
|
||||
--Thrid Option: your damage compared with other of the same class (chart damage of each player required)
|
||||
--Your habilites compared segment by segment (no chart data required)
|
||||
|
||||
--segment scroll in the left
|
||||
--boss image, boss name,
|
||||
|
||||
--when selecting a boss show the chart for the boss
|
||||
|
||||
local defaultChartSections = {
|
||||
{
|
||||
Name = "Raid Damage",
|
||||
ChartID = 1,
|
||||
ChartData = "alldamagers-segment",
|
||||
},
|
||||
{
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
local scrollWidth = 200
|
||||
local scrollHeight = 500
|
||||
local scrollButtonHeight = 20
|
||||
local amountScrollLines = floor(scrollHeight / scrollButtonHeight)
|
||||
local allLinesCreated = {}
|
||||
local lineSelectedBackdropColor = {.5, .5, .5, .5}
|
||||
|
||||
local onClickLine_SelectChartToView = function(button, mouseButton)
|
||||
for buttonId, line in ipairs(allLinesCreated) do
|
||||
line:SetDefaultBackdropColor()
|
||||
end
|
||||
end
|
||||
|
||||
local lineMixin = {
|
||||
SetDefaultBackdropColor = function(line)
|
||||
line.__background:SetVertexColor(unpack(line.defaultBackgroundColor))
|
||||
end,
|
||||
|
||||
SetSelectedBackdropColor = function(line)
|
||||
line.__background:SetVertexColor(unpack(lineSelectedBackdropColor))
|
||||
end,
|
||||
|
||||
OnClickLine = function(line)
|
||||
--select the chart to view
|
||||
end,
|
||||
}
|
||||
|
||||
--function to create a line in the scroll frame
|
||||
local createScrollLine = function(self, index)
|
||||
--create a new line
|
||||
local line = CreateFrame("button", "$parentLine" .. index, self, "BackdropTemplate")
|
||||
detailsFramework:Mixin(line, lineMixin)
|
||||
|
||||
--set its parameters
|
||||
line:SetPoint("topleft", self, "topleft", 1, -((index-1) * (scrollButtonHeight+1)) - 1)
|
||||
line:SetSize(scrollWidth-19, scrollButtonHeight)
|
||||
line:RegisterForClicks("LeftButtonDown", "RightButtonDown")
|
||||
|
||||
line:SetScript("OnClick", line.OnClickLine)
|
||||
|
||||
detailsFramework:ApplyStandardBackdrop(line)
|
||||
line.defaultBackgroundColor = {line.__background:GetVertexColor()}
|
||||
|
||||
local icon = line:CreateTexture("$parentSpecIcon", "artwork")
|
||||
icon:SetSize(scrollButtonHeight, scrollButtonHeight)
|
||||
icon:SetAlpha(0.71)
|
||||
|
||||
local chartData = defaultChartSections[index]
|
||||
local chartName = detailsFramework:CreateLabel(line, chartData.Name, 11, "white", "GameFontNormal")
|
||||
|
||||
icon:SetPoint("left", line, "left", 0, 0)
|
||||
chartName:SetPoint("topleft", icon, "topright", 2, -3)
|
||||
|
||||
line.Icon = icon
|
||||
line.ChartName = chartName
|
||||
return line
|
||||
end
|
||||
|
||||
local refreshScroll = function(self, data, offset, totalLines)
|
||||
for i = 1, totalLines do
|
||||
local index = i + offset
|
||||
local chartData = data[index]
|
||||
if (chartData) then
|
||||
local line = self:GetLine(i)
|
||||
line.ChartID = chartData.ChartID
|
||||
line.ChartData = chartData.ChartData
|
||||
line.ChartName.text = chartData.Name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Create the scrollbox showing the selection for charts
|
||||
local chartSelectionScrollBox = detailsFramework:CreateScrollBox(
|
||||
tabFrame,
|
||||
"$parentChartSelectionScroll",
|
||||
refreshScroll,
|
||||
{},
|
||||
scrollWidth,
|
||||
scrollHeight,
|
||||
amountScrollLines,
|
||||
scrollButtonHeight
|
||||
)
|
||||
|
||||
detailsFramework:ReskinSlider(chartSelectionScrollBox)
|
||||
chartSelectionScrollBox.ScrollBar:ClearAllPoints()
|
||||
chartSelectionScrollBox.ScrollBar:SetPoint("topright", chartSelectionScrollBox, "topright", -2, -17)
|
||||
chartSelectionScrollBox.ScrollBar:SetPoint("bottomright", chartSelectionScrollBox, "bottomright", -2, 17)
|
||||
chartSelectionScrollBox:SetPoint("topright", tabFrame, "topleft", -1, 0)
|
||||
chartSelectionScrollBox:SetPoint("bottomright", tabFrame, "bottomleft", -1, 0)
|
||||
|
||||
detailsFramework:ApplyStandardBackdrop(chartSelectionScrollBox)
|
||||
|
||||
tabFrame.chartSelectionScrollBox = chartSelectionScrollBox
|
||||
|
||||
--create the scrollbox lines
|
||||
for i = 1, amountScrollLines do
|
||||
chartSelectionScrollBox:CreateLine(createScrollLine)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -2,18 +2,24 @@
|
||||
|
||||
local Details = _G.Details
|
||||
local DF = _G.DetailsFramework
|
||||
local _
|
||||
local _, Details222 = ...
|
||||
_ = nil
|
||||
local _GetSpellInfo = Details.GetSpellInfo
|
||||
|
||||
function Details:ScrollDamage()
|
||||
if (not DetailsScrollDamage) then
|
||||
DetailsScrollDamage = DetailsFramework:CreateSimplePanel(UIParent)
|
||||
DetailsScrollDamage:SetSize(427 - 40 - 20 - 20, 505 - 150 + 20 + 40)
|
||||
DetailsScrollDamage:SetTitle("Details! Scroll Damage (/details scroll)")
|
||||
DetailsScrollDamage:SetTitle("/details scroll")
|
||||
DetailsScrollDamage.Data = {}
|
||||
DetailsScrollDamage:ClearAllPoints()
|
||||
DetailsScrollDamage:SetPoint("left", UIParent, "left", 10, 0)
|
||||
DetailsScrollDamage:Hide()
|
||||
|
||||
DetailsScrollDamage.Title:SetPoint("center", DetailsScrollDamage.TitleBar, "center", 108, 0)
|
||||
|
||||
DetailsFramework:ApplyStandardBackdrop(DetailsScrollDamage)
|
||||
|
||||
local scroll_width = 395 - 40 - 20 - 20
|
||||
local scroll_height = 340
|
||||
local scroll_lines = 16
|
||||
@@ -24,9 +30,12 @@ function Details:ScrollDamage()
|
||||
local backdrop_color_is_critical = {.4, .4, .2, 0.2}
|
||||
local backdrop_color_is_critical_on_enter = {1, 1, .8, 0.4}
|
||||
|
||||
local dropdownTemplate = DetailsFramework:GetTemplate("dropdown", "OPTIONS_DROPDOWNDARK_TEMPLATE")
|
||||
|
||||
local y = -15
|
||||
local headerY = y - 15
|
||||
local scrollY = headerY - 20
|
||||
local fontSize = 10
|
||||
|
||||
local LibWindow = _G.LibStub("LibWindow-1.1")
|
||||
DetailsScrollDamage:SetScript("OnMouseDown", nil)
|
||||
@@ -43,12 +52,15 @@ function Details:ScrollDamage()
|
||||
LibWindow.MakeDraggable(DetailsScrollDamage)
|
||||
LibWindow.RestorePosition(DetailsScrollDamage)
|
||||
|
||||
local scaleBar = DetailsFramework:CreateScaleBar(DetailsScrollDamage, Details.damage_scroll_position)
|
||||
DetailsScrollDamage:SetScale(Details.damage_scroll_position.scale)
|
||||
|
||||
--header
|
||||
local headerTable = {
|
||||
{text = "", width = 20},
|
||||
{text = "Spell Name", width = 104},
|
||||
{text = "Amount", width = 60},
|
||||
{text = "Time", width = 60},
|
||||
{text = "Time", width = 45},
|
||||
{text = "Spell ID", width = 80},
|
||||
}
|
||||
local headerOptions = {
|
||||
@@ -60,7 +72,7 @@ function Details:ScrollDamage()
|
||||
DetailsScrollDamage.searchText = ""
|
||||
DetailsScrollDamage.searchCache = {}
|
||||
|
||||
local refreshFunc = function(self, data, offset, totalLines)
|
||||
local refreshFunc = function(self, data, offset, totalLines) --~refresh
|
||||
local ToK = _detalhes:GetCurrentToKFunction()
|
||||
|
||||
for i = 1, totalLines do
|
||||
@@ -74,13 +86,14 @@ function Details:ScrollDamage()
|
||||
local spellName, _, spellIcon
|
||||
|
||||
if (token ~= "SWING_DAMAGE") then
|
||||
spellName, _, spellIcon = GetSpellInfo(spellID)
|
||||
spellName, _, spellIcon = _GetSpellInfo(spellID)
|
||||
else
|
||||
spellName, _, spellIcon = GetSpellInfo(1)
|
||||
spellName, _, spellIcon = _GetSpellInfo(1)
|
||||
end
|
||||
|
||||
line.SpellID = spellID
|
||||
line.IsCritical = isCritical
|
||||
line.IconFrame.SpellID = spellID
|
||||
|
||||
if (isCritical) then
|
||||
line:SetBackdropColor(unpack(backdrop_color_is_critical))
|
||||
@@ -91,11 +104,12 @@ function Details:ScrollDamage()
|
||||
if (spellName) then
|
||||
line.Icon:SetTexture(spellIcon)
|
||||
line.Icon:SetTexCoord(.1, .9, .1, .9)
|
||||
line.DamageText.text = isCritical and "|cFFFFFF00" .. ToK(_, amount) or ToK(_, amount)
|
||||
line.TimeText.text = format("%.2f", time - DetailsScrollDamage.Data.Started)
|
||||
line.DamageText.text = isCritical and "|cFFFFFF00 " .. ToK(_, amount) or " " .. ToK(_, amount)
|
||||
line.TimeText.text = " " .. format("%.2f", time - DetailsScrollDamage.Data.Started)
|
||||
line.SpellIDText.text = spellID
|
||||
line.SpellIDText:SetCursorPosition(0)
|
||||
line.SpellNameText.text = spellName
|
||||
DF:TruncateText(line.SpellNameText, 104)
|
||||
line.SpellNameText:SetCursorPosition(0)
|
||||
else
|
||||
line:Hide()
|
||||
end
|
||||
@@ -103,41 +117,45 @@ function Details:ScrollDamage()
|
||||
end
|
||||
end
|
||||
|
||||
local lineOnEnter = function(self)
|
||||
local lineOnEnter = function(self) --~onenter
|
||||
--if this does not have IconFrame it means it is the IconFrame itself
|
||||
if (not self.IconFrame) then
|
||||
GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT")
|
||||
GameTooltip:SetSpellByID(self.SpellID)
|
||||
GameTooltip:AddLine(" ")
|
||||
GameTooltip:Show()
|
||||
|
||||
self = self:GetParent()
|
||||
end
|
||||
|
||||
if (self.IsCritical) then
|
||||
self:SetBackdropColor(unpack(backdrop_color_is_critical_on_enter))
|
||||
else
|
||||
self:SetBackdropColor(unpack(backdrop_color_on_enter))
|
||||
end
|
||||
|
||||
if (self.SpellID) then
|
||||
--spell tooltip removed, it's to much annoying
|
||||
--GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT")
|
||||
--GameTooltip:SetSpellByID(self.SpellID)
|
||||
--GameTooltip:AddLine(" ")
|
||||
--GameTooltip:Show()
|
||||
end
|
||||
end
|
||||
|
||||
local lineOnLeave = function(self)
|
||||
if (self.IsCritical) then
|
||||
self:SetBackdropColor(unpack(backdrop_color_is_critical))
|
||||
else
|
||||
self:SetBackdropColor(unpack(backdrop_color))
|
||||
local lineOnLeave = function(self) --~onleave
|
||||
--if this has an icon frame it means its the line itself
|
||||
if (self.IconFrame) then
|
||||
if (self.IsCritical) then
|
||||
self:SetBackdropColor(unpack(backdrop_color_is_critical))
|
||||
else
|
||||
self:SetBackdropColor(unpack(backdrop_color))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
GameTooltip:Hide()
|
||||
end
|
||||
|
||||
local createLineFunc = function(self, index)
|
||||
|
||||
local line = CreateFrame("button", "$parentLine" .. index, self,"BackdropTemplate")
|
||||
line:SetPoint("topleft", self, "topleft", 1, -((index-1)*(scroll_line_height+1)) - 1)
|
||||
line:SetSize(scroll_width - 2, scroll_line_height)
|
||||
|
||||
line:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
|
||||
line:SetBackdropColor(unpack(backdrop_color))
|
||||
|
||||
-- ~createline --~line
|
||||
DF:Mixin(line, DF.HeaderFunctions)
|
||||
|
||||
line:SetScript("OnEnter", lineOnEnter)
|
||||
@@ -147,17 +165,22 @@ function Details:ScrollDamage()
|
||||
local icon = line:CreateTexture("$parentSpellIcon", "overlay")
|
||||
icon:SetSize(scroll_line_height - 2, scroll_line_height - 2)
|
||||
|
||||
local iconFrame = CreateFrame("frame", "$parentIconFrame", line)
|
||||
iconFrame:SetAllPoints(icon)
|
||||
iconFrame:SetScript("OnEnter", lineOnEnter)
|
||||
iconFrame:SetScript("OnLeave", lineOnLeave)
|
||||
|
||||
--spellname
|
||||
local spellNameText = DF:CreateLabel(line)
|
||||
local spellNameText = DetailsFramework:CreateTextEntry(line, function()end, DetailsScrollDamage.Header:GetColumnWidth(2), scroll_line_height, _, _, _, dropdownTemplate)
|
||||
|
||||
--damage
|
||||
local damageText = DF:CreateLabel(line)
|
||||
local damageText = DF:CreateLabel(line, "", fontSize, "white")
|
||||
|
||||
--time
|
||||
local timeText = DF:CreateLabel(line)
|
||||
local timeText = DF:CreateLabel(line, "", fontSize, "white")
|
||||
|
||||
--spell ID
|
||||
local spellIDText = DF:CreateLabel(line)
|
||||
local spellIDText = DetailsFramework:CreateTextEntry(line, function()end, DetailsScrollDamage.Header:GetColumnWidth(5), scroll_line_height, _, _, _, dropdownTemplate)
|
||||
|
||||
line:AddFrameToHeaderAlignment(icon)
|
||||
line:AddFrameToHeaderAlignment(spellNameText)
|
||||
@@ -168,6 +191,7 @@ function Details:ScrollDamage()
|
||||
line:AlignWithHeader(DetailsScrollDamage.Header, "left")
|
||||
|
||||
line.Icon = icon
|
||||
line.IconFrame = iconFrame
|
||||
line.DamageText = damageText
|
||||
line.TimeText = timeText
|
||||
line.SpellIDText = spellIDText
|
||||
@@ -251,7 +275,7 @@ function Details:ScrollDamage()
|
||||
autoOpenCheckbox:SetAsCheckBox()
|
||||
autoOpenCheckbox:SetPoint("left", statusBar, "left", 5, 0)
|
||||
|
||||
local autoOpenText = DetailsFramework:CreateLabel(statusBar, "Auto Open on Training Dummy")
|
||||
local autoOpenText = DetailsFramework:CreateLabel(statusBar, "Auto Open on Training Dummy", 10)
|
||||
autoOpenText:SetPoint("left", autoOpenCheckbox, "right", 2, 0)
|
||||
|
||||
--search bar
|
||||
|
||||
Reference in New Issue
Block a user