diff --git a/gui.lua b/gui.lua index 2e956b1..d5166db 100644 --- a/gui.lua +++ b/gui.lua @@ -9,6 +9,8 @@ public.config = { panel = {backdrop = {24, 24, 24, 1}, border = {255, 255, 255, .03}}, content = {backdrop = {42, 42, 42, 1}, border = {0, 0, 0, 0}}, state = {enabled = {70, 180, 70}, disabled = {190, 70, 70}}, + money1 = {gold = {255, 215, 10, 1}, silver = {252, 199, 207, 1}, copper = {237, 165, 95, 1}}, + money2 = {gold = {}, silver = {}, copper = {}}, }, edge_size = 1.5, font = [[Fonts\ARIALN.TTF]], diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..1bb3013 --- /dev/null +++ b/init.lua @@ -0,0 +1,42 @@ +local module = aux_module() +aux = tremove(module, 1) +local m, public, private = unpack(module) + +local function initialize_module(private_declarator) + private_declarator.LOAD = nil +end +initialize_module(public) +private.modules = {aux=module} +function public.module(name) + if m.modules[name] then + return unpack(m.modules[name]) + else + local module = aux_module() + initialize_module(module[4]) + m.modules[name] = module + public[name] = tremove(module, 1) + return unpack(module) + end +end + +local event_frame = CreateFrame('Frame') +private.ADDON_LOADED = {} +event_frame:SetScript('OnEvent', function() + if event == 'ADDON_LOADED' then + if m.ADDON_LOADED[arg1] then + m.ADDON_LOADED[arg1]() + end + else + m[event]() + if event == 'VARIABLES_LOADED' then + for _, module in m.modules do + if module[1].LOAD then + module[1].LOAD() + end + end + end + end +end) +for _, event in {'VARIABLES_LOADED', 'ADDON_LOADED', 'AUCTION_HOUSE_SHOW', 'AUCTION_HOUSE_CLOSED', 'AUCTION_BIDDER_LIST_UPDATE', 'AUCTION_OWNED_LIST_UPDATE'} do + event_frame:RegisterEvent(event) +end