diff options
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/eathena/beingrecv.cpp | 16 | ||||
-rw-r--r-- | src/net/eathena/playerrecv.cpp | 8 | ||||
-rw-r--r-- | src/net/tmwa/beingrecv.cpp | 34 |
3 files changed, 42 insertions, 16 deletions
diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp index f6153dee9..435468fb6 100644 --- a/src/net/eathena/beingrecv.cpp +++ b/src/net/eathena/beingrecv.cpp @@ -1741,7 +1741,7 @@ void BeingRecv::processBeingAttrs(Net::MessageIn &msg) Being *const dstBeing = actorManager->findBeing( msg.readBeingId("player id")); - const int gmLevel = msg.readInt32("group id"); + const int groupId = msg.readInt32("group id"); uint16_t mount = 0; mount = msg.readInt16("mount"); int language = -1; @@ -1749,15 +1749,15 @@ void BeingRecv::processBeingAttrs(Net::MessageIn &msg) language = msg.readInt16("language"); if (dstBeing != nullptr) { - if (serverVersion <= 17 && - dstBeing == localPlayer) + if (serverVersion <= 17 || + dstBeing != localPlayer) { - localPlayer->setGroupId(gmLevel); + dstBeing->setGroupId(groupId); + if (groupId != 0) + dstBeing->setGM(true); + else + dstBeing->setGM(false); } - if (gmLevel != 0) - dstBeing->setGM(true); - else - dstBeing->setGM(false); dstBeing->setHorse(mount); dstBeing->setLanguageId(language); if (dstBeing == localPlayer) diff --git a/src/net/eathena/playerrecv.cpp b/src/net/eathena/playerrecv.cpp index 84dbeb5f3..c575e2615 100644 --- a/src/net/eathena/playerrecv.cpp +++ b/src/net/eathena/playerrecv.cpp @@ -483,12 +483,16 @@ void PlayerRecv::processPlayerAttrs(Net::MessageIn &msg) if (len < 8) return; - const int gmLevel = msg.readInt32("group id"); + const int groupId = msg.readInt32("group id"); if (localPlayer == nullptr) return; - localPlayer->setGroupId(gmLevel); + localPlayer->setGroupId(groupId); + if (groupId > 0) + localPlayer->setGM(true); + else + localPlayer->setGM(false); } } // namespace EAthena diff --git a/src/net/tmwa/beingrecv.cpp b/src/net/tmwa/beingrecv.cpp index d9e058955..7a1b86356 100644 --- a/src/net/tmwa/beingrecv.cpp +++ b/src/net/tmwa/beingrecv.cpp @@ -61,6 +61,31 @@ extern OkDialog *deathNotice; namespace TmwAthena { +static void setGm(Being *const dstBeing, + const uint16_t gmstatus) +{ + if (dstBeing != localPlayer) + { + if ((gmstatus & 0x80) != 0) + { + dstBeing->setGroupId(60); + dstBeing->setGM(true); + } + else + { + dstBeing->setGroupId(0); + dstBeing->setGM(false); + } + } + else + { + if ((gmstatus & 0x80) != 0) + dstBeing->setGM(true); + else + dstBeing->setGM(false); + } +} + void BeingRecv::processBeingChangeLook(Net::MessageIn &msg) { BLOCK_START("BeingRecv::processBeingChangeLook") @@ -349,8 +374,7 @@ void BeingRecv::processPlayerUpdate1(Net::MessageIn &msg) const uint16_t gmstatus = msg.readInt16("gm status"); - if ((gmstatus & 0x80) != 0) - dstBeing->setGM(true); + setGm(dstBeing, gmstatus); applyPlayerAction(msg, dstBeing, msg.readUInt8("action type")); const int level = CAST_S32(msg.readUInt8("level")); @@ -494,8 +518,7 @@ void BeingRecv::processPlayerUpdate2(Net::MessageIn &msg) const uint16_t gmstatus = msg.readInt16("gm status"); - if ((gmstatus & 0x80) != 0) - dstBeing->setGM(true); + setGm(dstBeing, gmstatus); applyPlayerAction(msg, dstBeing, msg.readUInt8("action type")); const int level = CAST_S32(msg.readUInt8("level")); @@ -659,8 +682,7 @@ void BeingRecv::processPlayerMove(Net::MessageIn &msg) const uint16_t gmstatus = msg.readInt16("gm status"); - if ((gmstatus & 0x80) != 0) - dstBeing->setGM(true); + setGm(dstBeing, gmstatus); msg.readUInt8("unused"); |