Fix crash added in 9c655c11b7
--HG-- branch : trunk
This commit is contained in:
@@ -516,10 +516,20 @@ void WorldSession::HandleListStabledPetsOpcode(WorldPacket & recv_data)
|
||||
}
|
||||
|
||||
void WorldSession::SendStablePet(uint64 guid)
|
||||
{
|
||||
m_sendStabledPetCallback.SetParam(guid);
|
||||
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, uint64 guid)
|
||||
{
|
||||
sLog.outDebug("WORLD: Recv MSG_LIST_STABLED_PETS Send.");
|
||||
|
||||
WorldPacket data(MSG_LIST_STABLED_PETS, 200); // guess size
|
||||
|
||||
data << uint64 (guid);
|
||||
|
||||
Pet *pet = _player->GetPet();
|
||||
@@ -541,36 +551,26 @@ void WorldSession::SendStablePet(uint64 guid)
|
||||
data << uint8(1); // 1 = current, 2/3 = in stable (any from 4,5,... create problems with proper show)
|
||||
++num;
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
data->put<uint8>(4, num); // set real data to placeholder
|
||||
SendPacket(data);
|
||||
data.put<uint8>(sizeof(uint64), num); // set real data to placeholder
|
||||
SendPacket(&data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user