From 1cf6cb343c6c8df8a998c617fd6f8d40f5affbea Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 22 Mar 2016 18:59:41 +0300 Subject: Add support for packet version in servers list xml and in editor. --- src/net/ea/beingrecv.cpp | 12 +++++------- src/net/eathena/loginhandler.cpp | 6 ++++++ src/net/eathena/loginhandler.h | 2 ++ src/net/eathena/packetsin.inc | 2 +- src/net/logindata.h | 3 +++ src/net/loginhandler.h | 2 ++ src/net/serverinfo.h | 5 +++++ src/net/tmwa/loginhandler.cpp | 4 ++++ src/net/tmwa/loginhandler.h | 2 ++ src/net/tmwa/loginrecv.cpp | 1 - 10 files changed, 30 insertions(+), 9 deletions(-) (limited to 'src/net') diff --git a/src/net/ea/beingrecv.cpp b/src/net/ea/beingrecv.cpp index 2a0351ef2..9796af9ce 100644 --- a/src/net/ea/beingrecv.cpp +++ b/src/net/ea/beingrecv.cpp @@ -286,14 +286,12 @@ void BeingRecv::processBeingEmotion(Net::MessageIn &msg) return; } - if (player_relations.hasPermission(dstBeing, PlayerRelation::EMOTE)) + const uint8_t emote = msg.readUInt8("emote"); + if (emote && + player_relations.hasPermission(dstBeing, PlayerRelation::EMOTE)) { - const uint8_t emote = msg.readUInt8("emote"); - if (emote) - { - dstBeing->setEmote(emote, 0); - localPlayer->imitateEmote(dstBeing, emote); - } + dstBeing->setEmote(emote, 0); + localPlayer->imitateEmote(dstBeing, emote); } if (dstBeing->getType() == ActorType::Player) dstBeing->setOtherTime(); diff --git a/src/net/eathena/loginhandler.cpp b/src/net/eathena/loginhandler.cpp index a7bcd5406..07614be0c 100644 --- a/src/net/eathena/loginhandler.cpp +++ b/src/net/eathena/loginhandler.cpp @@ -29,6 +29,7 @@ #include "net/eathena/messageout.h" #include "net/eathena/network.h" +#include "net/eathena/updateprotocol.h" #include "net/eathena/protocolout.h" #include "debug.h" @@ -141,4 +142,9 @@ void LoginHandler::ping() const outMsg.writeInt32(0, "unused"); } +void LoginHandler::updatePacketVersion() const +{ + updateProtocol(); +} + } // namespace EAthena diff --git a/src/net/eathena/loginhandler.h b/src/net/eathena/loginhandler.h index 19a8a3f3c..b564b1b27 100644 --- a/src/net/eathena/loginhandler.h +++ b/src/net/eathena/loginhandler.h @@ -56,6 +56,8 @@ class LoginHandler final : public Ea::LoginHandler void ping() const override final; + void updatePacketVersion() const override final; + private: void sendLoginRegister(const std::string &restrict username, const std::string &restrict password, diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc index 8ed2e0b2b..510376e9c 100644 --- a/src/net/eathena/packetsin.inc +++ b/src/net/eathena/packetsin.inc @@ -447,7 +447,7 @@ if (serverVersion >= 11 || serverVersion == 0) packet(SMSG_BEING_MOVE, 0x09db, -1, &BeingRecv::processBeingMove); } -if (serverVersion >= 8 && packetVersion >= 20150226) +if ((serverVersion >= 8 || serverVersion == 0) && packetVersion >= 20150226) { packet(SMSG_VENDING_OPEN, 0x0136, -1, &VendingRecv::processOpen); packet(SMSG_VENDING_ITEMS_LIST, 0x0800, -1, &VendingRecv::processItemsList); diff --git a/src/net/logindata.h b/src/net/logindata.h index 3beab2ffd..60d5f9607 100644 --- a/src/net/logindata.h +++ b/src/net/logindata.h @@ -46,6 +46,7 @@ class LoginData final captchaResponse(), registerUrl(), gender(Gender::UNSPECIFIED), + packetVersion(0), remember(false), registerLogin(false), characterSlots(9) @@ -68,6 +69,7 @@ class LoginData final GenderT gender; + int packetVersion; bool remember; // Whether to store the username. bool registerLogin; // Whether an account is being registered. @@ -85,6 +87,7 @@ class LoginData final captchaResponse.clear(); registerUrl.clear(); gender = Gender::UNSPECIFIED; + packetVersion = 0; lastLogin.clear(); resetCharacterSlots(); } diff --git a/src/net/loginhandler.h b/src/net/loginhandler.h index 95fcf887b..1709b4526 100644 --- a/src/net/loginhandler.h +++ b/src/net/loginhandler.h @@ -91,6 +91,8 @@ class LoginHandler notfinal virtual void ping() const = 0; + virtual void updatePacketVersion() const = 0; + virtual ~LoginHandler() { } diff --git a/src/net/serverinfo.h b/src/net/serverinfo.h index 3ef8243fc..85d0f6bdd 100644 --- a/src/net/serverinfo.h +++ b/src/net/serverinfo.h @@ -45,6 +45,7 @@ class ServerInfo final std::vector updateMirrors; uint16_t port; VersionString version; + int packetVersion; bool save; bool persistentIp; @@ -64,6 +65,7 @@ class ServerInfo final port(6900), #endif version(), + packetVersion(), save(false), persistentIp(true) { @@ -82,6 +84,7 @@ class ServerInfo final updateMirrors(info.updateMirrors), port(info.port), version(), + packetVersion(info.packetVersion), save(info.save), persistentIp(info.persistentIp) { @@ -105,6 +108,7 @@ class ServerInfo final persistentIp = info.persistentIp; version.first = info.version.first; version.second = info.version.second; + packetVersion = info.packetVersion; return *this; } @@ -129,6 +133,7 @@ class ServerInfo final updateMirrors.clear(); version.first = 0; version.second.clear(); + packetVersion = 0; save = false; persistentIp = true; } diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index d48c5123f..c2e6d462c 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -122,4 +122,8 @@ void LoginHandler::ping() const { } +void LoginHandler::updatePacketVersion() const +{ +} + } // namespace TmwAthena diff --git a/src/net/tmwa/loginhandler.h b/src/net/tmwa/loginhandler.h index 536dfdaaa..d94402741 100644 --- a/src/net/tmwa/loginhandler.h +++ b/src/net/tmwa/loginhandler.h @@ -56,6 +56,8 @@ class LoginHandler final : public Ea::LoginHandler void ping() const override final A_CONST; + void updatePacketVersion() const override final A_CONST; + static void requestUpdateHosts() A_CONST; private: diff --git a/src/net/tmwa/loginrecv.cpp b/src/net/tmwa/loginrecv.cpp index 40b7a2aba..8e8d3a0a2 100644 --- a/src/net/tmwa/loginrecv.cpp +++ b/src/net/tmwa/loginrecv.cpp @@ -79,7 +79,6 @@ void LoginRecv::processServerVersion(Net::MessageIn &msg) logger->log("Tmw server version: x%06x", tmwServerVersion); else logger->log("Server without version"); - updateProtocol(); if (client->getState() != State::LOGIN) -- cgit v1.2.3-70-g09d2