From 9be90b76adb1518c4ffe0e365a18c5afcc3158f2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 23 Dec 2014 01:27:45 +0300 Subject: Add item type to item object. --- src/net/tmwa/buysellhandler.cpp | 4 ++-- src/net/tmwa/inventoryhandler.cpp | 28 +++++++++++++++------------- src/net/tmwa/tradehandler.cpp | 6 +++--- 3 files changed, 20 insertions(+), 18 deletions(-) (limited to 'src/net/tmwa') diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp index 2f1f23adc..89f6f0bf9 100644 --- a/src/net/tmwa/buysellhandler.cpp +++ b/src/net/tmwa/buysellhandler.cpp @@ -105,12 +105,12 @@ void BuySellHandler::processNpcBuy(Net::MessageIn &msg) { const int value = msg.readInt32("price"); msg.readInt32("dc value?"); - msg.readUInt8("type"); + const int type = msg.readUInt8("type"); const int itemId = msg.readInt16("item id"); uint8_t color = 1; if (serverFeatures->haveItemColors()) color = msg.readUInt8("item color"); - mBuyDialog->addItem(itemId, color, 0, value); + mBuyDialog->addItem(itemId, type, color, 0, value); } mBuyDialog->sort(); } diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 545c00b71..825bde798 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -292,12 +292,12 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg) { if (serverFeatures->haveItemColors()) { - inventory->setItem(index, itemId, 1, refine, + inventory->setItem(index, itemId, itemType, 1, refine, identified, true, false, false, true, false); } else { - inventory->setItem(index, itemId, 1, refine, + inventory->setItem(index, itemId, itemType, 1, refine, 1, identified != 0, false, false, true, false); } inventory->setCards(index, cards, 4); @@ -331,7 +331,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg) for (int f = 0; f < 4; f++) cards[f] = msg.readInt16("card"); const int equipType = msg.readInt16("equip type"); - msg.readUInt8("item type"); + const int type = msg.readUInt8("item type"); const ItemInfo &itemInfo = ItemDB::get(itemId); const unsigned char err = msg.readUInt8("status"); @@ -394,12 +394,12 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg) if (serverFeatures->haveItemColors()) { - inventory->setItem(index, itemId, amount, refine, + inventory->setItem(index, itemId, type, amount, refine, identified, true, false, false, equipType != 0, false); } else { - inventory->setItem(index, itemId, amount, refine, + inventory->setItem(index, itemId, type, amount, refine, 1, identified != 0, false, false, equipType != 0, false); } inventory->setCards(index, cards, 4); @@ -455,12 +455,12 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg) { if (serverFeatures->haveItemColors()) { - inventory->setItem(index, itemId, amount, + inventory->setItem(index, itemId, itemType, amount, 0, identified, true, false, false, isEquipment, false); } else { - inventory->setItem(index, itemId, amount, + inventory->setItem(index, itemId, itemType, amount, 0, 1, identified != 0, false, false, isEquipment, false); } inventory->setCards(index, cards, 4); @@ -500,12 +500,14 @@ void InventoryHandler::processPlayerStorage(Net::MessageIn &msg) if (serverFeatures->haveItemColors()) { mInventoryItems.push_back(Ea::InventoryItem(index, itemId, - cards, amount, 0, identified, true, false, false, false)); + itemType, cards, amount, 0, identified, + true, false, false, false)); } else { mInventoryItems.push_back(Ea::InventoryItem(index, itemId, - cards, amount, 0, 1, identified != 0, false, false, false)); + itemType, cards, amount, 0, 1, + identified != 0, false, false, false)); } } BLOCK_END("InventoryHandler::processPlayerInventory") @@ -573,13 +575,13 @@ void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg) if (serverFeatures->haveItemColors()) { mInventoryItems.push_back(Ea::InventoryItem(index, itemId, - cards, amount, refine, identified, true, + itemType, cards, amount, refine, identified, true, false, false, false)); } else { mInventoryItems.push_back(Ea::InventoryItem(index, itemId, - cards, amount, refine, 1, identified != 0, + itemType, cards, amount, refine, 1, identified != 0, false, false, false)); } } @@ -611,12 +613,12 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg) { if (serverFeatures->haveItemColors()) { - mStorage->setItem(index, itemId, amount, + mStorage->setItem(index, itemId, 0, amount, refine, identified, true, false, false, false, false); } else { - mStorage->setItem(index, itemId, amount, + mStorage->setItem(index, itemId, 0, amount, refine, 1, identified != 0, false, false, false, false); } mStorage->setCards(index, cards, 4); diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp index f85bdfc49..3a62c086f 100644 --- a/src/net/tmwa/tradehandler.cpp +++ b/src/net/tmwa/tradehandler.cpp @@ -189,14 +189,14 @@ void TradeHandler::processTradeItemAdd(Net::MessageIn &msg) { if (serverFeatures->haveItemColors()) { - tradeWindow->addItem2(type, + tradeWindow->addItem2(type, 0, cards, 4, false, amount, refine, identify, true, false, false, false); } else { - tradeWindow->addItem2(type, + tradeWindow->addItem2(type, 0, cards, 4, false, amount, refine, 1, identify != 0, false, false, false); @@ -228,7 +228,7 @@ void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg) // Successfully added item if (tradeWindow) { - tradeWindow->addItem2(item->getId(), + tradeWindow->addItem2(item->getId(), item->getType(), item->getCards(), 4, true, quantity, item->getRefine(), item->getColor(), item->getIdentified(), item->getDamaged(), -- cgit v1.2.3-70-g09d2