diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2006-07-25 18:04:38 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2006-07-25 18:04:38 +0000 |
commit | c7e7b62aa94bf295ca1dc556762ad6070221e0cd (patch) | |
tree | 04f827df0df64a80e04a4115986609486d715237 /src/net/inventoryhandler.cpp | |
parent | c0c8775271679ac4904bc0bc02a74d28fc75efd0 (diff) | |
download | mana-c7e7b62aa94bf295ca1dc556762ad6070221e0cd.tar.gz mana-c7e7b62aa94bf295ca1dc556762ad6070221e0cd.tar.bz2 mana-c7e7b62aa94bf295ca1dc556762ad6070221e0cd.tar.xz mana-c7e7b62aa94bf295ca1dc556762ad6070221e0cd.zip |
Switched client to use enet and modified login sequence to work with the new protocol from tmwserv.
Diffstat (limited to 'src/net/inventoryhandler.cpp')
-rw-r--r-- | src/net/inventoryhandler.cpp | 55 |
1 files changed, 26 insertions, 29 deletions
diff --git a/src/net/inventoryhandler.cpp b/src/net/inventoryhandler.cpp index 3742d327..51c71f8d 100644 --- a/src/net/inventoryhandler.cpp +++ b/src/net/inventoryhandler.cpp @@ -57,18 +57,16 @@ void InventoryHandler::handleMessage(MessageIn *msg) // Only called on map load / warp. First reset all items // to not load them twice on map change. player_node->clearInventory(); - msg->readInt16(); // length + msg->readShort(); // length number = (msg->getLength() - 4) / 18; for (int loop = 0; loop < number; loop++) { - index = msg->readInt16(); - itemId = msg->readInt16(); - msg->readInt8(); // type - msg->readInt8(); // identify flag - amount = msg->readInt16(); - msg->skip(2); // unknown - msg->skip(8); // card (4 shorts) + index = msg->readShort(); + itemId = msg->readShort(); + msg->readByte(); // type + msg->readByte(); // identify flag + amount = msg->readShort(); player_node->addInvItem(index, itemId, amount, false); @@ -81,17 +79,16 @@ void InventoryHandler::handleMessage(MessageIn *msg) break; case SMSG_PLAYER_INVENTORY_ADD: - index = msg->readInt16(); - amount = msg->readInt16(); - itemId = msg->readInt16(); - msg->readInt8(); // identify flag - msg->readInt8(); // attribute - msg->readInt8(); // refine - msg->skip(8); // card - equipType = msg->readInt16(); - msg->readInt8(); // type - - if (msg->readInt8()> 0) { + index = msg->readShort(); + amount = msg->readShort(); + itemId = msg->readShort(); + msg->readByte(); // identify flag + msg->readByte(); // attribute + msg->readByte(); // refine + equipType = msg->readShort(); + msg->readByte(); // type + + if (msg->readByte()> 0) { chatWindow->chatLog("Unable to pick up item", BY_SERVER); } else { player_node->addInvItem(index, itemId, amount, equipType != 0); @@ -99,26 +96,26 @@ void InventoryHandler::handleMessage(MessageIn *msg) break; case SMSG_PLAYER_INVENTORY_REMOVE: - index = msg->readInt16(); - amount = msg->readInt16(); + index = msg->readShort(); + amount = msg->readShort(); player_node->getInvItem(index)->increaseQuantity(-amount); break; case SMSG_PLAYER_INVENTORY_USE: - index = msg->readInt16(); - msg->readInt16(); // item id - msg->readInt32(); // id - amount = msg->readInt16(); - msg->readInt8(); // type + index = msg->readShort(); + msg->readShort(); // item id + msg->readLong(); // id + amount = msg->readShort(); + msg->readByte(); // type player_node->getInvItem(index)->setQuantity(amount); break; case SMSG_ITEM_USE_RESPONSE: - index = msg->readInt16(); - amount = msg->readInt16(); + index = msg->readShort(); + amount = msg->readShort(); - if (msg->readInt8() == 0) { + if (msg->readByte() == 0) { chatWindow->chatLog("Failed to use item", BY_SERVER); } else { player_node->getInvItem(index)->setQuantity(amount); |