Quantcast

addon message errors fixed

Munglunch [09-02-14 - 14:44]
addon message errors fixed
Filename
Interface/AddOns/SVUI/SVUI.lua
Interface/AddOns/SVUI/system/system.lua
Interface/AddOns/SVUI_AnsweringService/SVUI_AnsweringService.lua
diff --git a/Interface/AddOns/SVUI/SVUI.lua b/Interface/AddOns/SVUI/SVUI.lua
index b90b010..7870806 100644
--- a/Interface/AddOns/SVUI/SVUI.lua
+++ b/Interface/AddOns/SVUI/SVUI.lua
@@ -45,6 +45,8 @@ local SVUI = {};
 local SVUINameSpace, SVUICore = ...;
 local version = GetAddOnMetadata(..., "Version");
 local build = select(2, GetBuildInfo());
+local playerName = UnitName("player");
+local playerRealm = GetRealmName();
 local SetAddonCore;
 local callbacks = {};
 local numCallbacks = 0;
@@ -54,9 +56,9 @@ CONSTANTS
 ##########################################################
 ]]--
 BINDING_HEADER_SVUI = "SuperVillain UI";
-SLASH_RELOADUI1="/rl"
-SLASH_RELOADUI2="/reloadui"
-SlashCmdList.RELOADUI=ReloadUI
+SLASH_RELOADUI1 = "/rl"
+SLASH_RELOADUI2 = "/reloadui"
+SlashCmdList.RELOADUI = ReloadUI
 --[[
 ##########################################################
 MUNGLUNCH's FASTER ASSERT FUNCTION
@@ -648,35 +650,35 @@ function SVUI:Prototype(n, v)
     return obj
 end

-local function SendAddonMessage(msg, prefix)
-    if(type(msg) == "table") then
-        msg = tostring(msg)
-    end
+do
+    local messagePattern = "|cffFF2F00%s:|r"
+    local debugPattern = "|cffFF2F00%s|r [|cff992FFF%s|r]|cffFF2F00:|r"
+
+    local function _sendmessage(msg, prefix)
+        if(type(msg) == "table") then
+            msg = tostring(msg)
+        end

-    if(not msg) then return end
+        if(not msg) then return end

-    if(prefix) then
-        local outbound = ("%s %s"):format(prefix, msg);
-        print(outbound)
-    else
-        print(msg)
+        if(prefix) then
+            local outbound = ("%s %s"):format(prefix, msg);
+            print(outbound)
+        else
+            print(msg)
+        end
     end
-end

-function SVUI:Debugger(msg)
-    if(not self.DebuggingMode) then return end
-    local outbound = ("|cffFF2F00%s:|r |cff992FFF%s:|r"):format("SVUI", "DEBUG")
-    SendAddonMessage(msg, outbound)
-end
-
-function SVUI:AddonMessage(msg)
-    local outbound = ("|cffFF2F00%s:|r"):format("SVUI")
-    SendAddonMessage(msg, outbound)
-end
+    function SVUI:Debugger(msg)
+        if(not self.DebuggingMode) then return end
+        local outbound = (debugPattern):format("SVUI", "DEBUG")
+        _sendmessage(msg, outbound)
+    end

-function SVUI:ToonMessage(msg)
-    local outbound = ("|cff00FF00%s:|r"):format(playerName)
-    SendAddonMessage(msg, outbound)
+    function SVUI:AddonMessage(msg)
+        local outbound = (messagePattern):format("SVUI")
+        _sendmessage(msg, outbound)
+    end
 end

 SVUICore[1] = SVUI
diff --git a/Interface/AddOns/SVUI/system/system.lua b/Interface/AddOns/SVUI/system/system.lua
index 038daa5..2105d91 100644
--- a/Interface/AddOns/SVUI/system/system.lua
+++ b/Interface/AddOns/SVUI/system/system.lua
@@ -58,9 +58,6 @@ LOCALS
 ##########################################################
 ]]--
 local toonClass = select(2,UnitClass("player"));
-local playerName = UnitName("player");
-local playerRealm = GetRealmName();
-
 local rez = GetCVar("gxResolution");
 local gxHeight = tonumber(match(rez,"%d+x(%d+)"));
 local gxWidth = tonumber(match(rez,"(%d+)x%d+"));
diff --git a/Interface/AddOns/SVUI_AnsweringService/SVUI_AnsweringService.lua b/Interface/AddOns/SVUI_AnsweringService/SVUI_AnsweringService.lua
index 8c89297..911f9fa 100644
--- a/Interface/AddOns/SVUI_AnsweringService/SVUI_AnsweringService.lua
+++ b/Interface/AddOns/SVUI_AnsweringService/SVUI_AnsweringService.lua
@@ -993,11 +993,11 @@ local function LoadAnsweringService()
 	HenchmenOperator:Hide()
 	local strMsg
 	if SuperVillain.db.SVAnswer.autoAnswer == true then
-		strMsg = "The Henchmen Operators Are Screening My Calls.."
+		strMsg = "The Henchmen Operators Are Screening Your Calls.."
 	else
 		strMsg = "The Henchmen Operators Are Standing By.."
 	end
-	SuperVillain:ToonMessage(strMsg)
+	SuperVillain:AddonMessage(strMsg)
 end

 CONFIGS["SVAnswer"] = {