Quantcast

Some weird stuff to test. WIP

Darth Predator [04-19-17 - 11:36]
Some weird stuff to test. WIP
Filename
ElvUI_SLE/defaults/private.lua
ElvUI_SLE/locales/english.lua
ElvUI_SLE/locales/german.lua
ElvUI_SLE/locales/russian.lua
ElvUI_SLE/modules/equipmanager.lua
ElvUI_SLE/options/equipmanager_c.lua
diff --git a/ElvUI_SLE/defaults/private.lua b/ElvUI_SLE/defaults/private.lua
index 1157eb0..98e3fc7 100644
--- a/ElvUI_SLE/defaults/private.lua
+++ b/ElvUI_SLE/defaults/private.lua
@@ -11,40 +11,11 @@ V["sle"] = {
 	["equip"] = {
 		["enable"] = false,
 		["spam"] = false,
-		["instanceSet"] = false,
-		["pvpSet"] = false,
-		["timewalkingSet"] = false,
 		["onlyTalent"] = false,
-		["firstSpec"] = {
-			["general"] = "NONE",
-			["pvp"] = "NONE",
-			["instance"] = "NONE",
-			["timewalking"] = "NONE",
-		},
-		["secondSpec"] = {
-			["general"] = "NONE",
-			["pvp"] = "NONE",
-			["instance"] = "NONE",
-			["timewalking"] = "NONE",
-		},
-		["thirdSpec"] = {
-			["general"] = "NONE",
-			["pvp"] = "NONE",
-			["instance"] = "NONE",
-			["timewalking"] = "NONE",
-		},
-		["forthSpec"] = {
-			["general"] = "NONE",
-			["pvp"] = "NONE",
-			["instance"] = "NONE",
-			["timewalking"] = "NONE",
-		},
+		["conditions"] = "",
+		["conditions"] = "[solo, spec:3] Set1; [solo, spec:2] Set2",
 		["setoverlay"] = false,
 		["lockbutton"] = false,
-		["FishingSet"] = {
-			["enable"] = false,
-			["set"] = "NONE",
-		},
 	},
 	--Minimap Module
 	["minimap"] = {
diff --git a/ElvUI_SLE/locales/english.lua b/ElvUI_SLE/locales/english.lua
index 976778e..f426da6 100644
--- a/ElvUI_SLE/locales/english.lua
+++ b/ElvUI_SLE/locales/english.lua
@@ -455,20 +455,7 @@ L["SLE_EnhShadows_PetButtons_Option"] = "Pet Bar Buttons"
 L["Equipment Manager"] = true
 L["EM_DESC"] = "This module provides different options to automatically change your equipment sets on spec change or entering certain locations. All options are character based."
 L["Equipment Set Overlay"] = true
-L["Timewalking"] = true
 L["Show the associated equipment sets for the items in your bags (or bank)."] = true
-L["Here you can choose what equipment sets to use in different situations."] = true
-L["Equip this set when switching to specialization %s."] = true
-L["Equip this set for open world/general use."] = true
-L["Equip this set after entering dungeons or raids."] = true
-L["Equip this set after entering battlegrounds or arens."] = true
-L["Equip this set after enetering a timewalking dungeon."] = true
-L["Use Instance Set"] = true
-L["Use a dedicated set for instances and raids."] = true
-L["Use PvP Set"] = true
-L["Use a dedicated set for PvP situations."] = true
-L["Use Timewalking Set"] = true
-L["Use a dedicated set for timewalking instances."] = true
 L["Impossible to switch to appropriate equipment set in combat. Will switch after combat ends."] = true
 L["SLE_EM_LOCK_TITLE"] = "|cff9482c9S&L|r"
 L["SLE_EM_LOCK_TOOLTIP"] = [[This button is designed for temporary disable
@@ -478,6 +465,22 @@ L["Block button"] = true
 L["Create a button in character frame to allow temp blocking of auto set swap."] = true
 L["Ignore zone change"] = true
 L["Swap sets only on specialization change ignoring location change when. Does not influence entering/leaving instances and bg/arena."] = true
+L["Equipement conditions"] = true
+L["SLE_EM_SET_NOT_EXIST"] = "Equipment set |cff9482c9%s|r doesn't exist!"
+L["SLE_EM_TAG_INVALID"] = "Invalid tag: %s"
+L["SLE_EM_CONDITIONS_DESC"] = [[Determines conditions under which specified sets are equipeed.
+This works as macros and controlled by a set of tags as seen below.]]
+L["SLE_EM_TAGS_HELP"] = [[Following tags and parameters are eligible for setting equip condition:
+|cff3cbf27solo|r - when you are solo without any group;
+|cff3cbf27party|r - when you are in a group of any description. Can be of specified size, e.g. [party:4] - if in a group of total size 4;
+|cff3cbf27raid|r - when you are in a raid group. Can be of specified size like party option;
+|cff3cbf27spec|r - specified spec. Usage [spec:<number>] number is the index of desired spec as seen in spec tab;
+|cff3cbf27instance|r - if in instance. Can be of specified instance type - [instance:<type>]. Types are party, raid and scenario. If not specified will be true for any instance;
+|cff3cbf27pvp|r - if on BG, arena or world pvp area. Available arguments: pvp, arena;
+|cff3cbf27difficulty|r - defines the difficulty of the instance. Argumants are: normal, heroic, lfr, challenge, mythic;
+
+Example: [solo] Set1; [party:4, spec:3] Set2; [instance:raid, difficulty:heroic] Set3
+]]

 --Loot
 L["Loot Dropped:"] = true
diff --git a/ElvUI_SLE/locales/german.lua b/ElvUI_SLE/locales/german.lua
index d296d8e..7c6f283 100644
--- a/ElvUI_SLE/locales/german.lua
+++ b/ElvUI_SLE/locales/german.lua
@@ -446,20 +446,7 @@ L["SLE_EnhShadows_PetButtons_Option"] = "Begleitertasten"
 L["Equipment Manager"] = "Ausrüstungsmanager"
 L["EM_DESC"] = "Dieses Modul erlaubt dir verschiedene Einstellungen um automatisch dein Ausrüstungsset in verschiedenen Situationen zu benutzen. Alle Einstellungen sind Charakter basierend."
 L["Equipment Set Overlay"] = "Ausrüstungsset Überblendung"
-L["Timewalking"] = "Zeitwanderung"
 L["Show the associated equipment sets for the items in your bags (or bank)."] = "Zeigt die zugehörigen Ausrüstungssets für die Gegenstände in deiner Tasche (oder Bank)."
-L["Here you can choose what equipment sets to use in different situations."] = "Hier kannst du bestimmen welches Ausrüstungsset in bestimmten Situationen benutzt wird."
-L["Equip this set when switching to specialization %s."] = "Rüste dieses Set aus wenn du deine Spezialisierung zu %s änderst."
-L["Equip this set for open world/general use."] = "Rüste diese Set aus für den generellen Gebrauch."
-L["Equip this set after entering dungeons or raids."] = "Rüste dieses Set aus nach dem du eine Instanz/Raid betrittst."
-L["Equip this set after entering battlegrounds or arens."] = "Rüste dieses Set aus nach dem ein Schlachtfeld/Arena betrittst."
-L["Equip this set after enetering a timewalking dungeon."] = "Rüste dieses Set aus nach dem du eine Zeitwanderungsinstanz betrittst."
-L["Use Instance Set"] = "Benutze Instanz Set"
-L["Use a dedicated set for instances and raids."] = "Benutze ein bestimmtes Set für Instanzen und Raids."
-L["Use PvP Set"] = "Benutze PvP Set"
-L["Use a dedicated set for PvP situations."] = "Benutzt ein bestimmtes Set für PvP Situationen."
-L["Use Timewalking Set"] = "Benutze Zeitwanderung Set"
-L["Use a dedicated set for timewalking instances."] = "Benutze ein bestimmtes Set für Zeitwanderungsinstanzen."
 L["Impossible to switch to appropriate equipment set in combat. Will switch after combat ends."] = "Unmöglich um zum dazugehörigen Ausrüstungsset zu wechseln im Kampf. Nach dem Kampf wird gewechselt."
 L["SLE_EM_LOCK_TITLE"] = "|cff9482c9S&L|r"
 L["SLE_EM_LOCK_TOOLTIP"] = [[Dieser Knopf ist zum vorübergehenden deaktiveren des
@@ -469,6 +456,22 @@ L["Block button"] = "Sperrtaste"
 L["Create a button in character frame to allow temp blocking of auto set swap."] = "Erzeugt einen Knopf im Charakterfenster der erlaubt das Autowechseln vom Ausrüstungsset zu deaktivieren."
 L["Ignore zone change"] = "Ignoriere Zonenwechsel"
 L["Swap sets only on specialization change ignoring location change when. Does not influence entering/leaving instances and bg/arena."] = "Wechselt Ausrüstungssets nur wenn die Spezialisierung geändert wird. Beeinflusst nicht das betreten/verlassen von Instanzen und Schlachtfeld/Arena."
+L["Equipement conditions"] = true
+L["SLE_EM_SET_NOT_EXIST"] = "Equipment set |cff9482c9%s|r doesn't exist!"
+L["SLE_EM_TAG_INVALID"] = "Invalid tag: %s"
+L["SLE_EM_CONDITIONS_DESC"] = [[Determines conditions under which specified sets are equipeed.
+This works as macros and controlled by a set of tags as seen below.]]
+L["SLE_EM_TAGS_HELP"] = [[Following tags and parameters are eligible for setting equip condition:
+|cff3cbf27solo|r - when you are solo without any group;
+|cff3cbf27party|r - when you are in a group of any description. Can be of specified size, e.g. [party:4] - if in a group of total size 4;
+|cff3cbf27raid|r - when you are in a raid group. Can be of specified size like party option;
+|cff3cbf27spec|r - specified spec. Usage [spec:<number>] number is the index of desired spec as seen in spec tab;
+|cff3cbf27instance|r - if in instance. Can be of specified instance type - [instance:<type>]. Types are party, raid and scenario. If not specified will be true for any instance;
+|cff3cbf27pvp|r - if on BG, arena or world pvp area. Available arguments: pvp, arena;
+|cff3cbf27difficulty|r - defines the difficulty of the instance. Argumants are: normal, heroic, lfr, challenge, mythic;
+
+Example: [solo] Set1; [party:4, spec:3] Set2; [instance:raid, difficulty:heroic] Set3
+]]

 --Loot
 L["Loot Dropped:"] = "Beute:"
diff --git a/ElvUI_SLE/locales/russian.lua b/ElvUI_SLE/locales/russian.lua
index 2e72146..369142c 100644
--- a/ElvUI_SLE/locales/russian.lua
+++ b/ElvUI_SLE/locales/russian.lua
@@ -445,20 +445,7 @@ L["SLE_EnhShadows_PetButtons_Option"] = "Кнопки питомца"
 L["Equipment Manager"] = "Менеджер экипировки"
 L["EM_DESC"] = "Этот модуль предоставляет различные опции для автоматической смены комплектов экипировки при переключении набора талантов или попадании в определенную локацию."
 L['Equipment Set Overlay'] = "Название комплекта"
-L["Timewalking"] = "Путешествия во времени"
 L['Show the associated equipment sets for the items in your bags (or bank).'] = "Отображает название комплекта экипировки, к которому привязан предмет, на его иконке в сумках или банке."
-L["Here you can choose what equipment sets to use in different situations."] = "Здесь Вы можете выбрать какие комплекты экипировки использовать в различных случаях."
-L["Equip this set when switching to specialization %s."] = "Надеть этот комплект при переключении на специализацию %s."
-L["Equip this set for open world/general use."] = "Использовать этот комплект для открытого мира/общего назначения."
-L["Equip this set after entering dungeons or raids."] = "Использовать этот комплект после входа в подземелье или рейд."
-L["Equip this set after entering battlegrounds or arens."] = "Использовать этот комплект на полях боя или арене."
-L["Equip this set after enetering a timewalking dungeon."] = "Использовать этот комплект после входа в подземелье для путешестви во времени."
-L["Use Instance Set"] = "Сет для подземелий"
-L["Use a dedicated set for instances and raids."] = "Использовать отдельный комплект для подземелий и рейдов"
-L["Use PvP Set"] = "Сет для ПвП"
-L["Use a dedicated set for PvP situations."] = "Использовать отдельный комплект для пвп"
-L["Use Timewalking Set"] = "Сет путешествий во времени"
-L["Use a dedicated set for timewalking instances."] = "Использовать отдельный комплект для путешствий во времени."
 L["Impossible to switch to appropriate equipment set in combat. Will switch after combat ends."] = "Невозможно переключиться на подходящий комплект в бою. Переключение произойдет после окончания боя."
 L["SLE_EM_LOCK_TITLE"] = "|cff9482c9S&L|r"
 L["SLE_EM_LOCK_TOOLTIP"] = [[Эта кнопка позволит временно отключить автоматическую
@@ -468,6 +455,22 @@ L["Block button"] = "Кнопка блокировки"
 L["Create a button in character frame to allow temp blocking of auto set swap."] = "Создать в окне персонажа кнопку, позволяющую временно отключить автоматическую смену комплектов."
 L["Ignore zone change"] = "Игнорировать смену зоны"
 L["Swap sets only on specialization change ignoring location change when. Does not influence entering/leaving instances and bg/arena."] = "Изменять комплект только при смене специализации, игнорируя изменение локации. Не влиет на вход/выход из подземелий и полей боя/арен."
+L["Equipement conditions"] = "Условия экипировки"
+L["SLE_EM_SET_NOT_EXIST"] = "Комплекта |cff9482c9%s|r не существует!"
+L["SLE_EM_TAG_INVALID"] = "Неверный тэг: %s"
+L["SLE_EM_CONDITIONS_DESC"] = [[Определяет условия, при которых будут надеваться указанные сеты.
+Работает по принципу макросов и контроллируется набором тэгов, представленным ниже.]]
+L["SLE_EM_TAGS_HELP"] = [[Следующие тэги и параметры могут использоваться для условий экипировки:
+|cff3cbf27solo|r - когда вы не в группе;
+|cff3cbf27party|r - если вы в любом типе группы. Может быть с заданным размером, например [party:4] - в группе из 4 человек;
+|cff3cbf27raid|r - если вы состояите в рейде. Может быть с заданным размером, аналогино предыдущему;
+|cff3cbf27spec|r - указанная специализация. Использование [spec:<номер>], где номер это прядок специализации на соответствующей вкладке;
+|cff3cbf27instance|r - в подземелье. Может быть определенного типа - [instance:<тип>]. Типы подземелий: party, raid и scenario. Если тип не задан, то быдет использоваться во всех подземельях;
+|cff3cbf27pvp|r - для полей боя, арен и открытых пвп зон. Параметры: pvp, arena;
+|cff3cbf27difficulty|r - Определяет сложность подземелья. Параметры: normal, heroic, lfr, challenge, mythic;
+
+Пример: [solo] Set1; [party:4, spec:3] Set2; [instance:raid, difficulty:heroic] Set3
+]]

 --Loot
 L["Loot Dropped:"] = "Список добычи:"
diff --git a/ElvUI_SLE/modules/equipmanager.lua b/ElvUI_SLE/modules/equipmanager.lua
index 1742ca7..02f8d64 100644
--- a/ElvUI_SLE/modules/equipmanager.lua
+++ b/ElvUI_SLE/modules/equipmanager.lua
@@ -7,97 +7,145 @@ EM.ErrorShown = false
 --GLOBALS: CreateFrame, CharacterFrame, SLASH_FISH1, SlashCmdList
 local C_EquipmentSet = C_EquipmentSet
 local _G = _G
-
-local SpecTable = {
-	[1] = "firstSpec",
-	[2] = "secondSpec",
-	[3] = "thirdSpec",
-	[4] = "forthSpec",
+local gsub = gsub
+
+local Difficulties = {
+	[1] = 'normal', --5ppl normal
+	[2] = 'heroic', --5ppl heroic
+	[3] = 'normal', --10ppl raid
+	[4] = 'normal', --25ppl raid
+	[5] = 'heroic', --10ppl heroic raid
+	[6] = 'heroic', --25ppl heroic raid
+	[7] = 'lfr', --25ppl LFR
+	[8] = 'challenge', --5ppl challenge
+	[9] = 'normal', --40ppl raid
+	[11] = 'heroic', --Heroic scenario
+	[12] = 'normal', --Normal scenario
+	[14] = 'normal', --10-30ppl normal
+	[15] = 'heroic', --13-30ppl heroic
+	[16] = 'mythic', --20ppl mythic
+	[17] = 'lfr', --10-30 LFR
+	[23] = 'mythic', --5ppl mythic
+	[24] = 'timewalking', --Timewalking
 }

-function EM:GetData()
-	local spec = T.GetSpecialization()
-	local equipSet
-	local equipmentSetIDs = C_EquipmentSet.GetEquipmentSetIDs()
-	for index = 1, C_EquipmentSet.GetNumEquipmentSets() do
-		local name, _, _, isEquipped = C_EquipmentSet.GetEquipmentSetInfo(equipmentSetIDs[index]);
-		if isEquipped then
-			equipSet = name
-			break
+EM.TagsTable = {
+	["solo"] = function() if IsInGroup() then return false; else return true; end end,
+	["party"] = function(size)
+		size = T.tonumber(size)
+		if IsInGroup() then
+			if size then
+				if size == GetNumGroupMembers() then return true; else return false; end
+			else
+				return true
+			end
+		else
+			return false
 		end
-	end
-	return spec, equipSet
-end
-
-function EM:IsPvP(inInstance, instanceType)
-	if inInstance and (instanceType == "pvp" or instanceType == "arena") then return true end
-	for i = 1, T.GetNumWorldPVPAreas() do
-		local _, localizedName, isActive, canQueue = T.GetWorldPVPAreaInfo(i)
-		if (T.GetRealZoneText() == localizedName and isActive) or (GetRealZoneText() == localizedName and canQueue) then return true end
-	end
-	return false
-end
-
-local TIMEWALKING_DIFFICULTYID = 24;
-
-function EM:IsTimewalkingDungeon(inInstance, instanceType)
-	if inInstance and (instanceType ==  "scenario" or instanceType == "party" or instanceType == "raid") and T.select(3, T.GetInstanceInfo()) == TIMEWALKING_DIFFICULTYID then
-		return true
-	end
-	return false
-end
-
-function EM:IsDungeon(inInstance, instanceType)
-	if inInstance and (instanceType ==  "scenario" or instanceType == "party" or instanceType == "raid") then return true end
-	return false
-end
-
-function EM:IsUsingFishingSet()
-	return self.fishingSetEquipped;
-end
-
-function EM:WrongSet(equipSet, group, inCombat)
-	local inInstance, instanceType = T.IsInInstance()
-	if EM:IsUsingFishingSet() and E.private.sle.equip.FishingSet.enable then
-		return E.private.sle.equip.FishingSet.set ~= equipSet, E.private.sle.equip.FishingSet.set
-	end
-	if inInstance and ((EM.db.timewalkingSet and EM.db[group].timewalking ~= "NONE") or (EM.db.instanceSet and EM.db[group].instance ~= "NONE") or (EM.db.pvpSet and EM.db[group].pvp ~= "NONE")) then
-		if EM:IsTimewalkingDungeon(inInstance, instanceType) and EM.db.timewalkingSet then
-			if equipSet ~= EM.db[group].timewalking and EM.db[group].timewalking ~= "NONE" then
-				if inCombat then
-					if not EM.ErrorShown then SLE:ErrorPrint(L["Impossible to switch to appropriate equipment set in combat. Will switch after combat ends."]); EM.ErrorShown = true end
-					return false
-				end
-				return true, EM.db[group].timewalking
+	end,
+	["raid"] = function(size)
+		size = T.tonumber(size)
+		if IsInRaid() then
+			if size then
+				if size == GetNumGroupMembers() then return true; else return false; end
+			else
+				return true
 			end
+		else
+			return false
 		end
-		if EM:IsDungeon(inInstance, instanceType) and EM.db.instanceSet then
-			if equipSet ~= EM.db[group].instance and EM.db[group].instance ~= "NONE" then
-				if inCombat then
-					if not EM.ErrorShown then SLE:ErrorPrint(L["Impossible to switch to appropriate equipment set in combat. Will switch after combat ends."]); EM.ErrorShown = true end
-					return false
-				end
-				return true, EM.db[group].instance
+	end,
+	["spec"] = function(index)
+		local index = T.tonumber(index)
+		if not index then return false end
+		if index == GetSpecialization() then return true; else return false; end
+	end,
+	["instance"] = function(dungeonType)
+		local inInstance, InstanceType = T.IsInInstance()
+		if inInstance then
+			if dungeonType then
+				if InstanceType == dungeonType then return true; else return false; end
+			else
+				if InstanceType == "pvp" or InstanceType == "arena" then return false; else return true; end
 			end
+		else
+			return false
 		end
-		if EM:IsPvP(inInstance, instanceType) and EM.db.pvpSet then
-			if equipSet ~= EM.db[group].pvp and EM.db[group].pvp ~= "NONE" then
-				if inCombat then
-					if not EM.ErrorShown then SLE:ErrorPrint(L["Impossible to switch to appropriate equipment set in combat. Will switch after combat ends."]); EM.ErrorShown = true end
-					return false
+	end,
+	["pvp"] = function(pvpType)
+		local inInstance, InstanceType = T.IsInInstance()
+		if inInstance then
+			if pvpType and (InstanceType == "pvp" or InstanceType == "arena") then
+				if InstanceType == pvpType then return true; else return false; end
+			else
+				if InstanceType == "pvp" or InstanceType == "arena" then return true; else return false; end
+			end
+		else
+			for i = 1, T.GetNumWorldPVPAreas() do
+				local _, localizedName, isActive, canQueue = T.GetWorldPVPAreaInfo(i)
+				if (T.GetRealZoneText() == localizedName and isActive) or (T.GetRealZoneText() == localizedName and canQueue) then return true end
+			end
+			return false
+		end
+	end,
+	["difficulty"] = function(difficulty)
+		if not T.IsInInstance() then return false end
+		if not difficulty then return false end
+		local difID = T.select(3, T.GetInstanceInfo())
+		if difficulty == Difficulties[difID] then
+			return true;
+		else
+			return false;
+		end
+	end,
+}
+
+function EM:TagsProcess(msg)
+	local pattern = "%[(.-)%]([^;]+)"
+	local data = {}
+	local split_msg = { (";"):split(msg) }
+
+	for i, v in T.ipairs(split_msg) do
+		local split = split_msg[i]
+		local condition, option = split:match(pattern)
+		if (condition and option) then
+			local cnd_table = { (","):split(condition) }
+			local parsed_cmds = {};
+			for j = 1, #cnd_table do
+				local cnd = cnd_table[j];
+				if cnd then
+					local command, argument = (":"):split(cnd)
+					T.tinsert(parsed_cmds, { cmd = command:match("^%s*(.+)%s*$"), arg = argument })
 				end
-				return true, EM.db[group].pvp
 			end
+			T.tinsert(data, { option = option:gsub("^%s*", ""), cmds = parsed_cmds })
 		end
 	end
-	if equipSet ~= EM.db[group].general and EM.db[group].general ~= "NONE" then
-		if inCombat then
-			if not EM.ErrorShown then SLE:ErrorPrint(L["Impossible to switch to appropriate equipment set in combat. Will switch after combat ends."]); EM.ErrorShown = true end
-			return false
+
+	return data
+end
+
+function EM:TagsConditionsCheck(data)
+	for index,tagInfo in T.ipairs(data) do
+		local module = tagInfo.module
+		local ok = true
+		for conditionIndex,conditionInfo in T.ipairs(tagInfo.cmds) do
+			local func = conditionInfo["cmd"]
+			if not EM.TagsTable[func] then
+				SLE:ErrorPrint(T.format(L["SLE_EM_TAG_INVALID"], func))
+				return nil
+			end
+			local arg = conditionInfo["arg"]
+			local result = EM.TagsTable[func](arg)
+			if not result then
+				ok = false
+				break
+			end
+		end
+		if ok then
+			return tagInfo.option
 		end
-		return true, EM.db[group].general
 	end
-	return false
 end

 local function Equip(event)
@@ -115,13 +163,25 @@ local function Equip(event)
 		EM.ErrorShown = false
 	end

-	local spec, equipSet = EM:GetData()
-
-	if spec ~= nil then --In case you don't have spec
-		local isWrong, trueSet = EM:WrongSet(equipSet, SpecTable[spec], inCombat)
-		if isWrong and not T.UnitInVehicle("player") then
-			local SetID = C_EquipmentSet.GetEquipmentSetID(trueSet);
-			C_EquipmentSet.UseEquipmentSet(SetID)
+	local equippedSet
+	local equipmentSetIDs = C_EquipmentSet.GetEquipmentSetIDs()
+	for index = 1, C_EquipmentSet.GetNumEquipmentSets() do
+		local name, _, _, isEquipped = C_EquipmentSet.GetEquipmentSetInfo(equipmentSetIDs[index]);
+		if isEquipped then
+			equippedSet = name
+			break
+		end
+	end
+	local trueSet = EM:TagsConditionsCheck(EM.SetData)
+	-- print("trueSet:", trueSet)
+	if trueSet then
+		local SetID = C_EquipmentSet.GetEquipmentSetID(trueSet)
+		if SetID then
+			if not equippedSet or (equippedSet and trueSet ~= equippedSet) then
+				C_EquipmentSet.UseEquipmentSet(SetID)
+			end
+		else
+			SLE:ErrorPrint(T.format(L["SLE_EM_SET_NOT_EXIST"], trueSet))
 		end
 	end
 end
@@ -159,12 +219,9 @@ function EM:CreateLock()
 	end)
 end

-function EM:AddFishingCommand()
-	SLASH_FISH1 = "/fish"
-	function SlashCmdList.FISH(msg, editbox)
-		self.fishingSetEquipped = not self.fishingSetEquipped;
-		Equip()
-	end
+function EM:UpdateTags()
+	EM.SetData = EM:TagsProcess(EM.db.conditions)
+	Equip()
 end

 function EM:Initialize()
@@ -176,8 +233,9 @@ function EM:Initialize()
 	self:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED", Equip)
 	self:RegisterEvent("ZONE_CHANGED", Equip)

+	EM.SetData = EM:TagsProcess(EM.db.conditions)
+
 	self:CreateLock()
-	self:AddFishingCommand()
 end

 SLE:RegisterModule(EM:GetName())
diff --git a/ElvUI_SLE/options/equipmanager_c.lua b/ElvUI_SLE/options/equipmanager_c.lua
index 78de361..478fc44 100644
--- a/ElvUI_SLE/options/equipmanager_c.lua
+++ b/ElvUI_SLE/options/equipmanager_c.lua
@@ -141,33 +141,6 @@ local function configTable()
 				get = function(info) return EM.db.onlyTalent end,
 				set = function(info, value) EM.db.onlyTalent = value; end,
 			},
-			instanceSet = {
-				type = "toggle",
-				order = 8,
-				name = L["Use Instance Set"],
-				desc = L["Use a dedicated set for instances and raids."],
-				disabled = function() return not EM.db.enable end,
-				get = function(info) return EM.db.instanceSet end,
-				set = function(info, value) EM.db.instanceSet = value; end
-			},
-			timewalkingSet = {
-				type = "toggle",
-				order = 9,
-				name = L["Use Timewalking Set"],
-				desc = L["Use a dedicated set for timewalking instances."],
-				disabled = function() return not EM.db.enable end,
-				get = function(info) return EM.db.timewalkingSet end,
-				set = function(info, value) EM.db.timewalkingSet = value; end
-			},
-			pvpSet = {
-				type = "toggle",
-				order = 10,
-				name = L["Use PvP Set"],
-				desc = L["Use a dedicated set for PvP situations."],
-				disabled = function() return not EM.db.enable end,
-				get = function(info) return EM.db.pvpSet end,
-				set = function(info, value) EM.db.pvpSet = value; end
-			},
 			equipsets = {
 				type = "group",
 				name = PAPERDOLL_EQUIPMENTMANAGER,
@@ -175,15 +148,20 @@ local function configTable()
 				disabled = function() return not EM.db.enable end,
 				guiInline = true,
 				args = {
-					intro = {
+					conditions = {
 						order = 1,
+						type = "input",
+						width = "full",
+						name = L["Equipement conditions"],
+						desc = L["SLE_EM_CONDITIONS_DESC"],
+						get = function(info) return EM.db.conditions end,
+						set = function(info, value) EM.db.conditions = value; EM:UpdateTags() end
+					},
+					help = {
+						order = 2,
 						type = 'description',
-						name = L["Here you can choose what equipment sets to use in different situations."],
+						name = L["SLE_EM_TAGS_HELP"],
 					},
-					firstSpec = ConstructSpecOption(1, 1, "firstSpec"),
-					secondSpec = ConstructSpecOption(2, 2, "secondSpec"),
-					thirdSpec = ConstructSpecOption(3, 3, "thirdSpec"),
-					forthSpec = ConstructSpecOption(4, 4, "forthSpec"),
 				},
 			},
 		},