From 440d54fa16c600f060f59187a9efdd349ca1af19 Mon Sep 17 00:00:00 2001 From: ollidiemaus Date: Sat, 27 Jul 2024 09:19:48 +0200 Subject: [PATCH] Added Demonic Healthstone as Player Item --- AutoPotion.toc | 2 +- Core/Player.lua | 7 ++++++- Core/Potions.lua | 18 +++++++++--------- FrameXML/InterfaceOptionsFrame.lua | 1 + code.lua | 13 ++++++------- 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/AutoPotion.toc b/AutoPotion.toc index 452ff78..f3d12de 100755 --- a/AutoPotion.toc +++ b/AutoPotion.toc @@ -2,7 +2,7 @@ ## Interface-Classic: 11503 ## Interface-WOTLKC: 30403 ## Interface-Cata: 40400 -## Version: 3.5.1 +## Version: 3.5.2 ## 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/Player.lua b/Core/Player.lua index 083fa4c..0ad6f18 100755 --- a/Core/Player.lua +++ b/Core/Player.lua @@ -8,7 +8,12 @@ ham.Player.new = function() self.localizedClass, self.englishClass, self.classIndex = UnitClass("player"); function self.getHealingItems() - return + local healingItems = {} + ham.demonicHealthstoneItem = ham.Item.new(224464, "Demonic Healthstone") + + table.insert(healingItems, ham.demonicHealthstoneItem) + + return healingItems end function self.getHealingSpells() diff --git a/Core/Potions.lua b/Core/Potions.lua index c0eebd9..e0144a9 100644 --- a/Core/Potions.lua +++ b/Core/Potions.lua @@ -72,9 +72,9 @@ ham.major2 = ham.Item.new(19013, "Major Healthstone") ham.master0 = ham.Item.new(22103, "Master Healthstone") ham.master1 = ham.Item.new(22104, "Master Healthstone") ham.master2 = ham.Item.new(22105, "Master Healthstone") -ham.demonic0 = ham.Item.new(36889, "Demonic Healthstone") -ham.demonic1 = ham.Item.new(36890, "Demonic Healthstone") -ham.demonic2 = ham.Item.new(36891, "Demonic Healthstone") +ham.demonicWotLK0 = ham.Item.new(36889, "Demonic Healthstone") +ham.demonicWotLK1 = ham.Item.new(36890, "Demonic Healthstone") +ham.demonicWotLK2 = ham.Item.new(36891, "Demonic Healthstone") ham.fel0 = ham.Item.new(36892, "Fel Healthstone") ham.fel1 = ham.Item.new(36893, "Fel Healthstone") ham.fel2 = ham.Item.new(36894, "Fel Healthstone") @@ -224,9 +224,9 @@ function ham.getHealthstonesClassic() ham.fel2, ham.fel1, ham.fel0, - ham.demonic2, - ham.demonic1, - ham.demonic0, + ham.demonicWotLK2, + ham.demonicWotLK1, + ham.demonicWotLK0, ham.master2, ham.master1, ham.master0, @@ -253,9 +253,9 @@ function ham.getHealthstonesClassic() ham.fel2, ham.fel1, ham.fel0, - ham.demonic2, - ham.demonic1, - ham.demonic0, + ham.demonicWotLK2, + ham.demonicWotLK1, + ham.demonicWotLK0, ham.master2, ham.master1, ham.master0, diff --git a/FrameXML/InterfaceOptionsFrame.lua b/FrameXML/InterfaceOptionsFrame.lua index 5442ff2..0d1cc29 100644 --- a/FrameXML/InterfaceOptionsFrame.lua +++ b/FrameXML/InterfaceOptionsFrame.lua @@ -101,6 +101,7 @@ end function panel:updatePrio() ham.updateHeals() + ham.updateMacro() local spellCounter = 0 local itemCounter = 0 diff --git a/code.lua b/code.lua index 9ce67d4..09359bb 100755 --- a/code.lua +++ b/code.lua @@ -13,11 +13,10 @@ local macroStr = '' local resetType = "combat" local function addPlayerHealingItemIfAvailable() - local playerResetType, item = ham.myPlayer.getHealingItems() - - if item ~= nil then - if item.getCount() > 0 then - table.insert(ham.itemIdList, item.getId()) + for i, value in ipairs(ham.myPlayer.getHealingItems()) do + if value.getCount() > 0 then + table.insert(ham.itemIdList, value.getId()) + break; end end end @@ -113,7 +112,7 @@ local function buildItemMacroString() end end -local function updateMacro() +function ham.updateMacro() if next(ham.itemIdList) == nil and next(ham.spellIDs) == nil then macroStr = "#showtooltip" else @@ -159,6 +158,6 @@ updateFrame:SetScript("OnEvent", function(self, event, ...) if onCombat == false then ham.updateHeals() - updateMacro() + ham.updateMacro() end end)