LUA AddSpellBookEntry

EQ2Emulator Development forum.

Moderator: Team Members

Post Reply
bolly
Retired
Posts: 389
Joined: Mon Sep 21, 2009 3:03 pm
Location: Leeds, UK

LUA AddSpellBookEntry

Post by bolly » Tue Nov 17, 2009 9:33 am

AddSpellBookEntry(Spawn, SpellID, SpellTier)

int EQ2Emu_lua_AddSpellBookEntry(lua_State* state) {
if(!lua_interface)
return 0;
Spawn* player = lua_interface->GetSpawn(state);
int16 spellid = lua_interface->GetInt16Value(state, 2);
int16 tier = lua_interface->GetInt16Value(state, 3);

Spell* spell = master_spell_list.GetSpell(spellid, tier);
Client* client = player->GetZone()->GetClientBySpawn(player);
if(player && player->IsPlayer())
{
((Player*)player)->AddSpellBookEntry(spell->GetSpellID(), spell->GetSpellTier(), ((Player*)player)->GetFreeSpellBookSlot(spell->GetSpellData()->spell_book_type), spell->GetSpellData()->spell_book_type, true);
EQ2Packet* outapp = ((Player*)player)->GetSpellBookUpdatePacket(GetVersion());
if(outapp)
client->QueuePacket(outapp);
return 1;
}
return 0;
}

Cheers for the help with this one scat

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest