Quantcast

Added autoequipping gear sets. Still no options or anything like that.

Darthpred [02-21-13 - 20:44]
Added autoequipping gear sets. Still no options or anything like that.
Plan is to add options:
enable/disable
enable/disabale spam throttling
choose equip sets for each situation
Filename
ElvUI_SLE/config/sle_private.lua
ElvUI_SLE/modules/load_modules.xml
ElvUI_SLE/modules/specswitch/load_specswitch.xml
ElvUI_SLE/modules/specswitch/options.lua
ElvUI_SLE/modules/specswitch/specswitch.lua
diff --git a/ElvUI_SLE/config/sle_private.lua b/ElvUI_SLE/config/sle_private.lua
index f966b76..c0d31ef 100644
--- a/ElvUI_SLE/config/sle_private.lua
+++ b/ElvUI_SLE/config/sle_private.lua
@@ -41,4 +41,12 @@ V['sle'] = {
 		['enable'] = false,
 		['seedtrash'] = false,
 	},
+
+	['specswitch'] = {
+		['enable'] = false,
+		['primary'] = "",
+		['secondary'] = "",
+		['instance'] = "",
+		['pvp'] = "",
+	},
 }
diff --git a/ElvUI_SLE/modules/load_modules.xml b/ElvUI_SLE/modules/load_modules.xml
index c7dbb57..2da12be 100644
--- a/ElvUI_SLE/modules/load_modules.xml
+++ b/ElvUI_SLE/modules/load_modules.xml
@@ -1,19 +1,20 @@
-<Ui xmlns="http://www.blizzard.com/wow/ui/">
-	<Script file='install.lua'/>
-	<Script file='options.lua'/>
-	<Script file='pvpmover\pvpmover.lua'/>
-	<Include file='autorelease\load_autorelease.xml'/>
-	<Include file='backgrounds\load_backgrounds.xml'/>
-	<Include file='characterframe\load_characterframe.xml'/>
-	<Include file='chat\load_chat.xml'/>
-	<Include file='datatexts\load_datatexts.xml'/>
-	<Include file='errors\load_errors.xml'/>
-	<Include file='exprepbar\load_exprepbar.xml'/>
-	<Include file='farm\load_farm.xml'/>
-	<Include file='marks\load_marks.xml'/>
-	<Include file='raidutility\load_raidutility.xml'/>
-	<Include file='tooltip\load_tooltip.xml'/>
-	<Include file='uibuttons\load_uibuttons.xml'/>
-	<Include file='unitframes\load_unitframes.xml'/>
-	<Script file='test.lua'/>
+<Ui xmlns="http://www.blizzard.com/wow/ui/">
+	<Script file='install.lua'/>
+	<Script file='options.lua'/>
+	<Script file='pvpmover\pvpmover.lua'/>
+	<Include file='autorelease\load_autorelease.xml'/>
+	<Include file='backgrounds\load_backgrounds.xml'/>
+	<Include file='characterframe\load_characterframe.xml'/>
+	<Include file='chat\load_chat.xml'/>
+	<Include file='datatexts\load_datatexts.xml'/>
+	<Include file='errors\load_errors.xml'/>
+	<Include file='exprepbar\load_exprepbar.xml'/>
+	<Include file='farm\load_farm.xml'/>
+	<Include file='marks\load_marks.xml'/>
+	<Include file='raidutility\load_raidutility.xml'/>
+	<Include file='specswitch\load_specswitch.xml'/>
+	<Include file='tooltip\load_tooltip.xml'/>
+	<Include file='uibuttons\load_uibuttons.xml'/>
+	<Include file='unitframes\load_unitframes.xml'/>
+	<Script file='test.lua'/>
 </Ui>
\ No newline at end of file
diff --git a/ElvUI_SLE/modules/specswitch/load_specswitch.xml b/ElvUI_SLE/modules/specswitch/load_specswitch.xml
new file mode 100644
index 0000000..df31ee9
--- /dev/null
+++ b/ElvUI_SLE/modules/specswitch/load_specswitch.xml
@@ -0,0 +1,4 @@
+<Ui xmlns="http://www.blizzard.com/wow/ui/">
+	<Script file='specswitch.lua'/>
+	<Script file='options.lua'/>
+</Ui>
\ No newline at end of file
diff --git a/ElvUI_SLE/modules/specswitch/options.lua b/ElvUI_SLE/modules/specswitch/options.lua
new file mode 100644
index 0000000..49ec35c
--- /dev/null
+++ b/ElvUI_SLE/modules/specswitch/options.lua
@@ -0,0 +1,2 @@
+local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore
+local SS = E:GetModule('SpecSwitch')
\ No newline at end of file
diff --git a/ElvUI_SLE/modules/specswitch/specswitch.lua b/ElvUI_SLE/modules/specswitch/specswitch.lua
new file mode 100644
index 0000000..9b161e0
--- /dev/null
+++ b/ElvUI_SLE/modules/specswitch/specswitch.lua
@@ -0,0 +1,57 @@
+--Raid mark bar. Similar to quickmark which just semms to be impossible to skin
+local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore
+local SS = E:NewModule('SpecSwitch', 'AceHook-3.0', 'AceEvent-3.0');
+
+function SS:Equip(event)
+	print("1")
+	SS:EnableSpecSwitcherSpamFilter()
+	local primary = GetSpecialization()
+	if primary ~= nil then
+		local inInstance, instanceType = IsInInstance()
+		if (event == "ACTIVE_TALENT_GROUP_CHANGED") then
+			if GetActiveSpecGroup() == 1 then
+				UseEquipmentSet(E.private.sle.specswitch.primary)
+			else
+				UseEquipmentSet(E.private.sle.specswitch.secondary)
+			end
+		end
+		if (instanceType == "party" or instanceType == "raid") then
+			UseEquipmentSet(E.private.sle.specswitch.instance)
+		end
+		if (instanceType == "pvp" or instanceType == "arena") then
+			UseEquipmentSet(E.private.sle.specswitch.pvp)
+		end
+	end
+end
+
+function SS:SpecSwitcherSpamFilter(event, msg, ...)
+	if strfind(msg, string.gsub(ERR_LEARN_ABILITY_S:gsub('%.', '%.'), '%%s', '(.*)')) then
+		return true
+	elseif strfind(msg, string.gsub(ERR_LEARN_SPELL_S:gsub('%.', '%.'), '%%s', '(.*)')) then
+		return true
+	elseif strfind(msg, string.gsub(ERR_SPELL_UNLEARNED_S:gsub('%.', '%.'), '%%s', '(.*)')) then
+		return true
+	elseif strfind(msg, string.gsub(ERR_LEARN_PASSIVE_S:gsub('%.', '%.'), '%%s', '(.*)')) then
+		return true
+	end
+
+	return false, msg, ...
+end
+
+function SS:EnableSpecSwitcherSpamFilter()
+	ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", SS.SpecSwitcherSpamFilter)
+end
+
+function SS:DisableSpecSwitcherSpamFilter()
+	ChatFrame_RemoveMessageEventFilter("CHAT_MSG_SYSTEM", SpecSwitcherSpamFilter)
+end
+
+
+function SS:Initialize()
+	if not E.private.sle.specswitch.enable then return end
+	self:RegisterEvent("PLAYER_ENTERING_WORLD", "Equip")
+	self:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED", "Equip")
+	self:RegisterEvent("PLAYER_TALENT_UPDATE", "Equip")
+end
+
+E:RegisterModule(SS:GetName())
\ No newline at end of file