/trunk/Libs/AceDB-3.0
-- end |
-- @class file |
-- @name AceDB-3.0.lua |
-- @release $Id: AceDB-3.0.lua 1035 2011-07-09 03:20:13Z kaelten $ |
local ACEDB_MAJOR, ACEDB_MINOR = "AceDB-3.0", 22 |
-- @release $Id: AceDB-3.0.lua 1124 2014-10-27 21:00:07Z funkydude $ |
local ACEDB_MAJOR, ACEDB_MINOR = "AceDB-3.0", 26 |
local AceDB, oldminor = LibStub:NewLibrary(ACEDB_MAJOR, ACEDB_MINOR) |
if not AceDB then return end -- No upgrade needed |
local _, raceKey = UnitRace("player") |
local factionKey = UnitFactionGroup("player") |
local factionrealmKey = factionKey .. " - " .. realmKey |
local factionrealmregionKey = factionrealmKey .. " - " .. string.sub(GetCVar("realmList"), 1, 2):upper() |
local localeKey = GetLocale():lower() |
local regionTable = { "US", "KR", "EU", "TW", "CN" } |
local regionKey = regionTable[GetCurrentRegion()] |
local factionrealmregionKey = factionrealmKey .. " - " .. regionKey |
-- Actual database initialization function |
local function initdb(sv, defaults, defaultProfile, olddb, parent) |
-- Generate the database keys for each section |
["factionrealm"] = factionrealmKey, |
["factionrealmregion"] = factionrealmregionKey, |
["profile"] = profileKey, |
["locale"] = localeKey, |
["locale"] = localeKey, |
["global"] = true, |
["profiles"] = true, |
} |
end |
end |
-- switch all characters that use this profile back to the default |
if self.sv.profileKeys then |
for key, profile in pairs(self.sv.profileKeys) do |
if profile == name then |
self.sv.profileKeys[key] = nil |
end |
end |
end |
-- Callback: OnProfileDeleted, database, profileKey |
self.callbacks:Fire("OnProfileDeleted", self, name) |
end |