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 @@ +<Ui xmlns="http://www.blizzard.com/wow/ui/"> + <Script file='equipmanager.lua'/> + <Script file='options.lua'/> +</Ui> \ No newline at end of file diff --git a/ElvUI_SLE/modules/equipmanager/options.lua b/ElvUI_SLE/modules/equipmanager/options.lua new file mode 100644 index 0000000..858185c --- /dev/null +++ b/ElvUI_SLE/modules/equipmanager/options.lua @@ -0,0 +1,19 @@ +local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore +local EM = E:GetModule('EquipManager') +local function configTable() + +E.Options.args.sle.args.specswitch = { + type = 'group', + order = 7, + name = L['Equipment manager'], + args = { + intro = { + order = 1, + type = 'description', + name = L["FARM_DESC"], + }, + }, +} +end + +table.insert(E.SLEConfigs, configTable) \ No newline at end of file diff --git a/ElvUI_SLE/modules/load_modules.xml b/ElvUI_SLE/modules/load_modules.xml index 2da12be..54bbd65 100644 --- a/ElvUI_SLE/modules/load_modules.xml +++ b/ElvUI_SLE/modules/load_modules.xml @@ -7,12 +7,12 @@ <Include file='characterframe\load_characterframe.xml'/> <Include file='chat\load_chat.xml'/> <Include file='datatexts\load_datatexts.xml'/> + <Include file='equipmanager\load_equipmanager.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'/> diff --git a/ElvUI_SLE/modules/specswitch/load_specswitch.xml b/ElvUI_SLE/modules/specswitch/load_specswitch.xml deleted file mode 100644 index df31ee9..0000000 --- a/ElvUI_SLE/modules/specswitch/load_specswitch.xml +++ /dev/null @@ -1,4 +0,0 @@ -<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 deleted file mode 100644 index 49ec35c..0000000 --- a/ElvUI_SLE/modules/specswitch/options.lua +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 9b161e0..0000000 --- a/ElvUI_SLE/modules/specswitch/specswitch.lua +++ /dev/null @@ -1,57 +0,0 @@ ---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