Added functions for options. PvP set now takes in account world pvp zones when active
Darthpred [02-22-13 - 07:48]
Added functions for options. PvP set now takes in account world pvp zones when active
diff --git a/ElvUI_SLE/modules/equipmanager/equipmanager.lua b/ElvUI_SLE/modules/equipmanager/equipmanager.lua
index 7b67c66..c22d1b0 100644
--- a/ElvUI_SLE/modules/equipmanager/equipmanager.lua
+++ b/ElvUI_SLE/modules/equipmanager/equipmanager.lua
@@ -2,28 +2,49 @@
local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore
local EM = E:NewModule('EquipManager', 'AceHook-3.0', 'AceEvent-3.0');
+EM.equipSets = {
+["NONE"] = NONE,
+}
+
+function EM:FillTable()
+ for i = 1, GetNumEquipmentSets() do
+ local name, icon, lessIndex = GetEquipmentSetInfo(i)
+ if name then
+ EM.equipSets[name] = name
+ end
+ end
+end
+
function EM:Equip(event)
- EM: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)
+ UseEquipmentSet(E.private.sle.equip.primary)
else
- UseEquipmentSet(E.private.sle.specswitch.secondary)
+ UseEquipmentSet(E.private.sle.equip.secondary)
end
end
if (instanceType == "party" or instanceType == "raid") then
- UseEquipmentSet(E.private.sle.specswitch.instance)
+ UseEquipmentSet(E.private.sle.equip.instance)
end
if (instanceType == "pvp" or instanceType == "arena") then
- UseEquipmentSet(E.private.sle.specswitch.pvp)
+ UseEquipmentSet(E.private.sle.equip.pvp)
+ end
+ if E.private.sle.equip.pvp ~= "NONE" then
+ for i = 1, GetNumWorldPVPAreas() do
+ local _, localizedName, isActive = GetWorldPVPAreaInfo(i)
+
+ if (GetRealZoneText() == localizedName and isActive) then
+ UseEquipmentSet(E.private.sle.equip.pvp)
+ end
+ end
end
end
end
-function EM:SpecSwitcherSpamFilter(event, msg, ...)
+function EM:EquipSpamFilter(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
@@ -37,21 +58,31 @@ function EM:SpecSwitcherSpamFilter(event, msg, ...)
return false, msg, ...
end
-function EM:EnableSpecSwitcherSpamFilter()
- ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", EM.SpecSwitcherSpamFilter)
+function EM:EnableSpamFilter()
+ ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", EM.EquipSpamFilter)
end
-function EM:DisableSpecSwitcherSpamFilter()
- ChatFrame_RemoveMessageEventFilter("CHAT_MSG_SYSTEM", EM.SpecSwitcherSpamFilter)
+function EM:DisableSpamFilter()
+ ChatFrame_RemoveMessageEventFilter("CHAT_MSG_SYSTEM", EM.EquipSpamFilter)
end
+function EM:SpamThrottle()
+ if E.private.sle.equip.spam then
+ EM:EnableSpamFilter()
+ else
+ EM:DisableSpamFilter()
+ end
+end
function EM:Initialize()
- print("stuff")
- if not E.private.sle.specswitch.enable then return end
+ if not E.private.sle.equip.enable then return end
+ EM:FillTable()
+ EM:SpamThrottle()
self:RegisterEvent("PLAYER_ENTERING_WORLD", "Equip")
self:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED", "Equip")
self:RegisterEvent("PLAYER_TALENT_UPDATE", "Equip")
+ self:RegisterEvent("ZONE_CHANGED", "Equip")
+ self:RegisterEvent("EQUIPMENT_SETS_CHANGED", "FillTable")
end
E:RegisterModule(EM:GetName())
\ No newline at end of file