summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/manaserv/buysellhandler.cpp3
-rw-r--r--src/net/manaserv/npchandler.cpp3
-rw-r--r--src/net/manaserv/npchandler.h2
-rw-r--r--src/net/npchandler.h3
-rw-r--r--src/net/tmwa/buysellhandler.cpp3
-rw-r--r--src/net/tmwa/npchandler.cpp19
-rw-r--r--src/net/tmwa/npchandler.h2
7 files changed, 24 insertions, 11 deletions
diff --git a/src/net/manaserv/buysellhandler.cpp b/src/net/manaserv/buysellhandler.cpp
index 07737e20b..a519125de 100644
--- a/src/net/manaserv/buysellhandler.cpp
+++ b/src/net/manaserv/buysellhandler.cpp
@@ -79,7 +79,8 @@ void BuySellHandler::handleMessage(Net::MessageIn &msg)
int itemId = msg.readInt16();
int amount = msg.readInt16();
int value = msg.readInt16();
- dialog->addItem(itemId, amount, value);
+ // colors not supported, using 1.
+ dialog->addItem(itemId, 1, amount, value);
}
break;
}
diff --git a/src/net/manaserv/npchandler.cpp b/src/net/manaserv/npchandler.cpp
index 3117f9455..2c389bc7d 100644
--- a/src/net/manaserv/npchandler.cpp
+++ b/src/net/manaserv/npchandler.cpp
@@ -209,7 +209,8 @@ void NpcHandler::sell(int beingId _UNUSED_)
// TODO
}
-void NpcHandler::buyItem(int beingId _UNUSED_, int itemId, int amount)
+void NpcHandler::buyItem(int beingId _UNUSED_, int itemId,
+ unsigned char color _UNUSED_, int amount)
{
MessageOut msg(PGMSG_NPC_BUYSELL);
msg.writeInt16(itemId);
diff --git a/src/net/manaserv/npchandler.h b/src/net/manaserv/npchandler.h
index faaff060c..6ecfb4e97 100644
--- a/src/net/manaserv/npchandler.h
+++ b/src/net/manaserv/npchandler.h
@@ -68,7 +68,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);
diff --git a/src/net/npchandler.h b/src/net/npchandler.h
index 5850b9475..40b97deef 100644
--- a/src/net/npchandler.h
+++ b/src/net/npchandler.h
@@ -55,7 +55,8 @@ class NpcHandler
virtual void sell(int beingId) = 0;
- virtual void buyItem(int beingId, int itemId, int amount) = 0;
+ virtual void buyItem(int beingId, int itemId, unsigned char color,
+ int amount) = 0;
virtual void sellItem(int beingId, int itemId, int amount) = 0;
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);