From 68581ace3255ea4d8b0f0e5b33a33633a27b8e42 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 20 Jan 2015 23:48:46 +0300 Subject: eathena: add packet SMSG_NPC_AREA 0x0b0b Change protocol version to 5. --- src/being/being.cpp | 1 + src/being/being.h | 7 +++++++ src/net/eathena/network.h | 2 +- src/net/eathena/npchandler.cpp | 19 +++++++++++++++++++ src/net/eathena/npchandler.h | 2 ++ src/net/eathena/packets.h | 2 +- src/net/eathena/protocol.h | 1 + 7 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/being/being.cpp b/src/being/being.cpp index 03e13156c..2e64a9cd9 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -205,6 +205,7 @@ Being::Being(const int id, mUsageCounter(1), mKarma(0), mManner(0), + mAreaSize(11), mLook(0U), mHairColor(0), mErased(false), diff --git a/src/being/being.h b/src/being/being.h index e11f36003..361277f27 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -908,6 +908,12 @@ class Being notfinal : public ActorSprite, void enablePetAi() { mPetAi = true; } + int getAreaSize() const + { return mAreaSize; } + + void setAreaSize(const int areaSize) + { mAreaSize = areaSize; } + protected: /** * Updates name's location. @@ -1076,6 +1082,7 @@ class Being notfinal : public ActorSprite, int mUsageCounter; int mKarma; int mManner; + int mAreaSize; uint16_t mLook; unsigned char mHairColor; bool mErased; diff --git a/src/net/eathena/network.h b/src/net/eathena/network.h index 8920dd746..0e51b5a38 100644 --- a/src/net/eathena/network.h +++ b/src/net/eathena/network.h @@ -29,7 +29,7 @@ * Protocol version, reported to the eAthena char and mapserver who can adjust * the protocol accordingly. */ -#define CLIENT_PROTOCOL_VERSION 4 +#define CLIENT_PROTOCOL_VERSION 5 namespace EAthena { diff --git a/src/net/eathena/npchandler.cpp b/src/net/eathena/npchandler.cpp index 0bb2e2587..e797c0477 100644 --- a/src/net/eathena/npchandler.cpp +++ b/src/net/eathena/npchandler.cpp @@ -22,6 +22,8 @@ #include "net/eathena/npchandler.h" +#include "actormanager.h" + #include "being/localplayer.h" #include "gui/windows/npcdialog.h" @@ -56,6 +58,7 @@ NpcHandler::NpcHandler() : SMSG_NPC_CLOSE_TIMEOUT, SMSG_NPC_COMMAND, SMSG_NPC_CHANGETITLE, + SMSG_NPC_AREA, 0 }; handledMessages = _messages; @@ -114,6 +117,10 @@ void NpcHandler::handleMessage(Net::MessageIn &msg) processChangeTitle(msg); break; + case SMSG_NPC_AREA: + processArea(msg); + break; + default: break; } @@ -351,4 +358,16 @@ void NpcHandler::processNpcCloseTimeout(Net::MessageIn &msg) msg.readInt32("npc id"); } +void NpcHandler::processArea(Net::MessageIn &msg) +{ + const int len = msg.readInt16("len"); + if (len < 12) + return; + Being *const dstBeing = actorManager->findBeing( + msg.readInt32("npc id")); + const int area = msg.readInt32("area size"); + if (dstBeing) + dstBeing->setAreaSize(area); +} + } // namespace EAthena diff --git a/src/net/eathena/npchandler.h b/src/net/eathena/npchandler.h index dc6eb8f97..c42030fd0 100644 --- a/src/net/eathena/npchandler.h +++ b/src/net/eathena/npchandler.h @@ -95,6 +95,8 @@ class NpcHandler final : public MessageHandler, public Ea::NpcHandler static void processNpcShowProgressBar(Net::MessageIn &msg); static void processNpcCloseTimeout(Net::MessageIn &msg); + + static void processArea(Net::MessageIn &msg); }; } // namespace EAthena diff --git a/src/net/eathena/packets.h b/src/net/eathena/packets.h index 600a1a41e..fb6b788e7 100644 --- a/src/net/eathena/packets.h +++ b/src/net/eathena/packets.h @@ -281,7 +281,7 @@ int16_t packet_lengths[] = //0 1 2 3 4 5 6 7 8 9 a b c d e f //0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // #0x0B00 - 16, -1, 10, -1, -1, -1, -1, 0, 27, 0, -1, 0, 0, 0, 0, 0, + 16, -1, 10, -1, -1, -1, -1, 0, 27, 0, -1, -1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h index 3c713ff72..384ea8e3e 100644 --- a/src/net/eathena/protocol.h +++ b/src/net/eathena/protocol.h @@ -154,6 +154,7 @@ #define SMSG_NPC_MARKET_BUY_ACK 0x09d7 #define SMSG_NPC_CASH_SHOP_OPEN 0x0287 #define SMSG_NPC_CASH_BUY_ACK 0x0289 +#define SMSG_NPC_AREA 0x0b0b #define SMSG_PLAYER_CHAT 0x008e /**< Player talks */ #define SMSG_WHISPER 0x0097 /**< Whisper Recieved */ -- cgit v1.2.3-60-g2f50