From a86d90e7d63cfdd4d6a737c6c715c5eb4cca1a1e Mon Sep 17 00:00:00 2001 From: Darthpred Date: Fri, 22 Feb 2013 10:14:33 +0400 Subject: [PATCH 1/6] Renamed module --- ElvUI_SLE/modules/equipmanager/equipmanager.lua | 57 ++++++++++++++++++++ .../modules/equipmanager/load_equipmanager.xml | 4 ++ ElvUI_SLE/modules/equipmanager/options.lua | 19 +++++++ ElvUI_SLE/modules/load_modules.xml | 2 +- ElvUI_SLE/modules/specswitch/load_specswitch.xml | 4 -- ElvUI_SLE/modules/specswitch/options.lua | 2 - ElvUI_SLE/modules/specswitch/specswitch.lua | 57 -------------------- 7 files changed, 81 insertions(+), 64 deletions(-) create mode 100644 ElvUI_SLE/modules/equipmanager/equipmanager.lua create mode 100644 ElvUI_SLE/modules/equipmanager/load_equipmanager.xml create mode 100644 ElvUI_SLE/modules/equipmanager/options.lua delete mode 100644 ElvUI_SLE/modules/specswitch/load_specswitch.xml delete mode 100644 ElvUI_SLE/modules/specswitch/options.lua delete mode 100644 ElvUI_SLE/modules/specswitch/specswitch.lua diff --git a/ElvUI_SLE/modules/equipmanager/equipmanager.lua b/ElvUI_SLE/modules/equipmanager/equipmanager.lua new file mode 100644 index 0000000..7b67c66 --- /dev/null +++ b/ElvUI_SLE/modules/equipmanager/equipmanager.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 EM = E:NewModule('EquipManager', 'AceHook-3.0', 'AceEvent-3.0'); + +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) + 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 EM: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 EM:EnableSpecSwitcherSpamFilter() + ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", EM.SpecSwitcherSpamFilter) +end + +function EM:DisableSpecSwitcherSpamFilter() + ChatFrame_RemoveMessageEventFilter("CHAT_MSG_SYSTEM", EM.SpecSwitcherSpamFilter) +end + + +function EM:Initialize() + print("stuff") + 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(EM:GetName()) \ No newline at end of file diff --git a/ElvUI_SLE/modules/equipmanager/load_equipmanager.xml b/ElvUI_SLE/modules/equipmanager/load_equipmanager.xml new file mode 100644 index 0000000..da2a31a --- /dev/null +++ b/ElvUI_SLE/modules/equipmanager/load_equipmanager.xml @@ -0,0 +1,4 @@ + +