Skip to content

Commit

Permalink
Added Interface Options to configure the behaviour of the Addon
Browse files Browse the repository at this point in the history
* added initial interface options and settings
* updates to release workflow
* loading settings
* removed prints
  • Loading branch information
ollidiemaus authored Dec 21, 2022
1 parent 2bccd3d commit a82e071
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 22 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ on:
- main
tags:
- "**"

env:
CF_API_KEY: ${{ secrets.CF_API_KEY }}
WAGO_API_TOKEN: ${{ secrets.WAGO_API_TOKEN }}
GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }}

jobs:
release:
runs-on: ubuntu-latest
env:
GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Clone project
uses: actions/checkout@v3
Expand All @@ -18,5 +22,3 @@ jobs:

- name: Create Package
uses: BigWigsMods/packager@v2
env:
WAGO_API_TOKEN: ${{ secrets.WAGO_API_TOKEN }}
87 changes: 87 additions & 0 deletions FrameXML/InterfaceOptionsFrame.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
local defaults = {
renewal = true,
exhilaration = true,
bitterImmunity = true,
crimsonVial = false,
}

local panel = CreateFrame("Frame")

function panel:OnEvent(event, addOnName)
if addOnName == "HealthstoneAutoMacro" then
HAMDB = HAMDB or CopyTable(defaults)
self.db = HAMDB
self:InitializeOptions()
end
end

panel:RegisterEvent("ADDON_LOADED")
panel:SetScript("OnEvent", panel.OnEvent)

function panel:InitializeOptions()
self.panel = CreateFrame("Frame")
self.panel.name = "Healthstone Auto Macro"

local title = self.panel:CreateFontString("ARTWORK", nil, "GameFontNormalLarge")
title:SetPoint("TOP")
title:SetText("Healthstone Auto Marco Settings")

local subtitle = self.panel:CreateFontString("ARTWORK", nil, "GameFontNormal")
subtitle:SetPoint("TOPLEFT", 20, -30)
subtitle:SetText("Here you can configure the behaviour of the Addon eg. if you want to include class spells")

local renewalButton = CreateFrame("CheckButton", nil, self.panel, "InterfaceOptionsCheckButtonTemplate")
renewalButton:SetPoint("TOPLEFT", subtitle, 20, -30)
renewalButton.Text:SetText("Use Renewal")
renewalButton:HookScript("OnClick", function(_, btn, down)
self.db.renewal = renewalButton:GetChecked()
end)
renewalButton:SetChecked(self.db.renewal)

local exhilarationButton = CreateFrame("CheckButton", nil, self.panel, "InterfaceOptionsCheckButtonTemplate")
exhilarationButton:SetPoint("TOPLEFT", renewalButton, 0, -30)
exhilarationButton.Text:SetText("Use Exhilaration")
exhilarationButton:HookScript("OnClick", function(_, btn, down)
self.db.exhilaration = exhilarationButton:GetChecked()
end)
exhilarationButton:SetChecked(self.db.exhilaration)

local bitterImmunityButton = CreateFrame("CheckButton", nil, self.panel, "InterfaceOptionsCheckButtonTemplate")
bitterImmunityButton:SetPoint("TOPLEFT", exhilarationButton, 0, -30)
bitterImmunityButton.Text:SetText("Use Bitter Immunity")
bitterImmunityButton:HookScript("OnClick", function(_, btn, down)
self.db.bitterImmunity = bitterImmunityButton:GetChecked()
end)
bitterImmunityButton:SetChecked(self.db.bitterImmunity)

local crimsonVialButton = CreateFrame("CheckButton", nil, self.panel, "InterfaceOptionsCheckButtonTemplate")
crimsonVialButton:SetPoint("TOPLEFT", bitterImmunityButton, 0, -30)
crimsonVialButton.Text:SetText("Use Crimson Vial")
crimsonVialButton:HookScript("OnClick", function(_, btn, down)
self.db.crimsonVial = crimsonVialButton:GetChecked()
end)
crimsonVialButton:SetChecked(self.db.crimsonVial)

