summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-23 01:27:45 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-23 01:27:45 +0300
commit9be90b76adb1518c4ffe0e365a18c5afcc3158f2 (patch)
treebbfea959321e05c329f18ac37757be91f38b9df8 /src/net
parent7f1053c5ce9e80485730290d002f7ae25db83996 (diff)
downloadManaVerse-9be90b76adb1518c4ffe0e365a18c5afcc3158f2.tar.gz
ManaVerse-9be90b76adb1518c4ffe0e365a18c5afcc3158f2.tar.bz2
ManaVerse-9be90b76adb1518c4ffe0e365a18c5afcc3158f2.tar.xz
ManaVerse-9be90b76adb1518c4ffe0e365a18c5afcc3158f2.zip
Add item type to item object.
Diffstat (limited to 'src/net')
-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
9 files changed, 45 insertions, 38 deletions
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(),