summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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