Skip to content

Commit

Permalink
Fixed spell casting to use rank name instead of name
Browse files Browse the repository at this point in the history
  • Loading branch information
DerpleMQ2 committed Dec 29, 2023
1 parent dbd793e commit 92e9a0f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 29 deletions.
22 changes: 1 addition & 21 deletions modules/shd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function Module.New()
return newModule
end

-- helper function for advanced logic to see if we want to use Darl Lord's Unity
-- helper function for advanced logic to see if we want to use Dark Lord's Unity
function Module:castDLU()
if not Module.ResolvedActionMap['Shroud'] then return false end

Expand Down Expand Up @@ -115,28 +115,8 @@ function Module:setCombatMode(mode)
RGMercUtils.LoadSpellLoadOut(Module.SpellLoadOut)
end

local function renderSetting(k, v)
if type(v) == "table" then
ImGui.Text(k)
ImGui.Indent()
for ki, kv in pairs(v) do
renderSetting(ki, kv)
end
ImGui.Unindent()
else
ImGui.Text("%s => %s", k, v)
end
end

function Module:Render()
ImGui.Text("ShadowKnight Combat Modules")
local pressed

--if ImGui.CollapsingHeader("Current Settings") then
-- for k, v in pairs(self.settings) do
-- renderSetting(k, v)
-- end
--end

---@type boolean|nil
local pressed = false
Expand Down
17 changes: 9 additions & 8 deletions utils/rgmercs_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function Utils.MemorizeSpell(gem, spell)
mq.cmdf("/memspell %d \"%s\"", gem, spell)

while mq.TLO.Me.Gem(gem)() ~= spell do
RGMercsLogger.log_info("\ayWaiting for '%s' to load in slot %d'...", spell, gem)
RGMercsLogger.log_debug("\ayWaiting for '%s' to load in slot %d'...", spell, gem)
mq.delay(100)
end
end
Expand All @@ -133,19 +133,20 @@ function Utils.ExecEntry(e, map)

if e.type:lower() == "spell" then
local s = map[e.name]
RGMercsLogger.log_debug("%s - %s", e.name, s)
if s then
if not mq.TLO.Me.Book(s.Name())() then
if not mq.TLO.Me.Book(s.RankName())() then
--RGMercsLogger.log_error("\arSpell '\at%s\ar' is not in your book!", s.Name())
return
end

if not mq.TLO.Me.Gem(s.Name())() then
RGMercsLogger.log_debug("\ay%s is not memorized - meming!", s.Name())
Utils.MemorizeSpell(USEGEM, s.Name())
if not mq.TLO.Me.Gem(s.RankName())() then
RGMercsLogger.log_debug("\ay%s is not memorized - meming!", s.RankName())
Utils.MemorizeSpell(USEGEM, s.RankName())
end

Utils.WaitCastReady(s.Name())
cmd = string.format("/casting \"%s\" -maxtries|5", s)
Utils.WaitCastReady(s.RankName())
cmd = string.format("/casting \"%s\" -maxtries|5", s.RankName())
mq.cmdf(cmd)
RGMercsLogger.log_debug("Running: \at'%s'", cmd)
else
Expand All @@ -160,7 +161,7 @@ end

function Utils.RunRotation(s, r, map)
local oldSpellInSlot = mq.TLO.Me.Gem(USEGEM)
for idx, entry in ipairs(r) do
for _, entry in ipairs(r) do
if entry.cond then
local pass = entry.cond(s, map[entry.name] or mq.TLO.Spell(entry.name))
if pass == true then
Expand Down

0 comments on commit 92e9a0f

Please sign in to comment.