summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-01-05 10:14:17 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-01-05 10:14:17 +0000
commitc887f550b55b6160f074cb3160a4442ca659fad9 (patch)
tree43cd78f7bdbf00e0764792a2dbd49e7b115ac971 /src/net
parente880b17081962580afea1d003600afffe062d427 (diff)
downloadmana-c887f550b55b6160f074cb3160a4442ca659fad9.tar.gz
mana-c887f550b55b6160f074cb3160a4442ca659fad9.tar.bz2
mana-c887f550b55b6160f074cb3160a4442ca659fad9.tar.xz
mana-c887f550b55b6160f074cb3160a4442ca659fad9.zip
Implemented item dropping.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/gameserver/player.cpp8
-rw-r--r--src/net/gameserver/player.h1
-rw-r--r--src/net/protocol.h4
3 files changed, 11 insertions, 2 deletions
diff --git a/src/net/gameserver/player.cpp b/src/net/gameserver/player.cpp
index 763f3d28..033327c9 100644
--- a/src/net/gameserver/player.cpp
+++ b/src/net/gameserver/player.cpp
@@ -52,6 +52,14 @@ void Net::GameServer::Player::pickUp(int x, int y)
Net::GameServer::connection->send(msg);
}
+void Net::GameServer::Player::drop(int slot, int amount)
+{
+ MessageOut msg(PGMSG_DROP);
+ msg.writeByte(slot);
+ msg.writeByte(amount);
+ Net::GameServer::connection->send(msg);
+}
+
void Net::GameServer::Player::equip(int slot)
{
MessageOut msg(PGMSG_EQUIP);
diff --git a/src/net/gameserver/player.h b/src/net/gameserver/player.h
index a5429e65..73a533d5 100644
--- a/src/net/gameserver/player.h
+++ b/src/net/gameserver/player.h
@@ -35,6 +35,7 @@ namespace Net
void say(const std::string &text);
void walk(int x, int y);
void pickUp(int x, int y);
+ void drop(int slot, int amount);
void equip(int slot);
void attack(unsigned char direction);
}
diff --git a/src/net/protocol.h b/src/net/protocol.h
index 4896b977..2fbd59e4 100644
--- a/src/net/protocol.h
+++ b/src/net/protocol.h
@@ -148,6 +148,8 @@ enum {
GPMSG_PLAYER_MAP_CHANGE = 0x0100, // S filename, W x, W y
GPMSG_PLAYER_SERVER_CHANGE = 0x0101, // B*32 token, S game address, W game port
PGMSG_PICKUP = 0x0110, // W*2 position
+ PGMSG_DROP = 0x0111, // B slot, B amount
+ PGMSG_EQUIP = 0x0112, // B slot
GPMSG_INVENTORY = 0x0120, // { B slot, W item id [, B amount] }*
GPMSG_BEING_ENTER = 0x0200, // B type, W being id
// player: S name, B hair style, B hair color, B gender
@@ -163,8 +165,6 @@ enum {
GPMSG_SAY = 0x02A1, // W being id, S text
PGMSG_USE_ITEM = 0x0300, // L item id
GPMSG_USE_RESPONSE = 0x0301, // B error
- PGMSG_EQUIP = 0x0302, // L item id, B slot
- GPMSG_EQUIP_RESPONSE = 0x0303, // B error
GPMSG_BEINGS_DAMAGE = 0x0310, // { W being id, W amount }*
// Chat