diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-10-21 12:30:17 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-10-21 12:30:17 +0300 |
commit | 40a60a7bb7fd3291fde0a2a689f674a8169c7b64 (patch) | |
tree | 9410a23feea6c6248612afdc8968a1c04306e5b0 | |
parent | 76e55447563fae6f8d17f2fd90231c81e0b3f927 (diff) | |
download | mv-40a60a7bb7fd3291fde0a2a689f674a8169c7b64.tar.gz mv-40a60a7bb7fd3291fde0a2a689f674a8169c7b64.tar.bz2 mv-40a60a7bb7fd3291fde0a2a689f674a8169c7b64.tar.xz mv-40a60a7bb7fd3291fde0a2a689f674a8169c7b64.zip |
Add to item field damaged.
-rw-r--r-- | src/beingequipbackend.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/itemcontainer.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/itemamountwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/npcdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/tradewindow.cpp | 12 | ||||
-rw-r--r-- | src/gui/windows/tradewindow.h | 4 | ||||
-rw-r--r-- | src/inventory.cpp | 8 | ||||
-rw-r--r-- | src/inventory.h | 2 | ||||
-rw-r--r-- | src/item.cpp | 3 | ||||
-rw-r--r-- | src/item.h | 7 | ||||
-rw-r--r-- | src/net/ea/inventoryhandler.cpp | 1 | ||||
-rw-r--r-- | src/net/ea/inventoryitem.h | 3 | ||||
-rw-r--r-- | src/net/eathena/inventoryhandler.cpp | 17 | ||||
-rw-r--r-- | src/net/eathena/tradehandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/inventoryhandler.cpp | 24 | ||||
-rw-r--r-- | src/net/tmwa/tradehandler.cpp | 7 | ||||
-rw-r--r-- | src/shopitem.cpp | 10 |
17 files changed, 68 insertions, 40 deletions
diff --git a/src/beingequipbackend.cpp b/src/beingequipbackend.cpp index 1b1b3edc6..280159b99 100644 --- a/src/beingequipbackend.cpp +++ b/src/beingequipbackend.cpp @@ -43,7 +43,7 @@ BeingEquipBackend::BeingEquipBackend(Being *const being) if (id > 0 && idx >= 0 && idx < EQUIPMENT_SIZE) { mEquipment[idx] = new Item(id, 1, 0, - being->mSpriteColorsIds[f], true, true, true); + being->mSpriteColorsIds[f], true, false, true, true); } } } diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 8f8f886da..87c599fb6 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -553,7 +553,7 @@ void ItemContainer::mouseReleased(MouseEvent &event) if (item && !PlayerInfo::isItemProtected(item->getId())) { mInventory->addItem(item->getId(), 1, 1, item->getColor(), - item->getIdentified(), false, false); + item->getIdentified(), item->getDamaged(), false, false); } return; } diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp index 31c6c8adc..c301e14ee 100644 --- a/src/gui/windows/itemamountwindow.cpp +++ b/src/gui/windows/itemamountwindow.cpp @@ -319,7 +319,7 @@ void ItemAmountWindow::action(const ActionEvent &event) const int id = ItemDB::get(mItemsModal->getElementAt( mItemDropDown->getSelected())).getId(); - mItem = new Item(id, 10000, 0, 1, true, false, false); + mItem = new Item(id, 10000, 0, 1, true, false, false, false); if (mUsage == ShopBuyAdd) mMax = 10000; diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index ff434c07c..5360489cb 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -468,7 +468,7 @@ void NpcDialog::action(const ActionEvent &event) if (item) { mInventory->addItem(item->getId(), 1, 1, item->getColor(), - item->getIdentified(), false, false); + item->getIdentified(), item->getDamaged(), false, false); } } } diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp index 34164758c..0ffbcd34a 100644 --- a/src/gui/windows/tradewindow.cpp +++ b/src/gui/windows/tradewindow.cpp @@ -195,17 +195,18 @@ void TradeWindow::addItem(const int id, const int quantity, const uint8_t refine, const unsigned char color, - const bool identified) const + const bool identified, + const bool damaged) const { if (own) { mMyInventory->addItem(id, quantity, refine, color, - identified, false, false); + identified, damaged, false, false); } else { mPartnerInventory->addItem(id, quantity, refine, color, - identified, false, false); + identified, damaged, false, false); } } @@ -215,17 +216,18 @@ void TradeWindow::addItem2(const int id, const uint8_t refine, const unsigned char color, const bool identified, + const bool damaged, const bool equipment) const { if (own) { mMyInventory->addItem(id, quantity, refine, color, - identified, equipment, false); + identified, damaged, equipment, false); } else { mPartnerInventory->addItem(id, quantity, refine, color, - identified, equipment, false); + identified, damaged, equipment, false); } } diff --git a/src/gui/windows/tradewindow.h b/src/gui/windows/tradewindow.h index ef60b051e..2efe5cde7 100644 --- a/src/gui/windows/tradewindow.h +++ b/src/gui/windows/tradewindow.h @@ -72,7 +72,8 @@ class TradeWindow final : public Window, const int quantity, const uint8_t refine, const unsigned char color, - const bool identified) const; + const bool identified, + const bool damaged) const; /** * Reset both item containers @@ -88,6 +89,7 @@ class TradeWindow final : public Window, const uint8_t refine, const unsigned char color, const bool identified, + const bool damaged, const bool equipment) const; /** diff --git a/src/inventory.cpp b/src/inventory.cpp index d407d94f9..91a3a9b29 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -108,11 +108,12 @@ void Inventory::addItem(const int id, const uint8_t refine, const uint8_t color, const bool identified, + const bool damaged, const bool equipment, const bool equipped) { setItem(getFreeSlot(), id, quantity, refine, color, - identified, equipment, equipped); + identified, damaged, equipment, equipped); } void Inventory::setItem(const int index, @@ -121,6 +122,7 @@ void Inventory::setItem(const int index, const uint8_t refine, const unsigned char color, const bool identified, + const bool damaged, const bool equipment, const bool equipped) { @@ -134,7 +136,7 @@ void Inventory::setItem(const int index, if (!item1 && id > 0) { Item *const item = new Item(id, quantity, refine, color, - identified, equipment, equipped); + identified, damaged, equipment, equipped); item->setInvIndex(index); mItems[index] = item; mUsed++; @@ -146,6 +148,8 @@ void Inventory::setItem(const int index, item1->setQuantity(quantity); item1->setRefine(refine); item1->setEquipment(equipment); + item1->setIdentified(identified); + item1->setDamaged(damaged); } else if (item1) { diff --git a/src/inventory.h b/src/inventory.h index 6ec889a10..f4ee38324 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -92,6 +92,7 @@ class Inventory final const uint8_t refine, const unsigned char color, const bool identified, + const bool damaged, const bool equipment, const bool equipped); @@ -104,6 +105,7 @@ class Inventory final const uint8_t refine, const unsigned char color, const bool identified, + const bool damaged, const bool equipment, const bool equipped); diff --git a/src/item.cpp b/src/item.cpp index da4483874..2d4183a8b 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -42,6 +42,7 @@ Item::Item(const int id, const uint8_t refine, const unsigned char color, const bool identified, + const bool damaged, const bool equipment, const bool equipped) : mId(0), @@ -56,7 +57,7 @@ Item::Item(const int id, mEquipped(equipped), mInEquipment(false), mIdentified(identified), - mDamaged(false), + mDamaged(damaged), mFavorite(false) { setId(id, color); diff --git a/src/item.h b/src/item.h index fbc6abac6..b7ef7534b 100644 --- a/src/item.h +++ b/src/item.h @@ -45,6 +45,7 @@ class Item notfinal const uint8_t refine, const uint8_t color, const bool identified, + const bool damaged, const bool equipment, const bool equipped); @@ -175,6 +176,12 @@ class Item notfinal bool getIdentified() const A_WARN_UNUSED { return mIdentified; } + void setDamaged(const bool b) + { mDamaged = b; } + + bool getDamaged() const A_WARN_UNUSED + { return mDamaged; } + int mId; /**< Item type id. */ unsigned char mColor; int mQuantity; /**< Number of items. */ diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index c38871797..e43e0de9c 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -284,6 +284,7 @@ void InventoryHandler::processPlayerStorageStatus(Net::MessageIn &msg) (*it).refine, (*it).color, (*it).identified, + (*it).damaged, (*it).equip, false); } diff --git a/src/net/ea/inventoryitem.h b/src/net/ea/inventoryitem.h index 20ea399d4..19d9135f9 100644 --- a/src/net/ea/inventoryitem.h +++ b/src/net/ea/inventoryitem.h @@ -46,6 +46,7 @@ class InventoryItem final uint8_t refine; unsigned char color; bool identified; + bool damaged; bool equip; InventoryItem(const int slot0, @@ -54,6 +55,7 @@ class InventoryItem final const uint8_t refine0, const unsigned char color0, const bool identified0, + const bool damaged0, const bool equip0) : slot(slot0), id(id0), @@ -61,6 +63,7 @@ class InventoryItem final refine(refine0), color(color0), identified(identified0), + damaged(damaged0), equip(equip0) { } diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp index b016b6a17..4189dde81 100644 --- a/src/net/eathena/inventoryhandler.cpp +++ b/src/net/eathena/inventoryhandler.cpp @@ -326,7 +326,7 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg) if (inventory) { inventory->setItem(index, itemId, 1, refine, - 1, flags.bits.isIdentified, true, false); + 1, flags.bits.isIdentified, flags.bits.isDamaged, true, false); } if (equipType) @@ -351,7 +351,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg) int amount = msg.readInt16("count"); const int itemId = msg.readInt16("item id"); uint8_t identified = msg.readUInt8("identified"); - msg.readUInt8("is damaged"); + const uint8_t damaged = msg.readUInt8("is damaged"); const uint8_t refine = msg.readUInt8("refine"); msg.readInt16("card0"); msg.readInt16("card1"); @@ -422,7 +422,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg) amount += item->getQuantity(); inventory->setItem(index, itemId, amount, refine, - 1, identified != 0, equipType != 0, false); + 1, identified != 0, damaged != 0, equipType != 0, false); } ArrowsListener::distributeEvent(); } @@ -466,7 +466,8 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg) if (inventory) { inventory->setItem(index, itemId, amount, - 0, 1, flags.bits.isIdentified, false, false); + 0, 1, flags.bits.isIdentified, + flags.bits.isDamaged, false, false); } } BLOCK_END("InventoryHandler::processPlayerInventory") @@ -498,7 +499,8 @@ void InventoryHandler::processPlayerStorage(Net::MessageIn &msg) flags.byte = msg.readUInt8("flags"); mInventoryItems.push_back(Ea::InventoryItem(index, itemId, - amount, 0, 1, flags.bits.isIdentified, false)); + amount, 0, 1, flags.bits.isIdentified, + flags.bits.isDamaged, false)); } BLOCK_END("InventoryHandler::processPlayerInventory") } @@ -596,7 +598,8 @@ void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg) flags.byte = msg.readUInt8("flags"); mInventoryItems.push_back(Ea::InventoryItem(index, - itemId, amount, refine, 1, flags.bits.isIdentified, false)); + itemId, amount, refine, 1, flags.bits.isIdentified, + flags.bits.isDamaged, false)); } BLOCK_END("InventoryHandler::processPlayerStorageEquip") } @@ -627,7 +630,7 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg) if (mStorage) { mStorage->setItem(index, itemId, amount, - refine, 1, identified != 0, false, false); + refine, 1, identified != 0, false, false, false); } } BLOCK_END("InventoryHandler::processPlayerStorageAdd") diff --git a/src/net/eathena/tradehandler.cpp b/src/net/eathena/tradehandler.cpp index dffc68057..e992ee497 100644 --- a/src/net/eathena/tradehandler.cpp +++ b/src/net/eathena/tradehandler.cpp @@ -201,7 +201,7 @@ void TradeHandler::processTradeItemAdd(Net::MessageIn &msg) else { tradeWindow->addItem2(type, false, amount, - refine, 1, identify != 0, false); + refine, 1, identify != 0, false, false); } } } diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 32dc8fdc0..6685efd7c 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -271,12 +271,12 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg) if (serverFeatures->haveItemColors()) { inventory->setItem(index, itemId, 1, refine, - identified, true, true, false); + identified, true, false, true, false); } else { inventory->setItem(index, itemId, 1, refine, - 1, identified != 0, true, false); + 1, identified != 0, false, true, false); } } @@ -371,12 +371,12 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg) if (serverFeatures->haveItemColors()) { inventory->setItem(index, itemId, amount, refine, - identified, true, equipType != 0, false); + identified, true, false, equipType != 0, false); } else { inventory->setItem(index, itemId, amount, refine, - 1, identified != 0, equipType != 0, false); + 1, identified != 0, false, equipType != 0, false); } } ArrowsListener::distributeEvent(); @@ -431,12 +431,12 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg) if (serverFeatures->haveItemColors()) { inventory->setItem(index, itemId, amount, - 0, identified, true, isEquipment, false); + 0, identified, true, false, isEquipment, false); } else { inventory->setItem(index, itemId, amount, - 0, 1, identified != 0, isEquipment, false); + 0, 1, identified != 0, false, isEquipment, false); } } } @@ -474,12 +474,12 @@ void InventoryHandler::processPlayerStorage(Net::MessageIn &msg) if (serverFeatures->haveItemColors()) { mInventoryItems.push_back(Ea::InventoryItem(index, itemId, - amount, 0, identified, true, false)); + amount, 0, identified, true, false, false)); } else { mInventoryItems.push_back(Ea::InventoryItem(index, itemId, - amount, 0, 1, identified != 0, false)); + amount, 0, 1, identified != 0, false, false)); } } BLOCK_END("InventoryHandler::processPlayerInventory") @@ -547,12 +547,12 @@ void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg) if (serverFeatures->haveItemColors()) { mInventoryItems.push_back(Ea::InventoryItem(index, - itemId, amount, refine, identified, true, false)); + itemId, amount, refine, identified, true, false, false)); } else { mInventoryItems.push_back(Ea::InventoryItem(index, - itemId, amount, refine, 1, identified != 0, false)); + itemId, amount, refine, 1, identified != 0, false, false)); } } BLOCK_END("InventoryHandler::processPlayerStorageEquip") @@ -583,12 +583,12 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg) if (serverFeatures->haveItemColors()) { mStorage->setItem(index, itemId, amount, - refine, identified, true, false, false); + refine, identified, true, false, false, false); } else { mStorage->setItem(index, itemId, amount, - refine, 1, identified != 0, false, false); + refine, 1, identified != 0, false, false, false); } } } diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp index 5598d3781..c0ced4c42 100644 --- a/src/net/tmwa/tradehandler.cpp +++ b/src/net/tmwa/tradehandler.cpp @@ -183,12 +183,12 @@ void TradeHandler::processTradeItemAdd(Net::MessageIn &msg) if (serverFeatures->haveItemColors()) { tradeWindow->addItem2(type, false, amount, - refine, identify, true, false); + refine, identify, true, false, false); } else { tradeWindow->addItem2(type, false, amount, - refine, 1, identify != 0, false); + refine, 1, identify != 0, false, false); } } } @@ -219,7 +219,8 @@ void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg) { tradeWindow->addItem2(item->getId(), true, quantity, item->getRefine(), item->getColor(), - item->getIdentified(), item->isEquipment()); + item->getIdentified(), item->getDamaged(), + item->isEquipment()); } item->increaseQuantity(-quantity); break; diff --git a/src/shopitem.cpp b/src/shopitem.cpp index 6e01eabf6..b3122d762 100644 --- a/src/shopitem.cpp +++ b/src/shopitem.cpp @@ -32,10 +32,12 @@ #include "debug.h" -ShopItem::ShopItem(const int inventoryIndex, const int id, +ShopItem::ShopItem(const int inventoryIndex, + const int id, const unsigned char color, - const int quantity, const int price) : - Item(id, 0, 0, color, true, false, false), + const int quantity, + const int price) : + Item(id, 0, 0, color, true, false, false, false), mDisplayName(), mDuplicates(), mPrice(price), @@ -47,7 +49,7 @@ ShopItem::ShopItem(const int inventoryIndex, const int id, } ShopItem::ShopItem(const int id, const unsigned char color, const int price) : - Item(id, 0, 0, color, true, false, false), + Item(id, 0, 0, color, true, false, false, false), mDisplayName(), mDuplicates(), mPrice(price), |