diff options
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/ea/beinghandler.cpp | 19 | ||||
-rw-r--r-- | src/net/ea/playerhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/ea/playerhandler.h | 2 | ||||
-rw-r--r-- | src/net/ea/protocol.h | 1 | ||||
-rw-r--r-- | src/net/playerhandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwserv/beinghandler.cpp | 9 | ||||
-rw-r--r-- | src/net/tmwserv/gameserver/player.cpp | 7 | ||||
-rw-r--r-- | src/net/tmwserv/gameserver/player.h | 1 | ||||
-rw-r--r-- | src/net/tmwserv/playerhandler.cpp | 9 | ||||
-rw-r--r-- | src/net/tmwserv/playerhandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwserv/protocol.h | 8 |
11 files changed, 36 insertions, 28 deletions
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index 34a0d70a..f149f15f 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -65,6 +65,7 @@ BeingHandler::BeingHandler(bool enableSync): SMSG_PLAYER_MOVE_TO_ATTACK, SMSG_PLAYER_STATUS_CHANGE, SMSG_BEING_STATUS_CHANGE, + SMSG_BEING_RESURRECT, 0 }; handledMessages = _messages; @@ -260,6 +261,24 @@ void BeingHandler::handleMessage(MessageIn &msg) break; + case SMSG_BEING_RESURRECT: + // A being changed mortality status + id = msg.readInt32(); + + dstBeing = beingManager->findBeing(id); + + if (!dstBeing) + break; + + // If this is player's current target, clear it. + if (dstBeing == player_node->getTarget()) + player_node->stopAttack(); + + if (msg.readInt8() == 1) + dstBeing->setAction(Being::STAND); + + break; + case SMSG_BEING_ACTION: srcBeing = beingManager->findBeing(msg.readInt32()); dstBeing = beingManager->findBeing(msg.readInt32()); diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 2d953df1..c1b7cc84 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 808cd0ec..5dbc171b 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/ea/protocol.h b/src/net/ea/protocol.h index f8caf4c1..b3759946 100644 --- a/src/net/ea/protocol.h +++ b/src/net/ea/protocol.h @@ -87,6 +87,7 @@ static const int STORAGE_OFFSET = 1; #define SMSG_BEING_CHAT 0x008d /**< A being talks */ #define SMSG_BEING_NAME_RESPONSE 0x0095 /**< Has to be requested */ #define SMSG_BEING_CHANGE_DIRECTION 0x009c +#define SMSG_BEING_RESURRECT 0x0148 #define SMSG_PLAYER_STATUS_CHANGE 0x0119 #define SMSG_BEING_STATUS_CHANGE 0x0196 diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h index df49756d..163b48f3 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/beinghandler.cpp b/src/net/tmwserv/beinghandler.cpp index 1ec13800..99491203 100644 --- a/src/net/tmwserv/beinghandler.cpp +++ b/src/net/tmwserv/beinghandler.cpp @@ -191,11 +191,6 @@ void BeingHandler::handleBeingsMoveMessage(MessageIn &msg) int dy = 0; int speed = 0; - printf("handleBeingsMoveMessage for %p (%s | %s)\n", - (void*) being, - (flags & MOVING_POSITION) ? "pos" : "", - (flags & MOVING_DESTINATION) ? "dest" : ""); - if (flags & MOVING_POSITION) { Uint16 sx2, sy2; @@ -235,7 +230,7 @@ void BeingHandler::handleBeingsMoveMessage(MessageIn &msg) // If being is a player, and he only moves a little, its ok to be a little out of sync if (being->getType() == Being::PLAYER && abs(being->getPixelX() - dx) + - abs(being->getPixelY() - dy) < 2 * 32 && + abs(being->getPixelY() - dy) < 16 && (dx != being->getDestination().x && dy != being->getDestination().y)) { being->setDestination(being->getPixelX(),being->getPixelY()); @@ -258,7 +253,7 @@ void BeingHandler::handleBeingsMoveMessage(MessageIn &msg) } else { - being->adjustCourse(sx, sy, dx, dy); + being->setDestination(sx, sy, dx, dy); } } } 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 931e4294..b378817f 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) @@ -371,9 +373,6 @@ void PlayerHandler::setDestination(int x, int y, int /* direction */) msg.writeInt16(x); msg.writeInt16(y); Net::GameServer::connection->send(msg); - - // Debugging fire burst - effectManager->trigger(15, x, y); } void PlayerHandler::changeAction(Being::Action action) diff --git a/src/net/tmwserv/playerhandler.h b/src/net/tmwserv/playerhandler.h index 13ae8f39..164d30ae 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..6124263a 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 @@ -162,9 +162,11 @@ enum { CPMSG_GUILD_QUIT_RESPONSE = 0x0361, // B error PCMSG_GUILD_PROMOTE_MEMBER = 0x0365, // W guild, S name, B rights CPMSG_GUILD_PROMOTE_MEMBER_RESPONSE = 0x0366, // B error + PCMSG_GUILD_KICK_MEMBER = 0x0370, // W guild, S name + CPMSG_GUILD_KICK_MEMBER_RESPONSE = 0x0371, // B error - CPMSG_GUILD_INVITED = 0x0370, // S char name, S guild name, W id - CPMSG_GUILD_REJOIN = 0x0371, // S name, W guild, W rights, W channel, S announce + CPMSG_GUILD_INVITED = 0x0388, // S char name, S guild name, W id + CPMSG_GUILD_REJOIN = 0x0389, // S name, W guild, W rights, W channel, S announce // Party PCMSG_PARTY_INVITE = 0x03A0, // S name |