Core/Channels: Remove unnecessary calls to FindPlayer wherever is possible

- Add better opcode debug messages
- Move isValidChatMessage debug messages to trace
This commit is contained in:
Spp
2012-11-22 12:11:35 +01:00
parent d3c902915b
commit 32c259b1ce
9 changed files with 760 additions and 835 deletions
File diff suppressed because it is too large Load Diff
+72 -74
View File
@@ -51,10 +51,10 @@ enum ChatNotify
// CHAT_MODERATION_OFF_NOTICE = 0x10, //+ "[%s] Channel moderation disabled by %s."; // CHAT_MODERATION_OFF_NOTICE = 0x10, //+ "[%s] Channel moderation disabled by %s.";
CHAT_MUTED_NOTICE = 0x11, //+ "[%s] You do not have permission to speak."; CHAT_MUTED_NOTICE = 0x11, //+ "[%s] You do not have permission to speak.";
CHAT_PLAYER_KICKED_NOTICE = 0x12, //? "[%s] Player %s kicked by %s."; CHAT_PLAYER_KICKED_NOTICE = 0x12, //? "[%s] Player %s kicked by %s.";
CHAT_BANNED_NOTICE = 0x13, //+ "[%s] You are banned from that channel."; CHAT_BANNED_NOTICE = 0x13, //+ "[%s] You are bannedStore from that channel.";
CHAT_PLAYER_BANNED_NOTICE = 0x14, //? "[%s] Player %s banned by %s."; CHAT_PLAYER_BANNED_NOTICE = 0x14, //? "[%s] Player %s bannedStore by %s.";
CHAT_PLAYER_UNBANNED_NOTICE = 0x15, //? "[%s] Player %s unbanned by %s."; CHAT_PLAYER_UNBANNED_NOTICE = 0x15, //? "[%s] Player %s unbanned by %s.";
CHAT_PLAYER_NOT_BANNED_NOTICE = 0x16, //+ "[%s] Player %s is not banned."; CHAT_PLAYER_NOT_BANNED_NOTICE = 0x16, //+ "[%s] Player %s is not bannedStore.";
CHAT_PLAYER_ALREADY_MEMBER_NOTICE = 0x17, //+ "[%s] Player %s is already on the channel."; CHAT_PLAYER_ALREADY_MEMBER_NOTICE = 0x17, //+ "[%s] Player %s is already on the channel.";
CHAT_INVITE_NOTICE = 0x18, //+ "%2$s has invited you to join the channel '%1$s'."; CHAT_INVITE_NOTICE = 0x18, //+ "%2$s has invited you to join the channel '%1$s'.";
CHAT_INVITE_WRONG_FACTION_NOTICE = 0x19, //+ "Target is in the wrong alliance for %s."; CHAT_INVITE_WRONG_FACTION_NOTICE = 0x19, //+ "Target is in the wrong alliance for %s.";
@@ -62,7 +62,7 @@ enum ChatNotify
CHAT_INVALID_NAME_NOTICE = 0x1B, //+ "Invalid channel name"; CHAT_INVALID_NAME_NOTICE = 0x1B, //+ "Invalid channel name";
CHAT_NOT_MODERATED_NOTICE = 0x1C, //+ "%s is not moderated"; CHAT_NOT_MODERATED_NOTICE = 0x1C, //+ "%s is not moderated";
CHAT_PLAYER_INVITED_NOTICE = 0x1D, //+ "[%s] You invited %s to join the channel"; CHAT_PLAYER_INVITED_NOTICE = 0x1D, //+ "[%s] You invited %s to join the channel";
CHAT_PLAYER_INVITE_BANNED_NOTICE = 0x1E, //+ "[%s] %s has been banned."; CHAT_PLAYER_INVITE_BANNED_NOTICE = 0x1E, //+ "[%s] %s has been bannedStore.";
CHAT_THROTTLED_NOTICE = 0x1F, //+ "[%s] The number of messages that can be sent to this channel is limited, please wait to send another message."; CHAT_THROTTLED_NOTICE = 0x1F, //+ "[%s] The number of messages that can be sent to this channel is limited, please wait to send another message.";
CHAT_NOT_IN_AREA_NOTICE = 0x20, //+ "[%s] You are not in the correct area for this channel."; -- The user is trying to send a chat to a zone specific channel, and they're not physically in that zone. CHAT_NOT_IN_AREA_NOTICE = 0x20, //+ "[%s] You are not in the correct area for this channel."; -- The user is trying to send a chat to a zone specific channel, and they're not physically in that zone.
CHAT_NOT_IN_LFG_NOTICE = 0x21, //+ "[%s] You must be queued in looking for group before joining this channel."; -- The user must be in the looking for group system to join LFG chat channels. CHAT_NOT_IN_LFG_NOTICE = 0x21, //+ "[%s] You must be queued in looking for group before joining this channel."; -- The user must be in the looking for group system to join LFG chat channels.
@@ -145,18 +145,45 @@ class Channel
} }
}; };
typedef std::map<uint64, PlayerInfo> PlayerList; public:
PlayerList players; Channel(std::string const& name, uint32 channel_id, uint32 Team = 0);
typedef std::set<uint64> BannedList; std::string const& GetName() const { return _name; }
BannedList banned; uint32 GetChannelId() const { return _channelId; }
bool m_announce; bool IsConstant() const { return _channelId != 0; }
bool m_ownership; bool IsAnnounce() const { return _announce; }
std::string m_name; bool IsLFG() const { return GetFlags() & CHANNEL_FLAG_LFG; }
std::string m_password; std::string const& GetPassword() const { return _password; }
uint8 m_flags; void SetPassword(std::string const& npassword) { _password = npassword; }
uint32 m_channelId; void SetAnnounce(bool nannounce) { _announce = nannounce; }
uint64 m_ownerGUID; uint32 GetNumPlayers() const { return playersStore.size(); }
bool m_IsSaved; uint8 GetFlags() const { return _flags; }
bool HasFlag(uint8 flag) const { return _flags & flag; }
void JoinChannel(Player* player, std::string const& pass);
void LeaveChannel(Player* player, bool send = true);
void KickOrBan(Player const* player, std::string const& badname, bool ban);
void Kick(Player const* player, std::string const& badname) { KickOrBan(player, badname, false); }
void Ban(Player const* player, std::string const& badname) { KickOrBan(player, badname, true); }
void UnBan(Player const* player, std::string const& badname);
void Password(Player const* player, std::string const& pass);
void SetMode(Player const* player, std::string const& p2n, bool mod, bool set);
void SetOwner(uint64 guid, bool exclaim = true);
void SetOwner(Player const* player, std::string const& name);
void SendWhoOwner(uint64 guid);
void SetModerator(Player const* player, std::string const& newname) { SetMode(player, newname, true, true); }
void UnsetModerator(Player const* player, std::string const& newname) { SetMode(player, newname, true, false); }
void SetMute(Player const* player, std::string const& newname) { SetMode(player, newname, false, true); }
void UnsetMute(Player const* player, std::string const& newname) { SetMode(player, newname, false, false); }
void List(Player const* player);
void Announce(Player const* player);
void Say(uint64 guid, std::string const& what, uint32 lang);
void Invite(Player const* player, std::string const& newp);
void Voice(uint64 guid1, uint64 guid2);
void DeVoice(uint64 guid1, uint64 guid2);
void JoinNotify(uint64 guid); // invisible notify
void LeaveNotify(uint64 guid); // invisible notify
void SetOwnership(bool ownership) { _ownership = ownership; };
static void CleanOldChannelsInDB();
private: private:
// initial packet data (notify type and channel name) // initial packet data (notify type and channel name)
@@ -197,91 +224,62 @@ class Channel
void MakeVoiceOn(WorldPacket* data, uint64 guid); //+ 0x22 void MakeVoiceOn(WorldPacket* data, uint64 guid); //+ 0x22
void MakeVoiceOff(WorldPacket* data, uint64 guid); //+ 0x23 void MakeVoiceOff(WorldPacket* data, uint64 guid); //+ 0x23
void SendToAll(WorldPacket* data, uint64 p = 0); void SendToAll(WorldPacket* data, uint64 guid = 0);
void SendToAllButOne(WorldPacket* data, uint64 who); void SendToAllButOne(WorldPacket* data, uint64 who);
void SendToOne(WorldPacket* data, uint64 who); void SendToOne(WorldPacket* data, uint64 who);
bool IsOn(uint64 who) const { return players.find(who) != players.end(); } bool IsOn(uint64 who) const { return playersStore.find(who) != playersStore.end(); }
bool IsBanned(uint64 guid) const { return banned.find(guid) != banned.end(); } bool IsBanned(uint64 guid) const { return bannedStore.find(guid) != bannedStore.end(); }
void UpdateChannelInDB() const; void UpdateChannelInDB() const;
void UpdateChannelUseageInDB() const; void UpdateChannelUseageInDB() const;
uint8 GetPlayerFlags(uint64 p) const uint8 GetPlayerFlags(uint64 guid) const
{ {
PlayerList::const_iterator p_itr = players.find(p); PlayerContainer::const_iterator itr = playersStore.find(guid);
if (p_itr == players.end()) return itr != playersStore.end() ? itr->second.flags : 0;
return 0;
return p_itr->second.flags;
} }
void SetModerator(uint64 p, bool set) void SetModerator(uint64 guid, bool set)
{ {
if (players[p].IsModerator() != set) if (playersStore[guid].IsModerator() != set)
{ {
uint8 oldFlag = GetPlayerFlags(p); uint8 oldFlag = GetPlayerFlags(guid);
players[p].SetModerator(set); playersStore[guid].SetModerator(set);
WorldPacket data; WorldPacket data;
MakeModeChange(&data, p, oldFlag); MakeModeChange(&data, guid, oldFlag);
SendToAll(&data); SendToAll(&data);
} }
} }
void SetMute(uint64 p, bool set) void SetMute(uint64 guid, bool set)
{ {
if (players[p].IsMuted() != set) if (playersStore[guid].IsMuted() != set)
{ {
uint8 oldFlag = GetPlayerFlags(p); uint8 oldFlag = GetPlayerFlags(guid);
players[p].SetMuted(set); playersStore[guid].SetMuted(set);
WorldPacket data; WorldPacket data;
MakeModeChange(&data, p, oldFlag); MakeModeChange(&data, guid, oldFlag);
SendToAll(&data); SendToAll(&data);
} }
} }
public: typedef std::map<uint64, PlayerInfo> PlayerContainer;
uint32 m_Team; typedef std::set<uint64> BannedContainer;
Channel(std::string const& name, uint32 channel_id, uint32 Team = 0);
std::string const& GetName() const { return m_name; }
uint32 GetChannelId() const { return m_channelId; }
bool IsConstant() const { return m_channelId != 0; }
bool IsAnnounce() const { return m_announce; }
bool IsLFG() const { return GetFlags() & CHANNEL_FLAG_LFG; }
std::string const& GetPassword() const { return m_password; }
void SetPassword(std::string const& npassword) { m_password = npassword; }
void SetAnnounce(bool nannounce) { m_announce = nannounce; }
uint32 GetNumPlayers() const { return players.size(); }
uint8 GetFlags() const { return m_flags; }
bool HasFlag(uint8 flag) const { return m_flags & flag; }
void Join(uint64 p, const char *pass); bool _announce;
void Leave(uint64 p, bool send = true); bool _ownership;
void KickOrBan(uint64 good, const char *badname, bool ban); bool _IsSaved;
void Kick(uint64 good, const char *badname) { KickOrBan(good, badname, false); } uint8 _flags;
void Ban(uint64 good, const char *badname) { KickOrBan(good, badname, true); } uint32 _channelId;
void UnBan(uint64 good, const char *badname); uint32 _Team;
void Password(uint64 p, const char *pass); uint64 _ownerGUID;
void SetMode(uint64 p, const char *p2n, bool mod, bool set); std::string _name;
void SetOwner(uint64 p, bool exclaim = true); std::string _password;
void SetOwner(uint64 p, const char *newname); PlayerContainer playersStore;
void SendWhoOwner(uint64 p); BannedContainer bannedStore;
void SetModerator(uint64 p, const char *newname) { SetMode(p, newname, true, true); }
void UnsetModerator(uint64 p, const char *newname) { SetMode(p, newname, true, false); }
void SetMute(uint64 p, const char *newname) { SetMode(p, newname, false, true); }
void UnsetMute(uint64 p, const char *newname) { SetMode(p, newname, false, false); }
void List(Player* p);
void Announce(uint64 p);
void Say(uint64 p, const char *what, uint32 lang);
void Invite(uint64 p, const char *newp);
void Voice(uint64 guid1, uint64 guid2);
void DeVoice(uint64 guid1, uint64 guid2);
void JoinNotify(uint64 guid); // invisible notify
void LeaveNotify(uint64 guid); // invisible notify
void SetOwnership(bool ownership) { m_ownership = ownership; };
static void CleanOldChannelsInDB();
}; };
#endif #endif
+6 -5
View File
@@ -35,6 +35,7 @@ ChannelMgr* ChannelMgr::forTeam(uint32 team)
if (team == ALLIANCE) if (team == ALLIANCE)
return ACE_Singleton<AllianceChannelMgr, ACE_Null_Mutex>::instance(); return ACE_Singleton<AllianceChannelMgr, ACE_Null_Mutex>::instance();
if (team == HORDE) if (team == HORDE)
return ACE_Singleton<HordeChannelMgr, ACE_Null_Mutex>::instance(); return ACE_Singleton<HordeChannelMgr, ACE_Null_Mutex>::instance();
@@ -78,8 +79,8 @@ Channel* ChannelMgr::GetChannel(std::string const& name, Player* player, bool pk
return NULL; return NULL;
} }
else
return i->second; return i->second;
} }
void ChannelMgr::LeftChannel(std::string const& name) void ChannelMgr::LeftChannel(std::string const& name)
@@ -95,7 +96,7 @@ void ChannelMgr::LeftChannel(std::string const& name)
Channel* channel = i->second; Channel* channel = i->second;
if (channel->GetNumPlayers() == 0 && !channel->IsConstant()) if (!channel->GetNumPlayers() && !channel->IsConstant())
{ {
channels.erase(wname); channels.erase(wname);
delete channel; delete channel;
@@ -104,6 +105,6 @@ void ChannelMgr::LeftChannel(std::string const& name)
void ChannelMgr::MakeNotOnPacket(WorldPacket* data, std::string const& name) void ChannelMgr::MakeNotOnPacket(WorldPacket* data, std::string const& name)
{ {
data->Initialize(SMSG_CHANNEL_NOTIFY, (1+10)); // we guess size data->Initialize(SMSG_CHANNEL_NOTIFY, 1 + name.size());
(*data) << (uint8)0x05 << name; (*data) << uint8(5) << name;
} }
+50 -50
View File
@@ -75,7 +75,7 @@ inline bool CheckDelimiter(std::istringstream& iss, char delimiter, const char*
char c = iss.peek(); char c = iss.peek();
if (c != delimiter) if (c != delimiter)
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid %s link structure ('%c' expected, '%c' found)", iss.str().c_str(), context, delimiter, c); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid %s link structure ('%c' expected, '%c' found)", iss.str().c_str(), context, delimiter, c);
return false; return false;
} }
iss.ignore(1); iss.ignore(1);
@@ -109,20 +109,20 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
uint32 itemEntry = 0; uint32 itemEntry = 0;
if (!ReadUInt32(iss, itemEntry)) if (!ReadUInt32(iss, itemEntry))
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item entry", iss.str().c_str()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item entry", iss.str().c_str());
return false; return false;
} }
// Validate item // Validate item
_item = sObjectMgr->GetItemTemplate(itemEntry); _item = sObjectMgr->GetItemTemplate(itemEntry);
if (!_item) if (!_item)
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid itemEntry %u in |item command", iss.str().c_str(), itemEntry); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid itemEntry %u in |item command", iss.str().c_str(), itemEntry);
return false; return false;
} }
// Validate item's color // Validate item's color
if (_color != ItemQualityColors[_item->Quality]) if (_color != ItemQualityColors[_item->Quality])
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked item has color %u, but user claims %u", iss.str().c_str(), ItemQualityColors[_item->Quality], _color); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked item has color %u, but user claims %u", iss.str().c_str(), ItemQualityColors[_item->Quality], _color);
return false; return false;
} }
// Number of various item properties after item entry // Number of various item properties after item entry
@@ -136,7 +136,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
int32 id = 0; int32 id = 0;
if (!ReadInt32(iss, id)) if (!ReadInt32(iss, id))
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item property (%u)", iss.str().c_str(), index); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item property (%u)", iss.str().c_str(), index);
return false; return false;
} }
if (id && (index == randomPropertyPosition)) if (id && (index == randomPropertyPosition))
@@ -147,7 +147,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
_property = sItemRandomPropertiesStore.LookupEntry(id); _property = sItemRandomPropertiesStore.LookupEntry(id);
if (!_property) if (!_property)
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid item property id %u in |item command", iss.str().c_str(), id); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid item property id %u in |item command", iss.str().c_str(), id);
return false; return false;
} }
} }
@@ -156,7 +156,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
_suffix = sItemRandomSuffixStore.LookupEntry(-id); _suffix = sItemRandomSuffixStore.LookupEntry(-id);
if (!_suffix) if (!_suffix)
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid item suffix id %u in |item command", iss.str().c_str(), -id); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid item suffix id %u in |item command", iss.str().c_str(), -id);
return false; return false;
} }
} }
@@ -198,7 +198,7 @@ bool ItemChatLink::ValidateName(char* buffer, const char* context)
} }
} }
if (!res) if (!res)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked item (id: %u) name wasn't found in any localization", context, _item->ItemId); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked item (id: %u) name wasn't found in any localization", context, _item->ItemId);
return res; return res;
} }
@@ -210,14 +210,14 @@ bool QuestChatLink::Initialize(std::istringstream& iss)
uint32 questId = 0; uint32 questId = 0;
if (!ReadUInt32(iss, questId)) if (!ReadUInt32(iss, questId))
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading quest entry", iss.str().c_str()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading quest entry", iss.str().c_str());
return false; return false;
} }
// Validate quest // Validate quest
_quest = sObjectMgr->GetQuestTemplate(questId); _quest = sObjectMgr->GetQuestTemplate(questId);
if (!_quest) if (!_quest)
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): quest template %u not found", iss.str().c_str(), questId); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): quest template %u not found", iss.str().c_str(), questId);
return false; return false;
} }
// Check delimiter // Check delimiter
@@ -226,13 +226,13 @@ bool QuestChatLink::Initialize(std::istringstream& iss)
// Read quest level // Read quest level
if (!ReadInt32(iss, _questLevel)) if (!ReadInt32(iss, _questLevel))
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading quest level", iss.str().c_str()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading quest level", iss.str().c_str());
return false; return false;
} }
// Validate quest level // Validate quest level
if (_questLevel >= STRONG_MAX_LEVEL) if (_questLevel >= STRONG_MAX_LEVEL)
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): quest level %d is too big", iss.str().c_str(), _questLevel); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): quest level %d is too big", iss.str().c_str(), _questLevel);
return false; return false;
} }
return true; return true;
@@ -252,7 +252,7 @@ bool QuestChatLink::ValidateName(char* buffer, const char* context)
break; break;
} }
if (!res) if (!res)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked quest (id: %u) title wasn't found in any localization", context, _quest->GetQuestId()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked quest (id: %u) title wasn't found in any localization", context, _quest->GetQuestId());
return res; return res;
} }
@@ -266,14 +266,14 @@ bool SpellChatLink::Initialize(std::istringstream& iss)
uint32 spellId = 0; uint32 spellId = 0;
if (!ReadUInt32(iss, spellId)) if (!ReadUInt32(iss, spellId))
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading spell entry", iss.str().c_str()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading spell entry", iss.str().c_str());
return false; return false;
} }
// Validate spell // Validate spell
_spell = sSpellMgr->GetSpellInfo(spellId); _spell = sSpellMgr->GetSpellInfo(spellId);
if (!_spell) if (!_spell)
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |spell command", iss.str().c_str(), spellId); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |spell command", iss.str().c_str(), spellId);
return false; return false;
} }
return true; return true;
@@ -289,19 +289,19 @@ bool SpellChatLink::ValidateName(char* buffer, const char* context)
SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(_spell->Id); SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(_spell->Id);
if (bounds.first == bounds.second) if (bounds.first == bounds.second)
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line not found for spell %u", context, _spell->Id); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line not found for spell %u", context, _spell->Id);
return false; return false;
} }
SkillLineAbilityEntry const* skillInfo = bounds.first->second; SkillLineAbilityEntry const* skillInfo = bounds.first->second;
if (!skillInfo) if (!skillInfo)
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line ability not found for spell %u", context, _spell->Id); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line ability not found for spell %u", context, _spell->Id);
return false; return false;
} }
SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skillInfo->skillId); SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skillInfo->skillId);
if (!skillLine) if (!skillLine)
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line not found for skill %u", context, skillInfo->skillId); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line not found for skill %u", context, skillInfo->skillId);
return false; return false;
} }
@@ -327,7 +327,7 @@ bool SpellChatLink::ValidateName(char* buffer, const char* context)
} }
if (!res) if (!res)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked spell (id: %u) name wasn't found in any localization", context, _spell->Id); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked spell (id: %u) name wasn't found in any localization", context, _spell->Id);
return res; return res;
} }
@@ -341,14 +341,14 @@ bool AchievementChatLink::Initialize(std::istringstream& iss)
uint32 achievementId = 0; uint32 achievementId = 0;
if (!ReadUInt32(iss, achievementId)) if (!ReadUInt32(iss, achievementId))
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement entry", iss.str().c_str()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement entry", iss.str().c_str());
return false; return false;
} }
// Validate achievement // Validate achievement
_achievement = sAchievementStore.LookupEntry(achievementId); _achievement = sAchievementStore.LookupEntry(achievementId);
if (!_achievement) if (!_achievement)
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid achivement id %u in |achievement command", iss.str().c_str(), achievementId); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid achivement id %u in |achievement command", iss.str().c_str(), achievementId);
return false; return false;
} }
// Check delimiter // Check delimiter
@@ -357,7 +357,7 @@ bool AchievementChatLink::Initialize(std::istringstream& iss)
// Read HEX // Read HEX
if (!ReadHex(iss, _guid, 0)) if (!ReadHex(iss, _guid, 0))
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid hexadecimal number while reading char's guid", iss.str().c_str()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid hexadecimal number while reading char's guid", iss.str().c_str());
return false; return false;
} }
// Skip progress // Skip progress
@@ -369,7 +369,7 @@ bool AchievementChatLink::Initialize(std::istringstream& iss)
if (!ReadUInt32(iss, _data[index])) if (!ReadUInt32(iss, _data[index]))
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement property (%u)", iss.str().c_str(), index); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement property (%u)", iss.str().c_str(), index);
return false; return false;
} }
} }
@@ -389,7 +389,7 @@ bool AchievementChatLink::ValidateName(char* buffer, const char* context)
} }
if (!res) if (!res)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked achievement (id: %u) name wasn't found in any localization", context, _achievement->ID); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked achievement (id: %u) name wasn't found in any localization", context, _achievement->ID);
return res; return res;
} }
@@ -403,14 +403,14 @@ bool TradeChatLink::Initialize(std::istringstream& iss)
uint32 spellId = 0; uint32 spellId = 0;
if (!ReadUInt32(iss, spellId)) if (!ReadUInt32(iss, spellId))
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement entry", iss.str().c_str()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement entry", iss.str().c_str());
return false; return false;
} }
// Validate spell // Validate spell
_spell = sSpellMgr->GetSpellInfo(spellId); _spell = sSpellMgr->GetSpellInfo(spellId);
if (!_spell) if (!_spell)
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), spellId); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), spellId);
return false; return false;
} }
// Check delimiter // Check delimiter
@@ -419,7 +419,7 @@ bool TradeChatLink::Initialize(std::istringstream& iss)
// Minimum talent level // Minimum talent level
if (!ReadInt32(iss, _minSkillLevel)) if (!ReadInt32(iss, _minSkillLevel))
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading minimum talent level", iss.str().c_str()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading minimum talent level", iss.str().c_str());
return false; return false;
} }
// Check delimiter // Check delimiter
@@ -428,7 +428,7 @@ bool TradeChatLink::Initialize(std::istringstream& iss)
// Maximum talent level // Maximum talent level
if (!ReadInt32(iss, _maxSkillLevel)) if (!ReadInt32(iss, _maxSkillLevel))
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading maximum talent level", iss.str().c_str()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading maximum talent level", iss.str().c_str());
return false; return false;
} }
// Check delimiter // Check delimiter
@@ -437,7 +437,7 @@ bool TradeChatLink::Initialize(std::istringstream& iss)
// Something hexadecimal // Something hexadecimal
if (!ReadHex(iss, _guid, 0)) if (!ReadHex(iss, _guid, 0))
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement's owner guid", iss.str().c_str()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement's owner guid", iss.str().c_str());
return false; return false;
} }
// Skip base64 encoded stuff // Skip base64 encoded stuff
@@ -454,21 +454,21 @@ bool TalentChatLink::Initialize(std::istringstream& iss)
// Read talent entry // Read talent entry
if (!ReadUInt32(iss, _talentId)) if (!ReadUInt32(iss, _talentId))
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading talent entry", iss.str().c_str()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading talent entry", iss.str().c_str());
return false; return false;
} }
// Validate talent // Validate talent
TalentEntry const* talentInfo = sTalentStore.LookupEntry(_talentId); TalentEntry const* talentInfo = sTalentStore.LookupEntry(_talentId);
if (!talentInfo) if (!talentInfo)
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid talent id %u in |talent command", iss.str().c_str(), _talentId); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid talent id %u in |talent command", iss.str().c_str(), _talentId);
return false; return false;
} }
// Validate talent's spell // Validate talent's spell
_spell = sSpellMgr->GetSpellInfo(talentInfo->RankID[0]); _spell = sSpellMgr->GetSpellInfo(talentInfo->RankID[0]);
if (!_spell) if (!_spell)
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), talentInfo->RankID[0]); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), talentInfo->RankID[0]);
return false; return false;
} }
// Delimiter // Delimiter
@@ -477,7 +477,7 @@ bool TalentChatLink::Initialize(std::istringstream& iss)
// Rank // Rank
if (!ReadInt32(iss, _rankId)) if (!ReadInt32(iss, _rankId))
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading talent rank", iss.str().c_str()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading talent rank", iss.str().c_str());
return false; return false;
} }
return true; return true;
@@ -493,14 +493,14 @@ bool EnchantmentChatLink::Initialize(std::istringstream& iss)
uint32 spellId = 0; uint32 spellId = 0;
if (!ReadUInt32(iss, spellId)) if (!ReadUInt32(iss, spellId))
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading enchantment spell entry", iss.str().c_str()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading enchantment spell entry", iss.str().c_str());
return false; return false;
} }
// Validate spell // Validate spell
_spell = sSpellMgr->GetSpellInfo(spellId); _spell = sSpellMgr->GetSpellInfo(spellId);
if (!_spell) if (!_spell)
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |enchant command", iss.str().c_str(), spellId); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |enchant command", iss.str().c_str(), spellId);
return false; return false;
} }
return true; return true;
@@ -515,7 +515,7 @@ bool GlyphChatLink::Initialize(std::istringstream& iss)
// Slot // Slot
if (!ReadUInt32(iss, _slotId)) if (!ReadUInt32(iss, _slotId))
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading slot id", iss.str().c_str()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading slot id", iss.str().c_str());
return false; return false;
} }
// Check delimiter // Check delimiter
@@ -525,21 +525,21 @@ bool GlyphChatLink::Initialize(std::istringstream& iss)
uint32 glyphId = 0; uint32 glyphId = 0;
if (!ReadUInt32(iss, glyphId)) if (!ReadUInt32(iss, glyphId))
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading glyph entry", iss.str().c_str()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading glyph entry", iss.str().c_str());
return false; return false;
} }
// Validate glyph // Validate glyph
_glyph = sGlyphPropertiesStore.LookupEntry(glyphId); _glyph = sGlyphPropertiesStore.LookupEntry(glyphId);
if (!_glyph) if (!_glyph)
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid glyph id %u in |glyph command", iss.str().c_str(), glyphId); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid glyph id %u in |glyph command", iss.str().c_str(), glyphId);
return false; return false;
} }
// Validate glyph's spell // Validate glyph's spell
_spell = sSpellMgr->GetSpellInfo(_glyph->SpellId); _spell = sSpellMgr->GetSpellInfo(_glyph->SpellId);
if (!_spell) if (!_spell)
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |glyph command", iss.str().c_str(), _glyph->SpellId); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |glyph command", iss.str().c_str(), _glyph->SpellId);
return false; return false;
} }
return true; return true;
@@ -577,14 +577,14 @@ bool LinkExtractor::IsValidMessage()
} }
else if (_iss.get() != PIPE_CHAR) else if (_iss.get() != PIPE_CHAR)
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence aborted unexpectedly", _iss.str().c_str()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence aborted unexpectedly", _iss.str().c_str());
return false; return false;
} }
// pipe has always to be followed by at least one char // pipe has always to be followed by at least one char
if (_iss.peek() == '\0') if (_iss.peek() == '\0')
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): pipe followed by '\\0'", _iss.str().c_str()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): pipe followed by '\\0'", _iss.str().c_str());
return false; return false;
} }
@@ -607,14 +607,14 @@ bool LinkExtractor::IsValidMessage()
} }
else else
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid sequence, expected '%c' but got '%c'", _iss.str().c_str(), *validSequenceIterator, commandChar); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid sequence, expected '%c' but got '%c'", _iss.str().c_str(), *validSequenceIterator, commandChar);
return false; return false;
} }
} }
else if (validSequence != validSequenceIterator) else if (validSequence != validSequenceIterator)
{ {
// no escaped pipes in sequences // no escaped pipes in sequences
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got escaped pipe in sequence", _iss.str().c_str()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got escaped pipe in sequence", _iss.str().c_str());
return false; return false;
} }
@@ -623,7 +623,7 @@ bool LinkExtractor::IsValidMessage()
case 'c': case 'c':
if (!ReadHex(_iss, color, 8)) if (!ReadHex(_iss, color, 8))
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid hexadecimal number while reading color", _iss.str().c_str()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid hexadecimal number while reading color", _iss.str().c_str());
return false; return false;
} }
break; break;
@@ -632,7 +632,7 @@ bool LinkExtractor::IsValidMessage()
_iss.getline(buffer, 256, DELIMITER); _iss.getline(buffer, 256, DELIMITER);
if (_iss.eof()) if (_iss.eof())
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly", _iss.str().c_str()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly", _iss.str().c_str());
return false; return false;
} }
@@ -654,7 +654,7 @@ bool LinkExtractor::IsValidMessage()
link = new GlyphChatLink(); link = new GlyphChatLink();
else else
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): user sent unsupported link type '%s'", _iss.str().c_str(), buffer); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): user sent unsupported link type '%s'", _iss.str().c_str(), buffer);
return false; return false;
} }
_links.push_back(link); _links.push_back(link);
@@ -669,13 +669,13 @@ bool LinkExtractor::IsValidMessage()
// links start with '[' // links start with '['
if (_iss.get() != '[') if (_iss.get() != '[')
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): link caption doesn't start with '['", _iss.str().c_str()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): link caption doesn't start with '['", _iss.str().c_str());
return false; return false;
} }
_iss.getline(buffer, 256, ']'); _iss.getline(buffer, 256, ']');
if (_iss.eof()) if (_iss.eof())
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly", _iss.str().c_str()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly", _iss.str().c_str());
return false; return false;
} }
@@ -693,7 +693,7 @@ bool LinkExtractor::IsValidMessage()
// no further payload // no further payload
break; break;
default: default:
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid command |%c", _iss.str().c_str(), commandChar); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid command |%c", _iss.str().c_str(), commandChar);
return false; return false;
} }
} }
@@ -701,7 +701,7 @@ bool LinkExtractor::IsValidMessage()
// check if every opened sequence was also closed properly // check if every opened sequence was also closed properly
if (validSequence != validSequenceIterator) if (validSequence != validSequenceIterator)
{ {
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): EOF in active sequence", _iss.str().c_str()); sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): EOF in active sequence", _iss.str().c_str());
return false; return false;
} }
+2 -1
View File
@@ -18,8 +18,9 @@
#ifndef _LFGMGR_H #ifndef _LFGMGR_H
#define _LFGMGR_H #define _LFGMGR_H
#include "Common.h"
#include <ace/Singleton.h> #include <ace/Singleton.h>
#include "DBCStructure.h"
#include "Field.h"
#include "LFG.h" #include "LFG.h"
#include "LFGQueue.h" #include "LFGQueue.h"
#include "LFGGroupData.h" #include "LFGGroupData.h"
+8 -13
View File
@@ -5585,11 +5585,11 @@ void Player::CleanupChannels()
{ {
Channel* ch = *m_channels.begin(); Channel* ch = *m_channels.begin();
m_channels.erase(m_channels.begin()); // remove from player's channel list m_channels.erase(m_channels.begin()); // remove from player's channel list
ch->Leave(GetGUID(), false); // not send to client, not remove from player's channel list ch->LeaveChannel(this, false); // not send to client, not remove from player's channel list
if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetTeam())) if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetTeam()))
cMgr->LeftChannel(ch->GetName()); // deleted channel if empty cMgr->LeftChannel(ch->GetName()); // deleted channel if empty
} }
sLog->outDebug(LOG_FILTER_CHATSYS, "Player: channels cleaned up!"); sLog->outDebug(LOG_FILTER_CHATSYS, "Player %s: channels cleaned up!", GetName().c_str());
} }
void Player::UpdateLocalChannels(uint32 newZone) void Player::UpdateLocalChannels(uint32 newZone)
@@ -5662,11 +5662,11 @@ void Player::UpdateLocalChannels(uint32 newZone)
removeChannel = usedChannel; removeChannel = usedChannel;
if (joinChannel) if (joinChannel)
joinChannel->Join(GetGUID(), ""); // Changed Channel: ... or Joined Channel: ... joinChannel->JoinChannel(this, ""); // Changed Channel: ... or Joined Channel: ...
if (removeChannel) if (removeChannel)
{ {
removeChannel->Leave(GetGUID(), sendRemove); // Leave old channel removeChannel->LeaveChannel(this, sendRemove); // Leave old channel
std::string name = removeChannel->GetName(); // Store name, (*i)erase in LeftChannel std::string name = removeChannel->GetName(); // Store name, (*i)erase in LeftChannel
LeftChannel(removeChannel); // Remove from player's channel list LeftChannel(removeChannel); // Remove from player's channel list
cMgr->LeftChannel(name); // Delete if empty cMgr->LeftChannel(name); // Delete if empty
@@ -5681,7 +5681,7 @@ void Player::LeaveLFGChannel()
{ {
if ((*i)->IsLFG()) if ((*i)->IsLFG())
{ {
(*i)->Leave(GetGUID()); (*i)->LeaveChannel(this);
break; break;
} }
} }
@@ -5689,13 +5689,8 @@ void Player::LeaveLFGChannel()
void Player::UpdateDefense() void Player::UpdateDefense()
{ {
uint32 defense_skill_gain = sWorld->getIntConfig(CONFIG_SKILL_GAIN_DEFENSE); if (UpdateSkill(SKILL_DEFENSE, sWorld->getIntConfig(CONFIG_SKILL_GAIN_DEFENSE)))
UpdateDefenseBonusesMod(); // update dependent from defense skill part
if (UpdateSkill(SKILL_DEFENSE, defense_skill_gain))
{
// update dependent from defense skill part
UpdateDefenseBonusesMod();
}
} }
void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply) void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply)
@@ -21720,7 +21715,7 @@ bool Player::IsAlwaysDetectableFor(WorldObject const* seer) const
return false; return false;
} }
bool Player::IsVisibleGloballyFor(Player* u) const bool Player::IsVisibleGloballyFor(Player const* u) const
{ {
if (!u) if (!u)
return false; return false;
+1 -1
View File
@@ -2317,7 +2317,7 @@ class Player : public Unit, public GridObject<Player>
bool IsNeverVisible() const; bool IsNeverVisible() const;
bool IsVisibleGloballyFor(Player* player) const; bool IsVisibleGloballyFor(Player const* player) const;
void SendInitialVisiblePackets(Unit* target); void SendInitialVisiblePackets(Unit* target);
void UpdateObjectVisibility(bool forced = true); void UpdateObjectVisibility(bool forced = true);
+158 -144
View File
@@ -22,249 +22,252 @@
void WorldSession::HandleJoinChannel(WorldPacket& recvPacket) void WorldSession::HandleJoinChannel(WorldPacket& recvPacket)
{ {
sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); uint32 channelId;
uint32 channel_id;
uint8 unknown1, unknown2; uint8 unknown1, unknown2;
std::string channelname, pass; std::string channelName, password;
recvPacket >> channel_id; recvPacket >> channelId >> unknown1 >> unknown2 >> channelName >> password;
recvPacket >> unknown1 >> unknown2;
recvPacket >> channelname;
recvPacket >> pass;
if (channel_id) sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_JOIN_CHANNEL %s Channel: %u, unk1: %u, unk2: %u, channel: %s, password: %s",
GetPlayerInfo().c_str(), channelId, unknown1, unknown2, channelName.c_str(), password.c_str());
if (channelId)
{ {
ChatChannelsEntry const* channel = sChatChannelsStore.LookupEntry(channel_id); ChatChannelsEntry const* channel = sChatChannelsStore.LookupEntry(channelId);
if (!channel) if (!channel)
return; return;
AreaTableEntry const* current_zone = GetAreaEntryByAreaID(_player->GetZoneId()); AreaTableEntry const* zone = GetAreaEntryByAreaID(GetPlayer()->GetZoneId());
if (!current_zone) if (!zone || !GetPlayer()->CanJoinConstantChannelInZone(channel, zone))
return;
if (!_player->CanJoinConstantChannelInZone(channel, current_zone))
return; return;
} }
if (channelname.empty()) if (channelName.empty())
return; return;
if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
{ {
cMgr->setTeam(_player->GetTeam()); cMgr->setTeam(GetPlayer()->GetTeam());
if (Channel* chn = cMgr->GetJoinChannel(channelname, channel_id)) if (Channel* channel = cMgr->GetJoinChannel(channelName, channelId))
chn->Join(_player->GetGUID(), pass.c_str()); channel->JoinChannel(GetPlayer(), password);
} }
} }
void WorldSession::HandleLeaveChannel(WorldPacket& recvPacket) void WorldSession::HandleLeaveChannel(WorldPacket& recvPacket)
{ {
sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
uint32 unk; uint32 unk;
std::string channelname; std::string channelName;
recvPacket >> unk; // channel id? recvPacket >> unk >> channelName;
recvPacket >> channelname;
if (channelname.empty()) sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_LEAVE_CHANNEL %s Channel: %s, unk1: %u",
GetPlayerInfo().c_str(), channelName.c_str(), unk);
if (channelName.empty())
return; return;
if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
{ {
if (Channel* chn = cMgr->GetChannel(channelname, _player)) if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
chn->Leave(_player->GetGUID(), true); channel->LeaveChannel(GetPlayer(), true);
cMgr->LeftChannel(channelname); cMgr->LeftChannel(channelName);
} }
} }
void WorldSession::HandleChannelList(WorldPacket& recvPacket) void WorldSession::HandleChannelList(WorldPacket& recvPacket)
{ {
sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); std::string channelName;
std::string channelname; recvPacket >> channelName;
recvPacket >> channelname;
if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) sLog->outDebug(LOG_FILTER_CHATSYS, "%s %s Channel: %s",
if (Channel* chn = cMgr->GetChannel(channelname, _player)) recvPacket.GetOpcode() == CMSG_CHANNEL_DISPLAY_LIST ? "CMSG_CHANNEL_DISPLAY_LIST" : "CMSG_CHANNEL_LIST",
chn->List(_player); GetPlayerInfo().c_str(), channelName.c_str());
if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
channel->List(GetPlayer());
} }
void WorldSession::HandleChannelPassword(WorldPacket& recvPacket) void WorldSession::HandleChannelPassword(WorldPacket& recvPacket)
{ {
sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); std::string channelName, password;
std::string channelname, pass; recvPacket >> channelName >> password;
recvPacket >> channelname;
recvPacket >> pass; sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_PASSWORD %s Channel: %s, Password: %s",
GetPlayerInfo().c_str(), channelName.c_str(), password.c_str());
if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player)) if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
chn->Password(_player->GetGUID(), pass.c_str()); channel->Password(GetPlayer(), password);
} }
void WorldSession::HandleChannelSetOwner(WorldPacket& recvPacket) void WorldSession::HandleChannelSetOwner(WorldPacket& recvPacket)
{ {
sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); std::string channelName, targetName;
std::string channelname, newp; recvPacket >> channelName >> targetName;
recvPacket >> channelname;
recvPacket >> newp; sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_SET_OWNER %s Channel: %s, Target: %s",
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
if (!normalizePlayerName(newp)) if (!normalizePlayerName(targetName))
return; return;
if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player)) if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
chn->SetOwner(_player->GetGUID(), newp.c_str()); channel->SetOwner(GetPlayer(), targetName);
} }
void WorldSession::HandleChannelOwner(WorldPacket& recvPacket) void WorldSession::HandleChannelOwner(WorldPacket& recvPacket)
{ {
sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); std::string channelName;
std::string channelname; recvPacket >> channelName;
recvPacket >> channelname;
if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_OWNER %s Channel: %s",
if (Channel* chn = cMgr->GetChannel(channelname, _player)) GetPlayerInfo().c_str(), channelName.c_str());
chn->SendWhoOwner(_player->GetGUID());
if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
channel->SendWhoOwner(GetPlayer()->GetGUID());
} }
void WorldSession::HandleChannelModerator(WorldPacket& recvPacket) void WorldSession::HandleChannelModerator(WorldPacket& recvPacket)
{ {
sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); std::string channelName, targetName;
std::string channelname, otp; recvPacket >> channelName >> targetName;
recvPacket >> channelname;
recvPacket >> otp; sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_MODERATOR %s Channel: %s, Target: %s",
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
if (!normalizePlayerName(otp)) if (!normalizePlayerName(targetName))
return; return;
if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player)) if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
chn->SetModerator(_player->GetGUID(), otp.c_str()); channel->SetModerator(GetPlayer(), targetName);
} }
void WorldSession::HandleChannelUnmoderator(WorldPacket& recvPacket) void WorldSession::HandleChannelUnmoderator(WorldPacket& recvPacket)
{ {
sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); std::string channelName, targetName;
std::string channelname, otp; recvPacket >> channelName >> targetName;
recvPacket >> channelname;
recvPacket >> otp; sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_UNMODERATOR %s Channel: %s, Target: %s",
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
if (!normalizePlayerName(otp)) if (!normalizePlayerName(targetName))
return; return;
if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player)) if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
chn->UnsetModerator(_player->GetGUID(), otp.c_str()); channel->UnsetModerator(GetPlayer(), targetName);
} }
void WorldSession::HandleChannelMute(WorldPacket& recvPacket) void WorldSession::HandleChannelMute(WorldPacket& recvPacket)
{ {
sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); std::string channelName, targetName;
std::string channelname, otp; recvPacket >> channelName >> targetName;
recvPacket >> channelname;
recvPacket >> otp; sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_MUTE %s Channel: %s, Target: %s",
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
if (!normalizePlayerName(otp)) if (!normalizePlayerName(targetName))
return; return;
if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player)) if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
chn->SetMute(_player->GetGUID(), otp.c_str()); channel->SetMute(GetPlayer(), targetName);
} }
void WorldSession::HandleChannelUnmute(WorldPacket& recvPacket) void WorldSession::HandleChannelUnmute(WorldPacket& recvPacket)
{ {
sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); std::string channelName, targetName;
recvPacket >> channelName >> targetName;
std::string channelname, otp; sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_UNMUTE %s Channel: %s, Target: %s",
recvPacket >> channelname; GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
recvPacket >> otp; if (!normalizePlayerName(targetName))
if (!normalizePlayerName(otp))
return; return;
if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player)) if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
chn->UnsetMute(_player->GetGUID(), otp.c_str()); channel->UnsetMute(GetPlayer(), targetName);
} }
void WorldSession::HandleChannelInvite(WorldPacket& recvPacket) void WorldSession::HandleChannelInvite(WorldPacket& recvPacket)
{ {
sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); std::string channelName, targetName;
std::string channelname, otp; recvPacket >> channelName >> targetName;
recvPacket >> channelname;
recvPacket >> otp; sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_INVITE %s Channel: %s, Target: %s",
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
if (!normalizePlayerName(otp)) if (!normalizePlayerName(targetName))
return; return;
if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player)) if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
chn->Invite(_player->GetGUID(), otp.c_str()); channel->Invite(GetPlayer(), targetName);
} }
void WorldSession::HandleChannelKick(WorldPacket& recvPacket) void WorldSession::HandleChannelKick(WorldPacket& recvPacket)
{ {
sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); std::string channelName, targetName;
std::string channelname, otp; recvPacket >> channelName >> targetName;
recvPacket >> channelname;
recvPacket >> otp; sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_KICK %s Channel: %s, Target: %s",
if (!normalizePlayerName(otp)) GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
if (!normalizePlayerName(targetName))
return; return;
if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player)) if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
chn->Kick(_player->GetGUID(), otp.c_str()); channel->Kick(GetPlayer(), targetName);
} }
void WorldSession::HandleChannelBan(WorldPacket& recvPacket) void WorldSession::HandleChannelBan(WorldPacket& recvPacket)
{ {
sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); std::string channelName, targetName;
std::string channelname, otp; recvPacket >> channelName >> targetName;
recvPacket >> channelname;
recvPacket >> otp; sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_BAN %s Channel: %s, Target: %s",
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
if (!normalizePlayerName(otp)) if (!normalizePlayerName(targetName))
return; return;
if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player)) if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
chn->Ban(_player->GetGUID(), otp.c_str()); channel->Ban(GetPlayer(), targetName);
} }
void WorldSession::HandleChannelUnban(WorldPacket& recvPacket) void WorldSession::HandleChannelUnban(WorldPacket& recvPacket)
{ {
sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); std::string channelName, targetName;
recvPacket >> channelName >> targetName;
std::string channelname, otp; sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_UNBAN %s Channel: %s, Target: %s",
recvPacket >> channelname; GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
recvPacket >> otp; if (!normalizePlayerName(targetName))
if (!normalizePlayerName(otp))
return; return;
if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
if (Channel* chn = cMgr->GetChannel(channelname, _player)) if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
chn->UnBan(_player->GetGUID(), otp.c_str()); channel->UnBan(GetPlayer(), targetName);
} }
void WorldSession::HandleChannelAnnouncements(WorldPacket& recvPacket) void WorldSession::HandleChannelAnnouncements(WorldPacket& recvPacket)
{ {
sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); std::string channelName;
std::string channelname; recvPacket >> channelName;
recvPacket >> channelname;
if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_ANNOUNCEMENTS %s Channel: %s",
if (Channel* chn = cMgr->GetChannel(channelname, _player)) GetPlayerInfo().c_str(), channelName.c_str());
chn->Announce(_player->GetGUID());
if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
channel->Announce(GetPlayer());
} }
void WorldSession::HandleChannelDisplayListQuery(WorldPacket &recvPacket) void WorldSession::HandleChannelDisplayListQuery(WorldPacket &recvPacket)
@@ -275,17 +278,23 @@ void WorldSession::HandleChannelDisplayListQuery(WorldPacket &recvPacket)
void WorldSession::HandleGetChannelMemberCount(WorldPacket &recvPacket) void WorldSession::HandleGetChannelMemberCount(WorldPacket &recvPacket)
{ {
sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); std::string channelName;
std::string channelname; recvPacket >> channelName;
recvPacket >> channelname;
if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_GET_CHANNEL_MEMBER_COUNT %s Channel: %s",
GetPlayerInfo().c_str(), channelName.c_str());
if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
{ {
if (Channel* chn = cMgr->GetChannel(channelname, _player)) if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
{ {
WorldPacket data(SMSG_CHANNEL_MEMBER_COUNT, chn->GetName().size()+1+1+4); sLog->outDebug(LOG_FILTER_CHATSYS, "SMSG_CHANNEL_MEMBER_COUNT %s Channel: %s Count: %u",
data << chn->GetName(); GetPlayerInfo().c_str(), channelName.c_str(), channel->GetNumPlayers());
data << uint8(chn->GetFlags());
data << uint32(chn->GetNumPlayers()); WorldPacket data(SMSG_CHANNEL_MEMBER_COUNT, channel->GetName().size() + 1 + 4);
data << channel->GetName();
data << uint8(channel->GetFlags());
data << uint32(channel->GetNumPlayers());
SendPacket(&data); SendPacket(&data);
} }
} }
@@ -293,10 +302,15 @@ void WorldSession::HandleGetChannelMemberCount(WorldPacket &recvPacket)
void WorldSession::HandleSetChannelWatch(WorldPacket &recvPacket) void WorldSession::HandleSetChannelWatch(WorldPacket &recvPacket)
{ {
sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); std::string channelName;
std::string channelname; recvPacket >> channelName;
recvPacket >> channelname;
/*if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_SET_CHANNEL_WATCH %s Channel: %s",
if (Channel* chn = cMgr->GetChannel(channelname, _player)) GetPlayerInfo().c_str(), channelName.c_str());
chn->JoinNotify(_player->GetGUID());*/
/*
if (ChannelMgr* cMgr = channelMgr(GetPlayer()->GetTeam()))
if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
channel->JoinNotify(GetPlayer());
*/
} }
+29 -34
View File
@@ -15,15 +15,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "WorldSession.h"
#include "WorldPacket.h"
#include "DBCStores.h"
#include "Player.h"
#include "Group.h"
#include "LFGMgr.h" #include "LFGMgr.h"
#include "ObjectMgr.h" #include "ObjectMgr.h"
#include "GroupMgr.h" #include "Group.h"
#include "Player.h"
#include "Opcodes.h" #include "Opcodes.h"
#include "WorldPacket.h"
#include "WorldSession.h"
void BuildPlayerLockDungeonBlock(WorldPacket& data, const LfgLockMap& lock) void BuildPlayerLockDungeonBlock(WorldPacket& data, const LfgLockMap& lock)
{ {
@@ -60,7 +58,7 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData)
uint32 roles; uint32 roles;
recvData >> roles; recvData >> roles;
recvData.read_skip<uint16>(); // uint8 (always 0) - uint8 (always 0) recvData.read_skip<uint16>(); // uint8 (always 0) - uint8 (always 0)
recvData >> numDungeons; recvData >> numDungeons;
if (!numDungeons) if (!numDungeons)
{ {
@@ -73,10 +71,10 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData)
for (int8 i = 0; i < numDungeons; ++i) for (int8 i = 0; i < numDungeons; ++i)
{ {
recvData >> dungeon; recvData >> dungeon;
newDungeons.insert((dungeon & 0x00FFFFFF)); // remove the type from the dungeon entry newDungeons.insert((dungeon & 0x00FFFFFF)); // remove the type from the dungeon entry
} }
recvData.read_skip<uint32>(); // for 0..uint8 (always 3) { uint8 (always 0) } recvData.read_skip<uint32>(); // for 0..uint8 (always 3) { uint8 (always 0) }
std::string comment; std::string comment;
recvData >> comment; recvData >> comment;
@@ -101,7 +99,7 @@ void WorldSession::HandleLfgLeaveOpcode(WorldPacket& /*recvData*/)
void WorldSession::HandleLfgProposalResultOpcode(WorldPacket& recvData) void WorldSession::HandleLfgProposalResultOpcode(WorldPacket& recvData)
{ {
uint32 lfgGroupID; // Internal lfgGroupID uint32 lfgGroupID; // Internal lfgGroupID
bool accept; // Accept to join? bool accept; // Accept to join?
recvData >> lfgGroupID; recvData >> lfgGroupID;
recvData >> accept; recvData >> accept;
@@ -114,7 +112,7 @@ void WorldSession::HandleLfgProposalResultOpcode(WorldPacket& recvData)
void WorldSession::HandleLfgSetRolesOpcode(WorldPacket& recvData) void WorldSession::HandleLfgSetRolesOpcode(WorldPacket& recvData)
{ {
uint8 roles; uint8 roles;
recvData >> roles; // Player Group Roles recvData >> roles; // Player Group Roles
uint64 guid = GetPlayer()->GetGUID(); uint64 guid = GetPlayer()->GetGUID();
Group* grp = GetPlayer()->GetGroup(); Group* grp = GetPlayer()->GetGroup();
if (!grp) if (!grp)
@@ -295,10 +293,9 @@ void WorldSession::HandleLfrLeaveOpcode(WorldPacket& recvData)
void WorldSession::HandleLfgGetStatus(WorldPacket& /*recvData*/) void WorldSession::HandleLfgGetStatus(WorldPacket& /*recvData*/)
{ {
uint64 guid = GetPlayer()->GetGUID();
sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_GET_STATUS %s", GetPlayerInfo().c_str()); sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_GET_STATUS %s", GetPlayerInfo().c_str());
sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_GET_STATUS %s", GetPlayerInfo().c_str()); uint64 guid = GetPlayer()->GetGUID();
LfgUpdateData updateData = sLFGMgr->GetLfgStatus(guid); LfgUpdateData updateData = sLFGMgr->GetLfgStatus(guid);
if (GetPlayer()->GetGroup()) if (GetPlayer()->GetGroup())
@@ -318,7 +315,6 @@ void WorldSession::HandleLfgGetStatus(WorldPacket& /*recvData*/)
void WorldSession::SendLfgUpdatePlayer(const LfgUpdateData& updateData) void WorldSession::SendLfgUpdatePlayer(const LfgUpdateData& updateData)
{ {
bool queued = false; bool queued = false;
uint64 guid = GetPlayer()->GetGUID();
uint8 size = uint8(updateData.dungeons.size()); uint8 size = uint8(updateData.dungeons.size());
switch (updateData.updateType) switch (updateData.updateType)
@@ -337,13 +333,13 @@ void WorldSession::SendLfgUpdatePlayer(const LfgUpdateData& updateData)
sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_UPDATE_PLAYER %s updatetype: %u", sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_UPDATE_PLAYER %s updatetype: %u",
GetPlayerInfo().c_str(), updateData.updateType); GetPlayerInfo().c_str(), updateData.updateType);
WorldPacket data(SMSG_LFG_UPDATE_PLAYER, 1 + 1 + (size > 0 ? 1 : 0) * (1 + 1 + 1 + 1 + size * 4 + updateData.comment.length())); WorldPacket data(SMSG_LFG_UPDATE_PLAYER, 1 + 1 + (size > 0 ? 1 : 0) * (1 + 1 + 1 + 1 + size * 4 + updateData.comment.length()));
data << uint8(updateData.updateType); // Lfg Update type data << uint8(updateData.updateType); // Lfg Update type
data << uint8(size > 0); // Extra info data << uint8(size > 0); // Extra info
if (size) if (size)
{ {
data << uint8(queued); // Join the queue data << uint8(queued); // Join the queue
data << uint8(0); // unk - Always 0 data << uint8(0); // unk - Always 0
data << uint8(0); // unk - Always 0 data << uint8(0); // unk - Always 0
data << uint8(size); data << uint8(size);
for (LfgDungeonSet::const_iterator it = updateData.dungeons.begin(); it != updateData.dungeons.end(); ++it) for (LfgDungeonSet::const_iterator it = updateData.dungeons.begin(); it != updateData.dungeons.end(); ++it)
@@ -357,12 +353,11 @@ void WorldSession::SendLfgUpdateParty(const LfgUpdateData& updateData)
{ {
bool join = false; bool join = false;
bool queued = false; bool queued = false;
uint64 guid = GetPlayer()->GetGUID();
uint8 size = uint8(updateData.dungeons.size()); uint8 size = uint8(updateData.dungeons.size());
switch (updateData.updateType) switch (updateData.updateType)
{ {
case LFG_UPDATETYPE_ADDED_TO_QUEUE: // Rolecheck Success case LFG_UPDATETYPE_ADDED_TO_QUEUE: // Rolecheck Success
queued = true; queued = true;
// no break on purpose // no break on purpose
case LFG_UPDATETYPE_PROPOSAL_BEGIN: case LFG_UPDATETYPE_PROPOSAL_BEGIN:
@@ -379,16 +374,16 @@ void WorldSession::SendLfgUpdateParty(const LfgUpdateData& updateData)
sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_UPDATE_PARTY %s updatetype: %u", sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_UPDATE_PARTY %s updatetype: %u",
GetPlayerInfo().c_str(), updateData.updateType); GetPlayerInfo().c_str(), updateData.updateType);
WorldPacket data(SMSG_LFG_UPDATE_PARTY, 1 + 1 + (size > 0 ? 1 : 0) * (1 + 1 + 1 + 1 + 1 + size * 4 + updateData.comment.length())); WorldPacket data(SMSG_LFG_UPDATE_PARTY, 1 + 1 + (size > 0 ? 1 : 0) * (1 + 1 + 1 + 1 + 1 + size * 4 + updateData.comment.length()));
data << uint8(updateData.updateType); // Lfg Update type data << uint8(updateData.updateType); // Lfg Update type
data << uint8(size > 0); // Extra info data << uint8(size > 0); // Extra info
if (size) if (size)
{ {
data << uint8(join); // LFG Join data << uint8(join); // LFG Join
data << uint8(queued); // Join the queue data << uint8(queued); // Join the queue
data << uint8(0); // unk - Always 0 data << uint8(0); // unk - Always 0
data << uint8(0); // unk - Always 0 data << uint8(0); // unk - Always 0
for (uint8 i = 0; i < 3; ++i) for (uint8 i = 0; i < 3; ++i)
data << uint8(0); // unk - Always 0 data << uint8(0); // unk - Always 0
data << uint8(size); data << uint8(size);
for (LfgDungeonSet::const_iterator it = updateData.dungeons.begin(); it != updateData.dungeons.end(); ++it) for (LfgDungeonSet::const_iterator it = updateData.dungeons.begin(); it != updateData.dungeons.end(); ++it)
@@ -443,7 +438,7 @@ void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck& roleCheck)
data << uint8(roles > 0); // Ready data << uint8(roles > 0); // Ready
data << uint32(roles); // Roles data << uint32(roles); // Roles
Player* player = ObjectAccessor::FindPlayer(guid); Player* player = ObjectAccessor::FindPlayer(guid);
data << uint8(player ? player->getLevel() : 0); // Level data << uint8(player ? player->getLevel() : 0); // Level
for (LfgRolesMap::const_iterator it = roleCheck.roles.begin(); it != roleCheck.roles.end(); ++it) for (LfgRolesMap::const_iterator it = roleCheck.roles.begin(); it != roleCheck.roles.end(); ++it)
{ {
@@ -456,7 +451,7 @@ void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck& roleCheck)
data << uint8(roles > 0); // Ready data << uint8(roles > 0); // Ready
data << uint32(roles); // Roles data << uint32(roles); // Roles
player = ObjectAccessor::FindPlayer(guid); player = ObjectAccessor::FindPlayer(guid);
data << uint8(player ? player->getLevel() : 0); // Level data << uint8(player ? player->getLevel() : 0);// Level
} }
} }
SendPacket(&data); SendPacket(&data);
@@ -606,11 +601,11 @@ void WorldSession::SendLfgUpdateProposal(uint32 proposalId, LfgProposal const& p
} }
else else
{ {
data << uint8(player.group == proposal.group); // In dungeon (silent) data << uint8(player.group == proposal.group); // In dungeon (silent)
data << uint8(player.group == gguid); // Same Group than player data << uint8(player.group == gguid); // Same Group than player
} }
data << uint8(player.accept != LFG_ANSWER_PENDING); // Answered data << uint8(player.accept != LFG_ANSWER_PENDING);// Answered
data << uint8(player.accept == LFG_ANSWER_AGREE); // Accepted data << uint8(player.accept == LFG_ANSWER_AGREE); // Accepted
} }
SendPacket(&data); SendPacket(&data);
} }