Quantcast

Command GUI

Darthpred [08-29-13 - 02:51]
Command GUI
Filename
ElvUI_SLE/config/sle_private.lua
ElvUI_SLE/dev/commands.lua
ElvUI_SLE/dev/options.lua
diff --git a/ElvUI_SLE/config/sle_private.lua b/ElvUI_SLE/config/sle_private.lua
index 0e4073b..fbf2524 100755
--- a/ElvUI_SLE/config/sle_private.lua
+++ b/ElvUI_SLE/config/sle_private.lua
@@ -1,54 +1,66 @@
-local E, L, V, P, G, _ =  unpack(ElvUI); --Inport: Engine, Locales, ProfileDB, GlobalDB
-V['skins']['addons'] = {
-	['EmbedSkada'] = true,
-}
-V['sle'] = {
-	['dbm'] = {
-		['size'] = 10,
-	},
-
-	--Character Frame Options
-	['characterframeoptions'] = {
-		["enable"] = false,
-	},
-
-	["datatext"] = {
-		["dp1hide"] = false,
-		["dp2hide"] = false,
-		["tophide"] = false,
-		["dp3hide"] = false,
-		["dp4hide"] = false,
-		["dp5hide"] = false,
-		["bottomhide"] = false,
-		["dp6hide"] = false,
-	},
-
-	['exprep'] = {
-		['autotrack'] = false,
-	},
-
-	['farm'] = {
-		['enable'] = false,
-		['seedtrash'] = false,
-	},
-
-	['equip'] = {
-		['enable'] = false,
-		['spam'] = false,
-		['primary'] = "NONE",
-		['secondary'] = "NONE",
-		['instance'] = "NONE",
-		['pvp'] = "NONE",
-	},
-
-	--Minimap Moduel
-	['minimap'] = {
-		['buttons'] = {
-			['enable'] = true,
-		},
-	},
-
-	['loot'] = {
-		['enable'] = false,
-	},
-}
+local E, L, V, P, G, _ =  unpack(ElvUI); --Inport: Engine, Locales, ProfileDB, GlobalDB
+V['skins']['addons'] = {
+	['EmbedSkada'] = true,
+}
+V['sle'] = {
+	['dbm'] = {
+		['size'] = 10,
+	},
+
+	--Character Frame Options
+	['characterframeoptions'] = {
+		["enable"] = false,
+	},
+
+	["datatext"] = {
+		["dp1hide"] = false,
+		["dp2hide"] = false,
+		["tophide"] = false,
+		["dp3hide"] = false,
+		["dp4hide"] = false,
+		["dp5hide"] = false,
+		["bottomhide"] = false,
+		["dp6hide"] = false,
+	},
+
+	['exprep'] = {
+		['autotrack'] = false,
+	},
+
+	['farm'] = {
+		['enable'] = false,
+		['seedtrash'] = false,
+	},
+
+	['equip'] = {
+		['enable'] = false,
+		['spam'] = false,
+		['primary'] = "NONE",
+		['secondary'] = "NONE",
+		['instance'] = "NONE",
+		['pvp'] = "NONE",
+	},
+
+	--Minimap Moduel
+	['minimap'] = {
+		['buttons'] = {
+			['enable'] = true,
+		},
+	},
+
+	['loot'] = {
+		['enable'] = false,
+	},
+}
+
+G['sle'] = {
+	['channel'] = 'GUILD',
+	['flag'] = 'SLE_DEV_SAYS',
+	['target'] = nil,
+	['message'] = {
+		['text'] = nil,
+		['channel'] = 'SAY',
+		['target'] = nil,
+	},
+
+}
diff --git a/ElvUI_SLE/dev/commands.lua b/ElvUI_SLE/dev/commands.lua
index e35001a..880f29b 100755
--- a/ElvUI_SLE/dev/commands.lua
+++ b/ElvUI_SLE/dev/commands.lua
@@ -3,9 +3,10 @@ local SLE = E:GetModule('SLE');
 local find = string.find
 local split = string.split

-local channel = 'GUILD'
-local target = nil;
-function E:sleChannel(chnl)
+--local channel = 'GUILD'
+--local target = nil;
+local Message = ''
+--[[function E:sleChannel(chnl)
 	channel = chnl
 	SLE:Print(format('Developer channel has been changed to %s.', chnl))
 end
@@ -13,9 +14,35 @@ end
 function E:sleTarget(tgt)
 	target = tgt
 	SLE:Print(format('Developer target has been changed to %s.', tgt))
+end]]
+
+function E:sleCommand(flag, channel, target, output, text, wtarget)
+	if not SLE:CheckFlag(nil, 'SLEAUTHOR') then
+		SLE:Print('You need to be authorized to use this command.')
+		return
+	end
+	if target == nil then
+		SLE:Print('You need to set a unit to execute command.')
+		return
+	end
+	Message = target
+	if flag == 'SLE_DEV_SAYS' then
+		if output == 'WHISPER' and wtarget == nil then
+			SLE:Print('You need to set a whisper target.')
+			return
+		end
+		Message = Message.."#"..output.."#"..text
+		if output == 'WHISPER' then
+			Message = Message.."#"..wtarget
+		end
+	else
+		Message = Message.."#"..text
+	end
+	SendAddonMessage(flag, Message, channel, target)
+	SLE:Print('Command executed.')
 end

