Skip to content

Commit

Permalink
3.2.0 (#26)
Browse files Browse the repository at this point in the history
Implemented a preview of the Macro Priority in the Settings Page.

Also added the ability to Include the shortest Cooldown in the reset Condition of Castsequence. !!USE CAREFULLY!!
I would highly advise not to use it that way.
  • Loading branch information
ollidiemaus authored Oct 5, 2023
1 parent faa3227 commit 95a114f
Show file tree
Hide file tree
Showing 9 changed files with 355 additions and 355 deletions.
7 changes: 4 additions & 3 deletions AutoPotion.toc
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
## Interface: 100107
## Interface-Classic: 11404
## Interface-WOTLKC: 30402
## Version: 3.1.1
## Version: 3.2.0
## Title: Auto Potion
## Author: ollidiemaus
## Notes: Updates the Macro AutoPotion to use either Healthstone or the highest Potion found in Bags
## X-Curse-Project-ID: 312940
## X-Wago-ID: yQKybBG7
## SavedVariables: HAMDB
code.lua
Core/Item.lua
Core/Player.lua
Core/Potions.lua
Core/Spells.lua
Core/DB.lua
Core/Player.lua
code.lua
Bindings.lua
FrameXML/InterfaceOptionsFrame.lua
1 change: 0 additions & 1 deletion Bindings.lua
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
_G["BINDING_NAME_MACRO HAMHealthPot"] = "HAMHealthPot Macro"
_G["BINDING_NAME_MACRO AutoPotion"] = "AutoPotion Macro"
3 changes: 0 additions & 3 deletions Bindings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Bindings>
<Binding name="HAMHealthPot Macro" category="Auto Potion">
-- HAMHealthPot
</Binding>
<Binding name="AutoPotion Macro" category="Auto Potion">
-- AutoPotion
</Binding>
Expand Down
35 changes: 35 additions & 0 deletions Core/DB.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
local addonName, ham = ...
ham.defaults = {
cdReset = false,
witheringPotion = false,
activatedSpells = { ham.renewal, ham.exhilaration, ham.fortitudeOfTheBear, ham.bitterImmunity, ham.desperatePrayer,
ham.healingElixir }
}


function ham.dbContains(id)
local found = false
for _, v in pairs(HAMDB.activatedSpells) do
if v == id then
found = true
end
end
return found
end

function ham.removeFromDB(id)
local backup = {}
if ham.dbContains(id) then
for _, v in pairs(HAMDB.activatedSpells) do
if v ~= id then
table.insert(backup, v)
end
end
end

HAMDB.activatedSpells = CopyTable(backup)
end

function ham.insertIntoDB(id)
table.insert(HAMDB.activatedSpells, id)
end
70 changes: 3 additions & 67 deletions Core/Player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,76 +11,12 @@ ham.Player.new = function()
return
end

--returns table with Spellnames {"", ""}
function self.getHealingSpells()
local spells = {}

if self.englishClass == "DRUID" then
if HAMDB.renewal then
if IsSpellKnown(ham.renewal) then
local name, rank, icon, castTime, minRange, maxRange = GetSpellInfo(ham.renewal)
table.insert(spells, name)
end
end
end

if self.englishClass == "HUNTER" then
--NOTE: on GCD
if HAMDB.exhilaration then
if IsSpellKnown(ham.exhilaration) then
local name, rank, icon, castTime, minRange, maxRange = GetSpellInfo(ham.exhilaration)
table.insert(spells, name)
end
end
if HAMDB.fortitudeOfTheBear then
if IsSpellKnown(ham.fortitudeOfTheBear) then
local name, rank, icon, castTime, minRange, maxRange = GetSpellInfo(ham.fortitudeOfTheBear)
table.insert(spells, name)
end
end
end

if self.englishClass == "MONK" then
if HAMDB.expelHarm then
if IsSpellKnown(ham.expelHarm) then
local name, rank, icon, castTime, minRange, maxRange = GetSpellInfo(ham.expelHarm)
table.insert(spells, name)
end
end
if HAMDB.healingElixir then
if IsSpellKnown(ham.healingElixir) then
local name, rank, icon, castTime, minRange, maxRange = GetSpellInfo(ham.healingElixir)
--Twice because it has two charges ?!
table.insert(spells, name)
table.insert(spells, name)
end
end
end

if self.englishClass == "PRIEST" then
if HAMDB.desperatePrayer then
if IsSpellKnown(ham.desperatePrayer) then
local name, rank, icon, castTime, minRange, maxRange = GetSpellInfo(ham.desperatePrayer)
table.insert(spells, name)
end
end
end

if self.englishClass == "ROGUE" then
if HAMDB.crimsonVial then
if IsSpellKnown(ham.crimsonVialSpell) then
local name, rank, icon, castTime, minRange, maxRange = GetSpellInfo(ham.crimsonVialSpell)
table.insert(spells, name)
end
end
end

if self.englishClass == "WARRIOR" then
if HAMDB.bitterImmunity then
if IsSpellKnown(ham.bitterImmunity) then
local name, rank, icon, castTime, minRange, maxRange = GetSpellInfo(ham.bitterImmunity)
table.insert(spells, name)
end
for i, spell in ipairs(HAMDB.activatedSpells) do
if IsSpellKnown(spell) then
table.insert(spells, spell)
end
end

Expand Down
11 changes: 6 additions & 5 deletions Core/Potions.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local addonName, ham = ...
local isRetail = (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE)
local isClassic = (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC)
local isWrath = (WOW_PROJECT_ID == WOW_PROJECT_WRATH_CLASSIC)

Expand Down Expand Up @@ -67,7 +68,7 @@ ham.fel1 = ham.Item.new(36893, "Fel Healthstone")
ham.fel2 = ham.Item.new(36894, "Fel Healthstone")

function ham.getPots()
if isClassic == false and isWrath == false then
if isRetail then
local pots = {
ham.refreshingR3,
ham.refreshingR2,
Expand Down Expand Up @@ -103,7 +104,7 @@ function ham.getPots()

return pots
end
if isClassic == true then
if isClassic then
return {
ham.major,
ham.superior,
Expand All @@ -114,7 +115,7 @@ function ham.getPots()
}
end

if isWrath == true then
if isWrath then
return {
ham.runic,
ham.superreju,
Expand All @@ -135,7 +136,7 @@ function ham.getPots()
end

function ham.getHealthstonesClassic()
if isClassic == true then
if isClassic then
return {
ham.major2,
ham.major1,
Expand All @@ -155,7 +156,7 @@ function ham.getHealthstonesClassic()
}
end

if isWrath == true then
if isWrath then
return {
ham.fel2,
ham.fel1,
Expand Down
34 changes: 34 additions & 0 deletions Core/Spells.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,37 @@ ham.bitterImmunity = 383762
ham.desperatePrayer = 19236
ham.expelHarm = 322101
ham.healingElixir = 122281

ham.supportedSpells = {}
table.insert(ham.supportedSpells, ham.crimsonVialSpell)
table.insert(ham.supportedSpells, ham.renewal)
table.insert(ham.supportedSpells, ham.exhilaration)
table.insert(ham.supportedSpells, ham.fortitudeOfTheBear)
table.insert(ham.supportedSpells, ham.bitterImmunity)
table.insert(ham.supportedSpells, ham.desperatePrayer)
table.insert(ham.supportedSpells, ham.expelHarm)
table.insert(ham.supportedSpells, ham.healingElixir)

ham.Spell = {}

ham.Spell.new = function(id, name)
local self = {}

self.id = id
self.name = name
self.cd = GetSpellBaseCooldown(id)

function self.getId()
return self.id
end

function self.getName()
return self.name
end

function self.getCd()
return self.cd
end

return self
end
Loading

0 comments on commit 95a114f

Please sign in to comment.