From ce7aff7a710b98be98fcb067f6822f6a93502457 Mon Sep 17 00:00:00 2001 From: avitasia Date: Mon, 30 Mar 2026 08:42:00 -0700 Subject: [PATCH] treat autoshot as special spell --- nampower/helper.cpp | 31 ++++++++++++++++++------------- nampower/spellevents.cpp | 6 ++++++ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/nampower/helper.cpp b/nampower/helper.cpp index 508a8a6..6d40175 100644 --- a/nampower/helper.cpp +++ b/nampower/helper.cpp @@ -59,9 +59,11 @@ namespace Nampower { auto const getSpellInfoAtSlot = [&normalize](uint32_t slot, uint32_t type) -> SlotSpellInfo { uint32_t spellId = 0; if (type == 0) { - spellId = *reinterpret_cast(static_cast(Offsets::CGSpellBook_mKnownSpells) + slot * 4); + spellId = *reinterpret_cast( + static_cast(Offsets::CGSpellBook_mKnownSpells) + slot * 4); } else if (type == 1) { - spellId = *reinterpret_cast(static_cast(Offsets::CGSpellBook_mKnownPetSpells) + slot * 4); + spellId = *reinterpret_cast( + static_cast(Offsets::CGSpellBook_mKnownPetSpells) + slot * 4); } if (spellId == 0) { return {}; @@ -131,9 +133,11 @@ namespace Nampower { } uint32_t slotSpellId = 0; if (bookType == 0) { - slotSpellId = *reinterpret_cast(static_cast(Offsets::CGSpellBook_mKnownSpells) + slot * 4); + slotSpellId = *reinterpret_cast( + static_cast(Offsets::CGSpellBook_mKnownSpells) + slot * 4); } else { - slotSpellId = *reinterpret_cast(static_cast(Offsets::CGSpellBook_mKnownPetSpells) + slot * 4); + slotSpellId = *reinterpret_cast( + static_cast(Offsets::CGSpellBook_mKnownPetSpells) + slot * 4); } return slotSpellId == expectedId; }; @@ -196,15 +200,16 @@ namespace Nampower { bool SpellIsAttackTradeskillOrEnchant(const game::SpellRec *spell) { return ( - spell->Effect[0] == game::SpellEffects::SPELL_EFFECT_ATTACK || - spell->Attributes & game::SpellAttributes::SPELL_ATTR_TRADESPELL || - spell->Effect[0] == game::SpellEffects::SPELL_EFFECT_TRADE_SKILL || - spell->Effect[0] == game::SpellEffects::SPELL_EFFECT_TRANS_DOOR || - spell->Effect[0] == game::SpellEffects::SPELL_EFFECT_ENCHANT_ITEM || - spell->Effect[0] == game::SpellEffects::SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY || - spell->Effect[0] == game::SpellEffects::SPELL_EFFECT_CREATE_ITEM || - spell->Effect[0] == game::SpellEffects::SPELL_EFFECT_OPEN_LOCK || - spell->Effect[0] == game::SpellEffects::SPELL_EFFECT_OPEN_LOCK_ITEM); + spell->Id == 75 || // hunter abilities will queue autoshot early + spell->Effect[0] == game::SpellEffects::SPELL_EFFECT_ATTACK || + spell->Attributes & game::SpellAttributes::SPELL_ATTR_TRADESPELL || + spell->Effect[0] == game::SpellEffects::SPELL_EFFECT_TRADE_SKILL || + spell->Effect[0] == game::SpellEffects::SPELL_EFFECT_TRANS_DOOR || + spell->Effect[0] == game::SpellEffects::SPELL_EFFECT_ENCHANT_ITEM || + spell->Effect[0] == game::SpellEffects::SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY || + spell->Effect[0] == game::SpellEffects::SPELL_EFFECT_CREATE_ITEM || + spell->Effect[0] == game::SpellEffects::SPELL_EFFECT_OPEN_LOCK || + spell->Effect[0] == game::SpellEffects::SPELL_EFFECT_OPEN_LOCK_ITEM); } bool SpellIsMounting(const game::SpellRec *spell) { diff --git a/nampower/spellevents.cpp b/nampower/spellevents.cpp index ebab1a5..e4b8085 100644 --- a/nampower/spellevents.cpp +++ b/nampower/spellevents.cpp @@ -219,6 +219,12 @@ namespace Nampower { return; } + // ignore autoshot errors + if (spellId == 75) { + DEBUG_LOG("Ignoring autoshot failure with result " << int(spellResult)); + return; + } + // Check for Disenchant (13262) failure and stop the disenchant loop if (spellId == 13262) { DEBUG_LOG("Disenchant spell failed with result " << int(spellResult) << ", stopping disenchant loop");