mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 02:20:27 +00:00
feat(Core/Misc): implement ObjectGuid class (port from TC) (#4885)
This commit is contained in:
@@ -18,7 +18,7 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: Recvd CMSG_DISMISS_CONTROLLED_VEHICLE");
|
||||
#endif
|
||||
|
||||
uint64 vehicleGUID = _player->GetCharmGUID();
|
||||
ObjectGuid vehicleGUID = _player->GetCharmGUID();
|
||||
|
||||
if (!vehicleGUID) // something wrong here...
|
||||
{
|
||||
@@ -26,9 +26,8 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
uint64 guid;
|
||||
|
||||
recvData.readPackGUID(guid);
|
||||
ObjectGuid guid;
|
||||
recvData >> guid.ReadAsPacked();
|
||||
|
||||
// pussywizard: typical check for incomming movement packets
|
||||
if (!_player->m_mover || !_player->m_mover->IsInWorld() || _player->m_mover->IsDuringRemoveFromWorld() || guid != _player->m_mover->GetGUID())
|
||||
@@ -64,8 +63,8 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvData)
|
||||
if (!seat->CanSwitchFromSeat())
|
||||
{
|
||||
recvData.rfinish(); // prevent warnings spam
|
||||
LOG_ERROR("server", "HandleChangeSeatsOnControlledVehicle, Opcode: %u, Player %u tried to switch seats but current seatflags %u don't permit that.",
|
||||
recvData.GetOpcode(), GetPlayer()->GetGUIDLow(), seat->m_flags);
|
||||
LOG_ERROR("server", "HandleChangeSeatsOnControlledVehicle, Opcode: %u, Player %s tried to switch seats but current seatflags %u don't permit that.",
|
||||
recvData.GetOpcode(), GetPlayer()->GetGUID().ToString().c_str(), seat->m_flags);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -79,8 +78,8 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvData)
|
||||
break;
|
||||
case CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE:
|
||||
{
|
||||
uint64 guid; // current vehicle guid
|
||||
recvData.readPackGUID(guid);
|
||||
ObjectGuid guid; // current vehicle guid
|
||||
recvData >> guid.ReadAsPacked();
|
||||
|
||||
// pussywizard:
|
||||
if (vehicle_base->GetGUID() != guid)
|
||||
@@ -94,8 +93,8 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvData)
|
||||
ReadMovementInfo(recvData, &movementInfo);
|
||||
vehicle_base->m_movementInfo = movementInfo;
|
||||
|
||||
uint64 accessory; // accessory guid
|
||||
recvData.readPackGUID(accessory);
|
||||
ObjectGuid accessory; // accessory guid
|
||||
recvData >> accessory.ReadAsPacked();
|
||||
|
||||
int8 seatId;
|
||||
recvData >> seatId;
|
||||
@@ -112,8 +111,8 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvData)
|
||||
}
|
||||
case CMSG_REQUEST_VEHICLE_SWITCH_SEAT:
|
||||
{
|
||||
uint64 guid; // current vehicle guid
|
||||
recvData.readPackGUID(guid);
|
||||
ObjectGuid guid; // current vehicle guid
|
||||
recvData >> guid.ReadAsPacked();
|
||||
|
||||
int8 seatId;
|
||||
recvData >> seatId;
|
||||
@@ -134,7 +133,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvData)
|
||||
void WorldSession::HandleEnterPlayerVehicle(WorldPacket& data)
|
||||
{
|
||||
// Read guid
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
data >> guid;
|
||||
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*_player, guid))
|
||||
@@ -159,25 +158,25 @@ void WorldSession::HandleEjectPassenger(WorldPacket& data)
|
||||
if (!vehicle)
|
||||
{
|
||||
data.rfinish(); // prevent warnings spam
|
||||
LOG_ERROR("server", "HandleEjectPassenger: Player %u is not in a vehicle!", GetPlayer()->GetGUIDLow());
|
||||
LOG_ERROR("server", "HandleEjectPassenger: Player %s is not in a vehicle!", GetPlayer()->GetGUID().ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
data >> guid;
|
||||
|
||||
if (IS_PLAYER_GUID(guid))
|
||||
if (guid.IsPlayer())
|
||||
{
|
||||
Player* player = ObjectAccessor::GetPlayer(*_player, guid);
|
||||
if (!player)
|
||||
{
|
||||
LOG_ERROR("server", "Player %u tried to eject player %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
|
||||
LOG_ERROR("server", "Player %s tried to eject player %s from vehicle, but the latter was not found in world!", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player->IsOnVehicle(vehicle->GetBase()))
|
||||
{
|
||||
LOG_ERROR("server", "Player %u tried to eject player %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
|
||||
LOG_ERROR("server", "Player %s tried to eject player %s, but they are not in the same vehicle", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -186,21 +185,20 @@ void WorldSession::HandleEjectPassenger(WorldPacket& data)
|
||||
if (seat->IsEjectable())
|
||||
player->ExitVehicle();
|
||||
else
|
||||
LOG_ERROR("server", "Player %u attempted to eject player %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
|
||||
LOG_ERROR("server", "Player %s attempted to eject player %s from non-ejectable seat.", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str());
|
||||
}
|
||||
|
||||
else if (IS_CREATURE_GUID(guid))
|
||||
else if (guid.IsCreature())
|
||||
{
|
||||
Unit* unit = ObjectAccessor::GetUnit(*_player, guid);
|
||||
if (!unit) // creatures can be ejected too from player mounts
|
||||
{
|
||||
LOG_ERROR("server", "Player %u tried to eject creature guid %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
|
||||
LOG_ERROR("server", "Player %s tried to eject creature guid %s from vehicle, but the latter was not found in world!", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!unit->IsOnVehicle(vehicle->GetBase()))
|
||||
{
|
||||
LOG_ERROR("server", "Player %u tried to eject unit %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
|
||||
LOG_ERROR("server", "Player %s tried to eject unit %s, but they are not in the same vehicle", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -212,10 +210,10 @@ void WorldSession::HandleEjectPassenger(WorldPacket& data)
|
||||
unit->ExitVehicle();
|
||||
}
|
||||
else
|
||||
LOG_ERROR("server", "Player %u attempted to eject creature GUID %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
|
||||
LOG_ERROR("server", "Player %s attempted to eject creature %s from non-ejectable seat.", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str());
|
||||
}
|
||||
else
|
||||
LOG_ERROR("server", "HandleEjectPassenger: Player %u tried to eject invalid GUID " UI64FMTD, GetPlayer()->GetGUIDLow(), guid);
|
||||
LOG_ERROR("server", "HandleEjectPassenger: Player %s tried to eject invalid %s", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str());
|
||||
}
|
||||
|
||||
void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recvData*/)
|
||||
@@ -231,8 +229,8 @@ void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recvData*/)
|
||||
if (seat->CanEnterOrExit())
|
||||
GetPlayer()->ExitVehicle();
|
||||
else
|
||||
LOG_ERROR("server", "Player %u tried to exit vehicle, but seatflags %u (ID: %u) don't permit that.",
|
||||
GetPlayer()->GetGUIDLow(), seat->m_ID, seat->m_flags);
|
||||
LOG_ERROR("server", "Player %s tried to exit vehicle, but seatflags %u (ID: %u) don't permit that.",
|
||||
GetPlayer()->GetGUID().ToString().c_str(), seat->m_ID, seat->m_flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user