[12038] Use bitmask for chat tag.

Thanks to stfx for porting

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
kaelima 2012-07-13 22:23:43 +02:00 committed by Schmoozerd
parent d563c6576d
commit fd6c2e1751
6 changed files with 28 additions and 19 deletions

View file

@ -1606,23 +1606,22 @@ void Player::ToggleDND()
ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_DND);
}
uint8 Player::chatTag() const
uint8 Player::GetChatTag() const
{
// it's bitmask
// 0x1 - afk
// 0x2 - dnd
// 0x4 - gm
// 0x8 - ??
if (isGMChat()) // Always show GM icons if activated
return 4;
uint8 tag = CHAT_TAG_NONE;
if (isAFK())
return 1;
tag |= CHAT_TAG_AFK;
if (isDND())
return 3;
tag |= CHAT_TAG_DND;
if (isGMChat())
tag |= CHAT_TAG_GM;
if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_COMMENTATOR))
tag |= CHAT_TAG_COM;
if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER))
tag |= CHAT_TAG_DEV;
return 0;
return tag;
}
bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options)
@ -18431,7 +18430,7 @@ void Player::BuildPlayerChat(WorldPacket *data, uint8 msgtype, const std::string
*data << ObjectGuid(GetObjectGuid());
*data << uint32(text.length()+1);
*data << text;
*data << uint8(chatTag());
*data << uint8(GetChatTag());
}
void Player::Say(const std::string& text, const uint32 language)