From 72660d2c33773f0f74663efe6f9ac47648cdf283 Mon Sep 17 00:00:00 2001 From: David Athay Date: Mon, 18 May 2009 18:18:23 +0100 Subject: Added target combat --- src/net/ea/playerhandler.cpp | 4 ++-- src/net/ea/playerhandler.h | 2 +- src/net/playerhandler.h | 2 +- src/net/tmwserv/gameserver/player.cpp | 7 ------- src/net/tmwserv/gameserver/player.h | 1 - src/net/tmwserv/playerhandler.cpp | 6 ++++-- src/net/tmwserv/playerhandler.h | 2 +- src/net/tmwserv/protocol.h | 2 +- 8 files changed, 10 insertions(+), 16 deletions(-) (limited to 'src/net') diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index b7131f0a..8cc4b44f 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -422,10 +422,10 @@ void PlayerHandler::handleMessage(MessageIn &msg) } } -void PlayerHandler::attack(Being *being) +void PlayerHandler::attack(int id) { MessageOut outMsg(CMSG_PLAYER_ATTACK); - outMsg.writeInt32(being->getId()); + outMsg.writeInt32(id); outMsg.writeInt8(0); } diff --git a/src/net/ea/playerhandler.h b/src/net/ea/playerhandler.h index 94ae952f..4429d856 100644 --- a/src/net/ea/playerhandler.h +++ b/src/net/ea/playerhandler.h @@ -35,7 +35,7 @@ class PlayerHandler : public MessageHandler, public Net::PlayerHandler void handleMessage(MessageIn &msg); - void attack(Being *being); + void attack(int id); void emote(int emoteId); diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h index 0998da04..c51c59c0 100644 --- a/src/net/playerhandler.h +++ b/src/net/playerhandler.h @@ -31,7 +31,7 @@ namespace Net { class PlayerHandler { public: - virtual void attack(Being *being) = 0; + virtual void attack(int id) = 0; virtual void emote(int emoteId) = 0; diff --git a/src/net/tmwserv/gameserver/player.cpp b/src/net/tmwserv/gameserver/player.cpp index 3f05c954..93853681 100644 --- a/src/net/tmwserv/gameserver/player.cpp +++ b/src/net/tmwserv/gameserver/player.cpp @@ -58,13 +58,6 @@ void Net::GameServer::Player::moveItem(int oldSlot, int newSlot, int amount) Net::GameServer::connection->send(msg); } -void Net::GameServer::Player::attack(int direction) -{ - MessageOut msg(PGMSG_ATTACK); - msg.writeInt8(direction); - Net::GameServer::connection->send(msg); -} - void Net::GameServer::Player::useSpecial(int special) { MessageOut msg(PGMSG_USE_SPECIAL); diff --git a/src/net/tmwserv/gameserver/player.h b/src/net/tmwserv/gameserver/player.h index eddd9102..24b25dc7 100644 --- a/src/net/tmwserv/gameserver/player.h +++ b/src/net/tmwserv/gameserver/player.h @@ -43,7 +43,6 @@ namespace Net void walk(int x, int y); void pickUp(int x, int y); void moveItem(int oldSlot, int newSlot, int amount); - void attack(int direction); void useSpecial(int special); void requestTrade(int id); void acceptTrade(bool accept); diff --git a/src/net/tmwserv/playerhandler.cpp b/src/net/tmwserv/playerhandler.cpp index b697e8a8..543d18d8 100644 --- a/src/net/tmwserv/playerhandler.cpp +++ b/src/net/tmwserv/playerhandler.cpp @@ -332,9 +332,11 @@ void PlayerHandler::handleMapChangeMessage(MessageIn &msg) viewport->scrollBy(scrollOffsetX, scrollOffsetY); } -void PlayerHandler::attack(Being *being) +void PlayerHandler::attack(int id) { - // TODO + MessageOut msg(PGMSG_ATTACK); + msg.writeInt16(id); + Net::GameServer::connection->send(msg); } void PlayerHandler::emote(int emoteId) diff --git a/src/net/tmwserv/playerhandler.h b/src/net/tmwserv/playerhandler.h index 5524415e..238da182 100644 --- a/src/net/tmwserv/playerhandler.h +++ b/src/net/tmwserv/playerhandler.h @@ -34,7 +34,7 @@ class PlayerHandler : public MessageHandler, public Net::PlayerHandler void handleMessage(MessageIn &msg); - void attack(Being *being); + void attack(int id); void emote(int emoteId); diff --git a/src/net/tmwserv/protocol.h b/src/net/tmwserv/protocol.h index 7fa3b372..0f2a1b0d 100644 --- a/src/net/tmwserv/protocol.h +++ b/src/net/tmwserv/protocol.h @@ -106,7 +106,7 @@ enum { GPMSG_BEING_DIR_CHANGE = 0x0273, // W being id, B direction GPMSG_BEINGS_MOVE = 0x0280, // { W being id, B flags [, C position, B speed] [, W*2 destination] }* GPMSG_ITEMS = 0x0281, // { W item id, W*2 position }* - PGMSG_ATTACK = 0x0290, // B direction + PGMSG_ATTACK = 0x0290, // W being id PGMSG_USE_SPECIAL = 0x0292, // B specialID GPMSG_BEING_ATTACK = 0x0291, // W being id PGMSG_SAY = 0x02A0, // S text -- cgit v1.2.3-70-g09d2