mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-25 03:12:09 +01:00
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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1019,10 +1019,9 @@ void WorldSession::ProcessQueryCallbacks()
|
||||
//- SendStabledPet
|
||||
if (m_sendStabledPetCallback.IsReady())
|
||||
{
|
||||
WorldPacket* param1 = m_sendStabledPetCallback.GetFirstParam();
|
||||
uint8 param2 = m_sendStabledPetCallback.GetSecondParam();
|
||||
uint64 param = m_sendStabledPetCallback.GetParam();
|
||||
m_sendStabledPetCallback.GetResult(result);
|
||||
SendStablePetCallback(result, param1, param2);
|
||||
SendStablePetCallback(result, param);
|
||||
m_sendStabledPetCallback.FreeResult();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ class WorldSession
|
||||
// Pet
|
||||
void SendPetNameQuery(uint64 guid, uint32 petnumber);
|
||||
void SendStablePet(uint64 guid);
|
||||
void SendStablePetCallback(QueryResult_AutoPtr result, WorldPacket* data, uint8 num);
|
||||
void SendStablePetCallback(QueryResult_AutoPtr result, uint64 guid);
|
||||
void SendStableResult(uint8 guid);
|
||||
bool CheckStableMaster(uint64 guid);
|
||||
|
||||
@@ -806,7 +806,7 @@ class WorldSession
|
||||
QueryResultFuture m_addIgnoreCallback;
|
||||
QueryCallback<std::string> m_charRenameCallback;
|
||||
QueryCallback<std::string> m_addFriendCallback;
|
||||
QueryCallback_2<WorldPacket*, uint8> m_sendStabledPetCallback;
|
||||
QueryCallback<uint64> m_sendStabledPetCallback;
|
||||
QueryResultHolderFuture m_charLoginCallback;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user