summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-03-03 21:24:41 +0200
committerAndrei Karas <akaras@inbox.ru>2011-03-03 21:24:41 +0200
commitcb8ccdd838b0cc08a1620f1ed9c311d75f1aceba (patch)
treeb942d4501a9625fc3c50707b06b606058a90fca6
parenta9c8a8778611ae67a52469937a178fa2af0f5098 (diff)
downloadplus-cb8ccdd838b0cc08a1620f1ed9c311d75f1aceba.tar.gz
plus-cb8ccdd838b0cc08a1620f1ed9c311d75f1aceba.tar.bz2
plus-cb8ccdd838b0cc08a1620f1ed9c311d75f1aceba.tar.xz
plus-cb8ccdd838b0cc08a1620f1ed9c311d75f1aceba.zip
Add extended buy list items.
-rw-r--r--src/item.h2
-rw-r--r--src/net/tmwa/buysellhandler.cpp11
2 files changed, 11 insertions, 2 deletions
diff --git a/src/item.h b/src/item.h
index ae2cc9dfb..a5982c98e 100644
--- a/src/item.h
+++ b/src/item.h
@@ -158,7 +158,7 @@ class Item
bool isHaveTag(int tagId);
- unsigned char getColor()
+ unsigned char getColor() const
{ return mColor; }
protected:
diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp
index 87b6b8175..bf5df61a1 100644
--- a/src/net/tmwa/buysellhandler.cpp
+++ b/src/net/tmwa/buysellhandler.cpp
@@ -84,8 +84,12 @@ void BuySellHandler::handleMessage(Net::MessageIn &msg)
break;
case SMSG_NPC_BUY:
+ {
msg.readInt16(); // length
- n_items = (msg.getLength() - 4) / 11;
+ int sz = 11;
+ if (serverVersion > 0)
+ sz += 1;
+ n_items = (msg.getLength() - 4) / sz;
mBuyDialog = new BuyDialog(mNpcId);
mBuyDialog->setMoney(PlayerInfo::getAttribute(MONEY));
@@ -95,9 +99,14 @@ void BuySellHandler::handleMessage(Net::MessageIn &msg)
msg.readInt32(); // DCvalue
msg.readInt8(); // type
int itemId = msg.readInt16();
+ unsigned char color = 1;
+ if (serverVersion > 0)
+ color = msg.readInt8();
mBuyDialog->addItem(itemId, 0, value);
+// mBuyDialog->addItem(itemId, color, 0, value);
}
break;
+ }
case SMSG_NPC_SELL:
msg.readInt16(); // length