Another problem I just noticed is when I do a reload it is resenting all options to default.
Config.lua
Code:
function MyAddon:ConfigRefresh()
db = self.db.profile;
end
function MyAddon:SetUpOptions()
db = self.db.profile;
LibStub("AceConfig-3.0"):RegisterOptionsTable("MyAddon", GetOptions);
LibStub("AceConfig-3.0"):RegisterOptionsTable("MyAddon-Profiles", LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db));
self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("MyAddon", "MyAddon");
self.profilesFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("MyAddon-Profiles", "Profiles", "MyAddon");
self:RegisterChatCommand("MyAddon", "ChatCommand");
end
Core.lua
Code:
function MyAddon:UpdateStuff()
Hideblz();
Quest();
Buffs_N_Debuffs();
Chat();
Map();
ActionBars();
MicroMenu();
OneBag();
ExpBar();
CreateFrames();
hooksecurefunc("VehicleMenuBar_MoveMicroButtons",MicroMenu)
hooksecurefunc("ActionButton_Update", Style)
hooksecurefunc("PetActionBar_Update", StylePet)
hooksecurefunc("ShapeshiftBar_Update", StyleShapeshift)
hooksecurefunc("UIParent_ManageFramePositions",ActionBars)
end
---- EVENTS
function MyAddon:PLAYER_ENTERING_WORLD()
self:UpdateStuff();
end
---- INIT
function MyAddon:ProfChange()
db = self.db.profile;
self:ConfigRefresh();
self:Refresh();
end
function MyAddon:Refresh()
self:UpdateStuff();
-- self:UpdatePosition();
-- self:UpdateColors();
end
function MyAddon:PLAYER_LOGIN()
self:UpdateStuff();
self:Refresh();
end
function MyAddon:OnInitialize()
self.db = LibStub("AceDB-3.0"):New("MyAddonDB", defaults, "Default");
self.db.RegisterCallback(self, "OnProfileChanged", "ProfChange");
self.db.RegisterCallback(self, "OnProfileCopied", "ProfChange");
self.db.RegisterCallback(self, "OnProfileReset", "ProfChange");
self:SetUpOptions();
db = self.db.profile;
self:RegisterEvent("PLAYER_LOGIN");
self:RegisterEvent("PLAYER_ENTERING_WORLD");
end