diff options
Diffstat (limited to 'src/net/tmwa')
-rw-r--r-- | src/net/tmwa/inventoryhandler.cpp | 90 | ||||
-rw-r--r-- | src/net/tmwa/tradehandler.cpp | 16 |
2 files changed, 73 insertions, 33 deletions
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 2620fd1cc..32dc8fdc0 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -266,13 +266,18 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg) index, itemId, itemType, identified); } - if (!serverFeatures->haveItemColors() && identified > 1) - identified = 1; - if (inventory) { - inventory->setItem(index, itemId, 1, refine, - identified, true, false); + if (serverFeatures->haveItemColors()) + { + inventory->setItem(index, itemId, 1, refine, + identified, true, true, false); + } + else + { + inventory->setItem(index, itemId, 1, refine, + 1, identified != 0, true, false); + } } if (equipType) @@ -363,11 +368,16 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg) if (item && item->getId() == itemId) amount += item->getQuantity(); - if (!serverFeatures->haveItemColors() && identified > 1) - identified = 1; - - inventory->setItem(index, itemId, amount, refine, - identified, equipType != 0, false); + if (serverFeatures->haveItemColors()) + { + inventory->setItem(index, itemId, amount, refine, + identified, true, equipType != 0, false); + } + else + { + inventory->setItem(index, itemId, amount, refine, + 1, identified != 0, equipType != 0, false); + } } ArrowsListener::distributeEvent(); } @@ -413,16 +423,21 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg) cards[0], cards[1], cards[2], cards[3]); } - if (!serverFeatures->haveItemColors() && identified > 1) - identified = 1; - // Trick because arrows are not considered equipment const bool isEquipment = arrow & 0x8000; if (inventory) { - inventory->setItem(index, itemId, amount, - 0, identified, isEquipment, false); + if (serverFeatures->haveItemColors()) + { + inventory->setItem(index, itemId, amount, + 0, identified, true, isEquipment, false); + } + else + { + inventory->setItem(index, itemId, amount, + 0, 1, identified != 0, isEquipment, false); + } } } BLOCK_END("InventoryHandler::processPlayerInventory") @@ -456,11 +471,16 @@ void InventoryHandler::processPlayerStorage(Net::MessageIn &msg) cards[0], cards[1], cards[2], cards[3]); } - if (!serverFeatures->haveItemColors() && identified > 1) - identified = 1; - - mInventoryItems.push_back(Ea::InventoryItem(index, itemId, - amount, 0, identified, false)); + if (serverFeatures->haveItemColors()) + { + mInventoryItems.push_back(Ea::InventoryItem(index, itemId, + amount, 0, identified, true, false)); + } + else + { + mInventoryItems.push_back(Ea::InventoryItem(index, itemId, + amount, 0, 1, identified != 0, false)); + } } BLOCK_END("InventoryHandler::processPlayerInventory") } @@ -524,11 +544,16 @@ void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg) static_cast<unsigned int>(refine)); } - if (!serverFeatures->haveItemColors() && identified > 1U) - identified = 1U; - - mInventoryItems.push_back(Ea::InventoryItem(index, - itemId, amount, refine, identified, false)); + if (serverFeatures->haveItemColors()) + { + mInventoryItems.push_back(Ea::InventoryItem(index, + itemId, amount, refine, identified, true, false)); + } + else + { + mInventoryItems.push_back(Ea::InventoryItem(index, + itemId, amount, refine, 1, identified != 0, false)); + } } BLOCK_END("InventoryHandler::processPlayerStorageEquip") } @@ -555,11 +580,16 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg) { if (mStorage) { - if (!serverFeatures->haveItemColors() && identified > 1) - identified = 1; - - mStorage->setItem(index, itemId, amount, - refine, identified, false, false); + if (serverFeatures->haveItemColors()) + { + mStorage->setItem(index, itemId, amount, + refine, identified, true, false, false); + } + else + { + mStorage->setItem(index, itemId, amount, + refine, 1, identified != 0, false, false); + } } } BLOCK_END("InventoryHandler::processPlayerStorageAdd") diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp index 12e6b94ab..5598d3781 100644 --- a/src/net/tmwa/tradehandler.cpp +++ b/src/net/tmwa/tradehandler.cpp @@ -30,6 +30,8 @@ #include "gui/windows/tradewindow.h" +#include "net/serverfeatures.h" + #include "net/tmwa/messageout.h" #include "net/tmwa/protocol.h" @@ -178,8 +180,16 @@ void TradeHandler::processTradeItemAdd(Net::MessageIn &msg) } else { - tradeWindow->addItem2(type, false, amount, - refine, identify, false); + if (serverFeatures->haveItemColors()) + { + tradeWindow->addItem2(type, false, amount, + refine, identify, true, false); + } + else + { + tradeWindow->addItem2(type, false, amount, + refine, 1, identify != 0, false); + } } } } @@ -209,7 +219,7 @@ void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg) { tradeWindow->addItem2(item->getId(), true, quantity, item->getRefine(), item->getColor(), - item->isEquipment()); + item->getIdentified(), item->isEquipment()); } item->increaseQuantity(-quantity); break; |