BUG:FIX is included here, AddSpellBookEntry not working
Posted: Sat Nov 11, 2017 4:41 pm
The LUA Function AddSpellBookEntry is not adding spells for Spell ID's larger than an unsigned int16,
my example was spell id # 110012, and it was returning a number in the 40k range
through hard work and dedication i single handedly drove through the code and was able to Squash this beast of a bug, with the following change
the function was using an int16 for spell id instead of an int32
change the line
to
this is the fixed code
my example was spell id # 110012, and it was returning a number in the 40k range
through hard work and dedication i single handedly drove through the code and was able to Squash this beast of a bug, with the following change
the function was using an int16 for spell id instead of an int32
change the line
Code: Select all
int16 spellid = lua_interface->GetInt16Value(state, 2);Code: Select all
int32 spellid = lua_interface->GetInt32Value(state, 2);Code: Select all
int EQ2Emu_lua_AddSpellBookEntry(lua_State* state) {
if(!lua_interface)
return 0;
Spawn* player = lua_interface->GetSpawn(state);
int32 spellid = lua_interface->GetInt32Value(state, 2);
int16 tier = lua_interface->GetInt16Value(state, 3);
Spell* spell = master_spell_list.GetSpell(spellid, tier);
if (player && spell && player->IsPlayer()) {
Client* client = player->GetZone()->GetClientBySpawn(player);
if (client ) {
((Player*)player)->AddSpellBookEntry(spell->GetSpellID(), spell->GetSpellTier(), ((Player*)player)->GetFreeSpellBookSlot(spell->GetSpellData()->spell_book_type), spell->GetSpellData()->spell_book_type, spell->GetSpellData()->linked_timer, true);
EQ2Packet* outapp = ((Player*)player)->GetSpellBookUpdatePacket(client->GetVersion());
if (outapp)
client->QueuePacket(outapp);
}
}
return 0;
}