summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-02-27 03:36:52 +0200
committerAndrei Karas <akaras@inbox.ru>2011-02-27 03:36:52 +0200
commit1b57518ca97c670174f89c5af28659b6ad0c3d42 (patch)
tree369c6e2f8cfbd791f252de68c0f85bd1af47c351 /src/net
parent037248d338291529e0c044a80ca8345abe05dd2b (diff)
downloadplus-1b57518ca97c670174f89c5af28659b6ad0c3d42.tar.gz
plus-1b57518ca97c670174f89c5af28659b6ad0c3d42.tar.bz2
plus-1b57518ca97c670174f89c5af28659b6ad0c3d42.tar.xz
plus-1b57518ca97c670174f89c5af28659b6ad0c3d42.zip
Implement receiving item color from server.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/manaserv/tradehandler.cpp4
-rw-r--r--src/net/tmwa/inventoryhandler.cpp13
-rw-r--r--src/net/tmwa/inventoryhandler.h5
-rw-r--r--src/net/tmwa/tradehandler.cpp14
4 files changed, 24 insertions, 12 deletions
diff --git a/src/net/manaserv/tradehandler.cpp b/src/net/manaserv/tradehandler.cpp
index 18a60a424..cd3a21aca 100644
--- a/src/net/manaserv/tradehandler.cpp
+++ b/src/net/manaserv/tradehandler.cpp
@@ -134,7 +134,7 @@ void TradeHandler::handleMessage(Net::MessageIn &msg)
{
int type = msg.readInt16();
int amount = msg.readInt8();
- tradeWindow->addItem(type, false, amount, 0);
+ tradeWindow->addItem(type, false, amount, 0, 1);
} break;
case GPMSG_TRADE_SET_MONEY:
@@ -201,7 +201,7 @@ void TradeHandler::addItem(Item *item, int amount)
msg.writeInt8(amount);
gameServerConnection->send(msg);
- tradeWindow->addItem(item->getId(), true, amount, 0);
+ tradeWindow->addItem(item->getId(), true, amount, 0, 1);
item->increaseQuantity(-amount);
}
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index 9828fb957..340f0c4b2 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -223,7 +223,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
else
{
mInventoryItems.push_back(InventoryItem(index, itemId,
- amount, 0, false));
+ amount, 0, identified, false));
}
}
break;
@@ -256,7 +256,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
}
mInventoryItems.push_back(InventoryItem(index, itemId, amount,
- refine, false));
+ refine, identified, false));
}
break;
@@ -381,7 +381,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
for (; it != it_end; ++it)
{
mStorage->setItem((*it).slot, (*it).id, (*it).quantity,
- (*it).equip);
+ (*it).refine, (*it).color, (*it).equip);
}
mInventoryItems.clear();
@@ -403,13 +403,16 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
if (Item *item = mStorage->getItem(index))
{
- item->setId(itemId);
+ item->setId(itemId, identified);
item->increaseQuantity(amount);
}
else
{
if (mStorage)
- mStorage->setItem(index, itemId, amount, false);
+ {
+ mStorage->setItem(index, itemId, amount, refine,
+ identified, false);
+ }
}
break;
diff --git a/src/net/tmwa/inventoryhandler.h b/src/net/tmwa/inventoryhandler.h
index cc2286f2f..8dd39a781 100644
--- a/src/net/tmwa/inventoryhandler.h
+++ b/src/net/tmwa/inventoryhandler.h
@@ -109,15 +109,18 @@ class InventoryItem
int slot;
int id;
int quantity;
+ unsigned char color;
int refine;
bool equip;
- InventoryItem(int slot, int id, int quantity, int refine, bool equip)
+ InventoryItem(int slot, int id, int quantity, int refine,
+ unsigned char color, bool equip)
{
this->slot = slot;
this->id = id;
this->quantity = quantity;
this->refine = refine;
+ this->color = color;
this->equip = equip;
}
};
diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp
index 3fb05399d..815c8f54d 100644
--- a/src/net/tmwa/tradehandler.cpp
+++ b/src/net/tmwa/tradehandler.cpp
@@ -193,18 +193,23 @@ void TradeHandler::handleMessage(Net::MessageIn &msg)
{
int amount = msg.readInt32();
int type = msg.readInt16();
- msg.readInt8(); // identified flag
+ int identify = msg.readInt8(); // identified flag
msg.readInt8(); // attribute
- msg.readInt8(); // refine
+ int refine = msg.readInt8(); // refine
msg.skip(8); // card (4 shorts)
// TODO: handle also identified, etc
if (tradeWindow)
{
if (type == 0)
+ {
tradeWindow->setMoney(amount);
+ }
else
- tradeWindow->addItem(type, false, amount, false);
+ {
+ tradeWindow->addItem(type, false, amount, refine,
+ identify, false);
+ }
}
}
break;
@@ -233,7 +238,8 @@ void TradeHandler::handleMessage(Net::MessageIn &msg)
if (tradeWindow)
{
tradeWindow->addItem(item->getId(), true, quantity,
- item->isEquipment());
+ item->getRefine(), item->getColor(),
+ item->isEquipment());
}
item->increaseQuantity(-quantity);
break;