hey, this is my first time working with acedb and I have a problem, my settings that run under self.db.char are not adopted when I change a profile or create a new one, when I change this db to self.db.profile, Changes are copied/delete/reset but creating a profile or changing it causes an error.
The deleted icons of my addon that delete players are stored under ns.dbChar = self.db.char
Lua Code:
function Addon:PLAYER_LOGIN() -- OnInitialize()
ns.LoadOptions(self)
ns.Addon = Addon
-- Register Database Profile
self.db = LibStub("AceDB-3.0"):New("HandyNotes_MapNotesRetailDB", ns.defaults)
self.db.RegisterCallback(self, "OnProfileChanged", "OnProfileChanged")
self.db.RegisterCallback(self, "OnProfileCopied", "OnProfileCopied")
self.db.RegisterCallback(self, "OnProfileReset", "OnProfileReset")
self.db.RegisterCallback(self, "OnProfileDeleted", "OnProfileDeleted")
db = self.db.profile
-- deleted icons database+
ns.dbChar = self.db.char
-- Register options
HandyNotes:RegisterPluginDB("MapNotes", pluginHandler, ns.options)
LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable("MapNotes", ns.options)
-- Get the option table for profiles
ns.options.args.profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db)
end
Lua Code:
function Addon:OnProfileChanged(event, database)
db = database.profile
--ReloadUI();
HandyNotes:GetModule("FogOfWarButton"):Refresh()
ns.Addon:FullUpdate()
HandyNotes:SendMessage("HandyNotes_NotifyUpdate", "MapNotes")
end
function Addon:OnProfileReset(event, database, profileKeys)
db = database.profile
HandyNotes:GetModule("FogOfWarButton"):Refresh()
ns.Addon:FullUpdate()
HandyNotes:SendMessage("HandyNotes_NotifyUpdate", "MapNotes")
end
function Addon:OnProfileCopied(event, database)
db = database.profile
HandyNotes:GetModule("FogOfWarButton"):Refresh()
ns.Addon:FullUpdate()
HandyNotes:SendMessage("HandyNotes_NotifyUpdate", "MapNotes")
end
function Addon:OnProfileDeleted(event, database)
db = database.profile
HandyNotes:GetModule("FogOfWarButton"):Refresh()
ns.Addon:FullUpdate()
HandyNotes:SendMessage("HandyNotes_NotifyUpdate", "MapNotes")
end
Lua Code:
local ADDON_NAME, ns = ...
ns.defaults = {
profile = {
--FogOfWar
colorR = 1,
colorG = 1,
colorB = 1,
colorA = 1,
},
char = {
-- deleted icons function
AzerothDeletedIcons = {
['*'] = {},
}
},
}
Maybe someone can help, just write here any help is welcome