* Changed SetSpells() to AddSpell(spellid, spellslot)

* Added handling of SMSG_LEARNED_SPELL opcode
This commit is contained in:
Mini 2007-03-23 22:34:19 +00:00
parent 0aaf7b45d6
commit 739ee2eae2
4 changed files with 28 additions and 18 deletions

View File

@ -32,23 +32,13 @@ void MyCharacter::SetActionButtons(WorldPacket &data)
} }
void MyCharacter::SetSpells(WorldPacket &data) void MyCharacter::AddSpell(uint16 spellid, uint16 spellslot)
{ {
uint8 unk; SpellBookEntry _spell;
uint16 spellid,spellslot,count; _spell.id = spellid;
data >> unk >> count; _spell.slot = spellslot;
logdebug("Got initial spells list, %u spells.",count);
for(uint16 i = 0; i < count; i++)
{
data >> spellid >> spellslot;
logdebug("Initial Spell: id=%u slot=%u",spellid,spellslot);
SpellBookEntry _spell; _spells.push_back(_spell);
_spell.id = spellid;
_spell.slot = spellslot;
_spells.push_back(_spell);
}
} }
uint16 MyCharacter::GetSpellSlot(uint32 spellid) uint16 MyCharacter::GetSpellSlot(uint32 spellid)

View File

@ -202,7 +202,7 @@ public:
MyCharacter(); MyCharacter();
void SetActionButtons(WorldPacket &data); void SetActionButtons(WorldPacket &data);
void SetSpells(WorldPacket &data); void AddSpell(uint16 spellid, uint16 spellslot);
uint64 GetTarget(void) { return _target; } uint64 GetTarget(void) { return _target; }
void SetTarget(uint64 guid) { _target = guid; } // should only be called by WorldSession::SendSetSelection() !! void SetTarget(uint64 guid) { _target = guid; } // should only be called by WorldSession::SendSetSelection() !!
bool HasSpell(uint32 spellid) { return GetSpellSlot(spellid) != 0; } bool HasSpell(uint32 spellid) { return GetSpellSlot(spellid) != 0; }

View File

@ -185,6 +185,7 @@ OpcodeHandler *WorldSession::_GetOpcodeHandlerTable() const
{SMSG_ITEM_QUERY_SINGLE_RESPONSE, &WorldSession::_HandleItemQuerySingleResponseOpcode}, {SMSG_ITEM_QUERY_SINGLE_RESPONSE, &WorldSession::_HandleItemQuerySingleResponseOpcode},
{SMSG_DESTROY_OBJECT, &WorldSession::_HandleDestroyObjectOpcode}, {SMSG_DESTROY_OBJECT, &WorldSession::_HandleDestroyObjectOpcode},
{SMSG_INITIAL_SPELLS, &WorldSession::_HandleInitialSpellsOpcode}, {SMSG_INITIAL_SPELLS, &WorldSession::_HandleInitialSpellsOpcode},
{SMSG_LEARNED_SPELL, &WorldSession::_HandleLearnedSpellOpcode},
// table termination // table termination
{ 0, NULL } { 0, NULL }
@ -642,7 +643,25 @@ void WorldSession::_HandleCastResultOpcode(WorldPacket& recvPacket)
void WorldSession::_HandleInitialSpellsOpcode(WorldPacket& recvPacket) void WorldSession::_HandleInitialSpellsOpcode(WorldPacket& recvPacket)
{ {
// suggestion for later: what about MyCharacter->AddSpellBookEntry() ? uint8 unk;
GetMyChar()->SetSpells(recvPacket); uint16 spellid,spellslot,count;
recvPacket >> unk >> count;
logdebug("Got initial spells list, %u spells.",count);
for(uint16 i = 0; i < count; i++)
{
recvPacket >> spellid >> spellslot;
logdebug("Initial Spell: id=%u slot=%u",spellid,spellslot);
GetMyChar()->AddSpell(spellid, spellslot);
}
}
void WorldSession::_HandleLearnedSpellOpcode(WorldPacket& recvPacket)
{
uint16 spellid;
recvPacket >> spellid;
GetMyChar()->AddSpell(spellid, 0);
logdebug("Learned spell: id=%u",spellid);
} }

View File

@ -92,6 +92,7 @@ private:
void _HandleItemQuerySingleResponseOpcode(WorldPacket& recvPacket); void _HandleItemQuerySingleResponseOpcode(WorldPacket& recvPacket);
void _HandleDestroyObjectOpcode(WorldPacket& recvPacket); void _HandleDestroyObjectOpcode(WorldPacket& recvPacket);
void _HandleInitialSpellsOpcode(WorldPacket& recvPacket); void _HandleInitialSpellsOpcode(WorldPacket& recvPacket);
void _HandleLearnedSpellOpcode(WorldPacket& recvPacket);
void _MovementUpdate(uint8 objtypeid, uint64 guid, WorldPacket& recvPacket); // Helper for _HandleUpdateObjectOpcode void _MovementUpdate(uint8 objtypeid, uint64 guid, WorldPacket& recvPacket); // Helper for _HandleUpdateObjectOpcode
void _ValuesUpdate(uint64 uguid, WorldPacket& recvPacket); // ... void _ValuesUpdate(uint64 uguid, WorldPacket& recvPacket); // ...