1
0
Fork 0

changed slash command coloring and display order

This commit is contained in:
pigmonkey 2011-05-30 19:07:01 -04:00
parent df9f0e897a
commit f81b074aac
2 changed files with 9 additions and 4 deletions

View file

@ -61,14 +61,20 @@ function core:RegisterOptions(modOptions, modDefaults)
end end
function core:RegisterSlashCommand(callback, ...) function core:RegisterSlashCommand(callback, ...)
local long = "" local keyword
for i=1,select('#', ...) do for i=1,select('#', ...) do
local slash = select(i, ...) local slash = select(i, ...)
if slashCallback[slash] then
error(("Slash command paramter already registered: '%s'"):format(slash))
end
slashCallback[slash] = self[callback] slashCallback[slash] = self[callback]
long = string.len(slash)>string.len(long) and slash or long
if not keyword or slash:len() < keyword:len() then
keyword = slash
end
end end
slashList[long] = ("|cff33ff99%s|r:%s()"):format(self:GetName(), callback) slashList[("|cff33ff99%s|r:|cffcc7833%s()|r"):format(self:GetName(), callback)] = keyword
end end
function core:MainSlashHandle(msg) function core:MainSlashHandle(msg)

View file

@ -58,7 +58,6 @@ local armorGlyphs = {
function mod:OnInitialize() function mod:OnInitialize()
db = core.db.profile[self:GetName()] or {} db = core.db.profile[self:GetName()] or {}
self:RegisterOptions(options, defaults) self:RegisterOptions(options, defaults)
self:RegisterSlashCommand("method", "slsh1", "slash2")
end end
function mod:OnEnable() function mod:OnEnable()