diff --git a/AllTheLittleThings.lua b/AllTheLittleThings.lua index fe085b3..d181b5b 100644 --- a/AllTheLittleThings.lua +++ b/AllTheLittleThings.lua @@ -17,18 +17,19 @@ local options = { }, } +local slashCallback = {} function core:OnInitialize() self.db = LibStub("AceDB-3.0"):New("AllTheLittleThingsDB", defaults, "Default") - -- self:RegisterChatCommand("atlt", function() end) + self:RegisterChatCommand("atlt", "MainSlashHandle") -- LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable("AllTheLittleThings", options) -- local ACD = LibStub("AceConfigDialog-3.0") -- ACD:AddToBlizOptions("AllTheLittleThings", "AllTheLittleThings") self:SetDefaultModulePrototype({ - OnEnable = function(self) - end, + RegisterOptions = core.RegisterOptions, + RegisterSlashCommand = core.RegisterSlashCommand, }) end @@ -40,8 +41,9 @@ function core:OnDisable() end -function core:RegisterOptions(module, options, defaults) - local name = module:GetName() +-- two registry functions called with self=mod +function core:RegisterOptions(options, defaults) + local name = self:GetName() defaults.profile[name] = defaults options.args[name] = { name = name, @@ -50,3 +52,20 @@ function core:RegisterOptions(module, options, defaults) } end +function core:RegisterSlashCommand(callback, ...) + for i=1,select('#', ...) do + slashCallback[select('i', ...)] = self[callback] + end +end + +function core:MainSlashHandle(msg) + local _, e, command = string.find("(%S+)", msg) + msg = string.sub(msg, e+1) + + if command and slashCallback[command] then + slashCallback[command](msg) + else + -- print all commands + end +end + diff --git a/AllTheLittleThings.toc b/AllTheLittleThings.toc index 4237867..2ceea86 100644 --- a/AllTheLittleThings.toc +++ b/AllTheLittleThings.toc @@ -15,6 +15,22 @@ Libs\AceConsole-3.0\AceConsole-3.0.xml Libs\AceConfig-3.0\AceConfig-3.0.xml Libs\AceTimer-3.0\AceTimer-3.0.xml -transitive.lua +# transitive.lua +# PriorityQueue.lua + AllTheLittleThings.lua -PriorityQueue.lua \ No newline at end of file + +modules\announce.lua +modules\battlegrounds.lua +modules\chatfilter.lua +modules\defaultui.lua +# modules\deprecated.lua +modules\guildroster.lua +modules\macros.lua +modules\miscellaneous.lua +modules\potions.lua +modules\prat.lua +modules\raid.lua +modules\rbs.lua +modules\template.lua +