From 8a85cb2bc295ad0ec9e275782b7392c2f99ba134 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 21 Dec 2014 23:54:10 +0300 Subject: eathena: add partial support for packet SMSG_NPC_MARKET_OPEN 0x09d5. --- src/net/eathena/markethandler.cpp | 20 ++++++++++++++++++++ src/net/eathena/markethandler.h | 3 +++ src/net/eathena/packets.h | 2 +- src/net/eathena/protocol.h | 2 +- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/net/eathena/markethandler.cpp b/src/net/eathena/markethandler.cpp index 2643dd24b..3bbe678b7 100644 --- a/src/net/eathena/markethandler.cpp +++ b/src/net/eathena/markethandler.cpp @@ -20,6 +20,8 @@ #include "net/eathena/markethandler.h" +#include "net/eathena/protocol.h" + #include "debug.h" extern Net::MarketHandler *marketHandler; @@ -32,6 +34,7 @@ MarketHandler::MarketHandler() : { static const uint16_t _messages[] = { + SMSG_NPC_MARKET_OPEN, 0 }; handledMessages = _messages; @@ -42,9 +45,26 @@ void MarketHandler::handleMessage(Net::MessageIn &msg) { switch (msg.getId()) { + case SMSG_NPC_MARKET_OPEN: + processMarketOpen(msg); + break; + default: break; } } +void MarketHandler::processMarketOpen(Net::MessageIn &msg) +{ + const int len = (msg.readInt16("len") - 4) / 13; + for (int f = 0; f < len; f ++) + { + msg.readInt16("item id"); + msg.readUInt8("type"); + msg.readInt32("price"); + msg.readInt32("amount"); + msg.readInt16("view"); + } +} + } // namespace EAthena diff --git a/src/net/eathena/markethandler.h b/src/net/eathena/markethandler.h index c10d347eb..0ff713ed1 100644 --- a/src/net/eathena/markethandler.h +++ b/src/net/eathena/markethandler.h @@ -36,6 +36,9 @@ class MarketHandler final : public MessageHandler, A_DELETE_COPY(MarketHandler) void handleMessage(Net::MessageIn &msg) override final; + + protected: + void processMarketOpen(Net::MessageIn &msg); }; } // namespace EAthena diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h index 8c21b67c8..bf10c0315 100644 --- a/src/net/eathena/packets.h +++ b/src/net/eathena/packets.h @@ -253,7 +253,7 @@ int16_t packet_lengths[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // #0x09C0 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, + 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0 1 2 3 4 5 6 7 8 9 a b c d e f diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index aac136f94..138cdc04d 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -149,6 +149,7 @@ #define SMSG_NPC_STR_INPUT 0x01d4 /**< String input */ #define SMSG_NPC_SHOW_PROGRESS_BAR 0x02f0 #define SMSG_NPC_CHANGETITLE 0x0b06 +#define SMSG_NPC_MARKET_OPEN 0x09d5 #define SMSG_PLAYER_CHAT 0x008e /**< Player talks */ #define SMSG_WHISPER 0x0097 /**< Whisper Recieved */ #define SMSG_WHISPER_RESPONSE 0x09df @@ -286,7 +287,6 @@ #define SMSG_MERCENARY_SKILLS 0x029d #define SMSG_MERCENARY_ACTION 0x029f - #define SMSG_HOMUNCULUS_SKILLS 0x0235 #define SMSG_HOMUNCULUS_DATA 0x0230 #define SMSG_HOMUNCULUS_INFO 0x022e -- cgit v1.2.3-60-g2f50