diff options
-rw-r--r-- | src/being/being.cpp | 6 | ||||
-rw-r--r-- | src/being/localplayer.cpp | 7 | ||||
-rw-r--r-- | src/net/eathena/beingrecv.cpp | 4 | ||||
-rw-r--r-- | src/net/eathena/playerrecv.cpp | 4 | ||||
-rw-r--r-- | src/net/tmwa/beingrecv.cpp | 19 | ||||
-rw-r--r-- | src/resources/db/groupdb.cpp | 14 | ||||
-rw-r--r-- | src/resources/db/groupdb.h | 1 | ||||
-rw-r--r-- | src/resources/groupinfo.cpp | 3 | ||||
-rw-r--r-- | src/resources/groupinfo.h | 1 |
9 files changed, 29 insertions, 30 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index 3b012fd90..d447221f8 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -5586,5 +5586,11 @@ void Being::setGroupId(const int id) { mGroupId = id; showGmBadge(id != 0); + const bool gm = GroupDb::getHighlightName(mGroupId); + if (mIsGM != gm) + { + mIsGM = gm; + updateColors(); + } } } diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 9f805b21a..240228068 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -422,19 +422,14 @@ void LocalPlayer::setGroupId(const int id) { Being::setGroupId(id); - if (id > 0) + if (mIsGM != 0) { - setGM(true); if (chatWindow != nullptr) { chatWindow->loadGMCommands(); chatWindow->showGMTab(); } } - else - { - setGM(false); - } if (statusWindow != nullptr) statusWindow->updateLevelLabel(); } diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp index 313c2872b..535f65091 100644 --- a/src/net/eathena/beingrecv.cpp +++ b/src/net/eathena/beingrecv.cpp @@ -1783,10 +1783,6 @@ void BeingRecv::processBeingAttrs(Net::MessageIn &msg) dstBeing != localPlayer) { dstBeing->setGroupId(groupId); - if (groupId != 0) - dstBeing->setGM(true); - else - dstBeing->setGM(false); } dstBeing->setHorse(mount); dstBeing->setLanguageId(language); diff --git a/src/net/eathena/playerrecv.cpp b/src/net/eathena/playerrecv.cpp index d9f85f45b..a85b53c60 100644 --- a/src/net/eathena/playerrecv.cpp +++ b/src/net/eathena/playerrecv.cpp @@ -531,10 +531,6 @@ void PlayerRecv::processPlayerAttrs(Net::MessageIn &msg) return; localPlayer->setGroupId(groupId); - if (groupId > 0) - localPlayer->setGM(true); - else - localPlayer->setGM(false); } void PlayerRecv::processPlayerStatUpdate7(Net::MessageIn &msg) diff --git a/src/net/tmwa/beingrecv.cpp b/src/net/tmwa/beingrecv.cpp index c47b3e2c7..a40bcd1aa 100644 --- a/src/net/tmwa/beingrecv.cpp +++ b/src/net/tmwa/beingrecv.cpp @@ -64,25 +64,14 @@ namespace TmwAthena static void setGm(Being *const dstBeing, const uint16_t gmstatus) { - if (dstBeing != localPlayer) + if (dstBeing != localPlayer && + gmstatus == 0x80) { - if (gmstatus == 0x80) - { - dstBeing->setGroupId(paths.getIntValue("gmDefaultLevel")); - dstBeing->setGM(true); - } - else - { - dstBeing->setGroupId(gmstatus); - dstBeing->setGM(gmstatus != 0); - } + dstBeing->setGroupId(paths.getIntValue("gmDefaultLevel")); } else { - if (gmstatus != 0) - dstBeing->setGM(true); - else - dstBeing->setGM(false); + dstBeing->setGroupId(gmstatus); } } diff --git a/src/resources/db/groupdb.cpp b/src/resources/db/groupdb.cpp index e09e773aa..1d1d1bffa 100644 --- a/src/resources/db/groupdb.cpp +++ b/src/resources/db/groupdb.cpp @@ -314,6 +314,9 @@ void GroupDb::loadXmlFile(const std::string &fileName, group->showBadge = XML::getBoolProperty(node, "showBadge", false); + group->highlightName = XML::getBoolProperty(node, + "highlightName", + false); loadSubNodes(node, id, group); parseInherit(node, id, group); } @@ -364,6 +367,17 @@ bool GroupDb::getShowBadge(const int id) return (*it).second->showBadge; } +bool GroupDb::getHighlightName(const int id) +{ + GroupInfos::const_iterator it = mGroups.find(id); + if (it == mGroups.end()) + { + reportAlways("Unknown group id requested: %d", id); + return mEmptyGroup.highlightName; + } + return (*it).second->highlightName; +} + const std::string &GroupDb::getBadge(const int id) { GroupInfos::const_iterator it = mGroups.find(id); diff --git a/src/resources/db/groupdb.h b/src/resources/db/groupdb.h index a8fd1dcf3..f447baa96 100644 --- a/src/resources/db/groupdb.h +++ b/src/resources/db/groupdb.h @@ -41,6 +41,7 @@ namespace GroupDb const std::string &getName(const int id) A_WARN_UNUSED; const std::string &getLongName(const int id) A_WARN_UNUSED; bool getShowBadge(const int id) A_WARN_UNUSED; + bool getHighlightName(const int id) A_WARN_UNUSED; const std::string &getBadge(const int id) A_WARN_UNUSED; const GroupInfo *getGroup(const int id) A_WARN_UNUSED RETURNS_NONNULL; diff --git a/src/resources/groupinfo.cpp b/src/resources/groupinfo.cpp index 1f0198723..e951330a3 100644 --- a/src/resources/groupinfo.cpp +++ b/src/resources/groupinfo.cpp @@ -28,7 +28,8 @@ GroupInfo::GroupInfo() : name(), longName(), badge(), - showBadge(false) + showBadge(false), + highlightName(false) { for (size_t f = 0; f < CAST_SIZE(ServerCommandType::Max); f ++) mCommands[f] = ServerCommandEnable::No; diff --git a/src/resources/groupinfo.h b/src/resources/groupinfo.h index 7ef72000f..1162b71e5 100644 --- a/src/resources/groupinfo.h +++ b/src/resources/groupinfo.h @@ -45,6 +45,7 @@ struct GroupInfo final std::string longName; std::string badge; bool showBadge; + bool highlightName; }; #endif // RESOURCES_GROUPINFO_H |