More development on the new breakdown window

This commit is contained in:
Tercio Jose
2023-04-12 22:41:34 -03:00
parent f947e26945
commit f735cb63bd
8 changed files with 234 additions and 161 deletions
+5
View File
@@ -279,6 +279,11 @@
---@field GetSpellSchoolFormatedName fun(self: details, spellschool: number) : string
---@field CommaValue fun(self: details, number: number) : string
---@field SumSpellTables fun(self: details, spellTables: spelltable[], targetTable: table)
---@field CreateEventListener fun(self: details) : table
---@class detailseventlistener : table
---@field RegisterEvent fun(self: detailseventlistener, event: "DETAILS_INSTANCE_OPEN"|"DETAILS_INSTANCE_CLOSE"|"DETAILS_INSTANCE_SIZECHANGED"|"DETAILS_INSTANCE_STARTRESIZE"|"DETAILS_INSTANCE_ENDRESIZE"|"DETAILS_INSTANCE_STARTSTRETCH"|"DETAILS_INSTANCE_ENDSTRETCH"|"DETAILS_INSTANCE_CHANGESEGMENT"|"DETAILS_INSTANCE_CHANGEATTRIBUTE"|"DETAILS_INSTANCE_CHANGEMODE"|"DETAILS_INSTANCE_NEWROW"|"DETAILS_OPTIONS_MODIFIED"|"DETAILS_DATA_RESET"|"DETAILS_DATA_SEGMENTREMOVED"|"COMBAT_ENCOUNTER_START"|"COMBAT_ENCOUNTER_END"|"COMBAT_PLAYER_ENTER"|"COMBAT_PLAYER_LEAVE"|"COMBAT_PLAYER_TIMESTARTED"|"COMBAT_BOSS_WIPE"|"COMBAT_BOSS_DEFEATED"|"COMBAT_BOSS_FOUND"|"COMBAT_INVALID"|"COMBAT_PREPOTION_UPDATED"|"COMBAT_CHARTTABLES_CREATING"|"COMBAT_CHARTTABLES_CREATED"|"COMBAT_ENCOUNTER_PHASE_CHANGED"|"COMBAT_ARENA_START"|"COMBAT_ARENA_END"|"COMBAT_MYTHICDUNGEON_START"|"COMBAT_MYTHICDUNGEON_END"|"GROUP_ONENTER"|"GROUP_ONLEAVE"|"ZONE_TYPE_CHANGED"|"REALM_CHANNEL_ENTER"|"REALM_CHANNEL_LEAVE"|"COMM_EVENT_RECEIVED"|"COMM_EVENT_SENT"|"UNIT_SPEC"|"UNIT_TALENTS"|"PLAYER_TARGET"|"DETAILS_PROFILE_APPLYED", callback: function)
---@field UnregisterEvent fun(self: detailseventlistener, event: "DETAILS_INSTANCE_OPEN"|"DETAILS_INSTANCE_CLOSE"|"DETAILS_INSTANCE_SIZECHANGED"|"DETAILS_INSTANCE_STARTRESIZE"|"DETAILS_INSTANCE_ENDRESIZE"|"DETAILS_INSTANCE_STARTSTRETCH"|"DETAILS_INSTANCE_ENDSTRETCH"|"DETAILS_INSTANCE_CHANGESEGMENT"|"DETAILS_INSTANCE_CHANGEATTRIBUTE"|"DETAILS_INSTANCE_CHANGEMODE"|"DETAILS_INSTANCE_NEWROW"|"DETAILS_OPTIONS_MODIFIED"|"DETAILS_DATA_RESET"|"DETAILS_DATA_SEGMENTREMOVED"|"COMBAT_ENCOUNTER_START"|"COMBAT_ENCOUNTER_END"|"COMBAT_PLAYER_ENTER"|"COMBAT_PLAYER_LEAVE"|"COMBAT_PLAYER_TIMESTARTED"|"COMBAT_BOSS_WIPE"|"COMBAT_BOSS_DEFEATED"|"COMBAT_BOSS_FOUND"|"COMBAT_INVALID"|"COMBAT_PREPOTION_UPDATED"|"COMBAT_CHARTTABLES_CREATING"|"COMBAT_CHARTTABLES_CREATED"|"COMBAT_ENCOUNTER_PHASE_CHANGED"|"COMBAT_ARENA_START"|"COMBAT_ARENA_END"|"COMBAT_MYTHICDUNGEON_START"|"COMBAT_MYTHICDUNGEON_END"|"GROUP_ONENTER"|"GROUP_ONLEAVE"|"ZONE_TYPE_CHANGED"|"REALM_CHANNEL_ENTER"|"REALM_CHANNEL_LEAVE"|"COMM_EVENT_RECEIVED"|"COMM_EVENT_SENT"|"UNIT_SPEC"|"UNIT_TALENTS"|"PLAYER_TARGET"|"DETAILS_PROFILE_APPLYED")
---@class combat : table
---@field GetCombatTime fun(combat)
+3 -1
View File
@@ -426,7 +426,9 @@ detailsFramework.ScrollBoxFunctions = {
--hide all frames and tag as not in use
self._LinesInUse = 0
for index, frame in ipairs(self.Frames) do
frame:Hide()
if (not self.DontHideChildrenOnPreRefresh) then
frame:Hide()
end
frame._InUse = nil
end
+3 -2
View File
@@ -3889,6 +3889,7 @@ function detailsFramework:CreateScrollBox(parent, name, refreshFunc, data, width
scroll.Frames = {}
scroll.ReajustNumFrames = autoAmount
scroll.CreateLineFunc = createLineFunc
scroll.DontHideChildrenOnPreRefresh = false
detailsFramework:Mixin(scroll, detailsFramework.SortFunctions)
detailsFramework:Mixin(scroll, detailsFramework.ScrollBoxFunctions)
@@ -5515,13 +5516,13 @@ detailsFramework.HeaderCoreFunctions = {
resizerButton:SetScript("OnMouseDown", function()
newHeader.bIsRezising = true
print(1)
--newHeader:StartSizing("right")
newHeader:StartSizing("right")
end)
resizerButton:SetScript("OnMouseUp", function()
newHeader.bIsRezising = false
print(2)
--newHeader:StopMovingOrSizing()
newHeader:StopMovingOrSizing()
end)
resizerButton.texture = resizerButton:CreateTexture(nil, "overlay")
+25 -19
View File
@@ -7,14 +7,17 @@ local gump = Details.gump
local _
local addonName, Details222 = ...
--lua locals
--remove warnings in the code
local ipairs = ipairs
local pairs = pairs
local tinsert = tinsert
local tremove = tremove
local type = type
local unpack = _G.unpack
--api locals
local PixelUtil = PixelUtil
local UISpecialFrames = UISpecialFrames
local wipe = wipe
local CreateFrame = _G.CreateFrame
local subAttributes = Details.sub_atributos
local breakdownWindow = Details.playerDetailWindow
@@ -220,7 +223,7 @@ function Details:OpenBreakdownWindow(instanceObject, actorObject, bFromAttribute
--spellsTab.ResetBars() --to be implemented
---@type string
local actorClass = actorObject.classe
local actorClass = actorObject.classe --classe not registered because it should be renamed to english
if (not actorClass) then
actorClass = "monster"
@@ -239,7 +242,7 @@ function Details:OpenBreakdownWindow(instanceObject, actorObject, bFromAttribute
local tabsReplaced = {}
local tabReplacedAmount = 0
table.wipe(breakdownWindow.currentTabsInUse)
wipe(breakdownWindow.currentTabsInUse)
for index = 1, #Details.player_details_tabs do
local tab = Details.player_details_tabs[index]
@@ -314,16 +317,11 @@ function Details:OpenBreakdownWindow(instanceObject, actorObject, bFromAttribute
end
end
function Details:CloseBreakdownWindow(fromEscape)
function Details:CloseBreakdownWindow()
if (breakdownWindow.ativo) then
if (fromEscape) then
Details.FadeHandler.Fader(breakdownWindow, "in")
else
Details.FadeHandler.Fader(breakdownWindow, 1)
end
breakdownWindow.ativo = false --sinaliza o addon que a janela esta agora fechada
Details.FadeHandler.Fader(breakdownWindow, 1)
--Details.info_jogador.detalhes = nil
breakdownWindow.ativo = false --sinaliza o addon que a janela esta agora fechada
breakdownWindow.jogador = nil
breakdownWindow.atributo = nil
breakdownWindow.sub_atributo = nil
@@ -331,6 +329,13 @@ function Details:CloseBreakdownWindow(fromEscape)
breakdownWindow.actorName:SetText("")
breakdownWindow.attributeName:SetText("")
--iterate all tabs and clear caches
local tabsInUse = Details:GetBreakdownTabsInUse()
for index = 1, #tabsInUse do
local tabButton = tabsInUse[index]
tabButton.last_actor = nil
end
end
end
@@ -695,16 +700,17 @@ function Details:CreatePlayerDetailsTab(tabName, locName, conditionFunc, fillFun
tabFrame:SetScript("OnShow", function()
---@type actor
local actorObject = Details:GetActorObjectFromBreakdownWindow()
---@type instance
local instanceObject = Details:GetActiveWindowFromBreakdownWindow()
---@type combat
local combatObject = instanceObject:GetCombat()
if (tabButton.last_actor == actorObject) then
return
end
tabButton.last_actor = actorObject
---@type instance
local instanceObject = Details:GetActiveWindowFromBreakdownWindow()
---@type combat
local combatObject = instanceObject:GetCombat()
tabButton.last_actor = actorObject --it's caching the actor, on pre-reset need to clean up this variable (need to check this later)
tabButton:fillfunction(actorObject, combatObject)
end)
end
+59 -12
View File
@@ -52,7 +52,7 @@ function spellsTab.GetCombat()
end
function spellsTab.GetInstance()
return spellsTab.instance
return spellsTab.instance or Details:GetActiveWindowFromBreakdownWindow()
end
---return the breakdownspellscrollframe object, there's only one of this in the breakdown window
@@ -67,6 +67,13 @@ function spellsTab.GetSpellBlockContainer()
return spellsTab.TabFrame.SpellBlockContainer
end
function spellsTab.OnProfileChange()
spellsTab.spellcontainer_header_settings = Details.breakdown_spell_tab.spellcontainer_headers
spellsTab.UpdateHeadersSettings()
end
---default settings for the header of the spells container
---label is a localized string
---@type {name: string, width: number, label: string, align: string, enabled: boolean, attribute: number|nil}[]
local columnInfo = {
{name = "icon", width = 22, label = "", align = "center", enabled = true,},
@@ -86,6 +93,33 @@ local columnInfo = {
{name = "absorbed", label = "absorbed", width = 45, align = "left", enabled = false, attribute = DETAILS_ATTRIBUTE_HEAL},
}
function spellsTab.UpdateHeadersSettings()
--profile settings
---@type table
local settings = spellsTab.spellcontainer_header_settings
--do a loop and check if the column exists in the profile settings, if not, create it
for i = 1, #columnInfo do
--default column settings
local columnData = columnInfo[i]
--column settings for the column on details profile
local columnSettings = settings[columnData.name]
--check if this column does not have a mirror table in details profile
if (not columnSettings) then
--create the mirror table
settings[columnData.name] = {
enabled = columnData.enabled,
width = columnData.width,
align = columnData.align,
}
end
end
spellsTab.spellsHeaderData = spellsTab.BuildHeaderTable()
print("headerTable = ", #spellsTab.spellsHeaderData)
spellsTab.SpellScrollFrame.Header:SetHeaderTable(spellsTab.spellsHeaderData)
end
function spellsTab.BuildHeaderTable()
---@type {name: string, width: number, label: string, align: string, enabled: boolean}[]
local headerTable = {}
@@ -96,9 +130,14 @@ function spellsTab.BuildHeaderTable()
---@type number, number
local mainAttribute, subAttribute = instance:GetDisplay()
--settings from profile | updated at UpdateHeadersSettings() > called on OnProfileChange() and when the tab is opened
local settings = spellsTab.spellcontainer_header_settings
for i = 1, #columnInfo do
local columnData = columnInfo[i]
if (columnData.enabled) then
local columnSettings = settings[columnData.name]
if (columnSettings.enabled) then
local bCanAdd = true
if (columnData.attribute) then
if (columnData.attribute ~= mainAttribute) then
@@ -109,13 +148,14 @@ function spellsTab.BuildHeaderTable()
if (bCanAdd) then
headerTable[#headerTable+1] = {
text = columnData.label,
width = columnData.width,
width = columnSettings.width,
name = columnData.name,
--align = column.align,
}
end
end
end
return headerTable
end
@@ -177,10 +217,14 @@ function spellsTab.OnShownTab()
spellsTab.UnSelectSpellBar()
--reset the spell blocks
spellsTab.GetSpellBlockContainer():ClearBlocks()
--update spells header frame
spellsTab.UpdateHeadersSettings()
end
--called when the tab is getting created
--called when the tab is getting created, run only once
function spellsTab.OnCreateTabCallback(tabButton, tabFrame)
spellsTab.spellcontainer_header_settings = Details.breakdown_spell_tab.spellcontainer_headers
spellBreakdownSettings = Details.breakdown_spell_tab
DetailsFramework:ApplyStandardBackdrop(tabFrame)
@@ -1206,8 +1250,7 @@ local refreshFunc = function(scrollFrame, scrollData, offset, totalLines) --~ref
---@type instance
local instanceObject = spellsTab.GetInstance()
local headerTable = spellsTab.BuildHeaderTable()
scrollFrame.Header:SetHeaderTable(headerTable)
local headerTable = spellsTab.spellsHeaderData
local lineIndex = 1
for i = 1, totalLines do
@@ -1281,7 +1324,9 @@ function spellsTab.CreateSpellScrollContainer(tabFrame)
scrollFrame:SetPoint("topleft", tabFrame, "topleft", 5, -5) --need to set the points
scrollFrame:EnableMouse(true)
scrollFrame:SetMovable(true)
scrollFrame.DontHideChildrenOnPreRefresh = true
tabFrame.SpellScrollFrame = scrollFrame
spellsTab.SpellScrollFrame = scrollFrame
function scrollFrame:RefreshMe(data)
self:SetData(data)
@@ -1860,13 +1905,8 @@ function Details.InitializeSpellBreakdownTab()
end
end,
function() --[4] fill function
--spellsTab.JI_AtualizaContainerBarras(-1) --not in use anymore
spellsTab.TabFrame.no_targets:Hide() --this is nil
spellsTab.TabFrame.no_targets.text:Hide()
function() --[4] fill function | passing a fill function, it'll set a OnShow() script on the tabFrame | only run if the actor is different
spellsTab.OnShownTab()
--spellsTab.TrocaBackgroundInfo(spellsTab.TabFrame)
end,
function(tabButton, tabFrame) --[5] onclick
@@ -1893,5 +1933,12 @@ function Details.InitializeSpellBreakdownTab()
spellsTab.instance = instance
spellsTab.TabFrame.SpellScrollFrame:RefreshMe(data)
end
---@type detailseventlistener
local eventListener = Details:CreateEventListener()
eventListener:RegisterEvent("DETAILS_PROFILE_APPLYED", function()
--this event don't trigger at details startup
spellsTab.OnProfileChange()
end)
end
+2
View File
@@ -26,6 +26,7 @@
["UNIT_SPEC"] = {},
["UNIT_TALENTS"] = {},
["PLAYER_TARGET"] = {},
["DETAILS_PROFILE_APPLYED"] = {},
--data
["DETAILS_DATA_RESET"] = {},
@@ -123,6 +124,7 @@ local common_events = {
["UNIT_SPEC"] = true,
["UNIT_TALENTS"] = true,
["PLAYER_TARGET"] = true,
["DETAILS_PROFILE_APPLYED"] = true,
}
+135 -127
View File
@@ -1,5 +1,5 @@
local _detalhes = _G._detalhes
local Details = _G.Details
local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" )
local _
local addonName, Details222 = ...
@@ -7,7 +7,7 @@ local detailsFramework = DetailsFramework
---return the current profile name
---@return string
function _detalhes:GetCurrentProfileName()
function Details:GetCurrentProfileName()
if (_detalhes_database.active_profile == "") then
local characterKey = UnitName ("player") .. "-" .. GetRealmName()
_detalhes_database.active_profile = characterKey
@@ -18,7 +18,7 @@ end
---create a new profile
---@param profileName string
---@return boolean|table
function _detalhes:CreateProfile(profileName)
function Details:CreateProfile(profileName)
if (not profileName or type(profileName) ~= "string" or profileName == "") then
return false
end
@@ -29,7 +29,7 @@ function _detalhes:CreateProfile(profileName)
end
--copy the default table
local newProfile = Details.CopyTable(_detalhes.default_profile)
local newProfile = Details.CopyTable(Details.default_profile)
newProfile.instances = {}
--add to global container
@@ -41,7 +41,7 @@ end
---return the list os all profiles
---@return table
function _detalhes:GetProfileList()
function Details:GetProfileList()
local profileList = {}
for profileName in pairs(_detalhes_global.__profiles) do
profileList[#profileList + 1] = profileName
@@ -96,12 +96,12 @@ function Details:GetProfile(profileName, create)
return profile
end
function _detalhes:SetProfileCProp (name, cprop, value)
function Details:SetProfileCProp (name, cprop, value)
if (not name) then
name = _detalhes:GetCurrentProfileName()
name = Details:GetCurrentProfileName()
end
local profile = _detalhes:GetProfile (name, false)
local profile = Details:GetProfile (name, false)
if (profile) then
if (type(value) == "table") then
@@ -117,37 +117,37 @@ end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--Profiles:
--reset the profile
function _detalhes:ResetProfile (profile_name)
function Details:ResetProfile (profile_name)
--get the profile
local profile = _detalhes:GetProfile (profile_name, true)
local profile = Details:GetProfile (profile_name, true)
if (not profile) then
return false
end
--reset all already created instances
for index, instance in _detalhes:ListInstances() do
for index, instance in Details:ListInstances() do
if (not instance.baseframe) then
instance:AtivarInstancia()
end
instance.skin = ""
instance:ChangeSkin (_detalhes.default_skin_to_use)
instance:ChangeSkin (Details.default_skin_to_use)
end
for index, instance in pairs(_detalhes.unused_instances) do
for index, instance in pairs(Details.unused_instances) do
if (not instance.baseframe) then
instance:AtivarInstancia()
end
instance.skin = ""
instance:ChangeSkin(_detalhes.default_skin_to_use)
instance:ChangeSkin(Details.default_skin_to_use)
end
--reset the profile
table.wipe(profile.instances)
--export first instance
local instance = _detalhes:GetInstance(1)
local instance = Details:GetInstance(1)
local exported = instance:ExportSkin()
exported.__was_opened = instance:IsEnabled()
exported.__pos = Details.CopyTable(instance:GetPosition())
@@ -160,7 +160,7 @@ function _detalhes:ResetProfile (profile_name)
instance.verticalSnap = false
instance.snap = {}
_detalhes:ApplyProfile (profile_name, true)
Details:ApplyProfile (profile_name, true)
--end
return true
@@ -170,39 +170,39 @@ end
--Profiles:
--return the profile table requested
function _detalhes:CreatePanicWarning()
_detalhes.instance_load_failed = CreateFrame("frame", "DetailsPanicWarningFrame", UIParent,"BackdropTemplate")
_detalhes.instance_load_failed:SetHeight(80)
function Details:CreatePanicWarning()
Details.instance_load_failed = CreateFrame("frame", "DetailsPanicWarningFrame", UIParent,"BackdropTemplate")
Details.instance_load_failed:SetHeight(80)
--tinsert(UISpecialFrames, "DetailsPanicWarningFrame")
_detalhes.instance_load_failed.text = _detalhes.instance_load_failed:CreateFontString(nil, "overlay", "GameFontNormal")
_detalhes.instance_load_failed.text:SetPoint("center", _detalhes.instance_load_failed, "center")
_detalhes.instance_load_failed.text:SetTextColor(1, 0.6, 0)
_detalhes.instance_load_failed:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
_detalhes.instance_load_failed:SetBackdropColor(1, 0, 0, 0.2)
_detalhes.instance_load_failed:SetPoint("topleft", UIParent, "topleft", 0, -250)
_detalhes.instance_load_failed:SetPoint("topright", UIParent, "topright", 0, -250)
Details.instance_load_failed.text = Details.instance_load_failed:CreateFontString(nil, "overlay", "GameFontNormal")
Details.instance_load_failed.text:SetPoint("center", Details.instance_load_failed, "center")
Details.instance_load_failed.text:SetTextColor(1, 0.6, 0)
Details.instance_load_failed:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
Details.instance_load_failed:SetBackdropColor(1, 0, 0, 0.2)
Details.instance_load_failed:SetPoint("topleft", UIParent, "topleft", 0, -250)
Details.instance_load_failed:SetPoint("topright", UIParent, "topright", 0, -250)
end
local safe_load = function(func, param1, ...)
local okey, errortext = pcall(func, param1, ...)
if (not okey) then
if (not _detalhes.instance_load_failed) then
_detalhes:CreatePanicWarning()
if (not Details.instance_load_failed) then
Details:CreatePanicWarning()
end
_detalhes.do_not_save_skins = true
_detalhes.instance_load_failed.text:SetText("Failed to load a Details! window.\n/reload or reboot the game client may fix the problem.\nIf the problem persist, try /details reinstall.\nError: " .. errortext .. "")
Details.do_not_save_skins = true
Details.instance_load_failed.text:SetText("Failed to load a Details! window.\n/reload or reboot the game client may fix the problem.\nIf the problem persist, try /details reinstall.\nError: " .. errortext .. "")
end
return okey
end
function _detalhes:ApplyProfile (profile_name, nosave, is_copy)
function Details:ApplyProfile (profile_name, nosave, is_copy)
--get the profile
local profile = _detalhes:GetProfile (profile_name, true)
local profile = Details:GetProfile (profile_name, true)
--if the profile doesn't exist, just quit
if (not profile) then
_detalhes:Msg("Profile Not Found.")
Details:Msg("Profile Not Found.")
return false
end
@@ -211,15 +211,15 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy)
--always save the previous profile, except if nosave flag is up
if (not nosave) then
--salva o profile ativo no momento
_detalhes:SaveProfile()
Details:SaveProfile()
end
--update profile keys before go
for key, value in pairs(_detalhes.default_profile) do
for key, value in pairs(Details.default_profile) do
--the entire key doesn't exist
if (profile [key] == nil) then
if (type(value) == "table") then
profile [key] = Details.CopyTable(_detalhes.default_profile [key])
profile [key] = Details.CopyTable(Details.default_profile [key])
else
profile [key] = value
end
@@ -227,45 +227,45 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy)
--the key exist and is a table, check for missing values on sub tables
elseif (type(value) == "table") then
--deploy only copy non existing data
_detalhes.table.deploy(profile [key], value)
Details.table.deploy(profile [key], value)
end
end
--apply the profile values
for key, _ in pairs(_detalhes.default_profile) do
for key, _ in pairs(Details.default_profile) do
local value = profile [key]
if (type(value) == "table") then
if (key == "class_specs_coords") then
value = Details.CopyTable(_detalhes.default_profile.class_specs_coords)
value = Details.CopyTable(Details.default_profile.class_specs_coords)
end
local ctable = Details.CopyTable(value)
_detalhes [key] = ctable
Details [key] = ctable
else
_detalhes [key] = value
Details [key] = value
end
end
--set the current profile
if (not is_copy) then
_detalhes.active_profile = profile_name
Details.active_profile = profile_name
_detalhes_database.active_profile = profile_name
end
--apply the skin
--first save the local instance configs
_detalhes:SaveLocalInstanceConfig()
Details:SaveLocalInstanceConfig()
local saved_skins = profile.instances
local instance_limit = _detalhes.instances_amount
local instance_limit = Details.instances_amount
--then close all opened instances
for index, instance in _detalhes:ListInstances() do
for index, instance in Details:ListInstances() do
if (not getmetatable(instance)) then
instance.iniciada = false
setmetatable(instance, _detalhes)
setmetatable(instance, Details)
end
if (instance:IsStarted()) then
if (instance:IsEnabled()) then
@@ -276,16 +276,16 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy)
--check if there is a skin saved or this is a empty profile
if (#saved_skins == 0) then
local instance1 = _detalhes:GetInstance(1)
local instance1 = Details:GetInstance(1)
if (not instance1) then
instance1 = _detalhes:CreateInstance (1)
instance1 = Details:CreateInstance (1)
end
--apply default config on this instance (flat skin texture was 'ResetInstanceConfig' running).
instance1.modo = 2
instance1:ResetInstanceConfig()
instance1.skin = "no skin"
instance1:ChangeSkin (_detalhes.default_skin_to_use)
instance1:ChangeSkin (Details.default_skin_to_use)
--release the snap and lock
instance1:LoadLocalInstanceConfig()
@@ -294,11 +294,11 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy)
instance1.verticalSnap = nil
instance1:LockInstance (false)
if (#_detalhes.tabela_instancias > 1) then
for i = #_detalhes.tabela_instancias, 2, -1 do
_detalhes.tabela_instancias [i].modo = 2
_detalhes.unused_instances [i] = _detalhes.tabela_instancias [i]
_detalhes.tabela_instancias [i] = nil
if (#Details.tabela_instancias > 1) then
for i = #Details.tabela_instancias, 2, -1 do
Details.tabela_instancias [i].modo = 2
Details.unused_instances [i] = Details.tabela_instancias [i]
Details.tabela_instancias [i] = nil
end
end
else
@@ -312,10 +312,10 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy)
end
--get the instance
local instance = _detalhes:GetInstance(index)
local instance = Details:GetInstance(index)
if (not instance) then
--create a instance without creating its frames (not initializing)
instance = _detalhes:CreateDisabledInstance (index, skin)
instance = Details:CreateDisabledInstance (index, skin)
end
--copy skin
@@ -339,7 +339,7 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy)
--load data saved for this character only
instance:LoadLocalInstanceConfig()
if (skin.__was_opened) then
if (not safe_load (_detalhes.AtivarInstancia, instance, nil, true)) then
if (not safe_load (Details.AtivarInstancia, instance, nil, true)) then
return
end
else
@@ -351,7 +351,7 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy)
--load data saved again
instance:LoadLocalInstanceConfig()
--check window positioning
if (_detalhes.profile_save_pos) then
if (Details.profile_save_pos) then
--print("is profile save pos", skin.__pos.normal.x, skin.__pos.normal.y)
if (skin.__pos) then
instance.posicao = Details.CopyTable(skin.__pos)
@@ -385,14 +385,14 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy)
instance:LockInstance (instance.isLocked)
--tinsert(_detalhes.resize_debug, #_detalhes.resize_debug+1, "libwindow X (427): " .. (instance.libwindow.x or 0))
--tinsert(Details.resize_debug, #Details.resize_debug+1, "libwindow X (427): " .. (instance.libwindow.x or 0))
instance:RestoreMainWindowPosition()
instance:ReajustaGump()
--instance:SaveMainWindowPosition()
--Load StatusBarSaved values and options.
instance.StatusBarSaved = skin.StatusBarSaved or {options = {}}
instance.StatusBar.options = instance.StatusBarSaved.options
_detalhes.StatusBar:UpdateChilds (instance)
Details.StatusBar:UpdateChilds (instance)
instance:ChangeSkin()
else
@@ -403,18 +403,18 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy)
end
--move unused instances for unused container
if (#_detalhes.tabela_instancias > instances_loaded) then
for i = #_detalhes.tabela_instancias, instances_loaded+1, -1 do
_detalhes.unused_instances [i] = _detalhes.tabela_instancias [i]
_detalhes.tabela_instancias [i] = nil
if (#Details.tabela_instancias > instances_loaded) then
for i = #Details.tabela_instancias, instances_loaded+1, -1 do
Details.unused_instances [i] = Details.tabela_instancias [i]
Details.tabela_instancias [i] = nil
end
end
--check all snaps for invalid entries
for i = 1, instances_loaded do
local instance = _detalhes:GetInstance(i)
local previous_instance_id = _detalhes:GetInstance(i-1) and _detalhes:GetInstance(i-1):GetId() or 0
local next_instance_id = _detalhes:GetInstance(i+1) and _detalhes:GetInstance(i+1):GetId() or 0
local instance = Details:GetInstance(i)
local previous_instance_id = Details:GetInstance(i-1) and Details:GetInstance(i-1):GetId() or 0
local next_instance_id = Details:GetInstance(i+1) and Details:GetInstance(i+1):GetId() or 0
for snap_side, instance_id in pairs(instance.snap) do
if (instance_id < 1) then --invalid instance
@@ -426,18 +426,18 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy)
end
--auto realign windows
if (not _detalhes.initializing) then
for _, instance in _detalhes:ListInstances() do
if (not Details.initializing) then
for _, instance in Details:ListInstances() do
if (instance:IsEnabled()) then
_detalhes.move_janela_func(instance.baseframe, true, instance)
_detalhes.move_janela_func(instance.baseframe, false, instance)
Details.move_janela_func(instance.baseframe, true, instance)
Details.move_janela_func(instance.baseframe, false, instance)
end
end
else
--is in startup
for _, instance in _detalhes:ListInstances() do
for _, instance in Details:ListInstances() do
for side, id in pairs(instance.snap) do
local window = _detalhes.tabela_instancias [id]
local window = Details.tabela_instancias [id]
if (not window.ativa) then
instance.snap [side] = nil
if ((side == 1 or side == 3) and (not instance.snap [1] and not instance.snap [3])) then
@@ -460,36 +460,38 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy)
end
--check instance amount
_detalhes.opened_windows = 0
for index = 1, _detalhes.instances_amount do
local instance = _detalhes.tabela_instancias [index]
Details.opened_windows = 0
for index = 1, Details.instances_amount do
local instance = Details.tabela_instancias [index]
if (instance and instance.ativa) then
_detalhes.opened_windows = _detalhes.opened_windows + 1
Details.opened_windows = Details.opened_windows + 1
end
end
--update tooltip settings
_detalhes:SetTooltipBackdrop()
Details:SetTooltipBackdrop()
--update the numerical system
_detalhes:SelectNumericalSystem()
Details:SelectNumericalSystem()
--refresh the update interval
_detalhes:RefreshUpdater()
Details:RefreshUpdater()
--refresh animation functions
_detalhes:RefreshAnimationFunctions()
Details:RefreshAnimationFunctions()
--refresh broadcaster tools
_detalhes:LoadFramesForBroadcastTools()
Details:LoadFramesForBroadcastTools()
--change the rogue spec combat icon to outlaw depending on the game version
Details:HandleRogueCombatSpecIconByGameVersion()
if (_detalhes.initializing) then
_detalhes.profile_loaded = true
if (Details.initializing) then
Details.profile_loaded = true
end
Details:SendEvent("DETAILS_PROFILE_APPLYED", profile_name)
return true
end
@@ -497,7 +499,7 @@ end
--Profiles:
--return the profile table requested
function _detalhes:SaveProfile (saveas)
function Details:SaveProfile (saveas)
--get the current profile
@@ -506,15 +508,15 @@ function _detalhes:SaveProfile (saveas)
if (saveas) then
profile_name = saveas
else
profile_name = _detalhes:GetCurrentProfileName()
profile_name = Details:GetCurrentProfileName()
end
local profile = _detalhes:GetProfile (profile_name, true)
local profile = Details:GetProfile (profile_name, true)
--save default keys
for key, _ in pairs(_detalhes.default_profile) do
for key, _ in pairs(Details.default_profile) do
local current_value = _detalhes [key]
local current_value = Details [key]
if (type(current_value) == "table") then
local ctable = Details.CopyTable(current_value)
@@ -526,9 +528,9 @@ function _detalhes:SaveProfile (saveas)
end
--save skins
if (not _detalhes.do_not_save_skins) then
if (not Details.do_not_save_skins) then
table.wipe(profile.instances)
for index, instance in ipairs(_detalhes.tabela_instancias) do
for index, instance in ipairs(Details.tabela_instancias) do
local exported = instance:ExportSkin()
exported.__was_opened = instance:IsEnabled()
exported.__pos = Details.CopyTable(instance:GetPosition())
@@ -539,8 +541,8 @@ function _detalhes:SaveProfile (saveas)
profile.instances[index] = exported
end
end
_detalhes.do_not_save_skins = nil
_detalhes:SaveLocalInstanceConfig()
Details.do_not_save_skins = nil
Details:SaveLocalInstanceConfig()
return profile
end
@@ -1068,7 +1070,7 @@ local default_profile = {
},
--streamer
-- _detalhes.streamer_config.
-- Details.streamer_config.
streamer_config = {
reset_spec_cache = false,
disable_mythic_dungeon = false,
@@ -1130,7 +1132,7 @@ local default_profile = {
auto_swap_to_dynamic_overall = false,
}
_detalhes.default_profile = default_profile
Details.default_profile = default_profile
-- aqui fica as propriedades do jogador que no sero armazenadas no profile
local default_player_data = {
@@ -1259,7 +1261,7 @@ local default_player_data = {
--information about this character
character_data = {logons = 0},
--version
last_realversion = _detalhes.realversion,
last_realversion = Details.realversion,
last_version = "v1.0.0",
--profile
active_profile = "",
@@ -1318,7 +1320,7 @@ local default_player_data = {
on_death_menu = false,
}
_detalhes.default_player_data = default_player_data
Details.default_player_data = default_player_data
local default_global_data = {
@@ -1414,6 +1416,12 @@ local default_global_data = {
blockspell_spark_width = 2,
blockspell_spark_show = true,
blockspell_spark_color = {1, 1, 1, 0.7},
spellcontainer_headers = {}, --store information about active headers and their sizes
spellcontainer_header_height = 20,
spellcontainer_header_fontsize = 10,
spellcontainer_header_fontcolor = {1, 1, 1, 1},
},
--profile by spec
@@ -1578,35 +1586,35 @@ local default_global_data = {
},
}
_detalhes.default_global_data = default_global_data
Details.default_global_data = default_global_data
function _detalhes:GetTutorialCVar(key, default)
function Details:GetTutorialCVar(key, default)
--is disabling all popups from the streamer options
if (_detalhes.streamer_config.no_alerts) then
if (Details.streamer_config.no_alerts) then
return true
end
local value = _detalhes.tutorial [key]
local value = Details.tutorial [key]
if (value == nil and default) then
_detalhes.tutorial [key] = default
Details.tutorial [key] = default
value = default
end
return value
end
function _detalhes:SetTutorialCVar (key, value)
_detalhes.tutorial [key] = value
function Details:SetTutorialCVar (key, value)
Details.tutorial [key] = value
end
function _detalhes:SaveProfileSpecial()
function Details:SaveProfileSpecial()
--get the current profile
local profile_name = _detalhes:GetCurrentProfileName()
local profile = _detalhes:GetProfile (profile_name, true)
local profile_name = Details:GetCurrentProfileName()
local profile = Details:GetProfile (profile_name, true)
--save default keys
for key, _ in pairs(_detalhes.default_profile) do
for key, _ in pairs(Details.default_profile) do
local current_value = _detalhes_database [key] or _detalhes_global [key] or _detalhes.default_player_data [key] or _detalhes.default_global_data [key]
local current_value = _detalhes_database [key] or _detalhes_global [key] or Details.default_player_data [key] or Details.default_global_data [key]
if (type(current_value) == "table") then
local ctable = Details.CopyTable(current_value)
@@ -1620,8 +1628,8 @@ function _detalhes:SaveProfileSpecial()
--save skins
table.wipe(profile.instances)
if (_detalhes.tabela_instancias) then
for index, instance in ipairs(_detalhes.tabela_instancias) do
if (Details.tabela_instancias) then
for index, instance in ipairs(Details.tabela_instancias) do
local exported = instance:ExportSkin()
profile.instances [index] = exported
end
@@ -1632,8 +1640,8 @@ function _detalhes:SaveProfileSpecial()
end
--save things for the mythic dungeon run
function _detalhes:SaveState_CurrentMythicDungeonRun (runID, zoneName, zoneID, startAt, segmentID, level, ejID, latestBossAt)
local savedTable = _detalhes.mythic_dungeon_currentsaved
function Details:SaveState_CurrentMythicDungeonRun (runID, zoneName, zoneID, startAt, segmentID, level, ejID, latestBossAt)
local savedTable = Details.mythic_dungeon_currentsaved
savedTable.started = true
savedTable.run_id = runID
savedTable.dungeon_name = zoneName
@@ -1645,8 +1653,8 @@ function _detalhes:SaveState_CurrentMythicDungeonRun (runID, zoneName, zoneID, s
savedTable.previous_boss_killed_at = latestBossAt
end
function _detalhes:UpdateState_CurrentMythicDungeonRun (stillOngoing, segmentID, latestBossAt)
local savedTable = _detalhes.mythic_dungeon_currentsaved
function Details:UpdateState_CurrentMythicDungeonRun (stillOngoing, segmentID, latestBossAt)
local savedTable = Details.mythic_dungeon_currentsaved
if (not stillOngoing) then
savedTable.started = false
@@ -1661,14 +1669,14 @@ function _detalhes:UpdateState_CurrentMythicDungeonRun (stillOngoing, segmentID,
end
end
function _detalhes:RestoreState_CurrentMythicDungeonRun()
function Details:RestoreState_CurrentMythicDungeonRun()
--no need to check for mythic+ if the user is playing on classic wow
if (DetailsFramework.IsTimewalkWoW()) then
return
end
local savedTable = _detalhes.mythic_dungeon_currentsaved
local savedTable = Details.mythic_dungeon_currentsaved
local mythicLevel = C_ChallengeMode.GetActiveKeystoneInfo()
local zoneName, _, _, _, _, _, _, currentZoneID = GetInstanceInfo()
local mapID = C_Map.GetBestMapForUnit ("player")
@@ -1691,21 +1699,21 @@ function _detalhes:RestoreState_CurrentMythicDungeonRun()
--is there a mythic run ongoing and the level is the same as the saved state?
if (mythicLevel and mythicLevel == savedTable.level) then
--restore the state
_detalhes.MythicPlus.Started = true
_detalhes.MythicPlus.DungeonName = zoneName
_detalhes.MythicPlus.DungeonID = currentZoneID
_detalhes.MythicPlus.StartedAt = savedTable.started_at
_detalhes.MythicPlus.SegmentID = savedTable.segment_id
_detalhes.MythicPlus.Level = mythicLevel
_detalhes.MythicPlus.ejID = ejID
_detalhes.MythicPlus.PreviousBossKilledAt = savedTable.previous_boss_killed_at
_detalhes.MythicPlus.IsRestoredState = true
Details.MythicPlus.Started = true
Details.MythicPlus.DungeonName = zoneName
Details.MythicPlus.DungeonID = currentZoneID
Details.MythicPlus.StartedAt = savedTable.started_at
Details.MythicPlus.SegmentID = savedTable.segment_id
Details.MythicPlus.Level = mythicLevel
Details.MythicPlus.ejID = ejID
Details.MythicPlus.PreviousBossKilledAt = savedTable.previous_boss_killed_at
Details.MythicPlus.IsRestoredState = true
DetailsMythicPlusFrame.IsDoingMythicDungeon = true
print("D! (debug) mythic dungeon state restored.")
C_Timer.After(2, function()
_detalhes:SendEvent("COMBAT_MYTHICDUNGEON_START")
Details:SendEvent("COMBAT_MYTHICDUNGEON_START")
end)
return
else
+2
View File
@@ -15,6 +15,8 @@ function Details:StartMeUp()
end
Details.AndIWillNeverStop = true
--note: this runs after profile loaded
--set default time for arena and bg to be the Details! load time in case the client loads mid event
Details.lastArenaStartTime = GetTime()
Details.lastBattlegroundStartTime = GetTime()