diff options
author | Shauren <shauren.trinity@gmail.com> | 2014-09-14 16:14:12 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2014-09-14 16:14:12 +0200 |
commit | a0e50ea35fca61447bf07fc45d93c98234ba59f7 (patch) | |
tree | b4ee69a63866f42e466a3c03fc031ce0710ac762 /src/server/game/Handlers/PetHandler.cpp | |
parent | ce67a097bf3c0c3241f4441a808e32639ddbaafb (diff) |
Core/Entities: Use ObjectGuid class in game project
Diffstat (limited to 'src/server/game/Handlers/PetHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/PetHandler.cpp | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index 9346e982bd2..cb58d8968e8 100644 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -35,17 +35,17 @@ void WorldSession::HandleDismissCritter(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; recvData >> guid; - TC_LOG_DEBUG("network", "WORLD: Received CMSG_DISMISS_CRITTER for GUID " UI64FMTD, guid); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_DISMISS_CRITTER for %s", guid.ToString().c_str()); Unit* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid); if (!pet) { - TC_LOG_DEBUG("network", "Vanitypet (guid: %u) does not exist - player '%s' (guid: %u / account: %u) attempted to dismiss it (possibly lagged out)", - uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), GetAccountId()); + TC_LOG_DEBUG("network", "Vanitypet (%s) does not exist - player '%s' (guid: %u / account: %u) attempted to dismiss it (possibly lagged out)", + guid.ToString().c_str(), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), GetAccountId()); return; } @@ -58,9 +58,9 @@ void WorldSession::HandleDismissCritter(WorldPacket& recvData) void WorldSession::HandlePetAction(WorldPacket& recvData) { - uint64 guid1; + ObjectGuid guid1; uint32 data; - uint64 guid2; + ObjectGuid guid2; recvData >> guid1; //pet guid recvData >> data; recvData >> guid2; //tag guid @@ -69,18 +69,18 @@ void WorldSession::HandlePetAction(WorldPacket& recvData) uint8 flag = UNIT_ACTION_BUTTON_TYPE(data); //delete = 0x07 CastSpell = C1 // used also for charmed creature - Unit* pet= ObjectAccessor::GetUnit(*_player, guid1); - TC_LOG_INFO("network", "HandlePetAction: Pet %u - flag: %u, spellid: %u, target: %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2))); + Unit* pet = ObjectAccessor::GetUnit(*_player, guid1); + TC_LOG_INFO("network", "HandlePetAction: %s - flag: %u, spellid: %u, target: %s.", guid1.ToString().c_str(), uint32(flag), spellid, guid2.ToString().c_str()); if (!pet) { - TC_LOG_DEBUG("network", "HandlePetAction: Pet (GUID: %u) doesn't exist for player %s (GUID: %u)", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID())); + TC_LOG_DEBUG("network", "HandlePetAction: %s doesn't exist for %s %s", guid1.ToString().c_str(), GetPlayer()->GetGUID().ToString().c_str(), GetPlayer()->GetName().c_str()); return; } if (pet != GetPlayer()->GetFirstControlled()) { - TC_LOG_DEBUG("network", "HandlePetAction: Pet (GUID: %u) does not belong to player %s (GUID: %u)", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID())); + TC_LOG_DEBUG("network", "HandlePetAction: %s does not belong to %s %s", guid1.ToString().c_str(), GetPlayer()->GetGUID().ToString().c_str(), GetPlayer()->GetName().c_str()); return; } @@ -113,23 +113,23 @@ void WorldSession::HandlePetAction(WorldPacket& recvData) void WorldSession::HandlePetStopAttack(WorldPacket &recvData) { - uint64 guid; + ObjectGuid guid; recvData >> guid; - TC_LOG_DEBUG("network", "WORLD: Received CMSG_PET_STOP_ATTACK for GUID " UI64FMTD "", guid); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_PET_STOP_ATTACK for %s", guid.ToString().c_str()); Unit* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid); if (!pet) { - TC_LOG_ERROR("network", "HandlePetStopAttack: Pet %u does not exist", uint32(GUID_LOPART(guid))); + TC_LOG_ERROR("network", "HandlePetStopAttack: %s does not exist", guid.ToString().c_str()); return; } if (pet != GetPlayer()->GetPet() && pet != GetPlayer()->GetCharm()) { - TC_LOG_ERROR("network", "HandlePetStopAttack: Pet GUID %u isn't a pet or charmed creature of player %s", - uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); + TC_LOG_ERROR("network", "HandlePetStopAttack: %s isn't a pet or charmed creature of player %s", + guid.ToString().c_str(), GetPlayer()->GetName().c_str()); return; } @@ -139,13 +139,13 @@ void WorldSession::HandlePetStopAttack(WorldPacket &recvData) pet->AttackStop(); } -void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint32 spellid, uint16 flag, uint64 guid2) +void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spellid, uint16 flag, ObjectGuid guid2) { CharmInfo* charmInfo = pet->GetCharmInfo(); if (!charmInfo) { - TC_LOG_DEBUG("network", "WorldSession::HandlePetAction(petGuid: " UI64FMTD ", tagGuid: " UI64FMTD ", spellId: %u, flag: %u): object (GUID: %u Entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", - guid1, guid2, spellid, flag, pet->GetGUIDLow(), pet->GetEntry(), pet->GetTypeId()); + TC_LOG_DEBUG("network", "WorldSession::HandlePetAction(petGuid: %s, tagGuid: %s, spellId: %u, flag: %u): object (GUID: %u Entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", + guid1.ToString().c_str(), guid2.ToString().c_str(), spellid, flag, pet->GetGUIDLow(), pet->GetEntry(), pet->GetTypeId()); return; } @@ -401,7 +401,7 @@ void WorldSession::HandlePetNameQuery(WorldPacket& recvData) TC_LOG_INFO("network", "HandlePetNameQuery. CMSG_PET_NAME_QUERY"); uint32 petnumber; - uint64 petguid; + ObjectGuid petguid; recvData >> petnumber; recvData >> petguid; @@ -409,7 +409,7 @@ void WorldSession::HandlePetNameQuery(WorldPacket& recvData) SendPetNameQuery(petguid, petnumber); } -void WorldSession::SendPetNameQuery(uint64 petguid, uint32 petnumber) +void WorldSession::SendPetNameQuery(ObjectGuid petguid, uint32 petnumber) { Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, petguid); if (!pet) @@ -440,14 +440,14 @@ void WorldSession::SendPetNameQuery(uint64 petguid, uint32 petnumber) _player->GetSession()->SendPacket(&data); } -bool WorldSession::CheckStableMaster(uint64 guid) +bool WorldSession::CheckStableMaster(ObjectGuid guid) { // spell case or GM if (guid == GetPlayer()->GetGUID()) { if (!GetPlayer()->IsGameMaster() && !GetPlayer()->HasAuraType(SPELL_AURA_OPEN_STABLE)) { - TC_LOG_DEBUG("network", "Player (GUID:%u) attempt open stable in cheating way.", GUID_LOPART(guid)); + TC_LOG_DEBUG("network", "%s attempt open stable in cheating way.", guid.ToString().c_str()); return false; } } @@ -456,7 +456,7 @@ bool WorldSession::CheckStableMaster(uint64 guid) { if (!GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_STABLEMASTER)) { - TC_LOG_DEBUG("network", "Stablemaster (GUID:%u) not found or you can't interact with him.", GUID_LOPART(guid)); + TC_LOG_DEBUG("network", "Stablemaster %s not found or you can't interact with him.", guid.ToString().c_str()); return false; } } @@ -467,7 +467,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData) { TC_LOG_INFO("network", "HandlePetSetAction. CMSG_PET_SET_ACTION"); - uint64 petguid; + ObjectGuid petguid; uint8 count; recvData >> petguid; @@ -476,7 +476,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData) if (!pet || pet != _player->GetFirstControlled()) { - TC_LOG_ERROR("network", "HandlePetSetAction: Unknown pet (GUID: %u) or pet owner (GUID: %u)", GUID_LOPART(petguid), _player->GetGUIDLow()); + TC_LOG_ERROR("network", "HandlePetSetAction: Unknown %s or owner (%s)", petguid.ToString().c_str(), _player->GetGUID().ToString().c_str()); return; } @@ -584,7 +584,7 @@ void WorldSession::HandlePetRename(WorldPacket& recvData) { TC_LOG_INFO("network", "HandlePetRename. CMSG_PET_RENAME"); - uint64 petguid; + ObjectGuid petguid; uint8 isdeclined; std::string name; @@ -650,7 +650,7 @@ void WorldSession::HandlePetRename(WorldPacket& recvData) stmt->setUInt32(0, _player->GetGUIDLow()); for (uint8 i = 0; i < 5; i++) - stmt->setString(i+1, declinedname.name[i]); + stmt->setString(i + 1, declinedname.name[i]); trans->Append(stmt); } @@ -668,9 +668,9 @@ void WorldSession::HandlePetRename(WorldPacket& recvData) void WorldSession::HandlePetAbandon(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; recvData >> guid; //pet guid - TC_LOG_INFO("network", "HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid)); + TC_LOG_INFO("network", "HandlePetAbandon. CMSG_PET_ABANDON %s", guid.ToString().c_str()); if (!_player->IsInWorld()) return; @@ -697,7 +697,7 @@ void WorldSession::HandlePetAbandon(WorldPacket& recvData) void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) { TC_LOG_INFO("network", "CMSG_PET_SPELL_AUTOCAST"); - uint64 guid; + ObjectGuid guid; uint32 spellid; uint8 state; //1 for on, 0 for off recvPacket >> guid >> spellid >> state; @@ -712,7 +712,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) if (!pet || (pet != _player->GetGuardianPet() && pet != _player->GetCharm())) { - TC_LOG_ERROR("network", "HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s (GUID: %u).", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID())); + TC_LOG_ERROR("network", "HandlePetSpellAutocastOpcode. %s isn't pet of player %s (%s).", guid.ToString().c_str(), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUID().ToString().c_str()); return; } @@ -746,14 +746,14 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) { TC_LOG_DEBUG("network", "WORLD: CMSG_PET_CAST_SPELL"); - uint64 guid; + ObjectGuid guid; uint8 castCount; uint32 spellId; uint8 castFlags; recvPacket >> guid >> castCount >> spellId >> castFlags; - TC_LOG_DEBUG("network", "WORLD: CMSG_PET_CAST_SPELL, guid: " UI64FMTD ", castCount: %u, spellId %u, castFlags %u", guid, castCount, spellId, castFlags); + TC_LOG_DEBUG("network", "WORLD: CMSG_PET_CAST_SPELL, %s, castCount: %u, spellId %u, castFlags %u", guid.ToString().c_str(), castCount, spellId, castFlags); // This opcode is also sent from charmed and possessed units (players and creatures) if (!_player->GetGuardianPet() && !_player->GetCharm()) @@ -763,7 +763,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) if (!caster || (caster != _player->GetGuardianPet() && caster != _player->GetCharm())) { - TC_LOG_ERROR("network", "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s (GUID: %u).", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID())); + TC_LOG_ERROR("network", "HandlePetCastSpellOpcode: %s isn't pet of player %s (%s).", guid.ToString().c_str(), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUID().ToString().c_str()); return; } @@ -848,7 +848,7 @@ void WorldSession::HandlePetLearnTalent(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: CMSG_PET_LEARN_TALENT"); - uint64 guid; + ObjectGuid guid; uint32 talentId, requestedRank; recvData >> guid >> talentId >> requestedRank; @@ -860,7 +860,7 @@ void WorldSession::HandleLearnPreviewTalentsPet(WorldPacket& recvData) { TC_LOG_DEBUG("network", "CMSG_LEARN_PREVIEW_TALENTS_PET"); - uint64 guid; + ObjectGuid guid; recvData >> guid; uint32 talentsCount; |