Skip to content

Commit

Permalink
[10563] Implement CMSG_PET_STOP_ATTACK.
Browse files Browse the repository at this point in the history
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
  • Loading branch information
zergtmn authored and VladimirMangos committed Sep 30, 2010
1 parent 7ac7d2e commit f34c593
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/game/Opcodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x2E7*/ { "CMSG_WARDEN_DATA", STATUS_LOGGEDIN, &WorldSession::HandleWardenDataOpcode },
/*0x2E8*/ { "SMSG_GROUP_JOINED_BATTLEGROUND", STATUS_NEVER, &WorldSession::Handle_ServerSide },
/*0x2E9*/ { "MSG_BATTLEGROUND_PLAYER_POSITIONS", STATUS_LOGGEDIN, &WorldSession::HandleBattleGroundPlayerPositionsOpcode},
/*0x2EA*/ { "CMSG_PET_STOP_ATTACK", STATUS_UNHANDLED,&WorldSession::Handle_NULL },
/*0x2EA*/ { "CMSG_PET_STOP_ATTACK", STATUS_LOGGEDIN, &WorldSession::HandlePetStopAttack },
/*0x2EB*/ { "SMSG_BINDER_CONFIRM", STATUS_NEVER, &WorldSession::Handle_ServerSide },
/*0x2EC*/ { "SMSG_BATTLEGROUND_PLAYER_JOINED", STATUS_NEVER, &WorldSession::Handle_ServerSide },
/*0x2ED*/ { "SMSG_BATTLEGROUND_PLAYER_LEFT", STATUS_NEVER, &WorldSession::Handle_ServerSide },
Expand Down
26 changes: 26 additions & 0 deletions src/game/PetHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,32 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
}
}

void WorldSession::HandlePetStopAttack(WorldPacket& recv_data)
{
DEBUG_LOG("WORLD: Received CMSG_PET_STOP_ATTACK");

ObjectGuid petGuid;
recv_data >> petGuid;

Unit* pet = GetPlayer()->GetMap()->GetUnit(petGuid); // pet or controlled creature/player
if (!pet)
{
sLog.outError("%s doesn't exist.", petGuid.GetString().c_str());
return;
}

if (GetPlayer()->GetGUID() != pet->GetCharmerOrOwnerGUID())
{
sLog.outError("HandlePetStopAttack: %s isn't charm/pet of %s.", petGuid.GetString().c_str(), GetPlayer()->GetObjectGuid().GetString().c_str());
return;
}

if (!pet->isAlive())
return;

pet->AttackStop();
}

void WorldSession::HandlePetNameQueryOpcode( WorldPacket & recv_data )
{
DETAIL_LOG( "HandlePetNameQuery. CMSG_PET_NAME_QUERY" );
Expand Down
1 change: 1 addition & 0 deletions src/game/WorldSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ class MANGOS_DLL_SPEC WorldSession

//Pet
void HandlePetAction( WorldPacket & recv_data );
void HandlePetStopAttack(WorldPacket& recv_data);
void HandlePetNameQueryOpcode( WorldPacket & recv_data );
void HandlePetSetAction( WorldPacket & recv_data );
void HandlePetAbandon( WorldPacket & recv_data );
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10562"
#define REVISION_NR "10563"
#endif // __REVISION_NR_H__

0 comments on commit f34c593

Please sign in to comment.