Replacing table.wipe with Details:Destroy()
This commit is contained in:
+77
-74
@@ -1,14 +1,14 @@
|
||||
--[[this file save the data when player leave the game]]
|
||||
|
||||
local _detalhes = _G.Details
|
||||
local Details = _G.Details
|
||||
local addonName, Details222 = ...
|
||||
|
||||
function _detalhes:WipeConfig()
|
||||
function Details:WipeConfig()
|
||||
local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" )
|
||||
|
||||
local wipeButton = CreateFrame("button", "DetailsResetConfigButton", UIParent, "BackdropTemplate")
|
||||
wipeButton:SetSize(270, 40)
|
||||
wipeButton:SetScript("OnClick", function() _detalhes.wipe_full_config = true; ReloadUI(); end)
|
||||
wipeButton:SetScript("OnClick", function() Details.wipe_full_config = true; ReloadUI(); end)
|
||||
wipeButton:SetPoint("center", UIParent, "center", 0, 0)
|
||||
|
||||
tinsert(UISpecialFrames, "DetailsResetConfigButton")
|
||||
@@ -30,18 +30,17 @@ local is_exception = {
|
||||
["nick_tag_cache"] = true
|
||||
}
|
||||
|
||||
function _detalhes:SaveLocalInstanceConfig()
|
||||
|
||||
for index, instance in _detalhes:ListInstances() do
|
||||
function Details:SaveLocalInstanceConfig()
|
||||
for index, instance in Details:ListInstances() do
|
||||
--check for the max size toggle, don't save it
|
||||
if (instance.is_in_max_size) then
|
||||
instance.is_in_max_size = false
|
||||
instance:SetSize(instance.original_width, instance.original_height)
|
||||
end
|
||||
|
||||
|
||||
--save local instance data
|
||||
local a1, a2 = instance:GetDisplay()
|
||||
|
||||
|
||||
local t = {
|
||||
pos = Details.CopyTable(instance:GetPosition()),
|
||||
is_open = instance:IsEnabled(),
|
||||
@@ -57,13 +56,13 @@ function _detalhes:SaveLocalInstanceConfig()
|
||||
isLocked = instance.isLocked,
|
||||
last_raid_plugin = instance.last_raid_plugin
|
||||
}
|
||||
|
||||
|
||||
if (t.isLocked == nil) then
|
||||
t.isLocked = false
|
||||
end
|
||||
|
||||
if (_detalhes.profile_save_pos) then
|
||||
local cprofile = _detalhes:GetProfile()
|
||||
|
||||
if (Details.profile_save_pos) then
|
||||
local cprofile = Details:GetProfile()
|
||||
local skin = cprofile.instances [instance:GetId()]
|
||||
if (skin) then
|
||||
t.pos = Details.CopyTable(skin.__pos)
|
||||
@@ -74,76 +73,80 @@ function _detalhes:SaveLocalInstanceConfig()
|
||||
t.isLocked = skin.__locked
|
||||
end
|
||||
end
|
||||
|
||||
_detalhes.local_instances_config [index] = t
|
||||
|
||||
Details.local_instances_config [index] = t
|
||||
end
|
||||
end
|
||||
|
||||
function _detalhes:SaveConfig()
|
||||
function Details:SaveConfig()
|
||||
--save character instance settings, e.g. which attribute is selected, position, etc
|
||||
Details:SaveLocalInstanceConfig()
|
||||
|
||||
--save instance configs localy
|
||||
_detalhes:SaveLocalInstanceConfig()
|
||||
|
||||
--cleanup
|
||||
|
||||
_detalhes:PrepareTablesForSave()
|
||||
Details:PrepareTablesForSave()
|
||||
|
||||
_detalhes_database.tabela_instancias = {} --_detalhes.tabela_instancias --[[instances now saves only inside the profile --]]
|
||||
_detalhes_database.tabela_historico = _detalhes.tabela_historico
|
||||
|
||||
if (not _detalhes.overall_clear_logout) then
|
||||
_detalhes_database.tabela_overall = _detalhes.tabela_overall
|
||||
_detalhes_database.tabela_instancias = {} --Details.tabela_instancias --[[instances now saves only inside the profile --]]
|
||||
_detalhes_database.tabela_historico = Details.tabela_historico
|
||||
|
||||
if (Details.overall_clear_logout) then
|
||||
if (_detalhes_database.tabela_overall) then
|
||||
Details:Destroy(_detalhes_database.tabela_overall)
|
||||
_detalhes_database.tabela_overall = nil
|
||||
end
|
||||
|
||||
local name, ttype, difficulty, difficultyName, maxPlayers, playerDifficulty, isDynamicInstance, mapID, instanceGroupSize = GetInstanceInfo()
|
||||
if (ttype == "party" or ttype == "raid") then
|
||||
--salvar container de pet
|
||||
_detalhes_database.tabela_pets = _detalhes.tabela_pets.pets
|
||||
end
|
||||
|
||||
xpcall(_detalhes.TimeDataCleanUpTemporary, _detalhes.saver_error_func)
|
||||
|
||||
--buffs
|
||||
xpcall(_detalhes.Buffs.SaveBuffs, _detalhes.saver_error_func)
|
||||
|
||||
else
|
||||
_detalhes_database.tabela_overall = Details.tabela_overall
|
||||
--did it prepared the overall table for save?
|
||||
end
|
||||
|
||||
local name, instanceType = GetInstanceInfo()
|
||||
if (instanceType == "party" or instanceType == "raid") then
|
||||
--save pet ownership information
|
||||
_detalhes_database.tabela_pets = Details.tabela_pets.pets
|
||||
end
|
||||
|
||||
--clear temporarly time data (charts)
|
||||
xpcall(Details.TimeDataCleanUpTemporary, Details.saver_error_func)
|
||||
|
||||
--buffs - feature lost in time
|
||||
xpcall(Details.Buffs.SaveBuffs, Details.saver_error_func)
|
||||
|
||||
--date
|
||||
_detalhes.last_day = date ("%d")
|
||||
|
||||
--salva o container do personagem
|
||||
for key, value in pairs(_detalhes.default_player_data) do
|
||||
if (not is_exception [key]) then
|
||||
_detalhes_database [key] = _detalhes [key]
|
||||
end
|
||||
end
|
||||
|
||||
--salva o container das globais
|
||||
for key, value in pairs(_detalhes.default_global_data) do
|
||||
if (key ~= "__profiles") then
|
||||
_detalhes_global [key] = _detalhes [key]
|
||||
end
|
||||
end
|
||||
Details.last_day = date("%d")
|
||||
|
||||
--solo e raid mode
|
||||
if (_detalhes.SoloTables.Mode) then
|
||||
_detalhes_database.SoloTablesSaved = {}
|
||||
_detalhes_database.SoloTablesSaved.Mode = _detalhes.SoloTables.Mode
|
||||
if (_detalhes.SoloTables.Plugins [_detalhes.SoloTables.Mode]) then
|
||||
_detalhes_database.SoloTablesSaved.LastSelected = _detalhes.SoloTables.Plugins [_detalhes.SoloTables.Mode].real_name
|
||||
end
|
||||
--save character data (unique for each character)
|
||||
for key in pairs(Details.default_player_data) do
|
||||
if (not is_exception[key]) then
|
||||
_detalhes_database[key] = Details[key]
|
||||
end
|
||||
|
||||
_detalhes_database.RaidTablesSaved = nil
|
||||
|
||||
--salva switch tables
|
||||
_detalhes_global.switchSaved.slots = _detalhes.switch.slots
|
||||
_detalhes_global.switchSaved.table = _detalhes.switch.table
|
||||
|
||||
--last boss
|
||||
_detalhes_database.last_encounter = _detalhes.last_encounter
|
||||
|
||||
--last versions
|
||||
_detalhes_database.last_realversion = _detalhes.realversion --core number
|
||||
_detalhes_database.last_version = _detalhes.userversion --version
|
||||
_detalhes_global.got_first_run = true
|
||||
|
||||
end
|
||||
|
||||
--save shared data (shared among all characters)
|
||||
for key in pairs(Details.default_global_data) do
|
||||
if (key ~= "__profiles") then
|
||||
_detalhes_global[key] = Details[key]
|
||||
end
|
||||
end
|
||||
|
||||
--plugin for solo mode (currently none exists)
|
||||
if (Details.SoloTables.Mode) then
|
||||
_detalhes_database.SoloTablesSaved = {}
|
||||
_detalhes_database.SoloTablesSaved.Mode = Details.SoloTables.Mode
|
||||
if (Details.SoloTables.Plugins[Details.SoloTables.Mode]) then
|
||||
_detalhes_database.SoloTablesSaved.LastSelected = Details.SoloTables.Plugins[Details.SoloTables.Mode].real_name
|
||||
end
|
||||
end
|
||||
|
||||
_detalhes_database.RaidTablesSaved = nil
|
||||
|
||||
--save bookmark tables
|
||||
_detalhes_global.switchSaved.slots = Details.switch.slots
|
||||
_detalhes_global.switchSaved.table = Details.switch.table
|
||||
|
||||
--last boss (boss name)
|
||||
_detalhes_database.last_encounter = Details.last_encounter
|
||||
|
||||
--save the details version of the last time the user logged out
|
||||
_detalhes_database.last_realversion = Details.realversion --core number
|
||||
_detalhes_database.last_version = Details.userversion --version
|
||||
_detalhes_global.got_first_run = true
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user