mirror of
https://github.com/mangosfour/server.git
synced 2025-12-18 01:37:01 +00:00
[10635] Convert many opcode handlers to ObjectGuid use.
Also re-enabled anticheating check for bank window open base at .bank command access rights.
This commit is contained in:
parent
0901a4c2ac
commit
851e15c70a
26 changed files with 322 additions and 326 deletions
|
|
@ -525,11 +525,12 @@ void WorldSession::HandlePetRename( WorldPacket & recv_data )
|
|||
|
||||
void WorldSession::HandlePetAbandon( WorldPacket & recv_data )
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid; //pet guid
|
||||
DETAIL_LOG( "HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid) );
|
||||
|
||||
if(!_player->IsInWorld())
|
||||
DETAIL_LOG("HandlePetAbandon. CMSG_PET_ABANDON pet guid is %s", guid.GetString().c_str());
|
||||
|
||||
if (!_player->IsInWorld())
|
||||
return;
|
||||
|
||||
// pet/charmed
|
||||
|
|
@ -555,24 +556,24 @@ void WorldSession::HandlePetAbandon( WorldPacket & recv_data )
|
|||
void WorldSession::HandlePetUnlearnOpcode(WorldPacket& recvPacket)
|
||||
{
|
||||
DETAIL_LOG("CMSG_PET_UNLEARN");
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvPacket >> guid; // Pet guid
|
||||
|
||||
Pet* pet = _player->GetPet();
|
||||
|
||||
if(!pet || pet->getPetType() != HUNTER_PET || pet->m_usedTalentCount == 0)
|
||||
return;
|
||||
|
||||
if(guid != pet->GetGUID())
|
||||
if (!pet || guid != pet->GetObjectGuid())
|
||||
{
|
||||
sLog.outError( "HandlePetUnlearnOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)),GetPlayer()->GetName() );
|
||||
sLog.outError("HandlePetUnlearnOpcode. %s isn't pet of %s .", guid.GetString().c_str(), GetPlayer()->GetObjectGuid().GetString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (pet->getPetType() != HUNTER_PET || pet->m_usedTalentCount == 0)
|
||||
return;
|
||||
|
||||
CharmInfo *charmInfo = pet->GetCharmInfo();
|
||||
if(!charmInfo)
|
||||
if (!charmInfo)
|
||||
{
|
||||
sLog.outError("WorldSession::HandlePetUnlearnOpcode: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
|
||||
sLog.outError("WorldSession::HandlePetUnlearnOpcode: %s is considered pet-like but doesn't have a charminfo!", pet->GetObjectGuid().GetString().c_str());
|
||||
return;
|
||||
}
|
||||
pet->resetTalents();
|
||||
|
|
@ -582,34 +583,30 @@ void WorldSession::HandlePetUnlearnOpcode(WorldPacket& recvPacket)
|
|||
void WorldSession::HandlePetSpellAutocastOpcode( WorldPacket& recvPacket )
|
||||
{
|
||||
DETAIL_LOG("CMSG_PET_SPELL_AUTOCAST");
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint32 spellid;
|
||||
uint8 state; //1 for on, 0 for off
|
||||
recvPacket >> guid >> spellid >> state;
|
||||
|
||||
if(!_player->GetPet() && !_player->GetCharm())
|
||||
return;
|
||||
|
||||
Creature* pet = _player->GetMap()->GetAnyTypeCreature(guid);
|
||||
|
||||
if(!pet || (pet != _player->GetPet() && pet != _player->GetCharm()))
|
||||
if (!pet || (guid.GetRawValue() != _player->GetPetGUID() && guid.GetRawValue() != _player->GetCharmGUID()))
|
||||
{
|
||||
sLog.outError( "HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)),GetPlayer()->GetName() );
|
||||
sLog.outError("HandlePetSpellAutocastOpcode. %s isn't pet of %s .", guid.GetString().c_str(), GetPlayer()->GetObjectGuid().GetString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
// do not add not learned spells/ passive spells
|
||||
if(!pet->HasSpell(spellid) || IsPassiveSpell(spellid))
|
||||
if (!pet->HasSpell(spellid) || IsPassiveSpell(spellid))
|
||||
return;
|
||||
|
||||
CharmInfo *charmInfo = pet->GetCharmInfo();
|
||||
if(!charmInfo)
|
||||
if (!charmInfo)
|
||||
{
|
||||
sLog.outError("WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
|
||||
sLog.outError("WorldSession::HandlePetSpellAutocastOpcod: %s is considered pet-like but doesn't have a charminfo!", guid.GetString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if(pet->isCharmed())
|
||||
if (pet->isCharmed())
|
||||
//state can be used as boolean
|
||||
pet->GetCharmInfo()->ToggleCreatureAutocast(spellid, state);
|
||||
else
|
||||
|
|
@ -622,23 +619,20 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
|
|||
{
|
||||
DETAIL_LOG("WORLD: CMSG_PET_CAST_SPELL");
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint32 spellid;
|
||||
uint8 cast_count;
|
||||
uint8 unk_flags; // flags (if 0x02 - some additional data are received)
|
||||
|
||||
recvPacket >> guid >> cast_count >> spellid >> unk_flags;
|
||||
|
||||
DEBUG_LOG("WORLD: CMSG_PET_CAST_SPELL, cast_count: %u, spellid %u, unk_flags %u", cast_count, spellid, unk_flags);
|
||||
|
||||
if (!_player->GetPet() && !_player->GetCharm())
|
||||
return;
|
||||
DEBUG_LOG("WORLD: CMSG_PET_CAST_SPELL, %s, cast_count: %u, spellid %u, unk_flags %u", guid.GetString().c_str(), cast_count, spellid, unk_flags);
|
||||
|
||||
Creature* pet = _player->GetMap()->GetAnyTypeCreature(guid);
|
||||
|
||||
if (!pet || (pet != _player->GetPet() && pet!= _player->GetCharm()))
|
||||
if (!pet || (guid.GetRawValue() != _player->GetPetGUID() && guid.GetRawValue() != _player->GetCharmGUID()))
|
||||
{
|
||||
sLog.outError( "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)),GetPlayer()->GetName() );
|
||||
sLog.outError("HandlePetCastSpellOpcode: %s isn't pet of %s .", guid.GetString().c_str(), GetPlayer()->GetObjectGuid().GetString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -714,7 +708,7 @@ void WorldSession::HandlePetLearnTalent( WorldPacket & recv_data )
|
|||
{
|
||||
DEBUG_LOG("WORLD: CMSG_PET_LEARN_TALENT");
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint32 talent_id, requested_rank;
|
||||
recv_data >> guid >> talent_id >> requested_rank;
|
||||
|
||||
|
|
@ -726,7 +720,7 @@ void WorldSession::HandleLearnPreviewTalentsPet( WorldPacket & recv_data )
|
|||
{
|
||||
DEBUG_LOG("CMSG_LEARN_PREVIEW_TALENTS_PET");
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid;
|
||||
|
||||
uint32 talentsCount;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue