Skip to content

Commit

Permalink
added Pact of the Glutony Healthstones
Browse files Browse the repository at this point in the history
  • Loading branch information
ollidiemaus committed Aug 29, 2024
1 parent d9dbdcd commit b640844
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 26 deletions.
2 changes: 1 addition & 1 deletion AutoPotion.toc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions Core/Potions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
62 changes: 40 additions & 22 deletions code.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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()
Expand All @@ -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 = ''

Expand All @@ -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
Expand All @@ -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
Expand All @@ -140,6 +156,7 @@ function ham.updateMacro()
resetType = "combat"
buildItemMacroString()
buildSpellMacroString()
setResetType()
macroStr = "#showtooltip \n/castsequence reset=" .. resetType .. " "
if spellsMacroString ~= "" then
macroStr = macroStr .. spellsMacroString
Expand All @@ -151,6 +168,7 @@ function ham.updateMacro()
macroStr = macroStr .. itemsMacroString
end
end

createMacroIfMissing()
EditMacro(macroName, macroName, nil, macroStr)
end
Expand Down

0 comments on commit b640844

Please sign in to comment.