diff --git a/AddonComm.lua b/AddonComm.lua index 6aca5bc..9858491 100644 --- a/AddonComm.lua +++ b/AddonComm.lua @@ -1,4 +1,4 @@ ---[[ +--[[ * Copyright (c) 2011-2012 by Adam Hellberg. * * This file is part of Command. @@ -17,6 +17,14 @@ * along with Command. If not, see <http://www.gnu.org/licenses/>. --]] +-- Upvalues +local type = type +local wipe = wipe +local pairs = pairs +local ipairs = ipairs +local tostring = tostring +local tonumber = tonumber + local C = Command local L = C.LocaleManager diff --git a/BattleNetTools.lua b/BattleNetTools.lua index cf0d6d2..5fd81f5 100644 --- a/BattleNetTools.lua +++ b/BattleNetTools.lua @@ -1,4 +1,4 @@ ---[[ +--[[ * Copyright (c) 2011-2012 by Adam Hellberg. * * This file is part of Command. @@ -17,6 +17,10 @@ * along with Command. If not, see <http://www.gnu.org/licenses/>. --]] +-- Upvalues +local select = select +local tonumber = tonumber + local C = Command C.BattleNetTools = { diff --git a/ChatManager.lua b/ChatManager.lua index a631d0b..357857e 100644 --- a/ChatManager.lua +++ b/ChatManager.lua @@ -1,4 +1,4 @@ ---[[ +--[[ * Copyright (c) 2011-2012 by Adam Hellberg. * * This file is part of Command. @@ -17,6 +17,12 @@ * along with Command. If not, see <http://www.gnu.org/licenses/>. --]] +-- Upvalues +local type = type +local ipairs = ipairs +local unpack = unpack +local tostring = tostring + local C = Command --- Table holding all ChatManager methods. @@ -231,17 +237,4 @@ function CM:HandleMessage(msg, sender, channel, target, sourceChannel, isBN, pID end self:SendMessage(s, "WHISPER", sender, isBN) end - --[[ PRE-Locale stuff - if result then - if type(result) == "table" then - for _,v in ipairs(result) do - self:SendMessage(tostring(v), channel, target, isBN) - end - else - self:SendMessage(tostring(result), channel, target, isBN) - end - else - self:SendMessage(tostring(err), "WHISPER", sender, isBN) - end - -- END PRE-Locale stuff ]] end diff --git a/Command.lua b/Command.lua index f89a81a..3a5cbdf 100644 --- a/Command.lua +++ b/Command.lua @@ -1,4 +1,4 @@ ---[[ +--[[ * Copyright (c) 2011-2012 by Adam Hellberg. * * This file is part of Command. @@ -17,6 +17,10 @@ * along with Command. If not, see <http://www.gnu.org/licenses/>. --]] +-- Upvalues +local type = type +local wipe = wipe + --- Table containing all Command methods. -- This is referenced "C" in Command.lua -- @name Command diff --git a/CommandManager.lua b/CommandManager.lua index 8649d3b..0e8f421 100644 --- a/CommandManager.lua +++ b/CommandManager.lua @@ -1,4 +1,4 @@ ---[[ +--[[ * Copyright (c) 2011-2012 by Adam Hellberg. * * This file is part of Command. @@ -17,6 +17,14 @@ * along with Command. If not, see <http://www.gnu.org/licenses/>. --]] +-- Upvalues +local type = type +local pairs = pairs +local ipairs = ipairs +local unpack = unpack +local tostring = tostring +local tonumber = tonumber + local C = Command --- Table holding all CommandManager methods. @@ -178,7 +186,6 @@ CM:Register({"commands", "cmds", "cmdlist", "listcmds", "listcommands", "command end, "CM_COMMANDS_HELP") CM:Register({"version", "ver", "v"}, PM.Access.Groups.User.Level, function(args, sender, isChat) - --return C.Version return "CM_VERSION", {C.Version} end, "CM_VERSION_HELP") diff --git a/EventHandler.lua b/EventHandler.lua index a28c2e9..b3dc25e 100644 --- a/EventHandler.lua +++ b/EventHandler.lua @@ -1,4 +1,4 @@ ---[[ +--[[ * Copyright (c) 2011-2012 by Adam Hellberg. * * This file is part of Command. @@ -17,6 +17,9 @@ * along with Command. If not, see <http://www.gnu.org/licenses/>. --]] +-- Upvalues +local pairs = pairs + local C = Command local CES = C.Extensions.String diff --git a/Events.lua b/Events.lua index fa9a652..b01ac07 100644 --- a/Events.lua +++ b/Events.lua @@ -1,4 +1,4 @@ ---[[ +--[[ * Copyright (c) 2011-2012 by Adam Hellberg. * * This file is part of Command. @@ -17,6 +17,10 @@ * along with Command. If not, see <http://www.gnu.org/licenses/>. --]] +-- Upvalues +local select = select +local tostring = tostring + local C = Command local L = C.LocaleManager diff --git a/Events_Chat.lua b/Events_Chat.lua index eb554d0..0bd94e9 100644 --- a/Events_Chat.lua +++ b/Events_Chat.lua @@ -1,4 +1,4 @@ ---[[ +--[[ * Copyright (c) 2011-2012 by Adam Hellberg. * * This file is part of Command. @@ -17,6 +17,9 @@ * along with Command. If not, see <http://www.gnu.org/licenses/>. --]] +-- Upvalues +local select = select + local C = Command local CM = C.ChatManager local AC = C.AddonComm diff --git a/GroupTools.lua b/GroupTools.lua index 2898cce..0ea847f 100644 --- a/GroupTools.lua +++ b/GroupTools.lua @@ -1,4 +1,4 @@ ---[[ +--[[ * Copyright (c) 2011-2012 by Adam Hellberg. * * This file is part of Command. @@ -17,6 +17,9 @@ * along with Command. If not, see <http://www.gnu.org/licenses/>. --]] +-- Upvalues +local select = select + local C = Command --- Table containing all GroupTools methods. diff --git a/LocaleManager.lua b/LocaleManager.lua index 8be3937..ce20134 100644 --- a/LocaleManager.lua +++ b/LocaleManager.lua @@ -1,4 +1,4 @@ ---[[ +--[[ * Copyright (c) 2011-2012 by Adam Hellberg. * * This file is part of Command. @@ -20,6 +20,12 @@ -- NOTE: All error() calls use constant strings in english for debugging reasons. -- NOTE: return after error() shouldn't be needed. Consider remove. +-- Upvalues +local type = type +local pairs = pairs +local tostring = tostring +local setmetatable = setmetatable + local C = Command C.LocaleManager = { diff --git a/Logger.lua b/Logger.lua index ba14fe2..202a5e0 100644 --- a/Logger.lua +++ b/Logger.lua @@ -1 +1 @@ ---[[ * Copyright (c) 2011-2012 by Adam Hellberg. * * This file is part of Command. * * Command is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Command is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Command. If not, see <http://www.gnu.org/licenses/>. --]] local C = Command --- Table containing all Logger methods. -- This is referenced "Logger" in Logger.lua. -- @name Command.Logger -- @class table -- @field Level Table containing all logger levels. -- @field Settings Table containing all settings specific to Logger. -- C.Logger = { Level = { Debug = 0, Normal = 1, Warning = 2, Error = 3 }, Settings = { Debug = false, Format = "%s%s: %s", } } local Logger = C.Logger local L = C.LocaleManager ------------------------ -- MAIN LOGGER MODULE -- ------------------------ --- Print a log message at the specified level. -- @param msg Message to pring. -- @param level One of the levels defined in Logger.Level. -- function Logger:Print(msg, level) local prefix if level == self.Level.Debug then if not self.Settings.Debug then return end prefix = L("LOGGER_PREFIX_DEBUG") elseif level == self.Level.Normal then prefix = L("LOGGER_PREFIX_NORMAL") elseif level == self.Level.Warning then prefix = L("LOGGER_PREFIX_WARNING") elseif level == self.Level.Error then prefix = L("LOGGER_PREFIX_ERROR") else error(L("LOGGER_ERR_UNDEFINED"):format(tostring(level))) return end DEFAULT_CHAT_FRAME:AddMessage(self.Settings.Format:format(L("LOGGER_PREFIX_MAIN"):format(C.Name), prefix, msg)) end --- Print a debug message. -- @param msg Message to print. -- function Logger:Debug(msg) self:Print(msg, self.Level.Debug) end --- Print a normal message -- @param msg Message to print. -- function Logger:Normal(msg) self:Print(msg, self.Level.Normal) end --- Print a warning message. -- @param msg Message to pring. -- function Logger:Warning(msg) self:Print(msg, self.Level.Warning) end --- Print an error message. -- @param msg Message to print. -- function Logger:Error(msg) self:Print(msg, self.Level.Error) end --- Control the debug state. -- Setting debugging to enabled will enable debug messages to be printed. -- @param enabled Boolean indicating enabled or disabled state. -- function Logger:SetDebug(enabled) self.Settings.Debug = enabled end --- Enable debugging. -- function Logger:EnableDebug() self:SetDebug(true) end --- Disable debugging. -- function Logger:DisableDebug() self:SetDebug(false) end --- Toggle debugging. -- function Logger:ToggleDebug() self:SetDebug(not self.Settings.Debug) end \ No newline at end of file +--[[ * Copyright (c) 2011-2012 by Adam Hellberg. * * This file is part of Command. * * Command is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Command is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Command. If not, see <http://www.gnu.org/licenses/>. --]] -- Upvalues local tostring = tostring local C = Command --- Table containing all Logger methods. -- This is referenced "Logger" in Logger.lua. -- @name Command.Logger -- @class table -- @field Level Table containing all logger levels. -- @field Settings Table containing all settings specific to Logger. -- C.Logger = { Level = { Debug = 0, Normal = 1, Warning = 2, Error = 3 }, Settings = { Debug = false, Format = "%s%s: %s", } } local Logger = C.Logger local L = C.LocaleManager ------------------------ -- MAIN LOGGER MODULE -- ------------------------ --- Print a log message at the specified level. -- @param msg Message to pring. -- @param level One of the levels defined in Logger.Level. -- function Logger:Print(msg, level) local prefix if level == self.Level.Debug then if not self.Settings.Debug then return end prefix = L("LOGGER_PREFIX_DEBUG") elseif level == self.Level.Normal then prefix = L("LOGGER_PREFIX_NORMAL") elseif level == self.Level.Warning then prefix = L("LOGGER_PREFIX_WARNING") elseif level == self.Level.Error then prefix = L("LOGGER_PREFIX_ERROR") else error(L("LOGGER_ERR_UNDEFINED"):format(tostring(level))) return end DEFAULT_CHAT_FRAME:AddMessage(self.Settings.Format:format(L("LOGGER_PREFIX_MAIN"):format(C.Name), prefix, msg)) end --- Print a debug message. -- @param msg Message to print. -- function Logger:Debug(msg) self:Print(msg, self.Level.Debug) end --- Print a normal message -- @param msg Message to print. -- function Logger:Normal(msg) self:Print(msg, self.Level.Normal) end --- Print a warning message. -- @param msg Message to pring. -- function Logger:Warning(msg) self:Print(msg, self.Level.Warning) end --- Print an error message. -- @param msg Message to print. -- function Logger:Error(msg) self:Print(msg, self.Level.Error) end --- Control the debug state. -- Setting debugging to enabled will enable debug messages to be printed. -- @param enabled Boolean indicating enabled or disabled state. -- function Logger:SetDebug(enabled) self.Settings.Debug = enabled end --- Enable debugging. -- function Logger:EnableDebug() self:SetDebug(true) end --- Disable debugging. -- function Logger:DisableDebug() self:SetDebug(false) end --- Toggle debugging. -- function Logger:ToggleDebug() self:SetDebug(not self.Settings.Debug) end \ No newline at end of file diff --git a/LootManager.lua b/LootManager.lua index 29ccedd..53ac07d 100644 --- a/LootManager.lua +++ b/LootManager.lua @@ -1,4 +1,4 @@ ---[[ +--[[ * Copyright (c) 2011-2012 by Adam Hellberg. * * This file is part of Command. @@ -17,6 +17,9 @@ * along with Command. If not, see <http://www.gnu.org/licenses/>. --]] +-- Upvalues +local type = type + local C = Command --- Table holding all LootManager methods. diff --git a/PlayerManager.lua b/PlayerManager.lua index ea405ac..0e56e56 100644 --- a/PlayerManager.lua +++ b/PlayerManager.lua @@ -1,4 +1,4 @@ ---[[ +--[[ * Copyright (c) 2011-2012 by Adam Hellberg. * * This file is part of Command. @@ -17,6 +17,14 @@ * along with Command. If not, see <http://www.gnu.org/licenses/>. --]] +-- Upvalues +local type = type +local wipe = wipe +local pairs = pairs +local ipairs = ipairs +local select = select +local tostring = tostring + local MODE_BLACKLIST = 0 local MODE_WHITELIST = 1 diff --git a/QueueManager.lua b/QueueManager.lua index 0ba3fd5..eb3b698 100644 --- a/QueueManager.lua +++ b/QueueManager.lua @@ -1,4 +1,4 @@ ---[[ +--[[ * Copyright (c) 2011-2012 by Adam Hellberg. * * This file is part of Command. @@ -17,6 +17,12 @@ * along with Command. If not, see <http://www.gnu.org/licenses/>. --]] +-- Upvalues +local type = type +local pairs = pairs +local select = select +local tostring = tostring + local C = Command --- Table containing all QueueManager methods. diff --git a/RollManager.lua b/RollManager.lua index 3b58be5..f6ae1d0 100644 --- a/RollManager.lua +++ b/RollManager.lua @@ -1,4 +1,4 @@ ---[[ +--[[ * Copyright (c) 2011-2012 by Adam Hellberg. * * This file is part of Command. @@ -17,6 +17,13 @@ * along with Command. If not, see <http://www.gnu.org/licenses/>. --]] +-- Upvalues +local type = type +local wipe = wipe +local pairs = pairs +local tostring = tostring +local tonumber = tonumber + local C = Command local L = C.LocaleManager local GT = C.GroupTools @@ -257,7 +264,6 @@ function RM:ParseMessage(msg) roll = tonumber(roll) minRoll = tonumber(minRoll) maxRoll = tonumber(maxRoll) - print(name, roll, minRoll, maxRoll) if minRoll ~= self.Settings.MIN_ROLL or maxRoll ~= self.Settings.MAX_ROLL then CM:SendMessage(L("RM_ERR_INVALIDROLL"):format(name), "SMART") return diff --git a/String.lua b/String.lua index a725727..eda3adf 100644 --- a/String.lua +++ b/String.lua @@ -1,4 +1,4 @@ ---[[ +--[[ * Copyright (c) 2011-2012 by Adam Hellberg. * * This file is part of Command. @@ -17,6 +17,9 @@ * along with Command. If not, see <http://www.gnu.org/licenses/>. --]] +-- Upvalues +local type = type + local C = Command if type(C.Extensions) ~= "table" then diff --git a/Table.lua b/Table.lua index 2bedc23..dfb7cca 100644 --- a/Table.lua +++ b/Table.lua @@ -1,4 +1,4 @@ ---[[ +--[[ * Copyright (c) 2011-2012 by Adam Hellberg. * * This file is part of Command. @@ -17,6 +17,11 @@ * along with Command. If not, see <http://www.gnu.org/licenses/>. --]] +-- Upvalues +local type = type +local pairs = pairs +local tostring = tostring + local C = Command if type(C.Extensions) ~= "table" then diff --git a/locales/enUS.lua b/locales/enUS.lua index 7d6d904..6719706 100644 --- a/locales/enUS.lua +++ b/locales/enUS.lua @@ -1,4 +1,4 @@ ---[[ +--[[ * Copyright (c) 2011-2012 by Adam Hellberg. * * This file is part of Command. diff --git a/locales/svSE.lua b/locales/svSE.lua index 3a1c174..273997a 100644 --- a/locales/svSE.lua +++ b/locales/svSE.lua @@ -1,4 +1,4 @@ ---[[ +--[[ * Copyright (c) 2011-2012 by Adam Hellberg. * * This file is part of Command.