From 4704daf72cb1d712329543655c886e73a991d2e1 Mon Sep 17 00:00:00 2001 From: Taracque Date: Tue, 9 Dec 2014 12:25:52 +0100 Subject: [PATCH] Started a major rewrite of priority list. Half done on unholy. --- DKCrutch.lua | 167 ++++++++++++++++++++++++++++++++++++++++------------------ DKCrutch.toc | 2 +- 2 files changed, 118 insertions(+), 51 deletions(-) diff --git a/DKCrutch.lua b/DKCrutch.lua index f80a8fe..a3d78de 100755 --- a/DKCrutch.lua +++ b/DKCrutch.lua @@ -1,5 +1,5 @@ ------------------------------------------------------------------------------- --- DKCrutch 1.0.3 +-- DKCrutch 1.0.4 -- -- Death Knight rune tracker and ability advisor ------------------------------------------------------------------------------- @@ -8,7 +8,7 @@ DKCrutch = {Locals = {}} local L = DKCrutch.Locals -DKCrutch.versionNumber = '1.0.3' +DKCrutch.versionNumber = '1.0.4' DKCrutch.talent = "" DKCrutch.talentUnsure = true DKCrutch.DebugMode = false @@ -20,8 +20,9 @@ DKCrutch.runesUp = {} DKCrutch.depletedCount = 0 DKCrutch.events = {} DKCrutch.lastUpdate = GetTime(); -DKCrutch.hasT15_4pcs = false; DKCrutch.dualWield = false; +DKCrutch.tier1talent = 0; -- 19165 Plague Bearer, 19166 Plague Leech, 19217 Unholy Blight +DKCrutch.tier7talent = 0; -- 21207 Necrotic Plague, 21208 Defile, 21209 Breath of Sindragosa DKCrutch.SpellList = { ["Outbreak"] = GetSpellInfo(77575), ["Icy Touch"] = GetSpellInfo(45477), @@ -46,6 +47,7 @@ DKCrutch.SpellList = { ["Blood Tap"] = GetSpellInfo(45529), ["Blood Charge"] = GetSpellInfo(114851), ["Unholy Blight"] = GetSpellInfo(115989), + ["Breath of Sindragosa"] = GetSpellInfo(152279), -- draenor perks -- -- unholy -- @@ -67,7 +69,8 @@ DKCrutch.SpellList = { -- debuffs ["Frost Fever"] = GetSpellInfo(55095), - ["Blood Plague"] = GetSpellInfo(55078) + ["Blood Plague"] = GetSpellInfo(55078), + ["Necrotic Plague"] = GetSpellInfo(155159) } DKCrutch.lastSpell = "" DKCrutch.lastProc = "" @@ -124,7 +127,6 @@ end function DKCrutch.events.PLAYER_EQUIPMENT_CHANGED() local _, itemType, itemSlot; - DKCrutch.hasT15_4pcs = DKCrutch:HasSetBonus( 138347, 4 ); _, itemSlot = GetInventorySlotInfo("MainHandSlot"); if (itemSlot) and (GetInventoryItemID("player", itemSlot)) then _, _, _, _, _, _, _, _, itemType = GetItemInfo( GetInventoryItemID("player", itemSlot)); @@ -360,7 +362,7 @@ end function DKCrutch:Debug(statictxt,msg) if (DKCrutch.DebugMode) and (DKCrutch.DebugChat) then if (msg) then - DKCrutch.DebugChat:AddMessage( statictxt .. " : " .. msg) + DKCrutch.DebugChat:AddMessage( statictxt .. " : " .. tostring(msg)) else DKCrutch.DebugChat:AddMessage( statictxt .. " : " .. "") end @@ -383,6 +385,10 @@ function DKCrutch:detectTalent() if (spec == nil) then DKCrutch.talentUnsure = true else + -- check level 100 talent + local _; + _, DKCrutch.tier7talent = GetTalentRowSelectionInfo(7); + _, DKCrutch.tier1talent = GetTalentRowSelectionInfo(1); DKCrutch:adjustDeathTracker() DKCrutch.talentUnsure = false end @@ -771,7 +777,7 @@ function DKCrutch:AdviseFrostAbilityDW() -- Frost DK DualWield priority -- 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 (enabled ~= nil) and (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 + if (enabled ~= nil) and (cd) and (cd<=0) and (UnitHealthMax("target")>0) and ((UnitHealth("target")/UnitHealthMax("target")<0.35) or ((UnitHealth("target")/UnitHealthMax("target")<0.45))) then return "Soul Reaper" end end @@ -891,7 +897,7 @@ function DKCrutch:AdviseFrostAbility() -- 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 (enabled ~= nil) and (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 + if (enabled ~= nil) and (cd) and (cd<=0) and (UnitHealthMax("target")>0) and ((UnitHealth("target")/UnitHealthMax("target")<0.35) or ((UnitHealth("target")/UnitHealthMax("target")<0.45))) then return "Soul Reaper" end end @@ -992,8 +998,8 @@ end function DKCrutch:AdviseUnholyAbility() -- spell advisor - local spell = "" - local obcd,cd + local spell = ""; + local obcd,cd, enabled; -- raise dead if has no pet and raise dead is not on cd cd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Raise Dead"]) @@ -1001,47 +1007,129 @@ function DKCrutch:AdviseUnholyAbility() return "Raise Dead" end - -- Soul Reaper, if target health < 35% + obcd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Outbreak"]) + local ffName, _, _, _, _, _, ffExpiration, ffUnitCaster = DKCrutch:hasDeBuff("target", DKCrutch.SpellList["Frost Fever"], "player") + local bpName, _, _, _, _, _, bpExpiration, bpUnitCaster = DKCrutch:hasDeBuff("target", DKCrutch.SpellList["Blood Plague"], "player") + local npName, _, _, _, _, _, npExpiration, npUnitCaster = DKCrutch:hasDeBuff("target", DKCrutch.SpellList["Necrotic Plague"], "player") + if (not ffExpiration) then + ffExpiration = 0; + end + if (not bpExpiration) then + bpExpiration = 0; + end + if (not npExpiration) then + npExpiration = 0; + end + + -- Plague Leech + if (DKCrutch.tier1talent == 19166) and (DKCrutch.SpellList["Plague Leech"]) then + -- if outbreak available + if (obcd) and (obcd<=1) and (IsSpellInRange(DKCrutch.SpellList["Outbreak"], "target") == 1) and (DKCrutch.depletedCount>0) then + if (DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Plague Leech"]) <= 1) then + return "Plague Leech"; + end + end + -- or if diseases will expire in 2 sec on target + if ((DKCrutch.tier7talent == 21207) and (npExpiration - GetTime() < 2) ) or -- necrotic plague + ((ffExpiration - GetTime() < 2) and (bpExpiration - GetTime() < 2) ) + then + if (DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Plague Leech"]) <= 1) then + return "Plague Leech"; + end + end + end + + -- Soul Reaper, if target health < 35%, or have improved soul reaper and < 45% if (DKCrutch.SpellList["Soul Reaper"]) then cd, _, enabled = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Soul Reaper"]) - if (enabled ~= nil) and (cd) and (cd<=0) and (UnitHealthMax("target")>0) and ( + if (UnitHealthMax("target")>0) and ( (UnitHealth("target")/UnitHealthMax("target")<0.35) or ( - (UnitHealth("target")/UnitHealthMax("target")<0.45) and - ( - (DKCrutch.hasT15_4pcs) or - (DKCrutch.SpellList["Improved Soul Reaper"] ~= nil) - ) + (UnitHealth("target")/UnitHealthMax("target")<0.45) and (DKCrutch.SpellList["Improved Soul Reaper"] ~= nil) ) ) then - return "Soul Reaper" + if (enabled ~= nil) then + if (cd) and (cd<=0) then + return "Soul Reaper" + else + if (enabled == 10) then -- Blood Tap, if no unholy rune for Soul Reaper + if (DKCrutch.SpellList["Blood Tap"]) then + local name,_,_,count = DKCrutch:hasBuff("player", DKCrutch.SpellList["Blood Charge"]) + if (count) and (count>=5) and (DKCrutch.depletedCount>0) then + return "Blood Tap" + end + end + end + end + end end end - -- outbreak if frost fever or blood plague less than 2 sec remaining - local ffName, _, _, _, _, _, ffExpiration, ffUnitCaster = DKCrutch:hasDeBuff("target", DKCrutch.SpellList["Frost Fever"], "player") - local bpName, _, _, _, _, _, bpExpiration, bpUnitCaster = DKCrutch:hasDeBuff("target", DKCrutch.SpellList["Blood Plague"], "player") - if (not ffExpiration) then - ffExpiration = 0 + -- Death Coil if runic power>90 + local dccd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Death Coil"]); + if (dccd) and (dccd <= 1) and (UnitPower("player", 6) > 90) then + return "Death Coil"; end - if (not bpExpiration) then - bpExpiration = 0 + + -- Defile if available + if (DKCrutch.tier7talent == 21208) then + local ddcd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Death and Decay"]) + if (ddcd) and (ddcd <= 1) then + return "Death and Decay" + end end - obcd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Outbreak"]) + + -- Dark Transform, if has pet and available + cd, _, enabled = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Dark Transformation"]) + if (enabled ~= nil) and (cd) and (cd<=0) and (IsUsableSpell(DKCrutch.SpellList["Dark Transformation"])) and ( PetHasActionBar() ) then + return "Dark Transformation" + end + + -- Unholy Blight + if (DKCrutch.tier1talent == 19217) and (DKCrutch.SpellList["Unholy Blight"]) then + cd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Unholy Blight"]) + if (cd) and (cd<=0) and ( + ((DKCrutch.tier7talent == 21207) and (npExpiration - GetTime() < 2) ) + or + (ffExpiration - GetTime()<3) or (bpExpiration - GetTime()<3) + ) then + return "Unholy Blight" + end + end + + -- Outbreak if frost fever or blood plague less than 2 sec remaining if (obcd) and (obcd<=0) and (IsSpellInRange(DKCrutch.SpellList["Outbreak"], "target") == 1) then - if ( (ffExpiration - GetTime()) <2) or ( (bpExpiration - GetTime()) < 2) then + if ( + ((DKCrutch.tier7talent == 21207) and (npExpiration - GetTime() < 2) ) + or + (ffExpiration - GetTime() <2) or ( (bpExpiration - GetTime()) < 2) + ) then return "Outbreak" end end - -- plague strike + -- Plague strike cd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Plague Strike"]) if (cd) and (cd<=0) and ( IsSpellInRange(DKCrutch.SpellList["Plague Strike"],"target") == 1) then - if ( (bpExpiration - GetTime()) <3) or ( (ffExpiration - GetTime()) <3 ) then + if ( + ((DKCrutch.tier7talent == 21207) and (npExpiration - GetTime() < 2) ) + or + (ffExpiration - GetTime() <2) or ( (bpExpiration - GetTime()) < 2) + ) then return "Plague Strike" end end + -- Breath of Sindragosa, if runic power > 75 + if (DKCrutch.tier7talent == 21209) and (DKCrutch.SpellList["Breath of Sindragosa"]) then + local dccd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Breath of Sindragosa"]); + if (dccd) and (dccd <= 1) and (UnitPower("player", 6) > 75) then + return "Breath of Sindragosa"; + end + + -- If Breath of Sindragosa active focus on RP generation + end + -- Blood Tap if have at least 10 charges, and have >=32 runic power if (DKCrutch.SpellList["Blood Tap"]) then local name,_,_,count = DKCrutch:hasBuff("player", DKCrutch.SpellList["Blood Charge"]) @@ -1058,18 +1146,6 @@ function DKCrutch:AdviseUnholyAbility() end end - -- Dark Transform, if has pet and available - cd, _, enabled = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Dark Transformation"]) - if (enabled ~= nil) and (cd) and (cd<=0) and (IsUsableSpell(DKCrutch.SpellList["Dark Transformation"])) and ( PetHasActionBar() ) then - return "Dark Transformation" - end - - -- Death Coil if runic power>90 - local dccd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Death Coil"]) - if (dccd) and (dccd <= 1) and (UnitPower("player", 6) > 90) then - return "Death Coil" - end - -- Death and Decay if available and AoE local ddcd = DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Death and Decay"]) if (ddcd) and (ddcd <= 1) and (DKCrutch.person["foeCount"]>1) then @@ -1113,15 +1189,6 @@ function DKCrutch:AdviseUnholyAbility() return "Scourge Strike" end - -- Plague Leech if Outbreak available, and have on fully depleted rune - if (DKCrutch.SpellList["Plague Leech"]) then - if (obcd) and (obcd<=0) and (IsSpellInRange(DKCrutch.SpellList["Outbreak"], "target") == 1) and (DKCrutch.depletedCount>0) then - if (DKCrutch:GetSpellCooldownRemaining(DKCrutch.SpellList["Plague Leech"]) <= 1) then - return "Plague Leech" - end - end - end - -- Festering strike if (fscd) and (fscd <= 1) then return "Festering Strike" diff --git a/DKCrutch.toc b/DKCrutch.toc index 616f9e2..fa6b24c 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: 1.0.3 +## Version: 1.0.4 ## SavedVariables: DKCrutchDB ## OptionalDeps: ## Dependencies: -- 1.7.9.5