summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorDavid Athay <ko2fan@gmail.com>2009-05-21 10:20:32 +0100
committerDavid Athay <ko2fan@gmail.com>2009-05-21 10:20:32 +0100
commit2dad08e4e8e199c84da6a6f2f5289c8c0e40fc81 (patch)
tree293d4922893dfffcc065604743116e653c3b8d37 /src/net
parentdc1eb0895382451b1c79c60ecb7ca7dbbec89681 (diff)
parent244b0d9b46128ab3498da078020c8bbf8c65f69f (diff)
downloadmana-client-2dad08e4e8e199c84da6a6f2f5289c8c0e40fc81.tar.gz
mana-client-2dad08e4e8e199c84da6a6f2f5289c8c0e40fc81.tar.bz2
mana-client-2dad08e4e8e199c84da6a6f2f5289c8c0e40fc81.tar.xz
mana-client-2dad08e4e8e199c84da6a6f2f5289c8c0e40fc81.zip
Merge branch 'master' of git@gitorious.org:tmw/mainline
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/maphandler.cpp3
-rw-r--r--src/net/ea/playerhandler.cpp4
-rw-r--r--src/net/ea/playerhandler.h2
-rw-r--r--src/net/playerhandler.h2
-rw-r--r--src/net/tmwserv/gameserver/player.cpp7
-rw-r--r--src/net/tmwserv/gameserver/player.h1
-rw-r--r--src/net/tmwserv/playerhandler.cpp6
-rw-r--r--src/net/tmwserv/playerhandler.h2
-rw-r--r--src/net/tmwserv/protocol.h8
9 files changed, 17 insertions, 18 deletions
diff --git a/src/net/ea/maphandler.cpp b/src/net/ea/maphandler.cpp
index 76b3c480..c7ff0ec7 100644
--- a/src/net/ea/maphandler.cpp
+++ b/src/net/ea/maphandler.cpp
@@ -27,6 +27,7 @@
#include "net/messagein.h"
#include "net/messageout.h"
+#include "game.h"
#include "localplayer.h"
#include "log.h"
#include "main.h"
@@ -37,6 +38,7 @@
#include "utils/stringutils.h"
Net::MapHandler *mapHandler;
+extern Game *game;
namespace EAthena {
@@ -65,6 +67,7 @@ void MapHandler::handleMessage(MessageIn &msg)
logger->log("Protocol: Player start position: (%d, %d), Direction: %d",
player_node->mX, player_node->mY, direction);
state = STATE_GAME;
+ game = new Game;
break;
case SMSG_SERVER_PING:
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..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