Code changes, see commit description

Combat Objects which has been discarded due to any reason will have the boolean member:  __destroyed set to true. With this change, 3rd party code can see if the data cached is up to date or obsolete.

- Removed several deprecated code from March 2023 and earlier.
- Large amount of code cleanup and refactoring, some functions got renamed, they are listed below:
* TravarTempos renamed to LockActivityTime.
* ClearTempTables renamed to ClearCacheTables.
* SpellIsDot renamed to SetAsDotSpell.
* FlagCurrentCombat remamed to FlagNewCombat_PVPState.
* UpdateContainerCombatentes renamed to UpdatePetCache.
* segmentClass:AddCombat(combatObject) renamed to Details222.Combat.AddCombat(combatToBeAdded)

- CurrentCombat.verifica_combate timer is now obsolete.
- Details.last_closed_combat is now obsolete.
- Details.EstaEmCombate is now obsolete.
- Details.options is now obsolete.

- Added: Details:RemoveSegmentByCombatObject(combatObject)

- Spec Guess Timers are now stored within Details222.GuessSpecSchedules.Schedules, all timers are killed at the end of the combat or at a data reset.

- Initial time to send startup signal reduced from 5 to 4 seconds.

- Fixed some division by zero on ptr 10.1.5.
- Fixed DETAILS_STARTED event not triggering in some cases due to 'event not registered'.
This commit is contained in:
Tercio Jose
2023-06-27 19:01:44 -03:00
parent d3d5154c67
commit 6ccb64863e
23 changed files with 971 additions and 808 deletions
+27 -27
View File
@@ -58,25 +58,25 @@ local font_select_icon, font_select_texcoord = [[Interface\AddOns\Details\images
--store the current instance being edited
local currentInstance
function Details.options.SetCurrentInstance(instance)
function Details222.OptionsPanel.SetCurrentInstance(instance)
currentInstance = instance
end
function Details.options.SetCurrentInstanceAndRefresh(instance)
function Details222.OptionsPanel.SetCurrentInstanceAndRefresh(instance)
currentInstance = instance
_G.DetailsOptionsWindow.instance = instance
--get all the frames created and update the options
for i = 1, Details.options.maxSectionIds do
local sectionFrame = Details.options.GetOptionsSection(i)
for i = 1, Details222.OptionsPanel.maxSectionIds do
local sectionFrame = Details222.OptionsPanel.GetOptionsSection(i)
if (sectionFrame.RefreshOptions) then
sectionFrame:RefreshOptions()
end
end
Details.options.UpdateAutoHideSettings(instance)
Details222.OptionsPanel.UpdateAutoHideSettings(instance)
end
function Details.options.UpdateAutoHideSettings(instance)
function Details222.OptionsPanel.UpdateAutoHideSettings(instance)
for contextId, line in ipairs(_G.DetailsOptionsWindowTab13.AutoHideOptions) do --tab13 = automation settings
line.enabledCheckbox:SetValue(instance.hide_on_context[contextId].enabled)
line.reverseCheckbox:SetValue(instance.hide_on_context[contextId].inverse)
@@ -84,7 +84,7 @@ function Details.options.UpdateAutoHideSettings(instance)
end
end
function Details.options.RefreshInstances(instance)
function Details222.OptionsPanel.RefreshInstances(instance)
if (instance) then
Details:InstanceGroupCall(instance, "InstanceRefreshRows")
instance:InstanceReset()
@@ -94,7 +94,7 @@ function Details.options.RefreshInstances(instance)
end
end
function Details.options.GetCurrentInstanceInOptionsPanel()
function Details222.OptionsPanel.GetCurrentInstanceInOptionsPanel()
return currentInstance
end
@@ -577,7 +577,7 @@ do
local accepted, errortext = Details:SetNickname(text)
if (not accepted) then
Details:ResetPlayerPersona()
Details.options.SetCurrentInstanceAndRefresh(currentInstance)
Details222.OptionsPanel.SetCurrentInstanceAndRefresh(currentInstance)
end
afterUpdate()
end,
@@ -588,7 +588,7 @@ do
type = "execute",
func = function(self)
Details:ResetPlayerPersona()
Details.options.SetCurrentInstanceAndRefresh(currentInstance)
Details222.OptionsPanel.SetCurrentInstanceAndRefresh(currentInstance)
end,
icontexture = [[Interface\GLUES\LOGIN\Glues-CheckBox-Check]],
--icontexcoords = {160/512, 179/512, 142/512, 162/512},
@@ -769,7 +769,7 @@ do
--add the new skin
Details.savedStyles [#Details.savedStyles+1] = dataTable
Details:Msg(Loc ["STRING_OPTIONS_SAVELOAD_IMPORT_OKEY"])
Details.options.SetCurrentInstanceAndRefresh(currentInstance)
Details222.OptionsPanel.SetCurrentInstanceAndRefresh(currentInstance)
afterUpdate()
else
Details:Msg(Loc ["STRING_CUSTOM_IMPORT_ERROR"])
@@ -807,7 +807,7 @@ do
type = "execute",
func = function(self)
Details:InstanceGroupCall(currentInstance, "SetUserCustomSkinFile", "")
Details.options.SetCurrentInstanceAndRefresh(currentInstance)
Details222.OptionsPanel.SetCurrentInstanceAndRefresh(currentInstance)
afterUpdate()
end,
icontexture = [[Interface\GLUES\LOGIN\Glues-CheckBox-Check]],
@@ -821,7 +821,7 @@ do
get = function() return "" end,
set = function(self, _, text)
saveAsSkin(text)
Details.options.SetCurrentInstanceAndRefresh(currentInstance)
Details222.OptionsPanel.SetCurrentInstanceAndRefresh(currentInstance)
Details:Msg(Loc ["STRING_OPTIONS_SAVELOAD_SKINCREATED"])
afterUpdate()
end,
@@ -848,7 +848,7 @@ do
end
Details:Msg(Loc ["STRING_OPTIONS_SAVELOAD_APPLYALL"])
Details.options.SetCurrentInstanceAndRefresh(currentInstance)
Details222.OptionsPanel.SetCurrentInstanceAndRefresh(currentInstance)
afterUpdate()
end,
icontexture = [[Interface\Buttons\UI-HomeButton]],
@@ -887,7 +887,7 @@ do
for index, _table in ipairs(Details.savedStyles) do
tinsert(loadtable, {value = index, label = _table.name, onclick = function(_, _, index)
table.remove (Details.savedStyles, index)
Details.options.SetCurrentInstanceAndRefresh(currentInstance)
Details222.OptionsPanel.SetCurrentInstanceAndRefresh(currentInstance)
afterUpdate()
Details:Msg(Loc ["STRING_OPTIONS_SKIN_REMOVED"])
end,
@@ -914,7 +914,7 @@ do
else
Details:Msg("failed to export skin.") --localize-me
end
Details.options.SetCurrentInstanceAndRefresh(currentInstance)
Details222.OptionsPanel.SetCurrentInstanceAndRefresh(currentInstance)
afterUpdate()
end,
icon = [[Interface\Buttons\UI-GuildButton-MOTD-Up]], color = {1, 1, 1}, iconcolor = {1, .9, .9, 0.8}, texcoord = {1, 0, 0, 1}})
@@ -944,7 +944,7 @@ do
get = function() return Details.chat_tab_embed.enabled end,
set = function(self, fixedparam, value)
Details.chat_embed:SetTabSettings(nil, value)
Details.options.SetCurrentInstanceAndRefresh(currentInstance)
Details222.OptionsPanel.SetCurrentInstanceAndRefresh(currentInstance)
afterUpdate()
end,
name = Loc ["STRING_ENABLED"],
@@ -966,7 +966,7 @@ do
get = function() return Details.chat_tab_embed.single_window end,
set = function(self, fixedparam, value)
Details.chat_embed:SetTabSettings (nil, nil, value)
Details.options.SetCurrentInstanceAndRefresh(currentInstance)
Details222.OptionsPanel.SetCurrentInstanceAndRefresh(currentInstance)
afterUpdate()
end,
name = Loc ["STRING_OPTIONS_TABEMB_SINGLE"],
@@ -1409,7 +1409,7 @@ do
editInstanceSetting(currentInstance, "SetBarSettings", nil, nil, nil, nil, nil, nil, nil, nil, text)
end
Details.options.SetCurrentInstanceAndRefresh(currentInstance)
Details222.OptionsPanel.SetCurrentInstanceAndRefresh(currentInstance)
afterUpdate()
end,
name = Loc ["STRING_OPTIONS_BARS_CUSTOM_TEXTURE"],
@@ -1539,7 +1539,7 @@ do
set = function(self, fixedparam, value)
editInstanceSetting(currentInstance, "fontstrings_text_limit_offset", value)
editInstanceSetting(currentInstance, "InstanceRefreshRows")
Details.options.RefreshInstances(currentInstance)
Details222.OptionsPanel.RefreshInstances(currentInstance)
afterUpdate()
end,
min = -30,
@@ -1604,7 +1604,7 @@ do
set = function(self, fixedparam, value)
editInstanceSetting(currentInstance, "total_bar", "enabled", value)
afterUpdate()
Details.options.RefreshInstances(currentInstance)
Details222.OptionsPanel.RefreshInstances(currentInstance)
end,
name = Loc ["STRING_ENABLED"],
desc = Loc ["STRING_OPTIONS_SHOW_TOTALBAR_DESC"],
@@ -2116,8 +2116,8 @@ do
local separatorOption = sectionFrame.widget_list[25]
local bracketOption = sectionFrame.widget_list[26]
local warningLabel = sectionFrame.widget_list[27]
Details.options.textSeparatorOption = separatorOption
Details.options.textbracketOption = bracketOption
Details222.OptionsPanel.textSeparatorOption = separatorOption
Details222.OptionsPanel.textbracketOption = bracketOption
sectionFrame:SetScript("OnShow", function()
if (currentInstance.use_multi_fontstrings) then
@@ -3854,7 +3854,7 @@ do
local selectProfile = function(_, _, profileName)
Details:ApplyProfile(profileName)
Details:Msg(Loc ["STRING_OPTIONS_PROFILE_LOADED"], profileName)
--Details.options.SetCurrentInstanceAndRefresh(currentInstance)
--Details222.OptionsPanel.SetCurrentInstanceAndRefresh(currentInstance)
--afterUpdate()
_G.DetailsOptionsWindow:Hide()
Details:OpenOptionsWindow(currentInstance, false, 9)
@@ -3930,7 +3930,7 @@ do
if (new_profile) then
Details:ApplyProfile(profileName)
afterUpdate()
Details.options.SetCurrentInstanceAndRefresh(currentInstance)
Details222.OptionsPanel.SetCurrentInstanceAndRefresh(currentInstance)
else
return Details:Msg(Loc ["STRING_OPTIONS_PROFILE_NOTCREATED"])
end
@@ -3970,7 +3970,7 @@ do
Details:EraseProfile(profileName)
Details.options.SetCurrentInstanceAndRefresh(currentInstance)
Details222.OptionsPanel.SetCurrentInstanceAndRefresh(currentInstance)
afterUpdate()
Details:Msg(Loc ["STRING_OPTIONS_PROFILE_REMOVEOKEY"])
end,
@@ -5496,7 +5496,7 @@ do
sectionFrame.AutoHideOptions[i] = line
end
Details.options.UpdateAutoHideSettings(currentInstance)
Details222.OptionsPanel.UpdateAutoHideSettings(currentInstance)
--profile by spec