diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-09-17 13:51:37 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-09-17 13:51:37 +0000 |
commit | e846d4502b59a1a3b8d658a37ae5b5ce4aa1c00c (patch) | |
tree | 8feb8b51d731057412a59aeddbbe83b75b09912a /src/inventory.cpp | |
parent | 3bfcee0d9c033a46fe1b13795d89909c8fb6a239 (diff) | |
download | mana-e846d4502b59a1a3b8d658a37ae5b5ce4aa1c00c.tar.gz mana-e846d4502b59a1a3b8d658a37ae5b5ce4aa1c00c.tar.bz2 mana-e846d4502b59a1a3b8d658a37ae5b5ce4aa1c00c.tar.xz mana-e846d4502b59a1a3b8d658a37ae5b5ce4aa1c00c.zip |
Completed transition to use MessageOut.
Diffstat (limited to 'src/inventory.cpp')
-rw-r--r-- | src/inventory.cpp | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp index cf39f042..d7632737 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -25,7 +25,10 @@ #include "equipment.h" #include "item.h" + +#include "net/messageout.h" #include "net/network.h" +#include "net/protocol.h" Inventory::Inventory() { @@ -90,9 +93,10 @@ bool Inventory::contains(Item *item) int Inventory::useItem(Item *item) { - writeWord(0, 0x00a7); - writeWord(2, item->getInvIndex()); - writeLong(4, item->getId()); + MessageOut outMsg; + outMsg.writeShort(CMSG_PLAYER_INVENTORY_USE); + outMsg.writeShort(item->getInvIndex()); + outMsg.writeLong(item->getId()); // Note: id is dest of item, usually player_node->account_ID ?? writeSet(8); flush(); @@ -102,9 +106,10 @@ int Inventory::useItem(Item *item) int Inventory::dropItem(Item *item, int quantity) { // TODO: Fix wrong coordinates of drops, serverside? - writeWord(0, 0x00a2); - writeWord(2, item->getInvIndex()); - writeWord(4, quantity); + MessageOut outMsg; + outMsg.writeShort(CMSG_PLAYER_INVENTORY_DROP); + outMsg.writeShort(item->getInvIndex()); + outMsg.writeShort(quantity); writeSet(6); flush(); return 0; @@ -112,17 +117,19 @@ int Inventory::dropItem(Item *item, int quantity) void Inventory::equipItem(Item *item) { - writeWord(0, 0x00a9); - writeWord(2, item->getInvIndex()); - writeWord(4, 0); + MessageOut outMsg; + outMsg.writeShort(CMSG_PLAYER_EQUIP); + outMsg.writeShort(item->getInvIndex()); + outMsg.writeShort(0); writeSet(6); flush(); } void Inventory::unequipItem(Item *item) { - writeWord(0, 0x00ab); - writeWord(2, item->getInvIndex()); + MessageOut outMsg; + outMsg.writeShort(CMSG_PLAYER_UNEQUIP); + outMsg.writeShort(item->getInvIndex()); writeSet(4); flush(); |