add nice error msg if they don't have disenchant

This commit is contained in:
avitasia
2025-12-26 13:30:50 -08:00
parent c5b4549044
commit d9e764181c
2 changed files with 3043 additions and 3026 deletions
+3027 -3026
View File
File diff suppressed because it is too large Load Diff
+16
View File
@@ -691,6 +691,22 @@ namespace Nampower {
return 0;
}
// Check if player has Disenchant spell (13262)
constexpr uint32_t DISENCHANT_SPELL_ID = 13262;
bool hasDisenchant = false;
for (uint32_t slot = 0; slot < 1024; slot++) {
uint32_t spellId = *reinterpret_cast<uint32_t *>(static_cast<uint32_t>(Offsets::CGSpellBook_mKnownSpells) + slot * 4);
if (spellId == DISENCHANT_SPELL_ID) {
hasDisenchant = true;
break;
}
}
if (!hasDisenchant) {
lua_error(luaState, "You do not have the Disenchant spell");
return 0;
}
// Reset both modes
gDisenchantItemId = 0;
gDisenchantQuality = -1;