mirror of
https://github.com/mangosfour/server.git
synced 2026-01-01 16:37:12 +00:00
Various Cleanups (game C-E)
This commit is contained in:
parent
f80629e307
commit
c5c09cee3c
40 changed files with 1826 additions and 1818 deletions
|
|
@ -24,40 +24,40 @@
|
|||
#include "ObjectGuid.h"
|
||||
#include "Player.h"
|
||||
|
||||
void WorldSession::HandleAttackSwingOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleAttackSwingOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid;
|
||||
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "WORLD: Recvd CMSG_ATTACKSWING Message %s", guid.GetString().c_str());
|
||||
|
||||
if(!guid.IsUnit())
|
||||
if (!guid.IsUnit())
|
||||
{
|
||||
sLog.outError("WORLD: %s isn't unit", guid.GetString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
Unit *pEnemy = _player->GetMap()->GetUnit(guid);
|
||||
Unit* pEnemy = _player->GetMap()->GetUnit(guid);
|
||||
|
||||
if(!pEnemy)
|
||||
if (!pEnemy)
|
||||
{
|
||||
sLog.outError( "WORLD: Enemy %s not found", guid.GetString().c_str());
|
||||
sLog.outError("WORLD: Enemy %s not found", guid.GetString().c_str());
|
||||
|
||||
// stop attack state at client
|
||||
SendAttackStop(NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if(_player->IsFriendlyTo(pEnemy) || pEnemy->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
|
||||
if (_player->IsFriendlyTo(pEnemy) || pEnemy->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
|
||||
{
|
||||
sLog.outError( "WORLD: Enemy %s is friendly",guid.GetString().c_str());
|
||||
sLog.outError("WORLD: Enemy %s is friendly",guid.GetString().c_str());
|
||||
|
||||
// stop attack state at client
|
||||
SendAttackStop(pEnemy);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!pEnemy->isAlive())
|
||||
if (!pEnemy->isAlive())
|
||||
{
|
||||
// client can generate swing to known dead target if autoswitch between autoshot and autohit is enabled in client options
|
||||
// stop attack state at client
|
||||
|
|
@ -68,19 +68,19 @@ void WorldSession::HandleAttackSwingOpcode( WorldPacket & recv_data )
|
|||
_player->Attack(pEnemy,true);
|
||||
}
|
||||
|
||||
void WorldSession::HandleAttackStopOpcode( WorldPacket & /*recv_data*/ )
|
||||
void WorldSession::HandleAttackStopOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
GetPlayer()->AttackStop();
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetSheathedOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleSetSheathedOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint32 sheathed;
|
||||
recv_data >> sheathed;
|
||||
|
||||
//DEBUG_LOG( "WORLD: Recvd CMSG_SETSHEATHED Message guidlow:%u value1:%u", GetPlayer()->GetGUIDLow(), sheathed );
|
||||
|
||||
if(sheathed >= MAX_SHEATH_STATE)
|
||||
if (sheathed >= MAX_SHEATH_STATE)
|
||||
{
|
||||
sLog.outError("Unknown sheath state %u ??",sheathed);
|
||||
return;
|
||||
|
|
@ -91,7 +91,7 @@ void WorldSession::HandleSetSheathedOpcode( WorldPacket & recv_data )
|
|||
|
||||
void WorldSession::SendAttackStop(Unit const* enemy)
|
||||
{
|
||||
WorldPacket data( SMSG_ATTACKSTOP, (4+20) ); // we guess size
|
||||
WorldPacket data(SMSG_ATTACKSTOP, (4+20)); // we guess size
|
||||
data << GetPlayer()->GetPackGUID();
|
||||
data << (enemy ? enemy->GetPackGUID() : PackedGuid()); // must be packed guid
|
||||
data << uint32(0); // unk, can be 1 also
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue