diff options
author | Machiavelli <none@none> | 2010-08-24 19:05:59 +0200 |
---|---|---|
committer | Machiavelli <none@none> | 2010-08-24 19:05:59 +0200 |
commit | 119e05781047ab9d0b7629a3d89c9b67cd78056c (patch) | |
tree | 3f1201eab336403bceeac4faaac4d3b1db68cf2d | |
parent | 4185bb318136afe4ea657dc785e8c340d6adddfe (diff) |
I love you HG
--HG--
branch : trunk
-rw-r--r-- | src/server/game/Server/Protocol/Handlers/NPCHandler.cpp | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp b/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp index f4d49737899..d87d145b3fc 100644 --- a/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp @@ -542,30 +542,37 @@ void WorldSession::SendStablePet(uint64 guid) ++num; } - // 0 1 2 3 4 - QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT owner, id, entry, level, name FROM character_pet WHERE owner = '%u' AND slot >= '%u' AND slot <= '%u' ORDER BY slot", - _player->GetGUIDLow(),PET_SAVE_FIRST_STABLE_SLOT,PET_SAVE_LAST_STABLE_SLOT); + m_sendStabledPetCallback.SetFirstParam(&data); + m_sendStabledPetCallback.SetSecondParam(num); + m_sendStabledPetCallback.SetFutureResult( + CharacterDatabase.AsyncPQuery("SELECT owner, id, entry, level, name FROM character_pet WHERE owner = '%u' AND slot >= '%u' AND slot <= '%u' ORDER BY slot", + _player->GetGUIDLow(),PET_SAVE_FIRST_STABLE_SLOT,PET_SAVE_LAST_STABLE_SLOT) + ); +} +void WorldSession::SendStablePetCallback(QueryResult_AutoPtr result, WorldPacket* data, uint8 num) +{ if (result) { do { Field *fields = result->Fetch(); - data << uint32(fields[1].GetUInt32()); // petnumber - data << uint32(fields[2].GetUInt32()); // creature entry - data << uint32(fields[3].GetUInt32()); // level - data << fields[4].GetString(); // name - data << uint8(2); // 1 = current, 2/3 = in stable (any from 4,5,... create problems with proper show) + *data << uint32(fields[1].GetUInt32()); // petnumber + *data << uint32(fields[2].GetUInt32()); // creature entry + *data << uint32(fields[3].GetUInt32()); // level + *data << fields[4].GetString(); // name + *data << uint8(2); // 1 = current, 2/3 = in stable (any from 4,5,... create problems with proper show) ++num; - }while (result->NextRow()); + } + while (result->NextRow()); } - data.put<uint8>(wpos, num); // set real data to placeholder - SendPacket(&data); -} + data->put<uint8>(4, num); // set real data to placeholder + SendPacket(data); +} void WorldSession::SendStableResult(uint8 res) { |