From 7b85c87abcc5a03bd616f502322aae99fe280653 Mon Sep 17 00:00:00 2001 From: Taracque Date: Mon, 27 May 2013 16:01:28 +0200 Subject: [PATCH] Now detecting t15 4pcs set bonus for Soul Reaper --- DKCrutch.lua | 48 +++++++++++++++++++++++++++++++++++++++++++----- DKCrutch.toc | 2 +- 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/DKCrutch.lua b/DKCrutch.lua index 7fef5fb..e9448af 100755 --- a/DKCrutch.lua +++ b/DKCrutch.lua @@ -1,5 +1,5 @@ ------------------------------------------------------------------------------- --- DKCrutch 0.9.1 +-- DKCrutch 0.9.2 -- -- Death Knight rune tracker and ability advisor ------------------------------------------------------------------------------- @@ -8,7 +8,7 @@ DKCrutch = {Locals = {}} local L = DKCrutch.Locals -DKCrutch.versionNumber = '0.9.1' +DKCrutch.versionNumber = '0.9.2' DKCrutch.talent = "" DKCrutch.talentUnsure = true DKCrutch.DebugMode = false @@ -20,6 +20,7 @@ DKCrutch.runesUp = {} DKCrutch.depletedCount = 0 DKCrutch.events = {} DKCrutch.lastUpdate = GetTime(); +DKCrutch.hasT15_4pcs = false; DKCrutch.SpellList = { ["Outbreak"] = GetSpellInfo(77575), ["Icy Touch"] = GetSpellInfo(45477), @@ -90,12 +91,19 @@ DKCrutch.HostileFilter = { ["_INTERRUPT"] = true, ["_MISSED"] = true } +-- Set items +DKCrutch.ArmorSets = { + [138347] = { -- Death Knight T15 DPS 4P Bonus + [95825] = true, [95826] = true, [95827] = true, [95828] = true, [95829] = true, [96569] = true, [96570] = true, [96571] = true, [96572] = true, [96573] = true, [95225] = true, [95226] = true, [95227] = true, [95228] = true, [95229] = true + } +} -- Our sneaky frame to watch for events ... checks DKCrutch.events[] for the function. Passes all args. DKCrutch.eventFrame = CreateFrame("Frame") DKCrutch.eventFrame:RegisterEvent("PLAYER_LOGIN") DKCrutch.eventFrame:RegisterEvent("PLAYER_ALIVE") +DKCrutch.eventFrame:RegisterEvent("PLAYER_EQUIPMENT_CHANGED") DKCrutch.eventFrame:SetScript("OnEvent", function(this, event, ...) DKCrutch.events[event](...) end) @@ -111,9 +119,14 @@ function DKCrutch.events.PLAYER_ALIVE() -- DKCrutch.eventFrame:UnregisterEvent("PLAYER_ALIVE") end +function DKCrutch.events.PLAYER_EQUIPMENT_CHANGED() + DKCrutch.hasT15_4pcs = DKCrutch:HasSetBonus( 138347, 4 ); +end + function DKCrutch.events.PLAYER_ENTERING_WORLD() DKCrutch.playerGUID = UnitGUID("player") DKCrutch:detectTalent() + DKCrutch.hasT15_4pcs = DKCrutch:HasSetBonus( 138347, 4 ); end function DKCrutch.events.ACTIVE_TALENT_GROUP_CHANGED() @@ -406,6 +419,31 @@ function DKCrutch:GetSpellCooldownRemaining(spell) return duration, s, d end +function DKCrutch:HasSetBonus(spellID,minCount) + local slotId, _, itemId, i, setCount + + setCount = 0; + + if (DKCrutch.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 (DKCrutch.ArmorSets[spellID][itemId]) then + setCount = setCount + 1; + end + end + end + + return (setCount >= minCount); +end + function DKCrutch:ProcIcon(name,icon,d,e,value) if (name) then if (DKCrutch.lastProc ~= icon) then @@ -663,10 +701,10 @@ function DKCrutch:AdviseFrostAbility() end end - -- Soul Reaper, if target health < 35% + -- Soul Reaper, if target health < 35%, or 45% if has t15 4pcs if (DKCrutch.SpellList["Soul Reaper"]) then cd, enabled = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Soul Reaper"]) - if (cd) and (cd<=0) and (UnitHealthMax("target")>0) and (UnitHealth("target")/UnitHealthMax("target")<0.35) then + if (cd) and (cd<=0) and (UnitHealthMax("target")>0) and ((UnitHealth("target")/UnitHealthMax("target")<0.35) or ((UnitHealth("target")/UnitHealthMax("target")<0.45) and (DKCrutch.hasT15_4pcs))) then return "Soul Reaper" end end @@ -792,7 +830,7 @@ function DKCrutch:AdviseUnholyAbility() -- Soul Reaper, if target health < 35% if (DKCrutch.SpellList["Soul Reaper"]) then cd, enabled = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Soul Reaper"]) - if (cd) and (cd<=0) and (UnitHealthMax("target")>0) and (UnitHealth("target")/UnitHealthMax("target")<0.35) then + if (cd) and (cd<=0) and (UnitHealthMax("target")>0) and ((UnitHealth("target")/UnitHealthMax("target")<0.35) or ((UnitHealth("target")/UnitHealthMax("target")<0.45) and (DKCrutch.hasT15_4pcs))) then return "Soul Reaper" end end diff --git a/DKCrutch.toc b/DKCrutch.toc index c521d2a..0fc965b 100755 --- a/DKCrutch.toc +++ b/DKCrutch.toc @@ -2,7 +2,7 @@ ## Title: DKCrutch ## Notes: Death Knight rune tracker and rotation helper ## Author: Taracque, Dšgrov‡s of Arathor -## Version: 0.9.1 +## Version: 0.9.2 ## SavedVariables: DKCrutchDB ## OptionalDeps: ## Dependencies: -- 1.7.9.5