Quantcast

emotes changes

Munglunch [09-12-14 - 14:56]
emotes changes
Filename
Interface/AddOns/SVUI/scripts/reactions.lua
Interface/AddOns/SVUI/system/database.lua
Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua
diff --git a/Interface/AddOns/SVUI/scripts/reactions.lua b/Interface/AddOns/SVUI/scripts/reactions.lua
index e3bd724..226352f 100644
--- a/Interface/AddOns/SVUI/scripts/reactions.lua
+++ b/Interface/AddOns/SVUI/scripts/reactions.lua
@@ -40,17 +40,6 @@ LOCALS (from ShestakUI  by:Shestak)
 ]]--
 local toon = UnitName("player");

-local ReactionEmotes = {
-	"SALUTE",
-	"THANK",
-	"DRINK"
-}
-
-local function Thanks_Emote(sourceName)
-	local index = random(1,#ReactionEmotes)
-	DoEmote(ReactionEmotes[index], sourceName)
-end
-
 local Reactions = {
 	Woot = {
 		[29166] = true, [20484] = true, [61999] = true,
@@ -135,6 +124,9 @@ local random = math.random
 local function rng()
 	return random(1,6)
 end
+
+local REACTION_INTERRUPT, REACTION_WOOT, REACTION_LOOKY, REACTION_SHARE, REACTION_EMOTE, REACTION_CHAT = false, false, false, false, false, false;
+
 local SAPPED_MESSAGE = {
 	"Oh Hell No ... {rt8}SAPPED{rt8}",
 	"{rt8}SAPPED{rt8} ...Someone's about to get slapped!",
@@ -143,13 +135,26 @@ local SAPPED_MESSAGE = {
 	"{rt8}SAPPED{rt8} ...Ain't Nobody Got Time For That!",
 	"Uh-Oh... {rt8}SAPPED{rt8}"
 }
+
+local ReactionEmotes = {
+	"SALUTE",
+	"THANK",
+	"DRINK"
+}
+
+local function Thanks_Emote(sourceName)
+	if not REACTION_EMOTE then return end
+	local index = random(1,#ReactionEmotes)
+	DoEmote(ReactionEmotes[index], sourceName)
+end
+
 local ChatLogHandler = CreateFrame("Frame")
 local ChatLogHandler_OnEvent = function(self, event, ...)
 	local _, subEvent, _, sourceGUID, sourceName, _, _, destGUID, destName, _, _, spellID, _, _, otherSpellID = ...

 	if not sourceName then return end

-	if(SV.db.system.pvpinterrupt) then
+	if(REACTION_INTERRUPT) then
 		if ((spellID == 6770) and (destName == toon) and (subEvent == "SPELL_AURA_APPLIED" or subEvent == "SPELL_AURA_REFRESH")) then
 			local msg = SAPPED_MESSAGE[rng()]
 			SendChatMessage(msg, "SAY")
@@ -160,7 +165,7 @@ local ChatLogHandler_OnEvent = function(self, event, ...)
 		end
 	end

-	if(SV.db.system.woot) then
+	if(REACTION_WOOT) then
 		for key, value in pairs(Reactions.Woot) do
 			if spellID == key and value == true and destName == toon and sourceName ~= toon and (subEvent == "SPELL_AURA_APPLIED" or subEvent == "SPELL_CAST_SUCCESS") then
 				Thanks_Emote(sourceName)
@@ -170,10 +175,11 @@ local ChatLogHandler_OnEvent = function(self, event, ...)
 		end
 	end

-	if(SV.db.system.lookwhaticando) then
+	if(REACTION_LOOKY) then
 		local outbound;
 		local spells = Reactions.LookWhatICanDo
 		local _, _, difficultyID = GetInstanceInfo()
+
 		if(difficultyID ~= 0 and subEvent == "SPELL_CAST_SUCCESS") then
 			if(not (sourceGUID == UnitGUID("player") and sourceName == toon)) then
 				for i, spells in pairs(spells) do
@@ -183,7 +189,7 @@ local ChatLogHandler_OnEvent = function(self, event, ...)
 						else
 							outbound = (L["%s used a %s."]):format(sourceName, GetSpellLink(spellID).." -> "..destName)
 						end
-						if(SV.db.system.reactionChat) then
+						if(REACTION_CHAT) then
 							SendChatMessage(outbound, MsgTest())
 						else
 							print(outbound)
@@ -199,7 +205,7 @@ local ChatLogHandler_OnEvent = function(self, event, ...)
 						else
 							outbound = GetSpellLink(spellID).." -> "..destName
 						end
-						if(SV.db.system.reactionChat) then
+						if(REACTION_CHAT) then
 							SendChatMessage(outbound, MsgTest())
 						else
 							print(outbound)
@@ -210,13 +216,14 @@ local ChatLogHandler_OnEvent = function(self, event, ...)
 		end
 	end

-	if(SV.db.system.sharingiscaring) then
+	if(REACTION_SHARE) then
 		if not IsInGroup() or InCombatLockdown() or not subEvent or not spellID then return end
 		if not UnitInRaid(sourceName) and not UnitInParty(sourceName) then return end

 		local sourceName = format(sourceName:gsub("%-[^|]+", ""))
 		if(not sourceName) then return end
-		local thanks, outbound = false
+		local thanks = false
+		local outbound
 		if subEvent == "SPELL_CAST_SUCCESS" then
 			-- Feasts
 			if (spellID == 126492 or spellID == 126494) then
@@ -268,7 +275,7 @@ local ChatLogHandler_OnEvent = function(self, event, ...)
 		end

 		if(outbound) then
-			if(SV.db.system.reactionChat) then
+			if(REACTION_CHAT) then
 				SendChatMessage(outbound, MsgTest(true))
 			else
 				print(outbound)
@@ -285,7 +292,14 @@ CONFIG TOGGLE
 ##########################################################
 ]]--
 function SV:ToggleReactions()
-	local settings = SV.db.system
+	local settings = self.db.system
+
+	REACTION_INTERRUPT = settings.pvpinterrupt
+	REACTION_WOOT = settings.woot
+	REACTION_LOOKY = settings.lookwhaticando
+	REACTION_SHARE = settings.sharingiscaring
+	REACTION_EMOTE = settings.reactionEmote
+	REACTION_CHAT = settings.reactionChat

 	if(settings.stupidhat) then
 		StupidHatHandler:RegisterEvent("ZONE_CHANGED_NEW_AREA")
@@ -295,7 +309,7 @@ function SV:ToggleReactions()
 		StupidHatHandler:SetScript("OnEvent", nil)
 	end

-	if(not settings.sharingiscaring) and (not settings.pvpinterrupt) and (not settings.woot) and (not settings.lookwhaticando) then
+	if(not REACTION_SHARE) and (not REACTION_INTERRUPT) and (not REACTION_WOOT) and (not REACTION_LOOKY) then
 		ChatLogHandler:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
 		ChatLogHandler:SetScript("OnEvent", nil)
 	else
diff --git a/Interface/AddOns/SVUI/system/database.lua b/Interface/AddOns/SVUI/system/database.lua
index 664d061..3040dc7 100644
--- a/Interface/AddOns/SVUI/system/database.lua
+++ b/Interface/AddOns/SVUI/system/database.lua
@@ -78,6 +78,7 @@ CONFIGS["system"] = {
 	["pvpinterrupt"] = true,
 	["lookwhaticando"] = false,
 	["reactionChat"] = false,
+	["reactionEmote"] = false,
 	["sharingiscaring"] = false,
 	["arenadrink"] = true,
 	["stupidhat"] = true,
diff --git a/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua b/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua
index a414e73..6ecc749 100644
--- a/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua
+++ b/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua
@@ -369,6 +369,22 @@ SV.Options.args.common = {
 									get = function(j)return SV.db.system.sharingiscaring end,
 									set = function(j,value)SV.db.system.sharingiscaring = value;SV:ToggleReactions()end
 								},
+								reactionChat = {
+									order = 7,
+									type = 'toggle',
+									name = L["Report in Chat"],
+									desc = L["Announcements will be sent to group chat channels"],
+									get = function(j)return SV.db.system.reactionChat end,
+									set = function(j,value)SV.db.system.reactionChat = value;SV:ToggleReactions()end
+								},
+								reactionEmote = {
+									order = 8,
+									type = 'toggle',
+									name = L["Auto Emotes"],
+									desc = L["Some announcements are accompanied by player emotes."],
+									get = function(j)return SV.db.system.reactionEmote end,
+									set = function(j,value)SV.db.system.reactionEmote = value;SV:ToggleReactions()end
+								},
 							}
 						},
 						otherGroup = {