summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorJoshua Langley <joshlangley[at]optusnet.com.au>2007-08-14 05:59:52 +0000
committerJoshua Langley <joshlangley[at]optusnet.com.au>2007-08-14 05:59:52 +0000
commit0601642d8b3aa2c7aa365e27aa3ef2459553c3fd (patch)
treee2c4a93c3aca4b35b69857b17b722c3260b4c3d1 /src/net
parent68f069fea3182c6d5720df03f1d63de38f14c31d (diff)
downloadmana-0601642d8b3aa2c7aa365e27aa3ef2459553c3fd.tar.gz
mana-0601642d8b3aa2c7aa365e27aa3ef2459553c3fd.tar.bz2
mana-0601642d8b3aa2c7aa365e27aa3ef2459553c3fd.tar.xz
mana-0601642d8b3aa2c7aa365e27aa3ef2459553c3fd.zip
mantis_id:129 - Inventory Window Slots Added.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/gameserver/player.cpp17
-rw-r--r--src/net/gameserver/player.h2
-rw-r--r--src/net/protocol.h3
3 files changed, 20 insertions, 2 deletions
diff --git a/src/net/gameserver/player.cpp b/src/net/gameserver/player.cpp
index e93fff46..29d711d7 100644
--- a/src/net/gameserver/player.cpp
+++ b/src/net/gameserver/player.cpp
@@ -52,6 +52,15 @@ void Net::GameServer::Player::pickUp(int x, int y)
Net::GameServer::connection->send(msg);
}
+void Net::GameServer::Player::moveItem(int oldSlot, int newSlot, int amount)
+{
+ MessageOut msg(PGMSG_MOVE_ITEM);
+ msg.writeByte(oldSlot);
+ msg.writeByte(newSlot);
+ msg.writeByte(amount);
+ Net::GameServer::connection->send(msg);
+}
+
void Net::GameServer::Player::drop(int slot, int amount)
{
MessageOut msg(PGMSG_DROP);
@@ -74,6 +83,13 @@ void Net::GameServer::Player::unequip(int slot)
Net::GameServer::connection->send(msg);
}
+void Net::GameServer::Player::useItem(int slot)
+{
+ MessageOut msg(PGMSG_USE_ITEM);
+ msg.writeByte(slot);
+ Net::GameServer::connection->send(msg);
+}
+
void Net::GameServer::Player::attack(int direction)
{
MessageOut msg(PGMSG_ATTACK);
@@ -123,4 +139,3 @@ void Net::GameServer::Player::tradeItem(int slot, int amount)
msg.writeByte(amount);
Net::GameServer::connection->send(msg);
}
-
diff --git a/src/net/gameserver/player.h b/src/net/gameserver/player.h
index 4c27d4d0..d21e656e 100644
--- a/src/net/gameserver/player.h
+++ b/src/net/gameserver/player.h
@@ -37,9 +37,11 @@ namespace Net
void say(const std::string &text);
void walk(int x, int y);
void pickUp(int x, int y);
+ void moveItem(int oldSlot, int newSlot, int amount);
void drop(int slot, int amount);
void equip(int slot);
void unequip(int slot);
+ void useItem(int slot);
void attack(int direction);
void changeAction(Being::Action action);
void talkToNPC(int id, bool restart);
diff --git a/src/net/protocol.h b/src/net/protocol.h
index 6bbe7919..1dde518e 100644
--- a/src/net/protocol.h
+++ b/src/net/protocol.h
@@ -79,6 +79,7 @@ enum {
PGMSG_DROP = 0x0111, // B slot, B amount
PGMSG_EQUIP = 0x0112, // B slot
PGMSG_UNEQUIP = 0x0113, // B slot
+ PGMSG_MOVE_ITEM = 0x0114, // B slot1, B slot2, B amount
GPMSG_INVENTORY = 0x0120, // { B slot, W item id [, B amount] }*
GPMSG_INVENTORY_FULL = 0x0121, // { B slot, W item id [, B amount] }*
GPMSG_PLAYER_ATTRIBUTE_UPDATE = 0x0130, // { W attribute, W value }*
@@ -116,7 +117,7 @@ enum {
GPMSG_TRADE_ACCEPT = 0x02C7, // -
PGMSG_TRADE_ADD_ITEM = 0x02C8, // B slot, B amount
GPMSG_TRADE_ADD_ITEM = 0x02C9, // W item id, B amount
- PGMSG_USE_ITEM = 0x0300, // L item id
+ PGMSG_USE_ITEM = 0x0300, // B slot
GPMSG_USE_RESPONSE = 0x0301, // B error
GPMSG_BEINGS_DAMAGE = 0x0310, // { W being id, W amount }*