diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client.cpp | 12 | ||||
-rw-r--r-- | src/gui/windows/editserverdialog.cpp | 17 | ||||
-rw-r--r-- | src/gui/windows/editserverdialog.h | 4 | ||||
-rw-r--r-- | src/gui/windows/serverdialog.cpp | 10 | ||||
-rw-r--r-- | src/net/ea/beingrecv.cpp | 12 | ||||
-rw-r--r-- | src/net/eathena/loginhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/eathena/loginhandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/packetsin.inc | 2 | ||||
-rw-r--r-- | src/net/logindata.h | 3 | ||||
-rw-r--r-- | src/net/loginhandler.h | 2 | ||||
-rw-r--r-- | src/net/serverinfo.h | 5 | ||||
-rw-r--r-- | src/net/tmwa/loginhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/tmwa/loginhandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/loginrecv.cpp | 1 |
14 files changed, 67 insertions, 15 deletions
diff --git a/src/client.cpp b/src/client.cpp index 696389c69..0f451702e 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -767,6 +767,7 @@ void Client::stateConnectServer1() initFeatures(); PlayerInfo::loadData(); loginData.registerUrl = mCurrentServer.registerUrl; + loginData.packetVersion = mCurrentServer.packetVersion; if (!mCurrentServer.onlineListUrl.empty()) settings.onlineListUrl = mCurrentServer.onlineListUrl; else @@ -1100,6 +1101,17 @@ int Client::gameExec() // lower than the default value theme->setMinimumOpacity(0.8F); + if (packetVersion == 0) + { + packetVersion = loginData.packetVersion; + if (packetVersion != 0) + { + loginHandler->updatePacketVersion(); + logger->log("Preconfigured packet version: %d", + packetVersion); + } + } + loginData.updateType = static_cast<UpdateTypeT>( serverConfig.getValue("updateType", 0)); diff --git a/src/gui/windows/editserverdialog.cpp b/src/gui/windows/editserverdialog.cpp index 47a0f0335..9fa71b1f4 100644 --- a/src/gui/windows/editserverdialog.cpp +++ b/src/gui/windows/editserverdialog.cpp @@ -30,9 +30,9 @@ #include "gui/widgets/checkbox.h" #include "gui/widgets/createwidget.h" #include "gui/widgets/dropdown.h" +#include "gui/widgets/inttextfield.h" #include "gui/widgets/label.h" #include "gui/widgets/layout.h" -#include "gui/widgets/textfield.h" #include "utils/gettext.h" @@ -50,6 +50,7 @@ EditServerDialog::EditServerDialog(ServerDialog *const parent, mNameField(new TextField(this, std::string())), mDescriptionField(new TextField(this, std::string())), mOnlineListUrlField(new TextField(this, std::string())), + mPacketVersionField(new IntTextField(this, 0, 0, 20150805)), // TRANSLATORS: edit server dialog button mConnectButton(new Button(this, _("Connect"), "connect", this)), // TRANSLATORS: edit server dialog button @@ -79,6 +80,8 @@ EditServerDialog::EditServerDialog(ServerDialog *const parent, Label *const descriptionLabel = new Label(this, _("Description:")); // TRANSLATORS: edit server dialog label Label *const onlineListUrlLabel = new Label(this, _("Online list url:")); + // TRANSLATORS: edit server dialog label + Label *const packetVersionLabel = new Label(this, _("Packet version:")); mPortField->setNumeric(true); mPortField->setRange(1, 65535); @@ -99,10 +102,12 @@ EditServerDialog::EditServerDialog(ServerDialog *const parent, place(1, 4, mDescriptionField, 4).setPadding(3); place(0, 5, onlineListUrlLabel); place(1, 5, mOnlineListUrlField, 4).setPadding(3); - place(0, 6, mPersistentIp, 4).setPadding(3); - place(0, 7, mConnectButton); - place(4, 7, mOkButton); - place(3, 7, mCancelButton); + place(0, 6, packetVersionLabel); + place(1, 6, mPacketVersionField, 4).setPadding(3); + place(0, 7, mPersistentIp, 4).setPadding(3); + place(0, 8, mConnectButton); + place(4, 8, mOkButton); + place(3, 8, mCancelButton); // Do this manually instead of calling reflowLayout so we can enforce a // minimum width. @@ -135,6 +140,7 @@ EditServerDialog::EditServerDialog(ServerDialog *const parent, mDescriptionField->setText(mServer.description); mOnlineListUrlField->setText(mServer.onlineListUrl); mServerAddressField->setText(mServer.hostname); + mPacketVersionField->setValue(mServer.packetVersion); mPortField->setText(toString(mServer.port)); mPersistentIp->setSelected(mServer.persistentIp); @@ -223,6 +229,7 @@ void EditServerDialog::action(const ActionEvent &event) mServer.description = mDescriptionField->getText(); mServer.onlineListUrl = mOnlineListUrlField->getText(); mServer.hostname = mServerAddressField->getText(); + mServer.packetVersion = mPacketVersionField->getValue(); mServer.port = CAST_S16(atoi( mPortField->getText().c_str())); mServer.persistentIp = mPersistentIp->isSelected(); diff --git a/src/gui/windows/editserverdialog.h b/src/gui/windows/editserverdialog.h index 596d4a110..5595c3120 100644 --- a/src/gui/windows/editserverdialog.h +++ b/src/gui/windows/editserverdialog.h @@ -24,9 +24,10 @@ class Button; class CheckBox; -class TextField; class DropDown; +class IntTextField; class ServerDialog; +class TextField; class TypeListModel; #include "gui/widgets/window.h" @@ -68,6 +69,7 @@ class EditServerDialog final : public Window, TextField *mNameField A_NONNULLPOINTER; TextField *mDescriptionField A_NONNULLPOINTER; TextField *mOnlineListUrlField A_NONNULLPOINTER; + IntTextField *mPacketVersionField A_NONNULLPOINTER; Button *mConnectButton A_NONNULLPOINTER; Button *mOkButton A_NONNULLPOINTER; Button *mCancelButton A_NONNULLPOINTER; diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index 179173d2c..f03d28f03 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -236,6 +236,7 @@ void ServerDialog::connectToSelectedServer() mServerInfo->save = true; mServerInfo->persistentIp = server.persistentIp; mServerInfo->updateMirrors = server.updateMirrors; + mServerInfo->packetVersion = server.packetVersion; settings.persistentIp = mServerInfo->persistentIp; settings.supportUrl = mServerInfo->supportUrl; @@ -521,6 +522,8 @@ void ServerDialog::loadServers(const bool addNew) subNode, "althostname", ""); server.port = CAST_U16( XML::getProperty(subNode, "port", 0)); + server.packetVersion = XML::getProperty(subNode, + "packetVersion", 0); if (server.port == 0) { @@ -584,6 +587,7 @@ void ServerDialog::loadServers(const bool addNew) mServers[i].althostname = server.althostname; mServers[i].persistentIp = server.persistentIp; mServers[i].updateMirrors = server.updateMirrors; + mServers[i].packetVersion = server.packetVersion; mServersListModel->setVersionString(i, version); found = true; break; @@ -609,6 +613,8 @@ void ServerDialog::loadCustomServers() const std::string onlineListUrlKey ("MostUsedServerOnlineList" + index); const std::string persistentIpKey("persistentIp" + index); + const std::string packetVersionKey + ("MostUsedServerPacketVersion" + index); ServerInfo server; server.name = config.getValue(nameKey, ""); @@ -618,6 +624,7 @@ void ServerDialog::loadCustomServers() server.type = ServerInfo::parseType(config.getValue(typeKey, "")); server.persistentIp = config.getValue( persistentIpKey, 0) ? true : false; + server.packetVersion = config.getValue(packetVersionKey, 0); const int defaultPort = defaultPortForServerType(server.type); server.port = CAST_U16( @@ -676,6 +683,8 @@ void ServerDialog::saveCustomServers(const ServerInfo ¤tServer, const std::string onlineListUrlKey ("MostUsedServerOnlineList" + num); const std::string persistentIpKey("persistentIp" + num); + const std::string packetVersionKey + ("MostUsedServerPacketVersion" + num); config.setValue(nameKey, server.name); config.setValue(descKey, server.description); @@ -684,6 +693,7 @@ void ServerDialog::saveCustomServers(const ServerInfo ¤tServer, config.setValue(typeKey, serverTypeToString(server.type)); config.setValue(portKey, toString(server.port)); config.setValue(persistentIpKey, server.persistentIp); + config.setValue(packetVersionKey, server.packetVersion); ++ savedServerCount; } 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<std::string> 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) |