diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-07-12 18:34:00 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-07-12 19:20:20 +0300 |
commit | 64d81679e4fbaba26cd538669a394070e9aa7c44 (patch) | |
tree | 2745d7a1b8e0effbc6a9e8625c419f104e3775b2 | |
parent | 42564aea17d47d767979f2708ffa2f8a3a25edf9 (diff) | |
download | manaplus-64d81679e4fbaba26cd538669a394070e9aa7c44.tar.gz manaplus-64d81679e4fbaba26cd538669a394070e9aa7c44.tar.bz2 manaplus-64d81679e4fbaba26cd538669a394070e9aa7c44.tar.xz manaplus-64d81679e4fbaba26cd538669a394070e9aa7c44.zip |
Add packet SMSG_PLAYER_ATTRS 0x0b25.
It allow set local player attributes from server.
For now it send real group id.
-rw-r--r-- | src/being/localplayer.cpp | 8 | ||||
-rw-r--r-- | src/net/eathena/beingrecv.cpp | 17 | ||||
-rw-r--r-- | src/net/eathena/network.h | 2 | ||||
-rw-r--r-- | src/net/eathena/packetsin.inc | 1 | ||||
-rw-r--r-- | src/net/eathena/playerrecv.cpp | 14 | ||||
-rw-r--r-- | src/net/eathena/playerrecv.h | 1 |
6 files changed, 30 insertions, 13 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 3ba0ffc70..a9b76a10e 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -423,14 +423,18 @@ void LocalPlayer::setGMLevel(const int level) if (level > 0) { setGM(true); - if (statusWindow != nullptr) - statusWindow->updateLevelLabel(); if (chatWindow != nullptr) { chatWindow->loadGMCommands(); chatWindow->showGMTab(); } } + else + { + setGM(false); + } + if (statusWindow != nullptr) + statusWindow->updateLevelLabel(); } void LocalPlayer::nextTile(unsigned char dir A_UNUSED = 0) diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp index d99fa241e..2166205f6 100644 --- a/src/net/eathena/beingrecv.cpp +++ b/src/net/eathena/beingrecv.cpp @@ -1741,26 +1741,23 @@ void BeingRecv::processBeingAttrs(Net::MessageIn &msg) Being *const dstBeing = actorManager->findBeing( msg.readBeingId("player id")); - const int gmLevel = msg.readInt32("gm level"); + const int gmLevel = msg.readInt32("group id"); uint16_t mount = 0; mount = msg.readInt16("mount"); int language = -1; - if (serverVersion >= 17) + if (serverVersion >= 17 && len > 14) language = msg.readInt16("language"); if (dstBeing != nullptr) { - if (gmLevel != 0) + if (serverVersion <= 17 && + dstBeing == localPlayer) { - if (dstBeing == localPlayer) - localPlayer->setGMLevel(gmLevel); - dstBeing->setGM(true); + localPlayer->setGMLevel(gmLevel); } + if (gmLevel != 0) + dstBeing->setGM(true); else - { - if (dstBeing == localPlayer) - localPlayer->setGMLevel(0); dstBeing->setGM(false); - } dstBeing->setHorse(mount); dstBeing->setLanguageId(language); if (dstBeing == localPlayer) diff --git a/src/net/eathena/network.h b/src/net/eathena/network.h index d22adaa2b..6ca6a4d56 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 21 +#define CLIENT_PROTOCOL_VERSION 22 namespace EAthena { diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc index 036c5fde9..41cfa1036 100644 --- a/src/net/eathena/packetsin.inc +++ b/src/net/eathena/packetsin.inc @@ -844,6 +844,7 @@ if (serverVersion > 0) packet(SMSG_HOMUNCULUS_EXP, 0x0b22, 10, &HomunculusRecv::processHomunculusExp, 0); packet(SMSG_QUEST_LIST2, 0x0b23, -1, &QuestRecv::processAddQuests2, 0); packet(SMSG_QUEST_ADD2, 0x0b24, 23, &QuestRecv::processAddQuest2, 0); + packet(SMSG_PLAYER_ATTRS, 0x0b25, -1, &PlayerRecv::processPlayerAttrs, 0); // char server packet(SMSG_CHAR_PASSWORD_RESPONSE, 0x0062, 3, &LoginRecv::processCharPasswordResponse, 0); diff --git a/src/net/eathena/playerrecv.cpp b/src/net/eathena/playerrecv.cpp index 9eb57b687..d9674a90e 100644 --- a/src/net/eathena/playerrecv.cpp +++ b/src/net/eathena/playerrecv.cpp @@ -477,4 +477,18 @@ void PlayerRecv::processKilledBy(Net::MessageIn &msg) } } +void PlayerRecv::processPlayerAttrs(Net::MessageIn &msg) +{ + const int len = msg.readInt16("len"); + if (len < 8) + return; + + const int gmLevel = msg.readInt32("group id"); + + if (localPlayer == nullptr) + return; + + localPlayer->setGMLevel(gmLevel); +} + } // namespace EAthena diff --git a/src/net/eathena/playerrecv.h b/src/net/eathena/playerrecv.h index a4a24bddc..eb38684b8 100644 --- a/src/net/eathena/playerrecv.h +++ b/src/net/eathena/playerrecv.h @@ -53,6 +53,7 @@ namespace EAthena void processOnlineList(Net::MessageIn &msg); void processDressRoomOpen(Net::MessageIn &msg); void processKilledBy(Net::MessageIn &msg); + void processPlayerAttrs(Net::MessageIn &msg); } // namespace PlayerRecv } // namespace EAthena |