aboutsummaryrefslogtreecommitdiff
path: root/src/game/CombatHandler.cpp
diff options
context:
space:
mode:
authormaximius <none@none>2009-10-17 15:51:44 -0700
committermaximius <none@none>2009-10-17 15:51:44 -0700
commite585187b248f48b3c6e9247b49fa07c6565d65e5 (patch)
tree637c5b7ddacf41040bef4ea4f75a97da64c6a9bc /src/game/CombatHandler.cpp
parent26b5e033ffde3d161382fc9addbfa99738379641 (diff)
*Backed out changeset 3be01fb200a5
--HG-- branch : trunk
Diffstat (limited to 'src/game/CombatHandler.cpp')
-rw-r--r--src/game/CombatHandler.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/game/CombatHandler.cpp b/src/game/CombatHandler.cpp
index 80ca6ba3532..095986303f8 100644
--- a/src/game/CombatHandler.cpp
+++ b/src/game/CombatHandler.cpp
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#include "Common.h"
#include "Log.h"
#include "WorldPacket.h"
@@ -24,47 +25,61 @@
#include "ObjectAccessor.h"
#include "CreatureAI.h"
#include "ObjectDefines.h"
+
void WorldSession::HandleAttackSwingOpcode( WorldPacket & recv_data )
{
uint64 guid;
recv_data >> guid;
+
DEBUG_LOG( "WORLD: Recvd CMSG_ATTACKSWING Message guidlow:%u guidhigh:%u", GUID_LOPART(guid), GUID_HIPART(guid) );
+
Unit *pEnemy = ObjectAccessor::GetUnit(*_player, guid);
+
if(!pEnemy)
{
if(!IS_UNIT_GUID(guid))
sLog.outError("WORLD: Object %u (TypeID: %u) isn't player, pet or creature",GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid)));
else
sLog.outError( "WORLD: Enemy %s %u not found",GetLogNameForGuid(guid),GUID_LOPART(guid));
+
// stop attack state at client
SendAttackStop(NULL);
return;
}
+
if(!_player->canAttack(pEnemy))
{
sLog.outError( "WORLD: Enemy %s %u is friendly",(IS_PLAYER_GUID(guid) ? "player" : "creature"),GUID_LOPART(guid));
+
// stop attack state at client
SendAttackStop(pEnemy);
return;
}
+
_player->Attack(pEnemy,true);
}
+
void WorldSession::HandleAttackStopOpcode( WorldPacket & /*recv_data*/ )
{
GetPlayer()->AttackStop();
}
+
void WorldSession::HandleSetSheathedOpcode( WorldPacket & recv_data )
{
uint32 sheathed;
recv_data >> sheathed;
+
//sLog.outDebug( "WORLD: Recvd CMSG_SETSHEATHED Message guidlow:%u value1:%u", GetPlayer()->GetGUIDLow(), sheathed );
+
if(sheathed >= MAX_SHEATH_STATE)
{
sLog.outError("Unknown sheath state %u ??",sheathed);
return;
}
+
GetPlayer()->SetSheath(SheathState(sheathed));
}
+
void WorldSession::SendAttackStop(Unit const* enemy)
{
WorldPacket data( SMSG_ATTACKSTOP, (4+20) ); // we guess size