-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHizurosToolbox.lua
71 lines (60 loc) · 2.12 KB
/
HizurosToolbox.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
local addon,ns = ...; local L=ns.L;
function HizurosToolbox_OnEvent(self,event,arg1,...)
if event=="ADDON_LOADED" and arg1==addon then
if HizurosToolbox_ConfigDB==nil then
HizurosToolbox_ConfigDB = {
use_default_profile = true,
default_profile = DEFAULT,
profiles = {[DEFAULT]={}},
use_profile = {},
};
end
if HizurosToolbox_ConfigDB.use_default_profile then
if HizurosToolbox_ConfigDB.use_profile[ns.player.name_realm]==nil then
HizurosToolbox_ConfigDB.use_profile[ns.player.name_realm] = DEFAULT;
end
else
if HizurosToolbox_ConfigDB.use_profile[ns.player.name_realm]==nil then
if HizurosToolbox_ConfigDB.profiles[ns.player.name_realm]==nil then
HizurosToolbox_ConfigDB.profiles[ns.player.name_realm] = {};
end
HizurosToolbox_ConfigDB.use_profile[ns.player.name_realm] = ns.player.name_realm;
end
end
ns.profile = HizurosToolbox_ConfigDB.profiles[HizurosToolbox_ConfigDB.use_profile[ns.player.name_realm]];
if ns.profile.GeneralOptions==nil then
ns.profile.GeneralOptions = {};
end
-- character cache
if(HizurosToolbox_CharacterDB==nil)then
HizurosToolbox_CharacterDB={order={}};
end
if(HizurosToolbox_CharacterDB.order==nil)then
HizurosToolbox_CharacterDB.order={};
end
if(not HizurosToolbox_CharacterDB[ns.player.name_realm])then
tinsert(HizurosToolbox_CharacterDB.order,ns.player.name_realm);
HizurosToolbox_CharacterDB[ns.player.name_realm] = {orderId=#HizurosToolbox_CharacterDB.order};
end
HizurosToolbox_CharacterDB[ns.player.name_realm].basics = ns.player;
-- data cache
if HizurosToolbox_DataDB==nil then
HizurosToolbox_DataDB = {realms={}};
end
if HizurosToolbox_DataDB.realms==nil then
HizurosToolbox_DataDB.realms={}; -- ?
end
ns.data = HizurosToolbox_DataDB;
-- enable registered modules
ns.RegisterModules();
ns.print("AddOn loaded...");
elseif event=="PLAYER_ENTERING_WORLD" then
ns.RegisterOptionPanel();
self:UnregisterEvent(event);
end
end
-- function HizurosToolbox_OnShow(self) end
function HizurosToolbox_OnLoad(self)
self:RegisterEvent("ADDON_LOADED");
self:RegisterEvent("PLAYER_ENTERING_WORLD");
end