local btn = CreateFrame("Button", nil, self.panel, "UIPanelButtonTemplate")
btn:SetPoint("TOPLEFT", crimsonVialButton, 0, -40)
btn:SetText("Reset to Default")
btn:SetWidth(120)
btn:SetScript("OnClick", function()
HAMDB = CopyTable(defaults)
self.db = HAMDB
renewalButton:SetChecked(self.db.renewal)
exhilarationButton:SetChecked(self.db.exhilaration)
bitterImmunityButton:SetChecked(self.db.bitterImmunity)
crimsonVialButton:SetChecked(self.db.crimsonVial)
print("Reset successful!")
end)

InterfaceOptions_AddCategory(self.panel)
end

SLASH_HAM1 = "/ham"
SLASH_HAM2 = "/healtsthoneautomacro"

SlashCmdList.HAM = function(msg, editBox)
InterfaceOptionsFrame_OpenToCategory(panel.panel)
end
7 changes: 5 additions & 2 deletions HealthstoneAutoMacro.toc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
## Version: 2.3
## Title: Healthstone Auto Macro
## Author: ollidiemaus
## X-Wago-ID: yQKybBG7
## Notes: Updates the Macro HAMHealthPot to use either Healthstone or the highest Potion found in Bags
## X-Curse-Project-ID: 312940
## X-Wago-ID: yQKybBG7
## SavedVariables: HAMDB
code.lua
Bindings.lua
Bindings.lua
FrameXML/InterfaceOptionsFrame.lua
40 changes: 24 additions & 16 deletions code.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ Player.new = function()
function self.getSpellPotions()
---uncomment this block if you really want cirmson vial to be in this roation.
if self.englishClass=="ROGUE" then
local crimsonVialSpellId = 185311
if IsSpellKnown(crimsonVialSpellId) then
return "30", 137222
if HAMDB.crimsonVial then
local crimsonVialSpellId = 185311
if IsSpellKnown(crimsonVialSpellId) then
return "30", 137222
end
end
end
return
Expand All @@ -54,25 +56,31 @@ Player.new = function()
--returns resetType, spellId
function self.getHealingSpells()
if self.englishClass=="DRUID" then
local renewal = 108238
if IsSpellKnown(renewal) then
name, rank, icon, castTime, minRange, maxRange = GetSpellInfo(renewal)
return "90", name
if HAMDB.renewal then
local renewal = 108238
if IsSpellKnown(renewal) then
name, rank, icon, castTime, minRange, maxRange = GetSpellInfo(renewal)
return "90", name
end
end
end
if self.englishClass=="HUNTER" then
--NOTE: on GCD
local exhilaration = 109304
if IsSpellKnown(exhilaration) then
name, rank, icon, castTime, minRange, maxRange = GetSpellInfo(exhilaration)
return "120", name
if HAMDB.exhilaration then
local exhilaration = 109304
if IsSpellKnown(exhilaration) then
name, rank, icon, castTime, minRange, maxRange = GetSpellInfo(exhilaration)
return "120", name
end
end
end
if self.englishClass=="WARRIOR" then
local bitterImmunity = 383762
if IsSpellKnown(bitterImmunity) then
name, rank, icon, castTime, minRange, maxRange = GetSpellInfo(bitterImmunity)
return "180", name
if HAMDB.bitterImmunity then
local bitterImmunity = 383762
if IsSpellKnown(bitterImmunity) then
name, rank, icon, castTime, minRange, maxRange = GetSpellInfo(bitterImmunity)
return "180", name
end
end
end

Expand Down Expand Up @@ -158,7 +166,7 @@ HealPotMacroIcon:SetScript("OnEvent",function(self,event,...)
if event=="PLAYER_REGEN_ENABLED" then
onCombat = false
end

if onCombat==false then
Pot = getPots()
resetType = "combat"
Expand Down

0 comments on commit a82e071

Please sign in to comment.