summaryrefslogtreecommitdiff
path: root/src/net/tmwa/inventoryhandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-03-02 01:51:25 +0200
committerAndrei Karas <akaras@inbox.ru>2011-03-02 01:51:25 +0200
commit582428edf9e40db0d1ed7b78222562a7a5031fe4 (patch)
tree2a9f4b1303a3647e3d7bf4599e85ebd358159b4d /src/net/tmwa/inventoryhandler.cpp
parent218dbbd7ce5415fe8c26857f06c5907c7cc6d175 (diff)
downloadmv-582428edf9e40db0d1ed7b78222562a7a5031fe4.tar.gz
mv-582428edf9e40db0d1ed7b78222562a7a5031fe4.tar.bz2
mv-582428edf9e40db0d1ed7b78222562a7a5031fe4.tar.xz
mv-582428edf9e40db0d1ed7b78222562a7a5031fe4.zip
Add serverversion checks. And disable some advanced features in old servers.
Diffstat (limited to 'src/net/tmwa/inventoryhandler.cpp')
-rw-r--r--src/net/tmwa/inventoryhandler.cpp32
1 files changed, 23 insertions, 9 deletions
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index fc32c3ec3..7113cddb3 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -209,6 +209,9 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
cards[0], cards[1], cards[2], cards[3]);
}
+ if (serverVersion < 1 && identified > 1)
+ identified = 1;
+
if (msg.getId() == SMSG_PLAYER_INVENTORY)
{
// Trick because arrows are not considered equipment
@@ -255,6 +258,9 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
refine);
}
+ if (serverVersion < 1 && identified > 1)
+ identified = 1;
+
mInventoryItems.push_back(InventoryItem(index, itemId, amount,
refine, identified, false));
}
@@ -299,6 +305,9 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
if (item && item->getId() == itemId)
amount += inventory->getItem(index)->getQuantity();
+ if (serverVersion < 1 && identified > 1)
+ identified = 1;
+
inventory->setItem(index, itemId, amount, refine,
identified, equipType != 0);
}
@@ -410,6 +419,9 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
{
if (mStorage)
{
+ if (serverVersion < 1 && identified > 1)
+ identified = 1;
+
mStorage->setItem(index, itemId, amount, refine,
identified, false);
}
@@ -458,29 +470,31 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
{
index = msg.readInt16() - INVENTORY_OFFSET;
itemId = msg.readInt16();
- if (itemId == 1172)
- logger->log("step1");
int itemType = msg.readInt8(); // type
identified = msg.readInt8(); // identify flag
+
msg.readInt16(); // equip type
equipType = msg.readInt16();
msg.readInt8(); // attribute
refine = msg.readInt8();
msg.skip(8); // card
- if (itemId == 1172)
- logger->log("step2");
- if (inventory)
- inventory->setItem(index, itemId, 1, refine, identified, true);
-
- if (equipType)
- mEquips.setEquipment(getSlot(equipType), index);
if (debugInventory)
{
logger->log("Index: %d, ID: %d, Type: %d, Identified: %d",
index, itemId, itemType, identified);
}
+
+ if (serverVersion < 1 && identified > 1)
+ identified = 1;
+
+ if (inventory)
+ inventory->setItem(index, itemId, 1, refine, identified, true);
+
+ if (equipType)
+ mEquips.setEquipment(getSlot(equipType), index);
+
}
break;