diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/net/inventoryhandler.cpp | 16 | ||||
-rw-r--r-- | src/net/protocol.h | 1 |
3 files changed, 15 insertions, 4 deletions
@@ -2,6 +2,8 @@ * src/net/gameserver/player.h, src/net/gameserver/player.cpp, src/net/protocol.h, src/localplayer.cpp: Implemented item dropping. + * src/net/protocol.h, src/net/inventoryhandling.cpp: Added support for + full inventory update. 2007-01-05 Bjørn Lindeijer <bjorn@lindeijer.nl> diff --git a/src/net/inventoryhandler.cpp b/src/net/inventoryhandler.cpp index c6cc4a55..40febee2 100644 --- a/src/net/inventoryhandler.cpp +++ b/src/net/inventoryhandler.cpp @@ -44,6 +44,7 @@ InventoryHandler::InventoryHandler() SMSG_PLAYER_INVENTORY_USE, SMSG_ITEM_USE_RESPONSE, */ + GPMSG_INVENTORY_FULL, GPMSG_INVENTORY, 0 }; @@ -54,15 +55,22 @@ void InventoryHandler::handleMessage(MessageIn &msg) { switch (msg.getId()) { + case GPMSG_INVENTORY_FULL: + player_node->clearInventory(); + // no break! + case GPMSG_INVENTORY: while (msg.getUnreadLength()) { int slot = msg.readByte(); int id = msg.readShort(); - int amount = slot >= 32 ? msg.readByte() : 1; - Item *it = player_node->getInvItem(slot - 32); - it->setId(id); - it->setQuantity(amount); + if (slot >= 32) + { + int amount = msg.readByte(); + Item *it = player_node->getInvItem(slot - 32); + it->setId(id); + it->setQuantity(amount); + } }; break; diff --git a/src/net/protocol.h b/src/net/protocol.h index 2fbd59e4..096ba29c 100644 --- a/src/net/protocol.h +++ b/src/net/protocol.h @@ -151,6 +151,7 @@ enum { PGMSG_DROP = 0x0111, // B slot, B amount PGMSG_EQUIP = 0x0112, // B slot GPMSG_INVENTORY = 0x0120, // { B slot, W item id [, B amount] }* + GPMSG_INVENTORY_FULL = 0x0121, // { 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 // monster: W type id |