From 9437d4943a8b299b057020ee114b230399965abd Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 3 Mar 2011 23:13:07 +0200 Subject: Add colors to buy/sell dialogs. --- src/net/tmwa/buysellhandler.cpp | 3 +-- src/net/tmwa/npchandler.cpp | 19 +++++++++++++++---- src/net/tmwa/npchandler.h | 2 +- 3 files changed, 17 insertions(+), 7 deletions(-) (limited to 'src/net/tmwa') diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp index bf5df61a1..07d5bcc96 100644 --- a/src/net/tmwa/buysellhandler.cpp +++ b/src/net/tmwa/buysellhandler.cpp @@ -102,8 +102,7 @@ void BuySellHandler::handleMessage(Net::MessageIn &msg) unsigned char color = 1; if (serverVersion > 0) color = msg.readInt8(); - mBuyDialog->addItem(itemId, 0, value); -// mBuyDialog->addItem(itemId, color, 0, value); + mBuyDialog->addItem(itemId, color, 0, value); } break; } diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp index 553108fb8..8ddfeb090 100644 --- a/src/net/tmwa/npchandler.cpp +++ b/src/net/tmwa/npchandler.cpp @@ -221,12 +221,23 @@ void NpcHandler::sell(int beingId) outMsg.writeInt8(1); // Sell } -void NpcHandler::buyItem(int beingId _UNUSED_, int itemId, int amount) +void NpcHandler::buyItem(int beingId _UNUSED_, int itemId, + unsigned char color, int amount) { MessageOut outMsg(CMSG_NPC_BUY_REQUEST); - outMsg.writeInt16(8); // One item (length of packet) - outMsg.writeInt16(amount); - outMsg.writeInt16(itemId); + if (serverVersion > 0) + { + outMsg.writeInt16(9); // One item (length of packet) + outMsg.writeInt16(amount); + outMsg.writeInt16(itemId); + outMsg.writeInt8(color); + } + else + { + outMsg.writeInt16(8); // One item (length of packet) + outMsg.writeInt16(amount); + outMsg.writeInt16(itemId); + } } void NpcHandler::sellItem(int beingId _UNUSED_, int itemId, int amount) diff --git a/src/net/tmwa/npchandler.h b/src/net/tmwa/npchandler.h index c2db3394d..83d8e7981 100644 --- a/src/net/tmwa/npchandler.h +++ b/src/net/tmwa/npchandler.h @@ -69,7 +69,7 @@ class NpcHandler : public MessageHandler, public Net::NpcHandler void sell(int beingId); - void buyItem(int beingId, int itemId, int amount); + void buyItem(int beingId, int itemId, unsigned char color, int amount); void sellItem(int beingId, int itemId, int amount); -- cgit v1.2.3-70-g09d2