Files
coa-details/functions/savedata.lua
T
tercio 824b77d4f0 - Improvements done on Report Death and Spell List from Player Detail Window.
- Added option for disable window group (snap).
- Added option for select the icon pack instead of type the file name.
- Fixed several bugs on profile and skins support.
- Few fixes on Time Attack plugin.

- New API: instance:SetMode (DETAILS_MODE_* SOLO RAID GROUP ALL) change the instance mode.
- New API: instance:SetDisplay (segment, attribute, subattribute) change instance's display.
- New API: framework:ShowTutorialAlertFrame (maintext, desctext, clickfunc) show an alert on the left side of screen.
- New API: _detalhes:GetMaxInstancesAmount() return how many windows can be opened.
- New API: _detalhes:GetFreeInstancesAmount() return how many windows can still be created.
- New API: _detalhes:GetTutorialCVar (key, default) return a value from tutorial table.
- New API: _detalhes:SetTutorialCVar (key, value) set a value on tutorial table.
2014-08-14 18:14:40 -03:00

105 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,
last_raid_plugin = instance.last_raid_plugin
}
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