diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-10-21 17:43:19 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-10-21 17:43:19 +0300 |
commit | e3ad003fe09ff90524ffa5deae844e6721b903b2 (patch) | |
tree | 756f8cae3ee12060548384ece6750a25bee4ab45 /src/net/tmwa | |
parent | 4ab7d38fe9033695e23042e97b55999b26f00fd7 (diff) | |
download | manaverse-e3ad003fe09ff90524ffa5deae844e6721b903b2.tar.gz manaverse-e3ad003fe09ff90524ffa5deae844e6721b903b2.tar.bz2 manaverse-e3ad003fe09ff90524ffa5deae844e6721b903b2.tar.xz manaverse-e3ad003fe09ff90524ffa5deae844e6721b903b2.zip |
Set cards from net code.
Diffstat (limited to 'src/net/tmwa')
-rw-r--r-- | src/net/tmwa/inventoryhandler.cpp | 30 | ||||
-rw-r--r-- | src/net/tmwa/tradehandler.cpp | 17 |
2 files changed, 31 insertions, 16 deletions
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 645da2da7..79d60e381 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -258,7 +258,9 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg) const int equipType = msg.readInt16(); msg.readUInt8(); // attribute const uint8_t refine = msg.readUInt8(); - msg.skip(8); // card + int cards[4]; + for (int f = 0; f < 4; f++) + cards[f] = msg.readInt16("card"); if (mDebugInventory) { @@ -278,6 +280,7 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg) inventory->setItem(index, itemId, 1, refine, 1, identified != 0, false, false, true, false); } + inventory->setCards(index, cards, 4); } if (equipType) @@ -304,8 +307,9 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg) uint8_t identified = msg.readUInt8(); msg.readUInt8(); // attribute const uint8_t refine = msg.readUInt8(); - for (int i = 0; i < 4; i++) - msg.readInt16(); // cards[i] + int cards[4]; + for (int f = 0; f < 4; f++) + cards[f] = msg.readInt16("card"); const int equipType = msg.readInt16(); msg.readUInt8(); // itemType @@ -378,6 +382,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg) inventory->setItem(index, itemId, amount, refine, 1, identified != 0, false, false, equipType != 0, false); } + inventory->setCards(index, cards, 4); } ArrowsListener::distributeEvent(); } @@ -438,6 +443,7 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg) inventory->setItem(index, itemId, amount, 0, 1, identified != 0, false, false, isEquipment, false); } + inventory->setCards(index, cards, 4); } } BLOCK_END("InventoryHandler::processPlayerInventory") @@ -474,12 +480,12 @@ void InventoryHandler::processPlayerStorage(Net::MessageIn &msg) if (serverFeatures->haveItemColors()) { mInventoryItems.push_back(Ea::InventoryItem(index, itemId, - amount, 0, identified, true, false, false, false)); + cards, amount, 0, identified, true, false, false, false)); } else { mInventoryItems.push_back(Ea::InventoryItem(index, itemId, - amount, 0, 1, identified != 0, false, false, false)); + cards, amount, 0, 1, identified != 0, false, false, false)); } } BLOCK_END("InventoryHandler::processPlayerInventory") @@ -546,14 +552,14 @@ void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg) if (serverFeatures->haveItemColors()) { - mInventoryItems.push_back(Ea::InventoryItem(index, - itemId, amount, refine, identified, true, + mInventoryItems.push_back(Ea::InventoryItem(index, itemId, + cards, amount, refine, identified, true, false, false, false)); } else { - mInventoryItems.push_back(Ea::InventoryItem(index, - itemId, amount, refine, 1, identified != 0, + mInventoryItems.push_back(Ea::InventoryItem(index, itemId, + cards, amount, refine, 1, identified != 0, false, false, false)); } } @@ -570,8 +576,9 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg) unsigned char identified = msg.readUInt8(); msg.readUInt8(); // attribute const uint8_t refine = msg.readUInt8(); - for (int i = 0; i < 4; i++) - msg.readInt16(); // card i + int cards[4]; + for (int f = 0; f < 4; f++) + cards[f] = msg.readInt16("card"); if (Item *const item = mStorage->getItem(index)) { @@ -592,6 +599,7 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg) mStorage->setItem(index, itemId, amount, refine, 1, identified != 0, false, false, false, false); } + mStorage->setCards(index, cards, 4); } } BLOCK_END("InventoryHandler::processPlayerStorageAdd") diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp index 30b432d2f..5cb9e4ae2 100644 --- a/src/net/tmwa/tradehandler.cpp +++ b/src/net/tmwa/tradehandler.cpp @@ -170,7 +170,9 @@ void TradeHandler::processTradeItemAdd(Net::MessageIn &msg) const uint8_t identify = msg.readUInt8(); // identified flag msg.readUInt8(); // attribute const uint8_t refine = msg.readUInt8(); // refine - msg.skip(8); // card (4 shorts) + int cards[4]; + for (int f = 0; f < 4; f++) + cards[f] = msg.readInt16("card"); if (tradeWindow) { @@ -182,12 +184,16 @@ void TradeHandler::processTradeItemAdd(Net::MessageIn &msg) { if (serverFeatures->haveItemColors()) { - tradeWindow->addItem2(type, false, amount, + tradeWindow->addItem2(type, + cards, 4, + false, amount, refine, identify, true, false, false, false); } else { - tradeWindow->addItem2(type, false, amount, + tradeWindow->addItem2(type, + cards, 4, + false, amount, refine, 1, identify != 0, false, false, false); } } @@ -217,8 +223,9 @@ void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg) // Successfully added item if (tradeWindow) { - tradeWindow->addItem2(item->getId(), true, - quantity, item->getRefine(), item->getColor(), + tradeWindow->addItem2(item->getId(), + item->getCards(), 4, + true, quantity, item->getRefine(), item->getColor(), item->getIdentified(), item->getDamaged(), item->getFavorite(), item->isEquipment()); } |