From b640844a4d7bb681f27de08bb0f28a9af081f724 Mon Sep 17 00:00:00 2001 From: ollidiemaus Date: Thu, 29 Aug 2024 13:45:01 +0200 Subject: [PATCH] added Pact of the Glutony Healthstones --- AutoPotion.toc | 2 +- Core/Potions.lua | 4 +--- code.lua | 62 +++++++++++++++++++++++++++++++----------------- 3 files changed, 42 insertions(+), 26 deletions(-) diff --git a/AutoPotion.toc b/AutoPotion.toc index a12c510..6bfdb3a 100755 --- a/AutoPotion.toc +++ b/AutoPotion.toc @@ -2,7 +2,7 @@ ## Interface-Classic: 11503 ## Interface-WOTLKC: 30403 ## Interface-Cata: 40400 -## Version: 3.5.9 +## Version: 3.5.10 ## Title: Auto Potion ## Author: ollidiemaus ## Notes: Updates the Macro AutoPotion to use either Healthstone or the highest Potion found in Bags diff --git a/Core/Potions.lua b/Core/Potions.lua index 25e496e..b984527 100644 --- a/Core/Potions.lua +++ b/Core/Potions.lua @@ -4,10 +4,8 @@ local isClassic = (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC) local isWrath = (WOW_PROJECT_ID == WOW_PROJECT_WRATH_CLASSIC) local isCata = (WOW_PROJECT_ID == WOW_PROJECT_CATACLYSM_CLASSIC) ---ham.leywine = ham.Item.new(194684,"Azure Leywine") ---ham.healthstone = ham.Item.new(117, "Healthstone") ham.healthstone = ham.Item.new(5512, "Healthstone") -ham.demonicHealthstone = ham.Item.new(224464, "Demonic Healthstone") ---1 Minute CD +ham.demonicHealthstone = ham.Item.new(224464, "Demonic Healthstone") ---1 Minute CD due to Pact of Gluttony ham.algariHealingPotionR3 = ham.Item.new(211880, "Algari Healing Potion") ham.algariHealingPotionR2 = ham.Item.new(211879, "Algari Healing Potion") ham.algariHealingPotionR1 = ham.Item.new(211878, "Algari Healing Potion") diff --git a/code.lua b/code.lua index 9703be2..aef9102 100755 --- a/code.lua +++ b/code.lua @@ -37,6 +37,17 @@ local function addHealthstoneIfAvailable() if ham.healthstone.getCount() > 0 then table.insert(ham.itemIdList, ham.healthstone.getId()) end + if ham.demonicHealthstone.getCount() > 0 then + table.insert(ham.itemIdList, ham.demonicHealthstone.getId()) + if HAMDB.cdReset then + if shortestCD == nil then + shortestCD = 60 + end + if 60 < shortestCD then + shortestCD = 60 + end + end + end end end @@ -61,7 +72,7 @@ function ham.updateHeals() ham.spellIDs = ham.myPlayer.getHealingSpells() addPlayerHealingItemIfAvailable() - -- lower the priority of healthstones in a raid environment if selected + -- lower the priority of healthstones in insatanced content if selected if HAMDB.raidStone and IsInInstance() then addPotIfAvailable() addHealthstoneIfAvailable() @@ -78,6 +89,27 @@ local function createMacroIfMissing() end end +local function setShortestSpellCD(newSpell) + if HAMDB.cdReset then + local cd + cd = GetSpellBaseCooldown(newSpell) / 1000 + if shortestCD == nil then + shortestCD = cd + end + if cd < shortestCD then + shortestCD = cd + end + end +end + +local function setResetType() + if HAMDB.cdReset == true and shortestCD ~= nil then + resetType = "combat/" .. shortestCD + else + resetType = "combat" + end +end + local function buildSpellMacroString() spellsMacroString = '' @@ -90,20 +122,8 @@ local function buildSpellMacroString() name = GetSpellInfo(spell) end - if HAMDB.cdReset then - local cd - if isRetail == true then - cd = C_Spell.GetSpellCooldown(spell).duration - else - cd = GetSpellBaseCooldown(spell) - end - if shortestCD == nil then - shortestCD = cd - end - if cd < shortestCD then - shortestCD = cd - end - end + setShortestSpellCD(spell) + --TODO HEALING Elixir Twice because it has two charges ?! kinda janky but will work for now if spell == ham.healingElixir then name = name .. ", " .. name @@ -115,19 +135,15 @@ local function buildSpellMacroString() end end end - --add if ham.cdReset == true then combat/spelltime - if HAMDB.cdReset and shortestCD ~= nil then - resetType = "combat/" .. shortestCD - end end local function buildItemMacroString() if next(ham.itemIdList) ~= nil then - for i, v in ipairs(ham.itemIdList) do + for i, name in ipairs(ham.itemIdList) do if i == 1 then - itemsMacroString = "item:" .. v; + itemsMacroString = "item:" .. name; else - itemsMacroString = itemsMacroString .. ", " .. "item:" .. v; + itemsMacroString = itemsMacroString .. ", " .. "item:" .. name; end end end @@ -140,6 +156,7 @@ function ham.updateMacro() resetType = "combat" buildItemMacroString() buildSpellMacroString() + setResetType() macroStr = "#showtooltip \n/castsequence reset=" .. resetType .. " " if spellsMacroString ~= "" then macroStr = macroStr .. spellsMacroString @@ -151,6 +168,7 @@ function ham.updateMacro() macroStr = macroStr .. itemsMacroString end end + createMacroIfMissing() EditMacro(macroName, macroName, nil, macroStr) end