Skip to content

Commit

Permalink
maxWait for memorization
Browse files Browse the repository at this point in the history
  • Loading branch information
DerpleMQ2 committed Jan 5, 2024
1 parent 58e3c1f commit 12d7318
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions utils/rgmercs_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,10 @@ end

---@param gem integer
---@param spell string
function Utils.MemorizeSpell(gem, spell)
---@param maxWait number # max wait in ms
function Utils.MemorizeSpell(gem, spell, maxWait)
RGMercsLogger.log_info("\ag Meming \aw %s in \ag slot %d", spell, gem)
mq.cmdf("/memspell %d \"%s\"", gem, spell)
local maxWait = 5000

while mq.TLO.Me.Gem(gem)() ~= spell and maxWait > 0 do
RGMercsLogger.log_verbose("\ayWaiting for '%s' to load in slot %d'...", spell, gem)
Expand Down Expand Up @@ -547,7 +547,7 @@ function Utils.UseSpell(spellName, targetId, bAllowMem)

if not me.Gem(spellName)() then
RGMercsLogger.log_debug("\ay%s is not memorized - meming!", spellName)
Utils.MemorizeSpell(USEGEM, spellName)
Utils.MemorizeSpell(USEGEM, spellName, 5000)
end

if not me.Gem(spellName)() then
Expand Down Expand Up @@ -711,7 +711,7 @@ function Utils.RunRotation(s, r, targetId, map, steps, start_step, bAllowMem)

if oldSpellInSlot() and mq.TLO.Me.Gem(USEGEM)() ~= oldSpellInSlot.Name() then
RGMercsLogger.log_debug("\ayRestoring %s in slot %d", oldSpellInSlot, USEGEM)
Utils.MemorizeSpell(USEGEM, oldSpellInSlot.Name())
Utils.MemorizeSpell(USEGEM, oldSpellInSlot.Name(), 5000)
end

-- Move to the next step
Expand Down Expand Up @@ -2201,7 +2201,7 @@ function Utils.LoadSpellLoadOut(t)
end

if mq.TLO.Me.Gem(gem)() ~= selectedRank then
Utils.MemorizeSpell(gem, selectedRank)
Utils.MemorizeSpell(gem, selectedRank, 7000)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion version.lua
Original file line number Diff line number Diff line change
@@ -1 +1 @@
return { commitId = '21317a3 2024-01-05' }
return { commitId = '58e3c1f 2024-01-05' }

0 comments on commit 12d7318

Please sign in to comment.