From 21a671a5de9876ae79112b7a6da1259c2198300f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 24 Dec 2014 13:30:25 +0300 Subject: eathena: add partial support for packet SMSG_NPC_CASH_SHOP_OPEN 0x0287. --- src/net/eathena/cashshophandler.cpp | 21 +++++++++++++++++++++ src/net/eathena/cashshophandler.h | 3 +++ src/net/eathena/packets.h | 2 +- src/net/eathena/protocol.h | 1 + 4 files changed, 26 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/net/eathena/cashshophandler.cpp b/src/net/eathena/cashshophandler.cpp index 5e105babe..39db23b04 100644 --- a/src/net/eathena/cashshophandler.cpp +++ b/src/net/eathena/cashshophandler.cpp @@ -20,6 +20,8 @@ #include "net/eathena/cashshophandler.h" +#include "net/eathena/protocol.h" + #include "debug.h" extern Net::CashShopHandler *cashShopHandler; @@ -32,6 +34,7 @@ CashShopHandler::CashShopHandler() : { static const uint16_t _messages[] = { + SMSG_NPC_CASH_SHOP_OPEN, 0 }; handledMessages = _messages; @@ -42,9 +45,27 @@ void CashShopHandler::handleMessage(Net::MessageIn &msg) { switch (msg.getId()) { + case SMSG_NPC_CASH_SHOP_OPEN: + processCashShopOpen(msg); + break; + default: break; } } +void CashShopHandler::processCashShopOpen(Net::MessageIn &msg) +{ + const int count = (msg.readInt16("len") - 12) / 11; + msg.readInt32("cash points"); + msg.readInt32("kafra points"); + for (int f = 0; f < count; f ++) + { + msg.readInt32("price"); + msg.readInt32("discount price"); + msg.readUInt8("item type"); + msg.readInt16("item id"); + } +} + } // namespace EAthena diff --git a/src/net/eathena/cashshophandler.h b/src/net/eathena/cashshophandler.h index 4b16d99d5..d0e42cc63 100644 --- a/src/net/eathena/cashshophandler.h +++ b/src/net/eathena/cashshophandler.h @@ -36,6 +36,9 @@ class CashShopHandler final : public MessageHandler, A_DELETE_COPY(CashShopHandler) void handleMessage(Net::MessageIn &msg) override final; + + protected: + static void processCashShopOpen(Net::MessageIn &msg); }; } // namespace EAthena diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h index 0f9633440..336f1311c 100644 --- a/src/net/eathena/packets.h +++ b/src/net/eathena/packets.h @@ -93,7 +93,7 @@ int16_t packet_lengths[] = 6, 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, // #0x0280 - 0, 0, 0, 6, 14, 0, 0, 0, 0, 0, 18, 0, 0, 0, 4, 0, + 0, 0, 0, 6, 14, 0, 0, -1, 0, 0, 18, 0, 0, 0, 4, 0, 4, 4, 0, 0, 0, 0, 0, 0, 8, 6, 0, 80, 0, -1, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 107, 6, -1, 0, 7, 22, 191, 0, 0, 0, 0, 0, 0, diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index d081ea0d6..45c8e4d6e 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -151,6 +151,7 @@ #define SMSG_NPC_CHANGETITLE 0x0b06 #define SMSG_NPC_MARKET_OPEN 0x09d5 #define SMSG_NPC_MARKET_BUY_ACK 0x09d7 +#define SMSG_NPC_CASH_SHOP_OPEN 0x0287 #define SMSG_PLAYER_CHAT 0x008e /**< Player talks */ #define SMSG_WHISPER 0x0097 /**< Whisper Recieved */ -- cgit v1.2.3-60-g2f50