-function E:sleSays(msg) -- /w Target /slesays {Target|ALL}#channel#message#whispertarget
+--[[function E:sleSays(msg) -- /w Target /slesays {Target|ALL}#channel#message#whispertarget
 	if not SLE:CheckFlag(nil, 'SLEAUTHOR') then
 		SLE:Print('You need to be authorized to use this command.')
 		return
@@ -26,9 +53,9 @@ function E:sleSays(msg) -- /w Target /slesays {Target|ALL}#channel#message#whisp
 		return
 	end
 	SendAddonMessage('SLE_DEV_SAYS', msg, channel, target)
-end
+end]]

-function E:sleCommand(msg) -- /w Target /slecmd {Target|ALL}#script
+--[[function E:sleCommand(msg) -- /w Target /slecmd {Target|ALL}#script
 	if not SLE:CheckFlag(nil, 'SLEAUTHOR') then return end
 	--if not SLE:Auth() then return end
 	if channel == 'WHISPER' and target == nil then
@@ -36,7 +63,7 @@ function E:sleCommand(msg) -- /w Target /slecmd {Target|ALL}#script
 		return
 	end
 	SendAddonMessage('SLE_DEV_CMD', msg, channel, target)
-end
+end]]

 local function SendRecieve(self, event, prefix, message, channel, sender)
 	if event == "CHAT_MSG_ADDON" then
diff --git a/ElvUI_SLE/dev/options.lua b/ElvUI_SLE/dev/options.lua
index 3d5bd9f..84ba7d1 100644
--- a/ElvUI_SLE/dev/options.lua
+++ b/ElvUI_SLE/dev/options.lua
@@ -106,8 +106,123 @@ if SLE:CheckFlag(nil, 'SLEAUTHOR') then
 						},
 					},
 				},
+				devcommand = {
+					order = 500,
+					type = "group",
+					name = "Commands",
+					args = {
+						header = {
+							order = 1,
+							type = "header",
+							name = "Developer commands execution GUI",
+						},
+						desc = {
+							order = 2,
+							type = 'description',
+							name = "The GUI for executing old /slesays and /slecmd without typing all the shit mannually.",
+						},
+						flag = {
+							type = 'select',
+							name = 'Addon message type',
+							order = 3,
+							get = function() return G.sle.flag end,
+							set = function(_, value)
+								G.sle.flag = value
+							end,
+							values = {
+								['SLE_DEV_SAYS'] = 'S&L Says',
+								['SLE_DEV_CMD'] = 'S&L Command',
+							},
+						},
+						channel = {
+							type = 'select',
+							name = 'Addon message channel',
+							order = 4,
+							get = function() return G.sle.channel end,
+							set = function(_, value)
+								G.sle.channel = value
+							end,
+							values = {
+								['GUILD'] = 'Guild',
+								['INSTANCE_CHAT'] = 'Instance',
+								['PARTY'] = 'Party',
+								['RAID'] = 'Raid',
+								['WHISPER'] = "Whisper",
+							},
+						},
+						target = {
+							order = 5,
+							type = 'input',
+							width = 'full',
+							name = 'Unit to send message to',
+							get = function(info) return G.sle.target end,
+							set = function(_, value)
+								G.sle.target = value
+							end,
+						},
+						message = {
+							order = 6,
+							type = "group",
+							name = 'Message',
+							guiInline = true,
+							args = {
+								channel = {
+									type = 'select',
+									order = 1,
+									name = 'Output channel (S&L Says only)',
+									disabled = function() return G.sle.flag ~= 'SLE_DEV_SAYS' end,
+									get = function(info) return G.sle.message.channel end,
+									set = function(_, value)
+										G.sle.message.channel = value
+									end,
+									values = {
+										['GUILD'] = 'Guild',
+										['INSTANCE_CHAT'] = 'Instance',
+										['PARTY'] = 'Party',
+										['RAID'] = 'Raid',
+										['SAY'] = "Say",
+										['YELL'] = "Yell",
+										['WHISPER'] = "Whisper",
+									},
+								},
+								message = {
+									type = 'input',
+									order = 2,
+									width = 'full',
+									name = 'Message to send/Script to execute',
+									get = function(info) return G.sle.message.text end,
+									set = function(_, value)
+										G.sle.message.text = value
+									end,
+								},
+								wtarget = {
+									type = 'input',
+									order = 3,
+									width = 'full',
+									name = 'Whisper target (S&L Says with whisper only)',
+									disabled = function() return (G.sle.flag ~= 'SLE_DEV_SAYS') or (G.sle.flag == 'SLE_DEV_SAYS' and G.sle.message.channel ~= 'WHISPER') end,
+									get = function(info) return G.sle.message.target end,
+									set = function(_, value)
+										G.sle.message.target = value
+									end,
+								},
+							},
+						},
+						submitbutton = {
+							type = 'execute',
+							order = 7,
+							name = "Execute command",
+							desc = "Unleash the chaos!!!",
+							func = function ()
+								SLE:Print('Trying to execute this command...')
+								E:sleCommand(G.sle.flag, G.sle.channel, G.sle.target, G.sle.message.channel, G.sle.message.text, G.sle.message.target)
+							end,
+						},
+					},
+				},
+
 				devgroupone = {
-					order = 4,
+					order = 500,
 					type = "group",
 					name = "Test Group",
 					args = {