treat autoshot as special spell

This commit is contained in:
avitasia
2026-03-30 08:42:00 -07:00
parent 72d6b96b19
commit ce7aff7a71
2 changed files with 24 additions and 13 deletions
+18 -13
View File
@@ -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<uint32_t *>(static_cast<uint32_t>(Offsets::CGSpellBook_mKnownSpells) + slot * 4);
spellId = *reinterpret_cast<uint32_t *>(
static_cast<uint32_t>(Offsets::CGSpellBook_mKnownSpells) + slot * 4);
} else if (type == 1) {
spellId = *reinterpret_cast<uint32_t *>(static_cast<uint32_t>(Offsets::CGSpellBook_mKnownPetSpells) + slot * 4);
spellId = *reinterpret_cast<uint32_t *>(
static_cast<uint32_t>(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<uint32_t *>(static_cast<uint32_t>(Offsets::CGSpellBook_mKnownSpells) + slot * 4);
slotSpellId = *reinterpret_cast<uint32_t *>(
static_cast<uint32_t>(Offsets::CGSpellBook_mKnownSpells) + slot * 4);
} else {
slotSpellId = *reinterpret_cast<uint32_t *>(static_cast<uint32_t>(Offsets::CGSpellBook_mKnownPetSpells) + slot * 4);
slotSpellId = *reinterpret_cast<uint32_t *>(
static_cast<uint32_t>(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) {
+6
View File
@@ -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");