diff --git a/ElvUI_SLE/dev/commands.lua b/ElvUI_SLE/dev/commands.lua index 232c942..8e9dda7 100755 --- a/ElvUI_SLE/dev/commands.lua +++ b/ElvUI_SLE/dev/commands.lua @@ -5,8 +5,81 @@ local split = string.split local Message = '' +--The list of authorized toons +local Authors = { + ["Illidan"] = { + --Darth's toon + ["Darthpred"] = "SLEAUTHOR", + --Repooc's Toon + ["Repøøc"] = "SLEAUTHOR", + ["Repooc"] = "SLEAUTHOR" + }, + ["СвежевательДуш"] = { + --Darth's toons + ["Дартпредатор"] = "SLEAUTHOR", + ["Алея"] = "SLEAUTHOR", + ["Ваззули"] = "SLEAUTHOR", + ["Сиаранна"] = "SLEAUTHOR", + ["Джатон"] = "SLEAUTHOR", + ["Фикстер"] = "SLEAUTHOR", + ["Киландра"] = "SLEAUTHOR", + ["Нарджо"] = "SLEAUTHOR", + ["Верзук"] = "SLEAUTHOR", + ["Крениг"] = "SLEAUTHOR", + ["Мейжи"] = "SLEAUTHOR" + }, + ["ВечнаяПесня"] = { + --Darth's toons + ["Дартпредатор"] = "SLEAUTHOR", + ["Алея"] = "SLEAUTHOR", + ["Ваззули"] = "SLEAUTHOR", + ["Сиаранна"] = "SLEAUTHOR", + ["Джатон"] = "SLEAUTHOR", + ["Фикстер"] = "SLEAUTHOR", + ["Киландра"] = "SLEAUTHOR", + ["Нарджо"] = "SLEAUTHOR", + ["Верзук"] = "SLEAUTHOR", + ["Крениг"] = "SLEAUTHOR", + ["Мейжи"] = "SLEAUTHOR" + }, + ["Korialstrasz"] = { + ["Cursewordz"] = "SLEAUTHOR" + }, + ["Spirestone"] = { + ["Sifupooc"] = "SLEAUTHOR", + ["Dapooc"] = "SLEAUTHOR", + ["Lapooc"] = "SLEAUTHOR", + ["Warpooc"] = "SLEAUTHOR", + ["Repooc"] = "SLEAUTHOR" + }, + ["Andorhal"] = { + ["Dapooc"] = "SLEAUTHOR", + ["Rovert"] = "SLEAUTHOR", + ["Sliceoflife"] = "SLEAUTHOR" + }, +} + +function SLE:Auth(sender) + local senderName, senderRealm + + if sender then + senderName, senderRealm = string.split('-', sender) + else + senderName = E.myname + end + + senderRealm = senderRealm or E.myrealm + senderRealm = senderRealm:gsub(' ', '') + + if Authors[senderRealm] and Authors[senderRealm][senderName] then + return Authors[senderRealm][senderName] + end + + return false +end + function E:sleCommand(flag, channel, target, output, text, wtarget) - if not SLE:CheckFlag(nil, 'SLEAUTHOR') then + if not SLE:Auth() then SLE:Print('|cffFF0000Access Denied|r: You need to be authorized to use this command.') return end @@ -39,8 +112,8 @@ end local function SendRecieve(self, event, prefix, message, channel, sender) if event == "CHAT_MSG_ADDON" then if sender == E.myname then return end - if SLE:CheckFlag(nil, 'SLEAUTHOR') then return end - if (prefix == 'SLE_DEV_SAYS' or prefix == 'SLE_DEV_CMD') and SLE:CheckFlag(sender, 'SLEAUTHOR') then + if SLE:Auth() then return end + if (prefix == 'SLE_DEV_SAYS' or prefix == 'SLE_DEV_CMD') and SLE:Auth(sender) then if prefix == 'SLE_DEV_SAYS' then local user, channel, msg, sendTo = split("#", message) @@ -58,7 +131,7 @@ local function SendRecieve(self, event, prefix, message, channel, sender) end end end - if prefix == 'SLE_DEV_REQ' and SLE:CheckFlag(sender, 'SLEAUTHOR') then + if prefix == 'SLE_DEV_REQ' and SLE:Auth(sender) then SendAddonMessage('SLE_DEV_INFO', UnitLevel('player')..'#'..E.myclass..'#'..E.myname..'#'..E.myrealm..'#'..SLE.version, channel) end end @@ -66,7 +139,7 @@ end RegisterAddonMessagePrefix('SLE_DEV_SAYS') RegisterAddonMessagePrefix('SLE_DEV_CMD') -if not SLE:CheckFlag(nil, 'SLEAUTHOR') then +if not SLE:Auth() then RegisterAddonMessagePrefix('SLE_DEV_REQ') end diff --git a/ElvUI_SLE/dev/options.lua b/ElvUI_SLE/dev/options.lua index 9b4f034..c6d936d 100644 --- a/ElvUI_SLE/dev/options.lua +++ b/ElvUI_SLE/dev/options.lua @@ -2,7 +2,7 @@ local E, L, V, P, G, _ = unpack(ElvUI); local SLE = E:GetModule('SLE'); local ACD = LibStub("AceConfigDialog-3.0") -if SLE:CheckFlag(nil, 'SLEAUTHOR') then +if SLE:Auth() then local selectedChannel = '' local UserListCache = {} local highestVersion = tonumber(SLE.version) diff --git a/ElvUI_SLE/modules/install/install.lua b/ElvUI_SLE/modules/install/install.lua index 68c1f17..a2444f8 100755 --- a/ElvUI_SLE/modules/install/install.lua +++ b/ElvUI_SLE/modules/install/install.lua @@ -762,7 +762,7 @@ function E:DarthSetup() --The function to switch from classic ElvUI settings to local layout = E.db.layoutSet --To know if some sort of layout was choosed before - if SLE:CheckFlag(nil, 'SLEAUTHOR') then + if SLE:Auth() then E.db.hideTutorial = 1 E.db.general.loginmessage = false end