Core/Player: Make chat tag (last byte in SMSG_MESSAGECHAT) a bitmask.

This commit is contained in:
kaelima
2011-11-07 07:16:31 +01:00
parent ae600a0ea2
commit b5cb41b4ea
6 changed files with 28 additions and 19 deletions
@@ -75,7 +75,7 @@ namespace Trinity
data << uint64(target_guid); data << uint64(target_guid);
data << uint32(strlen(text) + 1); data << uint32(strlen(text) + 1);
data << text; data << text;
data << uint8 (_source ? _source->chatTag() : uint8(0)); data << uint8 (_source ? _source->GetChatTag() : 0);
} }
ChatMsg _msgtype; ChatMsg _msgtype;
@@ -108,7 +108,7 @@ namespace Trinity
data << uint64(target_guid); data << uint64(target_guid);
data << uint32(strlen(str) + 1); data << uint32(strlen(str) + 1);
data << str; data << str;
data << uint8 (_source ? _source->chatTag() : uint8(0)); data << uint8 (_source ? _source->GetChatTag() : uint8(0));
} }
private: private:
+1 -1
View File
@@ -650,7 +650,7 @@ void Channel::Say(uint64 p, const char *what, uint32 lang)
data << p; data << p;
data << messageLength; data << messageLength;
data << what; data << what;
data << uint8(plr ? plr->chatTag() : 0); data << uint8(plr ? plr->GetChatTag() : 0);
SendToAll(&data, !players[p].IsModerator() ? p : false); SendToAll(&data, !players[p].IsModerator() ? p : false);
} }
+1 -1
View File
@@ -1051,7 +1051,7 @@ void ChatHandler::FillMessageData(WorldPacket* data, WorldSession* session, uint
*data << uint32(messageLength); *data << uint32(messageLength);
*data << message; *data << message;
if (session != 0 && type != CHAT_MSG_WHISPER_INFORM && type != CHAT_MSG_DND && type != CHAT_MSG_AFK) 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 else
*data << uint8(0); *data << uint8(0);
} }
+12 -13
View File
@@ -2020,21 +2020,20 @@ bool Player::ToggleDND()
return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DND); return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DND);
} }
uint8 Player::chatTag() const uint8 Player::GetChatTag() const
{ {
// it's bitmask uint8 tag = CHAT_TAG_NONE;
// 0x8 - ??
// 0x4 - gm
// 0x2 - dnd
// 0x1 - afk
if (isGMChat()) if (isGMChat())
return 4; tag |= CHAT_TAG_GM;
else if (isDND()) if (isDND())
return 3; tag |= CHAT_TAG_DND;
if (isAFK()) if (isAFK())
return 1; tag |= CHAT_TAG_AFK;
else if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER))
return 0; tag |= CHAT_TAG_DEV;
return tag;
} }
void Player::SendTeleportPacket(Position &oldPos) void Player::SendTeleportPacket(Position &oldPos)
@@ -19340,7 +19339,7 @@ inline void Player::BuildPlayerChat(WorldPacket* data, uint8 msgtype, const std:
*data << uint64(GetGUID()); *data << uint64(GetGUID());
*data << uint32(text.length() + 1); *data << uint32(text.length() + 1);
*data << text; *data << text;
*data << uint8(chatTag()); *data << uint8(GetChatTag());
} }
void Player::Say(const std::string& text, const uint32 language) void Player::Say(const std::string& text, const uint32 language)
+11 -1
View File
@@ -768,6 +768,16 @@ enum EnviromentalDamage
DAMAGE_FALL_TO_VOID = 6 // custom case for fall without durability loss 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_UNK = 0x08, // Probably battleground commentator
CHAT_TAG_DEV = 0x10,
};
enum PlayedTimeIndex enum PlayedTimeIndex
{ {
PLAYED_TIME_TOTAL = 0, PLAYED_TIME_TOTAL = 0,
@@ -1125,7 +1135,7 @@ class Player : public Unit, public GridObject<Player>
bool ToggleDND(); bool ToggleDND();
bool isAFK() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK); } bool isAFK() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK); }
bool isDND() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DND); } bool isDND() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DND); }
uint8 chatTag() const; uint8 GetChatTag() const;
std::string afkMsg; std::string afkMsg;
std::string dndMsg; std::string dndMsg;
@@ -122,7 +122,7 @@ void PlayerSocial::SendSocialList(Player* plr)
uint32 size = m_playerSocialMap.size(); uint32 size = m_playerSocialMap.size();
WorldPacket data(SMSG_CONTACT_LIST, (4+4+size*25)); // just can guess size WorldPacket data(SMSG_CONTACT_LIST, (4+4+size*25)); // just can guess size
data << uint32(7); // unk flag (0x1, 0x2, 0x4), 0x7 if it include ignore list data << uint32(7); // 0x1 = Friendlist update. 0x2 = Ignorelist update. 0x4 = Mutelist update.
data << uint32(size); // friends count data << uint32(size); // friends count
for (PlayerSocialMap::iterator itr = m_playerSocialMap.begin(); itr != m_playerSocialMap.end(); ++itr) for (PlayerSocialMap::iterator itr = m_playerSocialMap.begin(); itr != m_playerSocialMap.end(); ++itr)