From 6fc4ccf78b7f6bb1c8262edd439bcd4903b67c92 Mon Sep 17 00:00:00 2001 From: Shane Mc Cormack Date: Fri, 30 Aug 2024 07:54:54 +0100 Subject: [PATCH] Make healthstones optional --- Core/DB.lua | 1 + FrameXML/InterfaceOptionsFrame.lua | 14 ++++++++++++++ code.lua | 3 +++ 3 files changed, 18 insertions(+) diff --git a/Core/DB.lua b/Core/DB.lua index b220639..cb7cf73 100644 --- a/Core/DB.lua +++ b/Core/DB.lua @@ -4,6 +4,7 @@ ham.defaults = { raidStone = false, witheringPotion = false, witheringDreamsPotion = false, + useHealthstones = true, activatedSpells = { ham.crimsonVialSpell, ham.renewal, ham.exhilaration, ham.fortitudeOfTheBear, ham.bitterImmunity, ham.desperatePrayer, ham.healingElixir, ham.giftOfTheNaaruDK, ham.giftOfTheNaaruHunter, ham.giftOfTheNaaruMage, ham.giftOfTheNaaruMageWarlock, ham.giftOfTheNaaruMonk, ham.giftOfTheNaaruPaladin, ham.giftOfTheNaaruPriest, ham diff --git a/FrameXML/InterfaceOptionsFrame.lua b/FrameXML/InterfaceOptionsFrame.lua index a5057d4..6ac78c4 100644 --- a/FrameXML/InterfaceOptionsFrame.lua +++ b/FrameXML/InterfaceOptionsFrame.lua @@ -274,6 +274,19 @@ function ham.settingsFrame:InitializeOptions() lastStaticElement = witheringPotionButton ---MAYBE witheringDreamsPotionButton end + local useHealthstonesButton = CreateFrame("CheckButton", nil, self.panel, "InterfaceOptionsCheckButtonTemplate") + useHealthstonesButton:SetPoint("TOPLEFT", lastStaticElement, 0, -PADDING) + ---@diagnostic disable-next-line: undefined-field + useHealthstonesButton.Text:SetText("Include Healthstones") + useHealthstonesButton:HookScript("OnClick", function(_, btn, down) + HAMDB.useHealthstones = useHealthstonesButton:GetChecked() + ham.updateHeals() + ham.updateMacro() + self:updatePrio() + end) + useHealthstonesButton:SetChecked(HAMDB.useHealthstones) + lastStaticElement = useHealthstonesButton + ------------- CURRENT PRIORITY ------------- currentPrioTitle = self.panel:CreateFontString("ARTWORK", nil, "GameFontNormalHuge") @@ -302,6 +315,7 @@ function ham.settingsFrame:InitializeOptions() witheringPotionButton:SetChecked(HAMDB.witheringPotion) witheringDreamsPotionButton:SetChecked(HAMDB.witheringDreamsPotion) end + useHealthstonesButton:SetChecked(HAMDB.useHealthstones) ham.updateHeals() ham.updateMacro() self:updatePrio() diff --git a/code.lua b/code.lua index 024a832..bac389e 100755 --- a/code.lua +++ b/code.lua @@ -25,6 +25,9 @@ local function addPlayerHealingItemIfAvailable() end local function addHealthstoneIfAvailable() + if not HAMDB.useHealthstones then + return + end if isClassic == true or isWrath == true then for i, value in ipairs(ham.getHealthstonesClassic()) do if value.getCount() > 0 then