From cdd3c77337a6bbff0d51d174663867463db8cf15 Mon Sep 17 00:00:00 2001 From: gumi Date: Sat, 24 Nov 2018 16:22:23 -0500 Subject: Show short group name when available instead of (GM) --- src/gui/onlineplayer.h | 6 +++++- src/gui/windows/whoisonline.cpp | 16 ++++++++++++++-- src/net/eathena/playerrecv.cpp | 2 +- src/net/tmwa/playerrecv.cpp | 5 ++--- 4 files changed, 22 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gui/onlineplayer.h b/src/gui/onlineplayer.h index 0b41cebec..219a473da 100644 --- a/src/gui/onlineplayer.h +++ b/src/gui/onlineplayer.h @@ -35,11 +35,13 @@ class OnlinePlayer final const unsigned char status, const signed char level, const GenderT gender, - const signed char version) : + const signed char version, + const unsigned char group) : mNick(nick), mText(), mStatus(status), mLevel(level), + mGroup(group), mVersion(version), mGender(gender), mIsGM(false) @@ -80,6 +82,8 @@ class OnlinePlayer final signed char mLevel; + unsigned char mGroup; + signed char mVersion; GenderT mGender; diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index 37dbf2a89..bc16397ed 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -55,6 +55,8 @@ #include "net/playerhandler.h" #include "net/serverfeatures.h" +#include "resources/db/groupdb.h" + #include "utils/foreach.h" #include "utils/gettext.h" #include "utils/sdlhelper.h" @@ -471,7 +473,7 @@ void WhoIsOnline::loadWebList() OnlinePlayer *const player = new OnlinePlayer(nick, CAST_U8(255), level, - Gender::UNSPECIFIED, -1); + Gender::UNSPECIFIED, -1, 0); mOnlinePlayers.insert(player); mOnlineNicks.insert(nick); @@ -870,8 +872,15 @@ void OnlinePlayer::setText(std::string color) } } - if ((mStatus != 255 && ((mStatus & BeingFlag::GM) != 0)) || mIsGM) + if (GroupDb::getShowBadge(mGroup)) + { + const std::string name = GroupDb::getName(mGroup); + mText.append(strprintf("(%s) ", name.c_str())); + } + else if ((mStatus != 255 && ((mStatus & BeingFlag::GM) != 0)) || mIsGM) + { mText.append("(GM) "); + } if (mLevel > 0) mText.append(strprintf("%d", mLevel)); @@ -881,6 +890,9 @@ void OnlinePlayer::setText(std::string color) else if (mGender == Gender::MALE) mText.append("\u2642"); + if (GroupDb::getHighlightName(mGroup) && color == "0") + color = "2"; + if (mStatus > 0 && mStatus != 255) { if ((mStatus & BeingFlag::SHOP) != 0) diff --git a/src/net/eathena/playerrecv.cpp b/src/net/eathena/playerrecv.cpp index da3e35a0d..51abbfdc3 100644 --- a/src/net/eathena/playerrecv.cpp +++ b/src/net/eathena/playerrecv.cpp @@ -481,7 +481,7 @@ void PlayerRecv::processOnlineList(Net::MessageIn &msg) gender = Gender::FEMALE; } arr.push_back(new OnlinePlayer(static_cast(buf), - status, level, gender, ver)); + status, level, gender, ver, 0)); buf += strlen(buf) + 1; } diff --git a/src/net/tmwa/playerrecv.cpp b/src/net/tmwa/playerrecv.cpp index 530621637..d088c3c54 100644 --- a/src/net/tmwa/playerrecv.cpp +++ b/src/net/tmwa/playerrecv.cpp @@ -232,12 +232,11 @@ void PlayerRecv::processOnlineList(Net::MessageIn &msg) default: break; } - if (GroupDb::getShowBadge(group)) - status |= BeingFlag::GM; + if (!config.getBoolValue("showgender")) gender = Gender::UNSPECIFIED; arr.push_back(new OnlinePlayer(name, - status, level, gender, 0)); + status, level, gender, 0, group)); if (actorManager) actorManager->updateNameId(name, beingId); } -- cgit v1.2.3-70-g09d2