Quantcast

Added T17 4pcs detection to code

Taracque [03-10-15 - 16:25]
Added T17 4pcs detection to code
Filename
Elementarist.lua
modules/elemental.lua
diff --git a/Elementarist.lua b/Elementarist.lua
index fc53564..03cbbd3 100755
--- a/Elementarist.lua
+++ b/Elementarist.lua
@@ -49,6 +49,7 @@ Elementarist.talentUnsure = true
 Elementarist.callbacks = {};
 Elementarist.tier6Talent = nil
 Elementarist.tier7Talent = nil
+Elementarist.hasT17_4pcs = false
 Elementarist.lastSpell = nil
 Elementarist.CustomIDs = {
 	["Alchemist's Flask Item"] = 75525,
@@ -85,6 +86,8 @@ Elementarist.SpellList = {
 	["Crystal of Insanity"] = GetSpellInfo(Elementarist.CustomIDs["Crystal of Insanity Spell"]),
 	["Flask of the Draconic Mind"] = GetSpellInfo(79470),
 	["Flask of the Warm Sun"] = GetSpellInfo(105691),
+	["Draenic Intellect Flask"] =GetSpellInfo(156070),
+	["Greater Draenic Intellect Flask"] =GetSpellInfo(156079),
 	["Lifeblood"] = GetSpellInfo(55503),
 	["AscendanceElementalBuff"] = GetSpellInfo(114050),

@@ -104,6 +107,12 @@ Elementarist.textureList = {
 	["shield"] = nil
 }

+Elementarist.ArmorSets = {
+	[165580]	= {	-- Shaman T17 DPS 4P Bonus
+		[115575] = true, [115576] = true, [115577] = true, [115578] = true, [115579] = true
+	}
+}
+
 Elementarist.textList = {
 	["dps"] = nil,
 	["debuff"] = nil,
@@ -174,18 +183,21 @@ function Elementarist.events.PLAYER_ALIVE()
 	-- check anything
 	Elementarist:detectTalent()
 	Elementarist:detectiLevel();
+	Elementarist.hasT17_4pcs = Elementaris.HasSetBonus( 165580, 4 );
 	Elementarist:ApplySettings()

 	-- Elementarist.eventFrame:UnregisterEvent("PLAYER_ALIVE")
 end

 function Elementarist.events.PLAYER_ENTERING_WORLD()
-	Elementarist:detectTalent()
+	Elementarist:detectTalent();
 	Elementarist:detectiLevel();
+	Elementarist.hasT17_4pcs = Elementaris.HasSetBonus( 165580, 4 );
 end

 function Elementarist.events.PLAYER_EQUIPMENT_CHANGED()
 	Elementarist:detectiLevel();
+	Elementarist.hasT17_4pcs = Elementaris.HasSetBonus( 165580, 4 );
 end

 function Elementarist.events.PLAYER_LOGIN()
@@ -319,6 +331,31 @@ function Elementarist:InitSettings()
 	if not ElementaristDB.shieldrelativePoint then ElementaristDB.shieldrelativePoint = "CENTER" end
 end

+function Elementarist:HasSetBonus(spellID,minCount)
+	local slotId, _, itemId, i, setCount
+
+	setCount = 0;
+
+	if (Elementarist.ArmorSets[spellID]) then
+
+		local CheckInventoryID = {
+			(GetInventorySlotInfo("HeadSlot")),
+			(GetInventorySlotInfo("ShoulderSlot")),
+			(GetInventorySlotInfo("ChestSlot")),
+			(GetInventorySlotInfo("HandsSlot")),
+			(GetInventorySlotInfo("LegsSlot")),
+		}
+		for i=1,5,1 do
+			itemId = GetInventoryItemID("player", CheckInventoryID[i]);
+			if (Elementarist.ArmorSets[spellID][itemId]) then
+				setCount = setCount + 1;
+			end
+		end
+	end
+
+	return (setCount >= minCount);
+end
+
 function Elementarist:detectiLevel()
 	local _,ilvl = GetAverageItemLevel();
 	Elementarist.iLvl = ilvl;
diff --git a/modules/elemental.lua b/modules/elemental.lua
index 17bd44a..3f76887 100755
--- a/modules/elemental.lua
+++ b/modules/elemental.lua
@@ -25,7 +25,8 @@ Elementarist.elemental = {
 		Elementarist:LoadSpells({
 			["Glyph of Flame Shock"] = GetSpellInfo(55447),
 			["Healing Stream Totem"] = GetSpellInfo(5394),
-			["Liquid Magma"] = GetSpellInfo(152255)
+			["Liquid Magma"] = GetSpellInfo(152255),
+			["Enhanced Chain Lightning"]  = GetSpellInfo(157766),
 		});

 		Elementarist.role = "DPS";