[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

@ -73,7 +73,7 @@ namespace MaNGOS
data << ObjectGuid(targetGuid);
data << uint32(strlen(text)+1);
data << text;
data << uint8(i_source ? i_source->chatTag() : uint8(0));
data << uint8(i_source ? i_source->GetChatTag() : CHAT_TAG_NONE);
}
ChatMsg i_msgtype;
@ -152,7 +152,7 @@ namespace MaNGOS
data << ObjectGuid(targetGuid);
data << uint32(strlen(str)+1);
data << str;
data << uint8(i_source ? i_source->chatTag() : uint8(0));
data << uint8(i_source ? i_source->GetChatTag() : CHAT_TAG_NONE);
}
private:

View file

@ -574,7 +574,7 @@ void Channel::Say(ObjectGuid p, const char *what, uint32 lang)
data << ObjectGuid(p);
data << uint32(messageLength);
data << what;
data << uint8(plr ? plr->chatTag() : 0);
data << uint8(plr ? plr->GetChatTag() : CHAT_TAG_NONE);
SendToAll(&data, !m_players[p].IsModerator() ? p : ObjectGuid());
}

View file

@ -2116,7 +2116,7 @@ void ChatHandler::FillMessageData( WorldPacket *data, WorldSession* session, uin
*data << uint32(messageLength);
*data << message;
if(session != 0 && type != CHAT_MSG_WHISPER_INFORM && type != CHAT_MSG_DND && type != CHAT_MSG_AFK)
*data << uint8(session->GetPlayer()->chatTag());
*data << uint8(session->GetPlayer()->GetChatTag());
else
*data << uint8(0);
}

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)

View file

@ -795,6 +795,16 @@ enum EnviromentalDamage
DAMAGE_FALL_TO_VOID = 6 // custom case for fall without durability loss
};
enum PlayerChatTag
{
CHAT_TAG_NONE = 0x00,
CHAT_TAG_AFK = 0x01,
CHAT_TAG_DND = 0x02,
CHAT_TAG_GM = 0x04,
CHAT_TAG_COM = 0x08, // Commentator
CHAT_TAG_DEV = 0x10, // Developer
};
enum PlayedTimeIndex
{
PLAYED_TIME_TOTAL = 0,
@ -1071,7 +1081,7 @@ class MANGOS_DLL_SPEC Player : public Unit
void ToggleDND();
bool isAFK() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK); }
bool isDND() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DND); }
uint8 chatTag() const;
uint8 GetChatTag() const;
std::string autoReplyMsg;
uint32 GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 newfacialhair, uint32 newskintone);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12037"
#define REVISION_NR "12038"
#endif // __REVISION_NR_H__