summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/actions/actions.cpp4
-rw-r--r--src/beingequipbackend.cpp2
-rw-r--r--src/gui/models/shopitems.cpp27
-rw-r--r--src/gui/models/shopitems.h23
-rw-r--r--src/gui/widgets/itemcontainer.cpp3
-rw-r--r--src/gui/widgets/selldialog.cpp21
-rw-r--r--src/gui/widgets/selldialog.h7
-rw-r--r--src/gui/windows/buydialog.cpp9
-rw-r--r--src/gui/windows/buydialog.h7
-rw-r--r--src/gui/windows/itemamountwindow.cpp2
-rw-r--r--src/gui/windows/npcdialog.cpp3
-rw-r--r--src/gui/windows/shopwindow.cpp22
-rw-r--r--src/gui/windows/tradewindow.cpp6
-rw-r--r--src/gui/windows/tradewindow.h2
-rw-r--r--src/inventory.cpp6
-rw-r--r--src/inventory.h2
-rw-r--r--src/item.cpp2
-rw-r--r--src/item.h8
-rw-r--r--src/net/ea/inventoryhandler.cpp1
-rw-r--r--src/net/ea/inventoryitem.h3
-rw-r--r--src/net/eathena/buysellhandler.cpp4
-rw-r--r--src/net/eathena/inventoryhandler.cpp24
-rw-r--r--src/net/eathena/markethandler.cpp4
-rw-r--r--src/net/eathena/tradehandler.cpp9
-rw-r--r--src/net/tmwa/buysellhandler.cpp4
-rw-r--r--src/net/tmwa/inventoryhandler.cpp28
-rw-r--r--src/net/tmwa/tradehandler.cpp6
-rw-r--r--src/shopitem.cpp10
-rw-r--r--src/shopitem.h12
29 files changed, 171 insertions, 90 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index cddaaddcb..d43853790 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -1359,14 +1359,14 @@ impHandler0(createItems)
if (!colors)
{
- dialog->addItem(id, 1, 100, 0);
+ dialog->addItem(id, 0, 1, 100, 0);
}
else
{
for (unsigned char f = 0; f < colors; f ++)
{
if (!info->getColor(f).empty())
- dialog->addItem(id, f, 100, 0);
+ dialog->addItem(id, 0, f, 100, 0);
}
}
}
diff --git a/src/beingequipbackend.cpp b/src/beingequipbackend.cpp
index 344b36856..4a7f31c4a 100644
--- a/src/beingequipbackend.cpp
+++ b/src/beingequipbackend.cpp
@@ -42,7 +42,7 @@ BeingEquipBackend::BeingEquipBackend(Being *const being)
const int id = being->mSpriteIDs[f];
if (id > 0 && idx >= 0 && idx < EQUIPMENT_SIZE)
{
- mEquipment[idx] = new Item(id, 1, 0,
+ mEquipment[idx] = new Item(id, 0, 1, 0,
being->mSpriteColorsIds[f],
true, false, false, true, true);
}
diff --git a/src/gui/models/shopitems.cpp b/src/gui/models/shopitems.cpp
index 58bfe0023..e6bbeb787 100644
--- a/src/gui/models/shopitems.cpp
+++ b/src/gui/models/shopitems.cpp
@@ -50,23 +50,32 @@ std::string ShopItems::getElementAt(int i)
return mShopItems.at(i)->getDisplayName();
}
-void ShopItems::addItem(const int id, const unsigned char color,
- const int amount, const int price)
+void ShopItems::addItem(const int id,
+ const int type,
+ const unsigned char color,
+ const int amount,
+ const int price)
{
- mShopItems.push_back(new ShopItem(-1, id, color, amount, price));
+ mShopItems.push_back(new ShopItem(-1, id, type, color, amount, price));
}
-void ShopItems::addItemNoDup(const int id, const unsigned char color,
- const int amount, const int price)
+void ShopItems::addItemNoDup(const int id,
+ const int type,
+ const unsigned char color,
+ const int amount,
+ const int price)
{
const ShopItem *const item = findItem(id, color);
if (!item)
- mShopItems.push_back(new ShopItem(-1, id, color, amount, price));
+ mShopItems.push_back(new ShopItem(-1, id, type, color, amount, price));
}
-void ShopItems::addItem2(const int inventoryIndex, const int id,
+void ShopItems::addItem2(const int inventoryIndex,
+ const int id,
+ const int type,
const unsigned char color,
- const int quantity, const int price)
+ const int quantity,
+ const int price)
{
ShopItem *item = nullptr;
if (mMergeDuplicates)
@@ -78,7 +87,7 @@ void ShopItems::addItem2(const int inventoryIndex, const int id,
}
else
{
- item = new ShopItem(inventoryIndex, id, color, quantity, price);
+ item = new ShopItem(inventoryIndex, id, type, color, quantity, price);
mShopItems.push_back(item);
}
}
diff --git a/src/gui/models/shopitems.h b/src/gui/models/shopitems.h
index 5e8fb2b97..68048c65c 100644
--- a/src/gui/models/shopitems.h
+++ b/src/gui/models/shopitems.h
@@ -59,8 +59,11 @@ class ShopItems final : public ListModel
/**
* Adds an item to the list.
*/
- void addItem(const int id, const unsigned char color,
- const int amount, const int price);
+ void addItem(const int id,
+ const int type,
+ const unsigned char color,
+ const int amount,
+ const int price);
/**
* Adds an item to the list (used by sell dialog). Looks for
@@ -71,12 +74,18 @@ class ShopItems final : public ListModel
* @param quantity number of available copies of the item
* @param price price of the item
*/
- void addItem2(const int inventoryIndex, const int id,
+ void addItem2(const int inventoryIndex,
+ const int id,
+ const int type,
const unsigned char color,
- const int amount, const int price);
-
- void addItemNoDup(const int id, const unsigned char color,
- const int amount, const int price);
+ const int amount,
+ const int price);
+
+ void addItemNoDup(const int id,
+ const int type,
+ const unsigned char color,
+ const int amount,
+ const int price);
/**
* Returns the number of items in the shop.
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 732e9e738..952da11c2 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -552,7 +552,8 @@ void ItemContainer::mouseReleased(MouseEvent &event)
const Item *const item = inventory->getItem(dragDrop.getTag());
if (item && !PlayerInfo::isItemProtected(item->getId()))
{
- mInventory->addItem(item->getId(), 1, 1, item->getColor(),
+ mInventory->addItem(item->getId(), item->getType(),
+ 1, 1, item->getColor(),
item->getIdentified(), item->getDamaged(),
item->getFavorite(),
false, false);
diff --git a/src/gui/widgets/selldialog.cpp b/src/gui/widgets/selldialog.cpp
index 2d45c39f8..4e289e93e 100644
--- a/src/gui/widgets/selldialog.cpp
+++ b/src/gui/widgets/selldialog.cpp
@@ -182,16 +182,27 @@ void SellDialog::addItem(const Item *const item, const int price)
if (!item)
return;
- mShopItems->addItem2(item->getInvIndex(), item->getId(),
- item->getColor(), item->getQuantity(), price);
+ mShopItems->addItem2(item->getInvIndex(),
+ item->getId(),
+ item->getType(),
+ item->getColor(),
+ item->getQuantity(),
+ price);
mShopItemList->adjustSize();
}
-void SellDialog::addItem(const int id, const unsigned char color,
- const int amount, const int price)
+void SellDialog::addItem(const int id,
+ const int type,
+ const unsigned char color,
+ const int amount,
+ const int price)
{
- mShopItems->addItem(id, color, amount, price);
+ mShopItems->addItem(id,
+ type,
+ color,
+ amount,
+ price);
mShopItemList->adjustSize();
}
diff --git a/src/gui/widgets/selldialog.h b/src/gui/widgets/selldialog.h
index d147947b5..a3f6137fb 100644
--- a/src/gui/widgets/selldialog.h
+++ b/src/gui/widgets/selldialog.h
@@ -90,8 +90,11 @@ class SellDialog notfinal : public Window,
*/
void setVisible(bool visible) override final;
- void addItem(const int id, const unsigned char color,
- const int amount, const int price);
+ void addItem(const int id,
+ const int type,
+ const unsigned char color,
+ const int amount,
+ const int price);
/**
* Returns true if any instances exist.
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp
index 61b5d7233..4340a671f 100644
--- a/src/gui/windows/buydialog.cpp
+++ b/src/gui/windows/buydialog.cpp
@@ -335,10 +335,13 @@ void BuyDialog::reset()
setMoney(0);
}
-void BuyDialog::addItem(const int id, const unsigned char color,
- const int amount, const int price)
+void BuyDialog::addItem(const int id,
+ const int type,
+ const unsigned char color,
+ const int amount,
+ const int price)
{
- mShopItems->addItem(id, color, amount, price);
+ mShopItems->addItem(id, type, color, amount, price);
mShopItemList->adjustSize();
}
diff --git a/src/gui/windows/buydialog.h b/src/gui/windows/buydialog.h
index 02862187c..af63432f7 100644
--- a/src/gui/windows/buydialog.h
+++ b/src/gui/windows/buydialog.h
@@ -91,8 +91,11 @@ class BuyDialog final : public Window,
/**
* Adds an item to the shop inventory.
*/
- void addItem(const int id, const unsigned char color,
- const int amount, const int price);
+ void addItem(const int id,
+ const int type,
+ const unsigned char color,
+ const int amount,
+ const int price);
/**
* Called when receiving actions from the widgets.
diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp
index 6eb51de98..548baa01d 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, false, false);
+ mItem = new Item(id, 0, 10000, 0, 1, true, false, false, false, false);
if (mUsage == ShopBuyAdd)
mMax = 10000;
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp
index 71290ef22..c99a4898d 100644
--- a/src/gui/windows/npcdialog.cpp
+++ b/src/gui/windows/npcdialog.cpp
@@ -468,7 +468,8 @@ void NpcDialog::action(const ActionEvent &event)
const Item *const item = inventoryWindow->getSelectedItem();
if (item)
{
- mInventory->addItem(item->getId(), 1, 1, item->getColor(),
+ mInventory->addItem(item->getId(), item->getType(),
+ 1, 1, item->getColor(),
item->getIdentified(), item->getDamaged(),
item->getFavorite(),
false, false);
diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp
index d72dab6b8..534218601 100644
--- a/src/gui/windows/shopwindow.cpp
+++ b/src/gui/windows/shopwindow.cpp
@@ -328,7 +328,10 @@ void ShopWindow::addBuyItem(const Item *const item, const int amount,
return;
const bool emp = isShopEmpty();
mBuyShopItems->addItemNoDup(item->getId(),
- item->getColor(), amount, price);
+ item->getType(),
+ item->getColor(),
+ amount,
+ price);
if (emp && localPlayer)
localPlayer->updateStatus();
@@ -342,7 +345,10 @@ void ShopWindow::addSellItem(const Item *const item, const int amount,
return;
const bool emp = isShopEmpty();
mSellShopItems->addItemNoDup(item->getId(),
- item->getColor(), amount, price);
+ item->getType(),
+ item->getColor(),
+ amount,
+ price);
if (emp && localPlayer)
localPlayer->updateStatus();
@@ -390,12 +396,12 @@ void ShopWindow::loadList()
if (tokens[1] && tokens[2] && mBuyShopItems)
{
mBuyShopItems->addItem(
- tokens[0], 1, tokens[1], tokens[2]);
+ tokens[0], 0, 1, tokens[1], tokens[2]);
}
if (tokens[3] && tokens[4] && mSellShopItems)
{
mSellShopItems->addItem(
- tokens[0], 1, tokens[3], tokens[4]);
+ tokens[0], 0, 1, tokens[3], tokens[4]);
}
}
}
@@ -663,7 +669,7 @@ void ShopWindow::showList(const std::string &nick, std::string data)
int amount = decodeStr(data.substr(f + 6, 3));
// +++ need impliment colors?
if (buyDialog && amount > 0)
- buyDialog->addItem(id, 1, amount, price);
+ buyDialog->addItem(id, 0, 1, amount, price);
if (sellDialog)
{
// +++ need support for colors
@@ -673,9 +679,9 @@ void ShopWindow::showList(const std::string &nick, std::string data)
if (item->getQuantity() < amount)
amount = item->getQuantity();
if (amount > 0)
- sellDialog->addItem(id, 1, amount, price);
+ sellDialog->addItem(id, 0, 1, amount, price);
else
- sellDialog->addItem(id, 1, -1, price);
+ sellDialog->addItem(id, 0, 1, -1, price);
}
}
}
@@ -736,7 +742,7 @@ void ShopWindow::processRequest(const std::string &nick, std::string data,
delete mTradeItem;
// +++ need impliment colors?
- mTradeItem = new ShopItem(-1, id, 1, amount, price);
+ mTradeItem = new ShopItem(-1, id, 0, 1, amount, price);
if (mode == BUY)
{
diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp
index c7cd1712d..ba1285366 100644
--- a/src/gui/windows/tradewindow.cpp
+++ b/src/gui/windows/tradewindow.cpp
@@ -191,6 +191,7 @@ void TradeWindow::setMoney(const int amount)
}
void TradeWindow::addItem(const int id,
+ const int type,
const bool own,
const int quantity,
const uint8_t refine,
@@ -200,11 +201,12 @@ void TradeWindow::addItem(const int id,
const bool favorite) const
{
Inventory *inv = own ? mMyInventory.get() : mPartnerInventory.get();
- inv->addItem(id, quantity, refine, color,
+ inv->addItem(id, type, quantity, refine, color,
identified, damaged, favorite, false, false);
}
void TradeWindow::addItem2(const int id,
+ const int type,
const int *const cards,
const int sz,
const bool own,
@@ -217,7 +219,7 @@ void TradeWindow::addItem2(const int id,
const bool equipment) const
{
Inventory *inv = own ? mMyInventory.get() : mPartnerInventory.get();
- const int slot = inv->addItem(id, quantity, refine, color,
+ const int slot = inv->addItem(id, type, quantity, refine, color,
identified, damaged, favorite, equipment, false);
if (slot >= 0)
inv->setCards(slot, cards, sz);
diff --git a/src/gui/windows/tradewindow.h b/src/gui/windows/tradewindow.h
index 5c782cf07..9dcfe91c1 100644
--- a/src/gui/windows/tradewindow.h
+++ b/src/gui/windows/tradewindow.h
@@ -68,6 +68,7 @@ class TradeWindow final : public Window,
* Add an item to the trade window.
*/
void addItem(const int id,
+ const int type,
const bool own,
const int quantity,
const uint8_t refine,
@@ -85,6 +86,7 @@ class TradeWindow final : public Window,
* Add an item to the trade window.
*/
void addItem2(const int id,
+ const int type,
const int *const cards,
const int sz,
const bool own,
diff --git a/src/inventory.cpp b/src/inventory.cpp
index da15cbe42..89683d15c 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -104,6 +104,7 @@ Item *Inventory::findItem(const int itemId, const unsigned char color) const
}
int Inventory::addItem(const int id,
+ const int type,
const int quantity,
const uint8_t refine,
const uint8_t color,
@@ -114,13 +115,14 @@ int Inventory::addItem(const int id,
const bool equipped)
{
const int slot = getFreeSlot();
- setItem(slot, id, quantity, refine, color,
+ setItem(slot, id, type, quantity, refine, color,
identified, damaged, favorite, equipment, equipped);
return slot;
}
void Inventory::setItem(const int index,
const int id,
+ const int type,
const int quantity,
const uint8_t refine,
const unsigned char color,
@@ -139,7 +141,7 @@ void Inventory::setItem(const int index,
Item *const item1 = mItems[index];
if (!item1 && id > 0)
{
- Item *const item = new Item(id, quantity, refine, color,
+ Item *const item = new Item(id, type, quantity, refine, color,
identified, damaged, favorite, equipment, equipped);
item->setInvIndex(index);
mItems[index] = item;
diff --git a/src/inventory.h b/src/inventory.h
index cddc00709..8ce5cf2cc 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -88,6 +88,7 @@ class Inventory final
* Adds a new item in a free slot.
*/
int addItem(const int id,
+ const int type,
const int quantity,
const uint8_t refine,
const unsigned char color,
@@ -102,6 +103,7 @@ class Inventory final
*/
void setItem(const int index,
const int id,
+ const int type,
const int quantity,
const uint8_t refine,
const unsigned char color,
diff --git a/src/item.cpp b/src/item.cpp
index 58148d2b1..34f72211f 100644
--- a/src/item.cpp
+++ b/src/item.cpp
@@ -38,6 +38,7 @@
DragDrop dragDrop(nullptr, DRAGDROP_SOURCE_EMPTY);
Item::Item(const int id,
+ const int type,
const int quantity,
const uint8_t refine,
const unsigned char color,
@@ -55,6 +56,7 @@ Item::Item(const int id,
mCards(),
mRefine(refine),
mInvIndex(0),
+ mType(type),
mEquipment(equipment),
mEquipped(equipped),
mInEquipment(false),
diff --git a/src/item.h b/src/item.h
index 15ea64a07..80343f400 100644
--- a/src/item.h
+++ b/src/item.h
@@ -43,6 +43,7 @@ class Item notfinal
* Constructor.
*/
Item(const int id,
+ const int type,
const int quantity,
const uint8_t refine,
const uint8_t color,
@@ -200,6 +201,12 @@ class Item notfinal
const int *getCards() const
{ return mCards; }
+ void setType(const int type)
+ { mType = type; }
+
+ int getType() const A_WARN_UNUSED
+ { return mType; }
+
int mId; /**< Item type id. */
unsigned char mColor;
int mQuantity; /**< Number of items. */
@@ -211,6 +218,7 @@ class Item notfinal
int mCards[maxCards];
uint8_t mRefine; /**< Item refine level. */
int mInvIndex; /**< Inventory index. */
+ int mType; /**< Item type. */
bool mEquipment; /**< Item is equipment. */
bool mEquipped; /**< Item is equipped. */
bool mInEquipment; /**< Item is in equipment */
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp
index dffcd18bc..236c0aeff 100644
--- a/src/net/ea/inventoryhandler.cpp
+++ b/src/net/ea/inventoryhandler.cpp
@@ -251,6 +251,7 @@ void InventoryHandler::processPlayerStorageStatus(Net::MessageIn &msg)
{
mStorage->setItem((*it).slot,
(*it).id,
+ (*it).type,
(*it).quantity,
(*it).refine,
(*it).color,
diff --git a/src/net/ea/inventoryitem.h b/src/net/ea/inventoryitem.h
index 1b6fd7f65..d1460e215 100644
--- a/src/net/ea/inventoryitem.h
+++ b/src/net/ea/inventoryitem.h
@@ -42,6 +42,7 @@ class InventoryItem final
public:
int slot;
int id;
+ int type;
int cards[4];
int quantity;
uint8_t refine;
@@ -53,6 +54,7 @@ class InventoryItem final
InventoryItem(const int slot0,
const int id0,
+ const int type0,
const int *const cards0,
const int quantity0,
const uint8_t refine0,
@@ -63,6 +65,7 @@ class InventoryItem final
const bool equip0) :
slot(slot0),
id(id0),
+ type(type0),
quantity(quantity0),
refine(refine0),
color(color0),
diff --git a/src/net/eathena/buysellhandler.cpp b/src/net/eathena/buysellhandler.cpp
index d4f7dfbaa..9f879e53b 100644
--- a/src/net/eathena/buysellhandler.cpp
+++ b/src/net/eathena/buysellhandler.cpp
@@ -99,10 +99,10 @@ 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");
const unsigned char color = 1;
- mBuyDialog->addItem(itemId, color, 0, value);
+ mBuyDialog->addItem(itemId, type, color, 0, value);
}
mBuyDialog->sort();
}
diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp
index 0623bfd54..0a5f49966 100644
--- a/src/net/eathena/inventoryhandler.cpp
+++ b/src/net/eathena/inventoryhandler.cpp
@@ -328,7 +328,7 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg)
{
const int index = msg.readInt16("index") - INVENTORY_OFFSET;
const int itemId = msg.readInt16("item id");
- msg.readUInt8("item type");
+ const int itemType = msg.readUInt8("item type");
msg.readInt32("location");
const int equipType = msg.readInt32("wear state");
const uint8_t refine = static_cast<uint8_t>(msg.readInt8("refine"));
@@ -342,7 +342,7 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg)
flags.byte = msg.readUInt8("flags");
if (inventory)
{
- inventory->setItem(index, itemId, 1, refine,
+ inventory->setItem(index, itemId, itemType, 1, refine,
1, flags.bits.isIdentified, flags.bits.isDamaged,
flags.bits.isFavorite,
true, false);
@@ -377,7 +377,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
for (int f = 0; f < 4; f++)
cards[f] = msg.readInt16("card");
const int equipType = msg.readInt32("location");
- msg.readUInt8("item type");
+ const int itemType = msg.readUInt8("item type");
const unsigned char err = msg.readUInt8("result");
msg.readInt32("hire expire date");
msg.readInt16("bind on equip");
@@ -440,7 +440,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
if (item && item->getId() == itemId)
amount += item->getQuantity();
- inventory->setItem(index, itemId, amount, refine,
+ inventory->setItem(index, itemId, itemType, amount, refine,
1, identified != 0, damaged != 0, false,
equipType != 0, false);
inventory->setCards(index, cards, 4);
@@ -473,7 +473,7 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg)
{
const int index = msg.readInt16("item index") - INVENTORY_OFFSET;
const int itemId = msg.readInt16("item id");
- msg.readUInt8("item type");
+ const int itemType = msg.readUInt8("item type");
const int amount = msg.readInt16("count");
msg.readInt32("wear state / equip");
int cards[4];
@@ -485,7 +485,7 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg)
if (inventory)
{
- inventory->setItem(index, itemId, amount,
+ inventory->setItem(index, itemId, itemType, amount,
0, 1, flags.bits.isIdentified,
flags.bits.isDamaged, flags.bits.isFavorite,
false, false);
@@ -509,7 +509,7 @@ void InventoryHandler::processPlayerStorage(Net::MessageIn &msg)
{
const int index = msg.readInt16("item index") - STORAGE_OFFSET;
const int itemId = msg.readInt16("item id");
- msg.readUInt8("item type");
+ const int itemType = msg.readUInt8("item type");
const int amount = msg.readInt16("count");
msg.readInt32("wear state / equip");
int cards[4];
@@ -519,7 +519,7 @@ void InventoryHandler::processPlayerStorage(Net::MessageIn &msg)
ItemFlags flags;
flags.byte = msg.readUInt8("flags");
- mInventoryItems.push_back(Ea::InventoryItem(index, itemId,
+ mInventoryItems.push_back(Ea::InventoryItem(index, itemId, itemType,
cards, amount, 0, 1, flags.bits.isIdentified,
flags.bits.isDamaged, flags.bits.isFavorite, false));
}
@@ -603,7 +603,7 @@ void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg)
{
const int index = msg.readInt16("index") - STORAGE_OFFSET;
const int itemId = msg.readInt16("item id");
- msg.readUInt8("item type");
+ const int itemType = msg.readUInt8("item type");
const int amount = 1;
msg.readInt32("location");
msg.readInt32("wear state");
@@ -617,7 +617,7 @@ void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg)
ItemFlags flags;
flags.byte = msg.readUInt8("flags");
- mInventoryItems.push_back(Ea::InventoryItem(index, itemId,
+ mInventoryItems.push_back(Ea::InventoryItem(index, itemId, itemType,
cards, amount, refine, 1, flags.bits.isIdentified,
flags.bits.isDamaged, flags.bits.isFavorite, false));
}
@@ -631,7 +631,7 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg)
const int index = msg.readInt16("index") - STORAGE_OFFSET;
const int amount = msg.readInt32("amount");
const int itemId = msg.readInt16("item id");
- msg.readUInt8("type");
+ const int itemType = msg.readUInt8("type");
const unsigned char identified = msg.readUInt8("identify");
msg.readUInt8("attribute");
const uint8_t refine = msg.readUInt8("refine");
@@ -648,7 +648,7 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg)
{
if (mStorage)
{
- mStorage->setItem(index, itemId, amount,
+ mStorage->setItem(index, itemId, itemType, amount,
refine, 1, identified != 0, false, false, false, false);
mStorage->setCards(index, cards, 4);
}
diff --git a/src/net/eathena/markethandler.cpp b/src/net/eathena/markethandler.cpp
index fbd0e0987..d7ceeabe4 100644
--- a/src/net/eathena/markethandler.cpp
+++ b/src/net/eathena/markethandler.cpp
@@ -82,12 +82,12 @@ void MarketHandler::processMarketOpen(Net::MessageIn &msg)
for (int f = 0; f < len; f ++)
{
const int itemId = msg.readInt16("item id");
- msg.readUInt8("type");
+ const int type = msg.readUInt8("type");
const int value = msg.readInt32("price");
const int amount = msg.readInt32("amount");
msg.readInt16("view");
const unsigned char color = 1;
- mBuyDialog->addItem(itemId, color, amount, value);
+ mBuyDialog->addItem(itemId, type, color, amount, value);
}
}
diff --git a/src/net/eathena/tradehandler.cpp b/src/net/eathena/tradehandler.cpp
index 88bcceb10..457bb0fe4 100644
--- a/src/net/eathena/tradehandler.cpp
+++ b/src/net/eathena/tradehandler.cpp
@@ -184,7 +184,7 @@ void TradeHandler::processTradeResponse(Net::MessageIn &msg)
void TradeHandler::processTradeItemAdd(Net::MessageIn &msg)
{
const int type = msg.readInt16("type");
- msg.readUInt8("item type");
+ const int itemType = msg.readUInt8("item type");
const int amount = msg.readInt32("amount");
const uint8_t identify = msg.readUInt8("identify");
msg.readUInt8("attribute");
@@ -201,10 +201,11 @@ void TradeHandler::processTradeItemAdd(Net::MessageIn &msg)
}
else
{
- tradeWindow->addItem2(type,
+ tradeWindow->addItem2(type, itemType,
cards, 4,
false, amount,
- refine, 1, identify != 0, false, false, false);
+ refine, 1, identify != 0,
+ false, false, false);
}
}
}
@@ -224,7 +225,7 @@ void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg)
return;
if (tradeWindow)
{
- tradeWindow->addItem2(item->getId(),
+ tradeWindow->addItem2(item->getId(), item->getType(),
item->getCards(), 4,
true, mQuantity, item->getRefine(), item->getColor(),
item->getIdentified(), item->getDamaged(),
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(),
diff --git a/src/shopitem.cpp b/src/shopitem.cpp
index 2dc82f010..d87668d93 100644
--- a/src/shopitem.cpp
+++ b/src/shopitem.cpp
@@ -34,10 +34,11 @@
ShopItem::ShopItem(const int inventoryIndex,
const int id,
+ const int type,
const unsigned char color,
const int quantity,
const int price) :
- Item(id, 0, 0, color, true, false, false, false, false),
+ Item(id, type, 0, 0, color, true, false, false, false, false),
mDisplayName(),
mDuplicates(),
mPrice(price),
@@ -48,8 +49,11 @@ ShopItem::ShopItem(const int inventoryIndex,
addDuplicate(inventoryIndex, quantity);
}
-ShopItem::ShopItem(const int id, const unsigned char color, const int price) :
- Item(id, 0, 0, color, true, false, false, false, false),
+ShopItem::ShopItem(const int id,
+ const int type,
+ const unsigned char color,
+ const int price) :
+ Item(id, type, 0, 0, color, true, false, false, false, false),
mDisplayName(),
mDuplicates(),
mPrice(price),
diff --git a/src/shopitem.h b/src/shopitem.h
index 42616d389..c64d5f901 100644
--- a/src/shopitem.h
+++ b/src/shopitem.h
@@ -44,9 +44,12 @@ class ShopItem final : public Item
* @param quantity number of available copies of the item
* @param price price of the item
*/
- ShopItem(const int inventoryIndex, const int id,
+ ShopItem(const int inventoryIndex,
+ const int id,
+ const int type,
const unsigned char color,
- const int quantity, const int price);
+ const int quantity,
+ const int price);
/**
* Constructor. Creates a new ShopItem. Inventory index will be set to
@@ -55,7 +58,10 @@ class ShopItem final : public Item
* @param id the id of the item
* @param price price of the item
*/
- ShopItem(const int id, const unsigned char color, const int price);
+ ShopItem(const int id,
+ const int type,
+ const unsigned char color,
+ const int price);
A_DELETE_COPY(ShopItem)