3c3d840b65
- Rewrite on profile -> skins bridge, now skins are only stored inside the profile. - Fixed issue with healing done player details which wans't showing pets. - Fixed unknown owner pet summon. - New API: _detalhes:ListInstances() return ipairs of current created instances. - New API: instance:GetPosition() return a table with .normal and .solo with .x and .y axis. - New API: instance:GetDisplay() return attribute, sub attribute shown in the instance. - New API: _detalhes.table.copy (t1, t2) copy values from table 't2' to 't1'.
104 lines
3.4 KiB
Lua
104 lines
3.4 KiB
Lua
--[[this file save the data when player leave the game]]
|
|
|
|
local _detalhes = _G._detalhes
|
|
|
|
function _detalhes:WipeConfig()
|
|
local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" )
|
|
|
|
local b = CreateFrame ("button", "DetailsResetConfigButton", UIParent, "OptionsButtonTemplate")
|
|
tinsert (UISpecialFrames, "DetailsResetConfigButton")
|
|
|
|
b:SetSize (250, 40)
|
|
b:SetText (Loc ["STRING_SLASH_WIPECONFIG_CONFIRM"])
|
|
b:SetScript ("OnClick", function() _detalhes.wipe_full_config = true; ReloadUI(); end)
|
|
b:SetPoint ("center", UIParent, "center", 0, 0)
|
|
end
|
|
|
|
local is_exception = {
|
|
["nick_tag_cache"] = true
|
|
}
|
|
|
|
function _detalhes:SaveLocalInstanceConfig()
|
|
for index, instance in _detalhes:ListInstances() do
|
|
local a1, a2 = instance:GetDisplay()
|
|
_detalhes.local_instances_config [index] = {
|
|
pos = table_deepcopy (instance:GetPosition()),
|
|
is_open = instance:IsEnabled(),
|
|
attribute = a1,
|
|
sub_attribute = a2,
|
|
mode = instance:GetMode(),
|
|
segment = instance:GetSegment(),
|
|
snap = table_deepcopy (instance.snap),
|
|
horizontalSnap = instance.horizontalSnap,
|
|
verticalSnap = instance.verticalSnap,
|
|
sub_atributo_last = instance.sub_atributo_last,
|
|
isLocked = instance.isLocked
|
|
}
|
|
|
|
if (_detalhes.local_instances_config [index].isLocked == nil) then
|
|
_detalhes.local_instances_config [index].isLocked = false
|
|
end
|
|
end
|
|
end
|
|
|
|
function _detalhes:SaveConfig()
|
|
|
|
--> save instance configs localy
|
|
_detalhes:SaveLocalInstanceConfig()
|
|
|
|
--> cleanup
|
|
_detalhes:PrepareTablesForSave()
|
|
|
|
_detalhes_database.tabela_instancias = {} --_detalhes.tabela_instancias --[[instances now saves only inside the profile --]]
|
|
_detalhes_database.tabela_historico = _detalhes.tabela_historico
|
|
|
|
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
|
|
|
|
_detalhes:TimeDataCleanUpTemporary()
|
|
|
|
--> buffs
|
|
_detalhes.Buffs:SaveBuffs()
|
|
|
|
--> 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
|
|
|
|
--> 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
|
|
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
|