aboutsummaryrefslogtreecommitdiff
path: root/src/server/game
diff options
context:
space:
mode:
authorSpp <spp@jorge.gr>2012-11-22 15:04:59 +0100
committerSpp <spp@jorge.gr>2012-11-22 15:04:59 +0100
commitb9b57c2d62fe68f5b35bf7cdb2fb6a68e501ca5e (patch)
tree7c15f9bd2298d0fc8564a12397e485317e754bcd /src/server/game
parent7416ada4f7b28c6fa8a9fd18d90327c1314106d4 (diff)
parent32c259b1ce88c36015514018e95a7d6c29420678 (diff)
Merge branch 'master' into 4.3.4
Conflicts: src/server/game/Chat/ChatLink.cpp src/server/game/Entities/Player/Player.cpp src/server/game/Handlers/ChannelHandler.cpp src/server/scripts/EasternKingdoms/hinterlands.cpp
Diffstat (limited to 'src/server/game')
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp4
-rwxr-xr-xsrc/server/game/Chat/Channels/Channel.cpp791
-rwxr-xr-xsrc/server/game/Chat/Channels/Channel.h146
-rwxr-xr-xsrc/server/game/Chat/Channels/ChannelMgr.cpp11
-rw-r--r--src/server/game/Chat/ChatLink.cpp100
-rwxr-xr-xsrc/server/game/DungeonFinding/LFG.h2
-rw-r--r--src/server/game/DungeonFinding/LFGGroupData.cpp2
-rwxr-xr-xsrc/server/game/DungeonFinding/LFGMgr.cpp20
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.h12
-rw-r--r--src/server/game/DungeonFinding/LFGPlayerData.cpp2
-rw-r--r--src/server/game/DungeonFinding/LFGScripts.cpp13
-rw-r--r--src/server/game/Entities/Player/Player.cpp12
-rw-r--r--src/server/game/Entities/Player/Player.h2
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp4
-rwxr-xr-xsrc/server/game/Handlers/CalendarHandler.cpp4
-rwxr-xr-xsrc/server/game/Handlers/ChannelHandler.cpp292
-rwxr-xr-xsrc/server/game/Handlers/LFGHandler.cpp245
17 files changed, 807 insertions, 855 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index a22978632fe..2cd65c42f74 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -753,12 +753,16 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
case SMART_ACTION_CALL_GROUPEVENTHAPPENS:
{
+ if (!unit)
+ break;
+
if (IsPlayer(unit) && GetBaseObject())
{
unit->ToPlayer()->GroupEventHappens(e.action.quest.quest, GetBaseObject());
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_CALL_GROUPEVENTHAPPENS: Player %u, group credit for quest %u",
unit->GetGUIDLow(), e.action.quest.quest);
}
+
// Special handling for vehicles
if (Vehicle* vehicle = unit->GetVehicleKit())
for (SeatMap::iterator it = vehicle->Seats.begin(); it != vehicle->Seats.end(); ++it)
diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp
index 3ccab6e5c6c..7bada252da6 100755
--- a/src/server/game/Chat/Channels/Channel.cpp
+++ b/src/server/game/Chat/Channels/Channel.cpp
@@ -25,48 +25,54 @@
#include "AccountMgr.h"
#include "Player.h"
-Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team) : m_announce(true),
- m_ownership(true), m_name(name), m_password(""), m_flags(0), m_channelId(channel_id),
- m_ownerGUID(0), m_Team(Team)
+Channel::Channel(std::string const& name, uint32 channelId, uint32 team):
+ _announce(true),
+ _ownership(true),
+ _IsSaved(false),
+ _flags(0),
+ _channelId(channelId),
+ _Team(team),
+ _ownerGUID(0),
+ _name(name),
+ _password("")
{
- m_IsSaved = false;
// set special flags if built-in channel
- if (ChatChannelsEntry const* ch = sChatChannelsStore.LookupEntry(channel_id)) // check whether it's a built-in channel
+ if (ChatChannelsEntry const* ch = sChatChannelsStore.LookupEntry(channelId)) // check whether it's a built-in channel
{
- m_announce = false; // no join/leave announces
- m_ownership = false; // no ownership handout
+ _announce = false; // no join/leave announces
+ _ownership = false; // no ownership handout
- m_flags |= CHANNEL_FLAG_GENERAL; // for all built-in channels
+ _flags |= CHANNEL_FLAG_GENERAL; // for all built-in channels
if (ch->flags & CHANNEL_DBC_FLAG_TRADE) // for trade channel
- m_flags |= CHANNEL_FLAG_TRADE;
+ _flags |= CHANNEL_FLAG_TRADE;
if (ch->flags & CHANNEL_DBC_FLAG_CITY_ONLY2) // for city only channels
- m_flags |= CHANNEL_FLAG_CITY;
+ _flags |= CHANNEL_FLAG_CITY;
if (ch->flags & CHANNEL_DBC_FLAG_LFG) // for LFG channel
- m_flags |= CHANNEL_FLAG_LFG;
+ _flags |= CHANNEL_FLAG_LFG;
else // for all other channels
- m_flags |= CHANNEL_FLAG_NOT_LFG;
+ _flags |= CHANNEL_FLAG_NOT_LFG;
}
else // it's custom channel
{
- m_flags |= CHANNEL_FLAG_CUSTOM;
+ _flags |= CHANNEL_FLAG_CUSTOM;
// If storing custom channels in the db is enabled either load or save the channel
if (sWorld->getBoolConfig(CONFIG_PRESERVE_CUSTOM_CHANNELS))
{
PreparedStatement *stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHANNEL);
stmt->setString(0, name);
- stmt->setUInt32(1, m_Team);
+ stmt->setUInt32(1, _Team);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result) //load
{
Field* fields = result->Fetch();
- m_announce = fields[0].GetBool();
- m_ownership = fields[1].GetBool();
- m_password = fields[2].GetString();
+ _announce = fields[0].GetBool();
+ _ownership = fields[1].GetBool();
+ _password = fields[2].GetString();
const char* db_BannedList = fields[3].GetCString();
if (db_BannedList)
@@ -77,8 +83,8 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team) : m_an
uint64 banned_guid = atol(*i);
if (banned_guid)
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "Channel(%s) loaded banned guid:" UI64FMTD "", name.c_str(), banned_guid);
- banned.insert(banned_guid);
+ sLog->outDebug(LOG_FILTER_CHATSYS, "Channel(%s) loaded bannedStore guid:" UI64FMTD "", name.c_str(), banned_guid);
+ bannedStore.insert(banned_guid);
}
}
}
@@ -87,45 +93,45 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team) : m_an
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHANNEL);
stmt->setString(0, name);
- stmt->setUInt32(1, m_Team);
+ stmt->setUInt32(1, _Team);
CharacterDatabase.Execute(stmt);
sLog->outDebug(LOG_FILTER_CHATSYS, "Channel(%s) saved in database", name.c_str());
}
- m_IsSaved = true;
+ _IsSaved = true;
}
}
}
void Channel::UpdateChannelInDB() const
{
- if (m_IsSaved)
+ if (_IsSaved)
{
std::ostringstream banlist;
- BannedList::const_iterator iter;
- for (iter = banned.begin(); iter != banned.end(); ++iter)
+ BannedContainer::const_iterator iter;
+ for (iter = bannedStore.begin(); iter != bannedStore.end(); ++iter)
banlist << (*iter) << ' ';
std::string banListStr = banlist.str();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL);
- stmt->setBool(0, m_announce);
- stmt->setBool(1, m_ownership);
- stmt->setString(2, m_password);
+ stmt->setBool(0, _announce);
+ stmt->setBool(1, _ownership);
+ stmt->setString(2, _password);
stmt->setString(3, banListStr);
- stmt->setString(4, m_name);
- stmt->setUInt32(5, m_Team);
+ stmt->setString(4, _name);
+ stmt->setUInt32(5, _Team);
CharacterDatabase.Execute(stmt);
- sLog->outDebug(LOG_FILTER_CHATSYS, "Channel(%s) updated in database", m_name.c_str());
+ sLog->outDebug(LOG_FILTER_CHATSYS, "Channel(%s) updated in database", _name.c_str());
}
}
void Channel::UpdateChannelUseageInDB() const
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_USAGE);
- stmt->setString(0, m_name);
- stmt->setUInt32(1, m_Team);
+ stmt->setString(0, _name);
+ stmt->setUInt32(1, _Team);
CharacterDatabase.Execute(stmt);
}
@@ -141,531 +147,500 @@ void Channel::CleanOldChannelsInDB()
}
}
-void Channel::Join(uint64 p, const char *pass)
+void Channel::JoinChannel(Player* player, std::string const& pass)
{
- WorldPacket data;
- if (IsOn(p))
+ uint64 guid = player->GetGUID();
+ if (IsOn(guid))
{
- if (!IsConstant()) // non send error message for built-in channels
+ // Do not send error message for built-in channels
+ if (!IsConstant())
{
- MakePlayerAlreadyMember(&data, p);
- SendToOne(&data, p);
+ WorldPacket data;
+ MakePlayerAlreadyMember(&data, guid);
+ SendToOne(&data, guid);
}
return;
}
- if (IsBanned(p))
+ if (IsBanned(guid))
{
+ WorldPacket data;
MakeBanned(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
return;
}
- if (m_password.length() > 0 && strcmp(pass, m_password.c_str()))
+ if (!_password.empty() && pass != _password)
{
+ WorldPacket data;
MakeWrongPassword(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
return;
}
- Player* player = ObjectAccessor::FindPlayer(p);
-
- if (player)
+ if (HasFlag(CHANNEL_FLAG_LFG) &&
+ sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) &&
+ AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) &&
+ player->GetGroup())
{
- if (HasFlag(CHANNEL_FLAG_LFG) &&
- sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) && player->GetGroup())
- {
- MakeNotInLfg(&data);
- SendToOne(&data, p);
- return;
- }
-
- player->JoinedChannel(this);
+ WorldPacket data;
+ MakeNotInLfg(&data);
+ SendToOne(&data, guid);
+ return;
}
- if (m_announce && (!player || !AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
+ player->JoinedChannel(this);
+
+ if (_announce && (!AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) ||
+ !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
{
- MakeJoined(&data, p);
+ WorldPacket data;
+ MakeJoined(&data, guid);
SendToAll(&data);
}
- data.clear();
-
PlayerInfo pinfo;
- pinfo.player = p;
+ pinfo.player = guid;
pinfo.flags = MEMBER_FLAG_NONE;
- players[p] = pinfo;
+ playersStore[guid] = pinfo;
+ WorldPacket data;
MakeYouJoined(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
- JoinNotify(p);
+ JoinNotify(guid);
// Custom channel handling
if (!IsConstant())
{
// Update last_used timestamp in db
- if (!players.empty())
+ if (!playersStore.empty())
UpdateChannelUseageInDB();
// If the channel has no owner yet and ownership is allowed, set the new owner.
- if (!m_ownerGUID && m_ownership)
+ if (!_ownerGUID && _ownership)
{
- SetOwner(p, (players.size() > 1 ? true : false));
- players[p].SetModerator(true);
+ SetOwner(guid, playersStore.size() > 1);
+ playersStore[guid].SetModerator(true);
}
}
}
-void Channel::Leave(uint64 p, bool send)
+void Channel::LeaveChannel(Player* player, bool send)
{
- if (!IsOn(p))
+ uint64 guid = player->GetGUID();
+ if (!IsOn(guid))
{
if (send)
{
WorldPacket data;
MakeNotMember(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
}
+ return;
}
- else
+
+ if (send)
{
- Player* player = ObjectAccessor::FindPlayer(p);
+ WorldPacket data;
+ MakeYouLeft(&data);
+ SendToOne(&data, guid);
+ player->LeftChannel(this);
+ data.clear();
+ }
- if (send)
- {
- WorldPacket data;
- MakeYouLeft(&data);
- SendToOne(&data, p);
- if (player)
- player->LeftChannel(this);
- data.clear();
- }
+ bool changeowner = playersStore[guid].IsOwner();
- bool changeowner = players[p].IsOwner();
+ playersStore.erase(guid);
+ if (_announce && (!AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) ||
+ !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
+ {
+ WorldPacket data;
+ MakeLeft(&data, guid);
+ SendToAll(&data);
+ }
- players.erase(p);
- if (m_announce && (!player || !AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
- {
- WorldPacket data;
- MakeLeft(&data, p);
- SendToAll(&data);
- }
+ LeaveNotify(guid);
- LeaveNotify(p);
+ if (!IsConstant())
+ {
+ // Update last_used timestamp in db
+ UpdateChannelUseageInDB();
- if (!IsConstant())
+ // If the channel owner left and there are still playersStore inside, pick a new owner
+ if (changeowner && _ownership && !playersStore.empty())
{
- // Update last_used timestamp in db
- UpdateChannelUseageInDB();
-
- // If the channel owner left and there are still players inside, pick a new owner
- if (changeowner && m_ownership && !players.empty())
- {
- uint64 newowner = players.begin()->second.player;
- players[newowner].SetModerator(true);
- SetOwner(newowner);
- }
+ uint64 newowner = playersStore.begin()->second.player;
+ playersStore[newowner].SetModerator(true);
+ SetOwner(newowner);
}
}
}
-void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
+void Channel::KickOrBan(Player const* player, std::string const& badname, bool ban)
{
- AccountTypes sec = SEC_PLAYER;
- Player* gplr = ObjectAccessor::FindPlayer(good);
- if (gplr)
- sec = gplr->GetSession()->GetSecurity();
+ AccountTypes sec = player->GetSession()->GetSecurity();
+ uint64 good = player->GetGUID();
if (!IsOn(good))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, good);
+ return;
}
- else if (!players[good].IsModerator() && !AccountMgr::IsGMAccount(sec))
+
+ if (!playersStore[good].IsModerator() && !AccountMgr::IsGMAccount(sec))
{
WorldPacket data;
MakeNotModerator(&data);
SendToOne(&data, good);
+ return;
}
- else
+
+ Player* bad = sObjectAccessor->FindPlayerByName(badname);
+ uint64 victim = bad ? bad->GetGUID() : 0;
+ if (!victim || !IsOn(victim))
{
- Player* bad = sObjectAccessor->FindPlayerByName(badname);
- if (bad == NULL || !IsOn(bad->GetGUID()))
- {
- WorldPacket data;
- MakePlayerNotFound(&data, badname);
- SendToOne(&data, good);
- }
- else if (!AccountMgr::IsGMAccount(sec) && bad->GetGUID() == m_ownerGUID && good != m_ownerGUID)
- {
- WorldPacket data;
- MakeNotOwner(&data);
- SendToOne(&data, good);
- }
- else
- {
- bool changeowner = (m_ownerGUID == bad->GetGUID());
-
- WorldPacket data;
- bool notify = !(AccountMgr::IsGMAccount(sec) && sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL));
+ WorldPacket data;
+ MakePlayerNotFound(&data, badname);
+ SendToOne(&data, good);
+ return;
+ }
- if (ban && !IsBanned(bad->GetGUID()))
- {
- banned.insert(bad->GetGUID());
- UpdateChannelInDB();
+ bool changeowner = _ownerGUID == victim;
- if (notify)
- MakePlayerBanned(&data, bad->GetGUID(), good);
- }
- else if (notify)
- MakePlayerKicked(&data, bad->GetGUID(), good);
+ if (!AccountMgr::IsGMAccount(sec) && changeowner && good != _ownerGUID)
+ {
+ WorldPacket data;
+ MakeNotOwner(&data);
+ SendToOne(&data, good);
+ return;
+ }
- if (notify)
- SendToAll(&data);
+ bool notify = !(AccountMgr::IsGMAccount(sec) && sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL));
- players.erase(bad->GetGUID());
- bad->LeftChannel(this);
+ if (ban && !IsBanned(victim))
+ {
+ bannedStore.insert(victim);
+ UpdateChannelInDB();
- if (changeowner && m_ownership && !players.empty())
- {
- uint64 newowner = good;
- players[newowner].SetModerator(true);
- SetOwner(newowner);
- }
+ if (notify)
+ {
+ WorldPacket data;
+ MakePlayerBanned(&data, victim, good);
+ SendToAll(&data);
}
}
+ else if (notify)
+ {
+ WorldPacket data;
+ MakePlayerKicked(&data, victim, good);
+ SendToAll(&data);
+ }
+
+ playersStore.erase(victim);
+ bad->LeftChannel(this);
+
+ if (changeowner && _ownership && !playersStore.empty())
+ {
+ uint64 newowner = good;
+ playersStore[newowner].SetModerator(true);
+ SetOwner(newowner);
+ }
}
-void Channel::UnBan(uint64 good, const char *badname)
+void Channel::UnBan(Player const* player, std::string const& badname)
{
- uint32 sec = 0;
- Player* gplr = ObjectAccessor::FindPlayer(good);
- if (gplr)
- sec = gplr->GetSession()->GetSecurity();
+ uint32 sec = player->GetSession()->GetSecurity();
+ uint64 good = player->GetGUID();
if (!IsOn(good))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, good);
+ return;
}
- else if (!players[good].IsModerator() && !AccountMgr::IsGMAccount(sec))
+
+ if (!playersStore[good].IsModerator() && !AccountMgr::IsGMAccount(sec))
{
WorldPacket data;
MakeNotModerator(&data);
SendToOne(&data, good);
+ return;
}
- else
- {
- Player* bad = sObjectAccessor->FindPlayerByName(badname);
- if (bad == NULL || !IsBanned(bad->GetGUID()))
- {
- WorldPacket data;
- MakePlayerNotFound(&data, badname);
- SendToOne(&data, good);
- }
- else
- {
- banned.erase(bad->GetGUID());
- WorldPacket data;
- MakePlayerUnbanned(&data, bad->GetGUID(), good);
- SendToAll(&data);
+ Player* bad = sObjectAccessor->FindPlayerByName(badname);
+ uint64 victim = bad ? bad->GetGUID(): 0;
- UpdateChannelInDB();
- }
+ if (!victim || !IsBanned(victim))
+ {
+ WorldPacket data;
+ MakePlayerNotFound(&data, badname);
+ SendToOne(&data, good);
+ return;
}
+
+ bannedStore.erase(victim);
+
+ WorldPacket data;
+ MakePlayerUnbanned(&data, victim, good);
+ SendToAll(&data);
+
+ UpdateChannelInDB();
}
-void Channel::Password(uint64 p, const char *pass)
+void Channel::Password(Player const* player, std::string const& pass)
{
- uint32 sec = 0;
- Player* player = ObjectAccessor::FindPlayer(p);
- if (player)
- sec = player->GetSession()->GetSecurity();
+ uint64 guid = player->GetGUID();
ChatHandler chat(player->GetSession());
-
- if (!IsOn(p))
+ if (!IsOn(guid))
{
WorldPacket data;
MakeNotMember(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
+ return;
}
- else if (!players[p].IsModerator() && !AccountMgr::IsGMAccount(sec))
+
+ if (!playersStore[guid].IsModerator() && !AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()))
{
WorldPacket data;
MakeNotModerator(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
+ return;
}
- else
- {
- m_password = pass;
- WorldPacket data;
- MakePasswordChanged(&data, p);
- SendToAll(&data);
+ _password = pass;
- UpdateChannelInDB();
- }
+ WorldPacket data;
+ MakePasswordChanged(&data, guid);
+ SendToAll(&data);
+
+ UpdateChannelInDB();
}
-void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
+void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bool set)
{
- Player* player = ObjectAccessor::FindPlayer(p);
- if (!player)
- return;
-
+ uint64 guid = player->GetGUID();
uint32 sec = player->GetSession()->GetSecurity();
- if (!IsOn(p))
+ if (!IsOn(guid))
{
WorldPacket data;
MakeNotMember(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
+ return;
}
- else if (!players[p].IsModerator() && !AccountMgr::IsGMAccount(sec))
+
+ if (!playersStore[guid].IsModerator() && !AccountMgr::IsGMAccount(sec))
{
WorldPacket data;
MakeNotModerator(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
+ return;
}
- else
- {
- Player* newp = sObjectAccessor->FindPlayerByName(p2n);
- if (!newp)
- {
- WorldPacket data;
- MakePlayerNotFound(&data, p2n);
- SendToOne(&data, p);
- return;
- }
- if (p == m_ownerGUID && newp->GetGUID() == m_ownerGUID && mod)
- return;
+ if (guid == _ownerGUID && std::string(p2n) == player->GetName() && mod)
+ return;
- if (!IsOn(newp->GetGUID()))
- {
- WorldPacket data;
- MakePlayerNotFound(&data, p2n);
- SendToOne(&data, p);
- return;
- }
+ Player* newp = sObjectAccessor->FindPlayerByName(p2n);
+ uint64 victim = newp ? newp->GetGUID() : 0;
+ if (!victim || !IsOn(victim) ||
// allow make moderator from another team only if both is GMs
// at this moment this only way to show channel post for GM from another team
- if ((!AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) || !AccountMgr::IsGMAccount(newp->GetSession()->GetSecurity())) &&
- player->GetTeam() != newp->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
- {
- WorldPacket data;
- MakePlayerNotFound(&data, p2n);
- SendToOne(&data, p);
- return;
- }
-
- if (m_ownerGUID == newp->GetGUID() && m_ownerGUID != p)
- {
- WorldPacket data;
- MakeNotOwner(&data);
- SendToOne(&data, p);
- return;
- }
-
- if (mod)
- SetModerator(newp->GetGUID(), set);
- else
- SetMute(newp->GetGUID(), set);
- }
-}
-
-void Channel::SetOwner(uint64 p, const char *newname)
-{
- Player* player = ObjectAccessor::FindPlayer(p);
- if (!player)
- return;
-
- uint32 sec = player->GetSession()->GetSecurity();
-
- if (!IsOn(p))
+ ((!AccountMgr::IsGMAccount(sec) || !AccountMgr::IsGMAccount(newp->GetSession()->GetSecurity())) &&
+ player->GetTeam() != newp->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)))
{
WorldPacket data;
- MakeNotMember(&data);
- SendToOne(&data, p);
+ MakePlayerNotFound(&data, p2n);
+ SendToOne(&data, guid);
return;
}
- if (!AccountMgr::IsGMAccount(sec) && p != m_ownerGUID)
+ if (_ownerGUID == victim && _ownerGUID != guid)
{
WorldPacket data;
MakeNotOwner(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
return;
}
- Player* newp = sObjectAccessor->FindPlayerByName(newname);
- if (newp == NULL || !IsOn(newp->GetGUID()))
+ if (mod)
+ SetModerator(newp->GetGUID(), set);
+ else
+ SetMute(newp->GetGUID(), set);
+}
+
+void Channel::SetOwner(Player const* player, std::string const& newname)
+{
+ uint64 guid = player->GetGUID();
+ uint32 sec = player->GetSession()->GetSecurity();
+
+ if (!IsOn(guid) || (!AccountMgr::IsGMAccount(sec) && guid != _ownerGUID))
{
WorldPacket data;
- MakePlayerNotFound(&data, newname);
- SendToOne(&data, p);
+ MakeNotMember(&data);
+ SendToOne(&data, guid);
return;
}
- if (newp->GetTeam() != player->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
+ Player* newp = sObjectAccessor->FindPlayerByName(newname);
+ uint64 victim = newp ? newp->GetGUID() : 0;
+
+ if (!victim || !IsOn(victim) ||
+ (newp->GetTeam() != player->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)))
{
WorldPacket data;
MakePlayerNotFound(&data, newname);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
return;
}
- players[newp->GetGUID()].SetModerator(true);
- SetOwner(newp->GetGUID());
+ playersStore[victim].SetModerator(true);
+ SetOwner(victim);
}
-void Channel::SendWhoOwner(uint64 p)
+void Channel::SendWhoOwner(uint64 guid)
{
- if (!IsOn(p))
- {
- WorldPacket data;
- MakeNotMember(&data);
- SendToOne(&data, p);
- }
- else
- {
- WorldPacket data;
+ WorldPacket data;
+ if (IsOn(guid))
MakeChannelOwner(&data);
- SendToOne(&data, p);
- }
+ else
+ MakeNotMember(&data);
+ SendToOne(&data, guid);
}
-void Channel::List(Player* player)
+void Channel::List(Player const* player)
{
- uint64 p = player->GetGUID();
+ uint64 guid = player->GetGUID();
- if (!IsOn(p))
+ if (!IsOn(guid))
{
WorldPacket data;
MakeNotMember(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
+ return;
}
- else
- {
- WorldPacket data(SMSG_CHANNEL_LIST, 1+(GetName().size()+1)+1+4+players.size()*(8+1));
- data << uint8(1); // channel type?
- data << GetName(); // channel name
- data << uint8(GetFlags()); // channel flags?
- size_t pos = data.wpos();
- data << uint32(0); // size of list, placeholder
+ sLog->outDebug(LOG_FILTER_CHATSYS, "SMSG_CHANNEL_LIST %s Channel: %s",
+ player->GetSession()->GetPlayerInfo().c_str(), GetName().c_str());
- uint32 gmLevelInWhoList = sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST);
+ WorldPacket data(SMSG_CHANNEL_LIST, 1+(GetName().size()+1)+1+4+playersStore.size()*(8+1));
+ data << uint8(1); // channel type?
+ data << GetName(); // channel name
+ data << uint8(GetFlags()); // channel flags?
- uint32 count = 0;
- for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
- {
- Player* member = ObjectAccessor::FindPlayer(i->first);
+ size_t pos = data.wpos();
+ data << uint32(0); // size of list, placeholder
- // PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
- // MODERATOR, GAME MASTER, ADMINISTRATOR can see all
- if (member && (!AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) || member->GetSession()->GetSecurity() <= AccountTypes(gmLevelInWhoList)) &&
- member->IsVisibleGloballyFor(player))
- {
- data << uint64(i->first);
- data << uint8(i->second.flags); // flags seems to be changed...
- ++count;
- }
- }
+ uint32 gmLevelInWhoList = sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST);
- data.put<uint32>(pos, count);
+ uint32 count = 0;
+ for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i)
+ {
+ Player* member = ObjectAccessor::FindPlayer(i->first);
- SendToOne(&data, p);
+ // PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
+ // MODERATOR, GAME MASTER, ADMINISTRATOR can see all
+ if (member && (!AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) || member->GetSession()->GetSecurity() <= AccountTypes(gmLevelInWhoList)) &&
+ member->IsVisibleGloballyFor(player))
+ {
+ data << uint64(i->first);
+ data << uint8(i->second.flags); // flags seems to be changed...
+ ++count;
+ }
}
+
+ data.put<uint32>(pos, count);
+
+ SendToOne(&data, guid);
}
-void Channel::Announce(uint64 p)
+void Channel::Announce(Player const* player)
{
- uint32 sec = 0;
- Player* player = ObjectAccessor::FindPlayer(p);
- if (player)
- sec = player->GetSession()->GetSecurity();
+ uint64 guid = player->GetGUID();
+ uint32 sec = player->GetSession()->GetSecurity();
- if (!IsOn(p))
+ if (!IsOn(guid))
{
WorldPacket data;
MakeNotMember(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
+ return;
}
- else if (!players[p].IsModerator() && !AccountMgr::IsGMAccount(sec))
+
+ if (!playersStore[guid].IsModerator() && !AccountMgr::IsGMAccount(sec))
{
WorldPacket data;
MakeNotModerator(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
+ return;
}
- else
- {
- m_announce = !m_announce;
- WorldPacket data;
- if (m_announce)
- MakeAnnouncementsOn(&data, p);
- else
- MakeAnnouncementsOff(&data, p);
- SendToAll(&data);
+ _announce = !_announce;
- UpdateChannelInDB();
- }
+ WorldPacket data;
+ if (_announce)
+ MakeAnnouncementsOn(&data, guid);
+ else
+ MakeAnnouncementsOff(&data, guid);
+ SendToAll(&data);
+
+ UpdateChannelInDB();
}
-void Channel::Say(uint64 p, const char *what, uint32 lang)
+void Channel::Say(uint64 guid, std::string const& what, uint32 lang)
{
- if (!what)
+ if (what.empty())
return;
+
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
lang = LANG_UNIVERSAL;
- Player* player = ObjectAccessor::FindPlayer(p);
+ Player* player = ObjectAccessor::FindPlayer(guid);
- if (!IsOn(p))
+ if (!IsOn(guid))
{
WorldPacket data;
MakeNotMember(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
+ return;
}
- else if (players[p].IsMuted())
+
+ if (playersStore[guid].IsMuted())
{
WorldPacket data;
MakeMuted(&data);
- SendToOne(&data, p);
- }
- else
- {
- uint32 messageLength = strlen(what) + 1;
-
- WorldPacket data(SMSG_MESSAGECHAT, 1+4+8+4+m_name.size()+1+8+4+messageLength+1);
- data << (uint8)CHAT_MSG_CHANNEL;
- data << (uint32)lang;
- data << p; // 2.1.0
- data << uint32(0); // 2.1.0
- data << m_name;
- data << p;
- data << messageLength;
- data << what;
- data << uint8(player ? player->GetChatTag() : 0);
-
- SendToAll(&data, !players[p].IsModerator() ? p : false);
+ SendToOne(&data, guid);
+ return;
}
+
+ WorldPacket data(SMSG_MESSAGECHAT, 1 + 4 + 8 + 4 + _name.size() + 8 + 4 + what.size() + 1);
+ data << uint8(CHAT_MSG_CHANNEL);
+ data << uint32(lang);
+ data << guid;
+ data << uint32(0);
+ data << _name;
+ data << guid;
+ data << what.size() + 1;
+ data << what;
+ data << uint8(player ? player->GetChatTag() : 0);
+
+ SendToAll(&data, !playersStore[guid].IsModerator() ? guid : false);
}
-void Channel::Invite(uint64 p, const char *newname)
+void Channel::Invite(Player const* player, std::string const& newname)
{
- if (!IsOn(p))
+ uint64 guid = player->GetGUID();
+
+ if (!IsOn(guid))
{
WorldPacket data;
MakeNotMember(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
return;
}
@@ -674,7 +649,7 @@ void Channel::Invite(uint64 p, const char *newname)
{
WorldPacket data;
MakePlayerNotFound(&data, newname);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
return;
}
@@ -682,19 +657,15 @@ void Channel::Invite(uint64 p, const char *newname)
{
WorldPacket data;
MakePlayerInviteBanned(&data, newname);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
return;
}
- Player* player = ObjectAccessor::FindPlayer(p);
- if (!player)
- return;
-
if (newp->GetTeam() != player->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
{
WorldPacket data;
MakeInviteWrongFaction(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
return;
}
@@ -702,45 +673,47 @@ void Channel::Invite(uint64 p, const char *newname)
{
WorldPacket data;
MakePlayerAlreadyMember(&data, newp->GetGUID());
- SendToOne(&data, p);
+ SendToOne(&data, guid);
return;
}
- WorldPacket data;
- if (!newp->GetSocial()->HasIgnore(GUID_LOPART(p)))
+ if (!newp->GetSocial()->HasIgnore(GUID_LOPART(guid)))
{
- MakeInvite(&data, p);
+ WorldPacket data;
+ MakeInvite(&data, guid);
SendToOne(&data, newp->GetGUID());
data.clear();
}
+
+ WorldPacket data;
MakePlayerInvited(&data, newp->GetName());
- SendToOne(&data, p);
+ SendToOne(&data, guid);
}
void Channel::SetOwner(uint64 guid, bool exclaim)
{
- if (m_ownerGUID)
+ if (_ownerGUID)
{
// [] will re-add player after it possible removed
- PlayerList::iterator p_itr = players.find(m_ownerGUID);
- if (p_itr != players.end())
+ PlayerContainer::iterator p_itr = playersStore.find(_ownerGUID);
+ if (p_itr != playersStore.end())
p_itr->second.SetOwner(false);
}
- m_ownerGUID = guid;
- if (m_ownerGUID)
+ _ownerGUID = guid;
+ if (_ownerGUID)
{
- uint8 oldFlag = GetPlayerFlags(m_ownerGUID);
- players[m_ownerGUID].SetModerator(true);
- players[m_ownerGUID].SetOwner(true);
+ uint8 oldFlag = GetPlayerFlags(_ownerGUID);
+ playersStore[_ownerGUID].SetModerator(true);
+ playersStore[_ownerGUID].SetOwner(true);
WorldPacket data;
- MakeModeChange(&data, m_ownerGUID, oldFlag);
+ MakeModeChange(&data, _ownerGUID, oldFlag);
SendToAll(&data);
if (exclaim)
{
- MakeOwnerChanged(&data, m_ownerGUID);
+ MakeOwnerChanged(&data, _ownerGUID);
SendToAll(&data);
}
@@ -748,36 +721,25 @@ void Channel::SetOwner(uint64 guid, bool exclaim)
}
}
-void Channel::SendToAll(WorldPacket* data, uint64 p)
+void Channel::SendToAll(WorldPacket* data, uint64 guid)
{
- for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
- {
- Player* player = ObjectAccessor::FindPlayer(i->first);
- if (player)
- {
- if (!p || !player->GetSocial()->HasIgnore(GUID_LOPART(p)))
+ for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i)
+ if (Player* player = ObjectAccessor::FindPlayer(i->first))
+ if (!guid || !player->GetSocial()->HasIgnore(GUID_LOPART(guid)))
player->GetSession()->SendPacket(data);
- }
- }
}
void Channel::SendToAllButOne(WorldPacket* data, uint64 who)
{
- for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
- {
+ for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i)
if (i->first != who)
- {
- Player* player = ObjectAccessor::FindPlayer(i->first);
- if (player)
+ if (Player* player = ObjectAccessor::FindPlayer(i->first))
player->GetSession()->SendPacket(data);
- }
- }
}
void Channel::SendToOne(WorldPacket* data, uint64 who)
{
- Player* player = ObjectAccessor::FindPlayer(who);
- if (player)
+ if (Player* player = ObjectAccessor::FindPlayer(who))
player->GetSession()->SendPacket(data);
}
@@ -791,29 +753,25 @@ void Channel::DeVoice(uint64 /*guid1*/, uint64 /*guid2*/)
}
-// done
void Channel::MakeNotifyPacket(WorldPacket* data, uint8 notify_type)
{
- data->Initialize(SMSG_CHANNEL_NOTIFY, 1+m_name.size()+1);
+ data->Initialize(SMSG_CHANNEL_NOTIFY, 1 + _name.size());
*data << uint8(notify_type);
- *data << m_name;
+ *data << _name;
}
-// done 0x00
void Channel::MakeJoined(WorldPacket* data, uint64 guid)
{
MakeNotifyPacket(data, CHAT_JOINED_NOTICE);
*data << uint64(guid);
}
-// done 0x01
void Channel::MakeLeft(WorldPacket* data, uint64 guid)
{
MakeNotifyPacket(data, CHAT_LEFT_NOTICE);
*data << uint64(guid);
}
-// done 0x02
void Channel::MakeYouJoined(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_YOU_JOINED_NOTICE);
@@ -822,7 +780,6 @@ void Channel::MakeYouJoined(WorldPacket* data)
*data << uint32(0);
}
-// done 0x03
void Channel::MakeYouLeft(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_YOU_LEFT_NOTICE);
@@ -830,64 +787,55 @@ void Channel::MakeYouLeft(WorldPacket* data)
*data << uint8(IsConstant());
}
-// done 0x04
void Channel::MakeWrongPassword(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_WRONG_PASSWORD_NOTICE);
}
-// done 0x05
void Channel::MakeNotMember(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_NOT_MEMBER_NOTICE);
}
-// done 0x06
void Channel::MakeNotModerator(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_NOT_MODERATOR_NOTICE);
}
-// done 0x07
void Channel::MakePasswordChanged(WorldPacket* data, uint64 guid)
{
MakeNotifyPacket(data, CHAT_PASSWORD_CHANGED_NOTICE);
*data << uint64(guid);
}
-// done 0x08
void Channel::MakeOwnerChanged(WorldPacket* data, uint64 guid)
{
MakeNotifyPacket(data, CHAT_OWNER_CHANGED_NOTICE);
*data << uint64(guid);
}
-// done 0x09
-void Channel::MakePlayerNotFound(WorldPacket* data, const std::string& name)
+void Channel::MakePlayerNotFound(WorldPacket* data, std::string const& name)
{
MakeNotifyPacket(data, CHAT_PLAYER_NOT_FOUND_NOTICE);
*data << name;
}
-// done 0x0A
void Channel::MakeNotOwner(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_NOT_OWNER_NOTICE);
}
-// done 0x0B
void Channel::MakeChannelOwner(WorldPacket* data)
{
std::string name = "";
- if (!sObjectMgr->GetPlayerNameByGUID(m_ownerGUID, name) || name.empty())
+ if (!sObjectMgr->GetPlayerNameByGUID(_ownerGUID, name) || name.empty())
name = "PLAYER_NOT_FOUND";
MakeNotifyPacket(data, CHAT_CHANNEL_OWNER_NOTICE);
- *data << ((IsConstant() || !m_ownerGUID) ? "Nobody" : name);
+ *data << ((IsConstant() || !_ownerGUID) ? "Nobody" : name);
}
-// done 0x0C
void Channel::MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags)
{
MakeNotifyPacket(data, CHAT_MODE_CHANGE_NOTICE);
@@ -896,27 +844,23 @@ void Channel::MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags)
*data << uint8(GetPlayerFlags(guid));
}
-// done 0x0D
void Channel::MakeAnnouncementsOn(WorldPacket* data, uint64 guid)
{
MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_ON_NOTICE);
*data << uint64(guid);
}
-// done 0x0E
void Channel::MakeAnnouncementsOff(WorldPacket* data, uint64 guid)
{
MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_OFF_NOTICE);
*data << uint64(guid);
}
-// done 0x11
void Channel::MakeMuted(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_MUTED_NOTICE);
}
-// done 0x12
void Channel::MakePlayerKicked(WorldPacket* data, uint64 bad, uint64 good)
{
MakeNotifyPacket(data, CHAT_PLAYER_KICKED_NOTICE);
@@ -924,13 +868,11 @@ void Channel::MakePlayerKicked(WorldPacket* data, uint64 bad, uint64 good)
*data << uint64(good);
}
-// done 0x13
void Channel::MakeBanned(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_BANNED_NOTICE);
}
-// done 0x14
void Channel::MakePlayerBanned(WorldPacket* data, uint64 bad, uint64 good)
{
MakeNotifyPacket(data, CHAT_PLAYER_BANNED_NOTICE);
@@ -938,7 +880,6 @@ void Channel::MakePlayerBanned(WorldPacket* data, uint64 bad, uint64 good)
*data << uint64(good);
}
-// done 0x15
void Channel::MakePlayerUnbanned(WorldPacket* data, uint64 bad, uint64 good)
{
MakeNotifyPacket(data, CHAT_PLAYER_UNBANNED_NOTICE);
@@ -946,91 +887,77 @@ void Channel::MakePlayerUnbanned(WorldPacket* data, uint64 bad, uint64 good)
*data << uint64(good);
}
-// done 0x16
void Channel::MakePlayerNotBanned(WorldPacket* data, const std::string &name)
{
MakeNotifyPacket(data, CHAT_PLAYER_NOT_BANNED_NOTICE);
*data << name;
}
-// done 0x17
void Channel::MakePlayerAlreadyMember(WorldPacket* data, uint64 guid)
{
MakeNotifyPacket(data, CHAT_PLAYER_ALREADY_MEMBER_NOTICE);
*data << uint64(guid);
}
-// done 0x18
void Channel::MakeInvite(WorldPacket* data, uint64 guid)
{
MakeNotifyPacket(data, CHAT_INVITE_NOTICE);
*data << uint64(guid);
}
-// done 0x19
void Channel::MakeInviteWrongFaction(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_INVITE_WRONG_FACTION_NOTICE);
}
-// done 0x1A
void Channel::MakeWrongFaction(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_WRONG_FACTION_NOTICE);
}
-// done 0x1B
void Channel::MakeInvalidName(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_INVALID_NAME_NOTICE);
}
-// done 0x1C
void Channel::MakeNotModerated(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_NOT_MODERATED_NOTICE);
}
-// done 0x1D
void Channel::MakePlayerInvited(WorldPacket* data, const std::string& name)
{
MakeNotifyPacket(data, CHAT_PLAYER_INVITED_NOTICE);
*data << name;
}
-// done 0x1E
void Channel::MakePlayerInviteBanned(WorldPacket* data, const std::string& name)
{
MakeNotifyPacket(data, CHAT_PLAYER_INVITE_BANNED_NOTICE);
*data << name;
}
-// done 0x1F
void Channel::MakeThrottled(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_THROTTLED_NOTICE);
}
-// done 0x20
void Channel::MakeNotInArea(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_NOT_IN_AREA_NOTICE);
}
-// done 0x21
void Channel::MakeNotInLfg(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_NOT_IN_LFG_NOTICE);
}
-// done 0x22
void Channel::MakeVoiceOn(WorldPacket* data, uint64 guid)
{
MakeNotifyPacket(data, CHAT_VOICE_ON_NOTICE);
*data << uint64(guid);
}
-// done 0x23
void Channel::MakeVoiceOff(WorldPacket* data, uint64 guid)
{
MakeNotifyPacket(data, CHAT_VOICE_OFF_NOTICE);
@@ -1039,13 +966,7 @@ void Channel::MakeVoiceOff(WorldPacket* data, uint64 guid)
void Channel::JoinNotify(uint64 guid)
{
- WorldPacket data;
-
- if (IsConstant())
- data.Initialize(SMSG_USERLIST_ADD, 8+1+1+4+GetName().size()+1);
- else
- data.Initialize(SMSG_USERLIST_UPDATE, 8+1+1+4+GetName().size()+1);
-
+ WorldPacket data(IsConstant() ? SMSG_USERLIST_ADD : SMSG_USERLIST_UPDATE, 8 + 1 + 1 + 4 + GetName().size());
data << uint64(guid);
data << uint8(GetPlayerFlags(guid));
data << uint8(GetFlags());
@@ -1060,7 +981,7 @@ void Channel::JoinNotify(uint64 guid)
void Channel::LeaveNotify(uint64 guid)
{
- WorldPacket data(SMSG_USERLIST_REMOVE, 8+1+4+GetName().size()+1);
+ WorldPacket data(SMSG_USERLIST_REMOVE, 8 + 1 + 4 + GetName().size());
data << uint64(guid);
data << uint8(GetFlags());
data << uint32(GetNumPlayers());
diff --git a/src/server/game/Chat/Channels/Channel.h b/src/server/game/Chat/Channels/Channel.h
index 5f6be0e36de..5ac4cf14280 100755
--- a/src/server/game/Chat/Channels/Channel.h
+++ b/src/server/game/Chat/Channels/Channel.h
@@ -53,10 +53,10 @@ enum ChatNotify
CHAT_MODERATION_OFF_NOTICE = 0x10, //+ "[%s] Channel moderation disabled by %s.";
CHAT_MUTED_NOTICE = 0x11, //+ "[%s] You do not have permission to speak.";
CHAT_PLAYER_KICKED_NOTICE = 0x12, //? "[%s] Player %s kicked by %s.";
- CHAT_BANNED_NOTICE = 0x13, //+ "[%s] You are banned from that channel.";
- CHAT_PLAYER_BANNED_NOTICE = 0x14, //? "[%s] Player %s banned by %s.";
+ CHAT_BANNED_NOTICE = 0x13, //+ "[%s] You are bannedStore from that channel.";
+ CHAT_PLAYER_BANNED_NOTICE = 0x14, //? "[%s] Player %s bannedStore 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_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.";
@@ -64,7 +64,7 @@ enum ChatNotify
CHAT_INVALID_NAME_NOTICE = 0x1B, //+ "Invalid channel name";
CHAT_NOT_MODERATED_NOTICE = 0x1C, //+ "%s is not moderated";
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_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.
@@ -147,18 +147,45 @@ class Channel
}
};
- typedef std::map<uint64, PlayerInfo> PlayerList;
- PlayerList players;
- typedef std::set<uint64> BannedList;
- BannedList banned;
- bool m_announce;
- bool m_ownership;
- std::string m_name;
- std::string m_password;
- uint8 m_flags;
- uint32 m_channelId;
- uint64 m_ownerGUID;
- bool m_IsSaved;
+ public:
+ Channel(std::string const& name, uint32 channel_id, uint32 Team = 0);
+ std::string const& GetName() const { return _name; }
+ uint32 GetChannelId() const { return _channelId; }
+ bool IsConstant() const { return _channelId != 0; }
+ bool IsAnnounce() const { return _announce; }
+ bool IsLFG() const { return GetFlags() & CHANNEL_FLAG_LFG; }
+ std::string const& GetPassword() const { return _password; }
+ void SetPassword(std::string const& npassword) { _password = npassword; }
+ void SetAnnounce(bool nannounce) { _announce = nannounce; }
+ uint32 GetNumPlayers() const { return playersStore.size(); }
+ 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:
// initial packet data (notify type and channel name)
@@ -199,91 +226,62 @@ class Channel
void MakeVoiceOn(WorldPacket* data, uint64 guid); //+ 0x22
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 SendToOne(WorldPacket* data, uint64 who);
- bool IsOn(uint64 who) const { return players.find(who) != players.end(); }
- bool IsBanned(uint64 guid) const { return banned.find(guid) != banned.end(); }
+ bool IsOn(uint64 who) const { return playersStore.find(who) != playersStore.end(); }
+ bool IsBanned(uint64 guid) const { return bannedStore.find(guid) != bannedStore.end(); }
void UpdateChannelInDB() const;
void UpdateChannelUseageInDB() const;
- uint8 GetPlayerFlags(uint64 p) const
+ uint8 GetPlayerFlags(uint64 guid) const
{
- PlayerList::const_iterator p_itr = players.find(p);
- if (p_itr == players.end())
- return 0;
-
- return p_itr->second.flags;
+ PlayerContainer::const_iterator itr = playersStore.find(guid);
+ return itr != playersStore.end() ? itr->second.flags : 0;
}
- 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);
- players[p].SetModerator(set);
+ uint8 oldFlag = GetPlayerFlags(guid);
+ playersStore[guid].SetModerator(set);
WorldPacket data;
- MakeModeChange(&data, p, oldFlag);
+ MakeModeChange(&data, guid, oldFlag);
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);
- players[p].SetMuted(set);
+ uint8 oldFlag = GetPlayerFlags(guid);
+ playersStore[guid].SetMuted(set);
WorldPacket data;
- MakeModeChange(&data, p, oldFlag);
+ MakeModeChange(&data, guid, oldFlag);
SendToAll(&data);
}
}
- public:
- uint32 m_Team;
- 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; }
+ typedef std::map<uint64, PlayerInfo> PlayerContainer;
+ typedef std::set<uint64> BannedContainer;
- void Join(uint64 p, const char *pass);
- void Leave(uint64 p, bool send = true);
- void KickOrBan(uint64 good, const char *badname, bool ban);
- void Kick(uint64 good, const char *badname) { KickOrBan(good, badname, false); }
- void Ban(uint64 good, const char *badname) { KickOrBan(good, badname, true); }
- void UnBan(uint64 good, const char *badname);
- void Password(uint64 p, const char *pass);
- void SetMode(uint64 p, const char *p2n, bool mod, bool set);
- void SetOwner(uint64 p, bool exclaim = true);
- void SetOwner(uint64 p, const char *newname);
- void SendWhoOwner(uint64 p);
- 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();
+ bool _announce;
+ bool _ownership;
+ bool _IsSaved;
+ uint8 _flags;
+ uint32 _channelId;
+ uint32 _Team;
+ uint64 _ownerGUID;
+ std::string _name;
+ std::string _password;
+ PlayerContainer playersStore;
+ BannedContainer bannedStore;
};
#endif
diff --git a/src/server/game/Chat/Channels/ChannelMgr.cpp b/src/server/game/Chat/Channels/ChannelMgr.cpp
index 4c1db28c18b..b903f15c9a8 100755
--- a/src/server/game/Chat/Channels/ChannelMgr.cpp
+++ b/src/server/game/Chat/Channels/ChannelMgr.cpp
@@ -36,6 +36,7 @@ ChannelMgr* ChannelMgr::forTeam(uint32 team)
if (team == ALLIANCE)
return ACE_Singleton<AllianceChannelMgr, ACE_Null_Mutex>::instance();
+
if (team == HORDE)
return ACE_Singleton<HordeChannelMgr, ACE_Null_Mutex>::instance();
@@ -79,8 +80,8 @@ Channel* ChannelMgr::GetChannel(std::string const& name, Player* player, bool pk
return NULL;
}
- else
- return i->second;
+
+ return i->second;
}
void ChannelMgr::LeftChannel(std::string const& name)
@@ -96,7 +97,7 @@ void ChannelMgr::LeftChannel(std::string const& name)
Channel* channel = i->second;
- if (channel->GetNumPlayers() == 0 && !channel->IsConstant())
+ if (!channel->GetNumPlayers() && !channel->IsConstant())
{
channels.erase(wname);
delete channel;
@@ -105,6 +106,6 @@ void ChannelMgr::LeftChannel(std::string const& name)
void ChannelMgr::MakeNotOnPacket(WorldPacket* data, std::string const& name)
{
- data->Initialize(SMSG_CHANNEL_NOTIFY, (1+10)); // we guess size
- (*data) << (uint8)0x05 << name;
+ data->Initialize(SMSG_CHANNEL_NOTIFY, 1 + name.size());
+ (*data) << uint8(5) << name;
}
diff --git a/src/server/game/Chat/ChatLink.cpp b/src/server/game/Chat/ChatLink.cpp
index 8c2a3a22a70..218564c9f36 100644
--- a/src/server/game/Chat/ChatLink.cpp
+++ b/src/server/game/Chat/ChatLink.cpp
@@ -76,7 +76,7 @@ inline bool CheckDelimiter(std::istringstream& iss, char delimiter, const char*
char c = iss.peek();
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;
}
iss.ignore(1);
@@ -110,20 +110,20 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
uint32 itemEntry = 0;
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;
}
// Validate item
_item = sObjectMgr->GetItemTemplate(itemEntry);
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;
}
// Validate item's color
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;
}
// Number of various item properties after item entry
@@ -137,7 +137,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
int32 id = 0;
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;
}
if (id && (index == randomPropertyPosition))
@@ -148,7 +148,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
_property = sItemRandomPropertiesStore.LookupEntry(id);
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;
}
}
@@ -157,7 +157,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
_suffix = sItemRandomSuffixStore.LookupEntry(-id);
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;
}
}
@@ -199,7 +199,7 @@ bool ItemChatLink::ValidateName(char* buffer, const char* context)
}
}
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;
}
@@ -211,14 +211,14 @@ bool QuestChatLink::Initialize(std::istringstream& iss)
uint32 questId = 0;
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;
}
// Validate quest
_quest = sObjectMgr->GetQuestTemplate(questId);
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;
}
// Check delimiter
@@ -227,13 +227,13 @@ bool QuestChatLink::Initialize(std::istringstream& iss)
// Read quest level
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;
}
// Validate quest 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 true;
@@ -253,7 +253,7 @@ bool QuestChatLink::ValidateName(char* buffer, const char* context)
break;
}
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;
}
@@ -267,14 +267,14 @@ bool SpellChatLink::Initialize(std::istringstream& iss)
uint32 spellId = 0;
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;
}
// Validate spell
_spell = sSpellMgr->GetSpellInfo(spellId);
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 true;
@@ -290,19 +290,19 @@ bool SpellChatLink::ValidateName(char* buffer, const char* context)
SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(_spell->Id);
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;
}
SkillLineAbilityEntry const* skillInfo = bounds.first->second;
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;
}
SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skillInfo->skillId);
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;
}
@@ -319,7 +319,7 @@ bool SpellChatLink::ValidateName(char* buffer, const char* context)
if (*_spell->SpellName && strcmp(_spell->SpellName, buffer) == 0)
return true;
- 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 false;
}
@@ -333,14 +333,14 @@ bool AchievementChatLink::Initialize(std::istringstream& iss)
uint32 achievementId = 0;
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;
}
// Validate achievement
_achievement = sAchievementMgr->GetAchievement(achievementId);
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;
}
// Check delimiter
@@ -349,7 +349,7 @@ bool AchievementChatLink::Initialize(std::istringstream& iss)
// Read HEX
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;
}
// Skip progress
@@ -361,7 +361,7 @@ bool AchievementChatLink::Initialize(std::istringstream& iss)
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;
}
}
@@ -375,7 +375,7 @@ bool AchievementChatLink::ValidateName(char* buffer, const char* context)
if (*_achievement->name && strcmp(_achievement->name, buffer) == 0)
return true;
- 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 false;
}
@@ -389,14 +389,14 @@ bool TradeChatLink::Initialize(std::istringstream& iss)
uint32 spellId = 0;
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;
}
// Validate spell
_spell = sSpellMgr->GetSpellInfo(spellId);
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;
}
// Check delimiter
@@ -405,7 +405,7 @@ bool TradeChatLink::Initialize(std::istringstream& iss)
// Minimum talent level
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;
}
// Check delimiter
@@ -414,7 +414,7 @@ bool TradeChatLink::Initialize(std::istringstream& iss)
// Maximum talent level
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;
}
// Check delimiter
@@ -423,7 +423,7 @@ bool TradeChatLink::Initialize(std::istringstream& iss)
// Something hexadecimal
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;
}
// Skip base64 encoded stuff
@@ -440,21 +440,21 @@ bool TalentChatLink::Initialize(std::istringstream& iss)
// Read talent entry
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;
}
// Validate talent
TalentEntry const* talentInfo = sTalentStore.LookupEntry(_talentId);
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;
}
// Validate talent's spell
_spell = sSpellMgr->GetSpellInfo(talentInfo->RankID[0]);
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;
}
// Delimiter
@@ -463,7 +463,7 @@ bool TalentChatLink::Initialize(std::istringstream& iss)
// Rank
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 true;
@@ -479,14 +479,14 @@ bool EnchantmentChatLink::Initialize(std::istringstream& iss)
uint32 spellId = 0;
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;
}
// Validate spell
_spell = sSpellMgr->GetSpellInfo(spellId);
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 true;
@@ -501,7 +501,7 @@ bool GlyphChatLink::Initialize(std::istringstream& iss)
// Slot
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;
}
// Check delimiter
@@ -511,21 +511,21 @@ bool GlyphChatLink::Initialize(std::istringstream& iss)
uint32 glyphId = 0;
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;
}
// Validate glyph
_glyph = sGlyphPropertiesStore.LookupEntry(glyphId);
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;
}
// Validate glyph's spell
_spell = sSpellMgr->GetSpellInfo(_glyph->SpellId);
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 true;
@@ -563,14 +563,14 @@ bool LinkExtractor::IsValidMessage()
}
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;
}
// pipe has always to be followed by at least one char
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;
}
@@ -593,14 +593,14 @@ bool LinkExtractor::IsValidMessage()
}
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;
}
}
else if (validSequence != validSequenceIterator)
{
// 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;
}
@@ -609,7 +609,7 @@ bool LinkExtractor::IsValidMessage()
case 'c':
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;
}
break;
@@ -618,7 +618,7 @@ bool LinkExtractor::IsValidMessage()
_iss.getline(buffer, 256, DELIMITER);
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;
}
@@ -640,7 +640,7 @@ bool LinkExtractor::IsValidMessage()
link = new GlyphChatLink();
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;
}
_links.push_back(link);
@@ -655,13 +655,13 @@ bool LinkExtractor::IsValidMessage()
// links start with '['
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;
}
_iss.getline(buffer, 256, ']');
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;
}
@@ -679,7 +679,7 @@ bool LinkExtractor::IsValidMessage()
// no further payload
break;
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;
}
}
@@ -687,7 +687,7 @@ bool LinkExtractor::IsValidMessage()
// check if every opened sequence was also closed properly
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;
}
diff --git a/src/server/game/DungeonFinding/LFG.h b/src/server/game/DungeonFinding/LFG.h
index 6ad30547670..8477002279c 100755
--- a/src/server/game/DungeonFinding/LFG.h
+++ b/src/server/game/DungeonFinding/LFG.h
@@ -41,7 +41,7 @@ enum LfgUpdateType
LFG_UPDATETYPE_DEFAULT = 0, // Internal Use
LFG_UPDATETYPE_LEADER_UNK1 = 1, // FIXME: At group leave
LFG_UPDATETYPE_ROLECHECK_ABORTED = 4,
- LFG_UPDATETYPE_JOIN_PROPOSAL = 5,
+ LFG_UPDATETYPE_JOIN_QUEUE = 5,
LFG_UPDATETYPE_ROLECHECK_FAILED = 6,
LFG_UPDATETYPE_REMOVED_FROM_QUEUE = 7,
LFG_UPDATETYPE_PROPOSAL_FAILED = 8,
diff --git a/src/server/game/DungeonFinding/LFGGroupData.cpp b/src/server/game/DungeonFinding/LFGGroupData.cpp
index a4ee230b5eb..c7cf6f23ce9 100644
--- a/src/server/game/DungeonFinding/LFGGroupData.cpp
+++ b/src/server/game/DungeonFinding/LFGGroupData.cpp
@@ -37,7 +37,7 @@ void LfgGroupData::SetState(LfgState state)
case LFG_STATE_FINISHED_DUNGEON:
case LFG_STATE_NONE:
case LFG_STATE_DUNGEON:
- m_OldState = state;
+ m_OldState = m_State;
// No break on purpose
default:
m_State = state;
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index 41d3b540089..da279016255 100755
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -553,14 +553,17 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
LfgDungeonSet const& playerDungeons = GetSelectedDungeons(guid);
if (playerDungeons == dungeons) // Joining the same dungeons -- Send OK
{
- LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_ADDED_TO_QUEUE, dungeons, comment);
player->GetSession()->SendLfgJoinResult(joinData); // Default value of joinData.result = LFG_JOIN_OK
if (grp)
{
+ LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_ADDED_TO_QUEUE, dungeons, comment);
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
if (itr->getSource() && itr->getSource()->GetSession())
itr->getSource()->GetSession()->SendLfgUpdateParty(updateData);
}
+ else
+ player->GetSession()->SendLfgUpdatePlayer(LfgUpdateData(LFG_UPDATETYPE_JOIN_QUEUE, dungeons, comment));
+
return;
}
else // Remove from queue and rejoin
@@ -691,7 +694,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
SetState(gguid, LFG_STATE_ROLECHECK);
// Send update to player
- LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_JOIN_PROPOSAL, dungeons, comment);
+ LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_JOIN_QUEUE, dungeons, comment);
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{
if (Player* plrg = itr->getSource())
@@ -728,7 +731,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
}
// Send update to player
player->GetSession()->SendLfgJoinResult(joinData);
- player->GetSession()->SendLfgUpdatePlayer(LfgUpdateData(LFG_UPDATETYPE_JOIN_PROPOSAL, dungeons, comment));
+ player->GetSession()->SendLfgUpdatePlayer(LfgUpdateData(LFG_UPDATETYPE_JOIN_QUEUE, dungeons, comment));
SetState(gguid, LFG_STATE_QUEUED);
SetRoles(guid, roles);
debugNames.append(player->GetName());
@@ -751,10 +754,10 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
*/
void LFGMgr::LeaveLfg(uint64 guid)
{
- LfgState state = GetState(guid);
- uint64 gguid = IS_GROUP(guid) ? guid : GetGroup(guid);
-
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::Leave: [" UI64FMTD "]", guid);
+
+ uint64 gguid = IS_GROUP(guid) ? guid : GetGroup(guid);
+ LfgState state = GetState(guid);
switch (state)
{
case LFG_STATE_QUEUED:
@@ -1964,11 +1967,10 @@ void LFGMgr::SetOptions(uint32 options)
m_options = options;
}
-LfgState LFGMgr::GetLfgStatus(uint64 guid, LfgUpdateData& data)
+LfgUpdateData LFGMgr::GetLfgStatus(uint64 guid)
{
LfgPlayerData& playerData = PlayersStore[guid];
- data.dungeons = playerData.GetSelectedDungeons();
- return playerData.GetState();
+ return LfgUpdateData(LFG_UPDATETYPE_UPDATE_STATUS, playerData.GetState(), playerData.GetSelectedDungeons());
}
bool LFGMgr::IsSeasonActive(uint32 dungeonId)
diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h
index 84d8af88984..62dec80db05 100644
--- a/src/server/game/DungeonFinding/LFGMgr.h
+++ b/src/server/game/DungeonFinding/LFGMgr.h
@@ -18,8 +18,9 @@
#ifndef _LFGMGR_H
#define _LFGMGR_H
-#include "Common.h"
#include <ace/Singleton.h>
+#include "DBCStructure.h"
+#include "Field.h"
#include "LFG.h"
#include "LFGQueue.h"
#include "LFGGroupData.h"
@@ -155,11 +156,14 @@ struct LfgJoinResultData
// Data needed by SMSG_LFG_UPDATE_PARTY and SMSG_LFG_UPDATE_PLAYER
struct LfgUpdateData
{
- LfgUpdateData(LfgUpdateType _type = LFG_UPDATETYPE_DEFAULT): updateType(_type), comment("") {}
+ LfgUpdateData(LfgUpdateType _type = LFG_UPDATETYPE_DEFAULT): updateType(_type), state(LFG_STATE_NONE), comment("") { }
LfgUpdateData(LfgUpdateType _type, LfgDungeonSet const& _dungeons, std::string const& _comment):
- updateType(_type), dungeons(_dungeons), comment(_comment) {}
+ updateType(_type), state(LFG_STATE_NONE), dungeons(_dungeons), comment(_comment) { }
+ LfgUpdateData(LfgUpdateType _type, LfgState _state, LfgDungeonSet const& _dungeons, std::string const& _comment = ""):
+ updateType(_type), state(_state), dungeons(_dungeons), comment(_comment) { }
LfgUpdateType updateType;
+ LfgState state;
LfgDungeonSet dungeons;
std::string comment;
};
@@ -361,7 +365,7 @@ class LFGMgr
bool isOptionEnabled(uint32 option);
uint32 GetOptions();
void SetOptions(uint32 options);
- LfgState GetLfgStatus(uint64 guid, LfgUpdateData& data);
+ LfgUpdateData GetLfgStatus(uint64 guid);
bool IsSeasonActive(uint32 dungeonId);
std::string DumpQueueInfo(bool full = false);
diff --git a/src/server/game/DungeonFinding/LFGPlayerData.cpp b/src/server/game/DungeonFinding/LFGPlayerData.cpp
index e5645f0f0aa..f1281875598 100644
--- a/src/server/game/DungeonFinding/LFGPlayerData.cpp
+++ b/src/server/game/DungeonFinding/LFGPlayerData.cpp
@@ -35,7 +35,7 @@ void LfgPlayerData::SetState(LfgState state)
m_SelectedDungeons.clear();
// No break on purpose
case LFG_STATE_DUNGEON:
- m_OldState = state;
+ m_OldState = m_State;
// No break on purpose
default:
m_State = state;
diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp
index 930367a0745..f9e3c02fe98 100644
--- a/src/server/game/DungeonFinding/LFGScripts.cpp
+++ b/src/server/game/DungeonFinding/LFGScripts.cpp
@@ -46,14 +46,11 @@ void LFGPlayerScript::OnLogout(Player* player)
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
return;
- uint64 guid = player->GetGUID();
- sLFGMgr->LeaveLfg(guid);
- LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE);
- player->GetSession()->SendLfgUpdateParty(updateData);
- player->GetSession()->SendLfgUpdatePlayer(updateData);
- player->GetSession()->SendLfgLfrList(false);
- // TODO - Do not remove, add timer before deleting
- sLFGMgr->RemovePlayerData(guid);
+ if (!player->GetGroup())
+ {
+ player->GetSession()->SendLfgLfrList(false);
+ sLFGMgr->LeaveLfg(player->GetGUID());
+ }
}
void LFGPlayerScript::OnLogin(Player* player)
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 8b85f761b85..5de54a9d974 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -5621,11 +5621,11 @@ void Player::CleanupChannels()
{
Channel* ch = *m_channels.begin();
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()))
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)
@@ -5698,11 +5698,11 @@ void Player::UpdateLocalChannels(uint32 newZone)
removeChannel = usedChannel;
if (joinChannel)
- joinChannel->Join(GetGUID(), ""); // Changed Channel: ... or Joined Channel: ...
+ joinChannel->JoinChannel(this, ""); // Changed Channel: ... or Joined Channel: ...
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
LeftChannel(removeChannel); // Remove from player's channel list
cMgr->LeftChannel(name); // Delete if empty
@@ -5717,7 +5717,7 @@ void Player::LeaveLFGChannel()
{
if ((*i)->IsLFG())
{
- (*i)->Leave(GetGUID());
+ (*i)->LeaveChannel(this);
break;
}
}
@@ -22150,7 +22150,7 @@ bool Player::IsAlwaysDetectableFor(WorldObject const* seer) const
return false;
}
-bool Player::IsVisibleGloballyFor(Player* u) const
+bool Player::IsVisibleGloballyFor(Player const* u) const
{
if (!u)
return false;
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 56983dfeee9..1b6a2e81299 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -2546,7 +2546,7 @@ class Player : public Unit, public GridObject<Player>
bool IsNeverVisible() const;
- bool IsVisibleGloballyFor(Player* player) const;
+ bool IsVisibleGloballyFor(Player const* player) const;
void SendInitialVisiblePackets(Unit* target);
void UpdateObjectVisibility(bool forced = true);
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index ce0ed7f565f..66bc030623c 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -16,11 +16,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "Unit.h"
+#include "Common.h"
#include "Battlefield.h"
#include "BattlefieldMgr.h"
#include "Battleground.h"
#include "CellImpl.h"
-#include "Common.h"
#include "ConditionMgr.h"
#include "CreatureAI.h"
#include "CreatureAIImpl.h"
@@ -53,7 +54,6 @@
#include "TemporarySummon.h"
#include "Totem.h"
#include "Transport.h"
-#include "Unit.h"
#include "UpdateFieldFlags.h"
#include "Util.h"
#include "Vehicle.h"
diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp
index 12873d2d4a4..c13831066e6 100755
--- a/src/server/game/Handlers/CalendarHandler.cpp
+++ b/src/server/game/Handlers/CalendarHandler.cpp
@@ -249,7 +249,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
if (calendarEvent->IsGuildAnnouncement())
{
// 946684800 is 01/01/2000 00:00:00 - default response time
- CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), calendarEvent->GetEventId(), 0, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, "");
+ CalendarInvite* invite = new CalendarInvite(0, calendarEvent->GetEventId(), 0, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, "");
sCalendarMgr->AddInvite(calendarEvent, invite);
}
else
@@ -445,7 +445,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData)
{
if (isGuildEvent && inviteeGuildId == _player->GetGuildId())
{
- sCalendarMgr->SendCalendarCommandResult(inviteeGuid, CALENDAR_ERROR_NO_GUILD_INVITES);
+ sCalendarMgr->SendCalendarCommandResult(playerGuid, CALENDAR_ERROR_NO_GUILD_INVITES);
return;
}
diff --git a/src/server/game/Handlers/ChannelHandler.cpp b/src/server/game/Handlers/ChannelHandler.cpp
index 15379271812..828aefc3a01 100755
--- a/src/server/game/Handlers/ChannelHandler.cpp
+++ b/src/server/game/Handlers/ChannelHandler.cpp
@@ -23,19 +23,20 @@
void WorldSession::HandleJoinChannel(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
-
uint32 channelId;
uint32 channelLength, passLength;
- std::string channelName, pass;
+ std::string channelName, password;
recvPacket >> channelId;
- recvPacket.ReadBit(); // unknowns
- recvPacket.ReadBit();
+ uint8 unknown1 = recvPacket.ReadBit(); // unknowns
+ uint8 unknown2 = recvPacket.ReadBit();
channelLength = recvPacket.ReadBits(8);
passLength = recvPacket.ReadBits(8);
channelName = recvPacket.ReadString(channelLength);
- pass = recvPacket.ReadString(passLength);
+ password = recvPacket.ReadString(passLength);
+
+ 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)
{
@@ -43,254 +44,272 @@ void WorldSession::HandleJoinChannel(WorldPacket& recvPacket)
if (!channel)
return;
- AreaTableEntry const* current_zone = GetAreaEntryByAreaID(_player->GetZoneId());
- if (!current_zone)
- return;
-
- if (!_player->CanJoinConstantChannelInZone(channel, current_zone))
+ AreaTableEntry const* zone = GetAreaEntryByAreaID(GetPlayer()->GetZoneId());
+ if (!zone || !GetPlayer()->CanJoinConstantChannelInZone(channel, zone))
return;
}
if (channelName.empty())
return;
- if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam()))
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
{
- cMgr->setTeam(_player->GetTeam());
- if (Channel* chn = cMgr->GetJoinChannel(channelName, channelId))
- chn->Join(_player->GetGUID(), pass.c_str());
+ cMgr->setTeam(GetPlayer()->GetTeam());
+ if (Channel* channel = cMgr->GetJoinChannel(channelName, channelId))
+ channel->JoinChannel(GetPlayer(), password);
}
}
void WorldSession::HandleLeaveChannel(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
-
uint32 unk;
- std::string channelname;
+ std::string channelName;
recvPacket >> unk; // channel id?
uint32 length = recvPacket.ReadBits(8);
- channelname = recvPacket.ReadString(length);
+ channelName = recvPacket.ReadString(length);
- 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;
- if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam()))
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
{
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->Leave(_player->GetGUID(), true);
- cMgr->LeftChannel(channelname);
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->LeaveChannel(GetPlayer(), true);
+ cMgr->LeftChannel(channelName);
}
}
void WorldSession::HandleChannelList(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
-
uint32 length = recvPacket.ReadBits(8);
- std::string channelname = recvPacket.ReadString(length);
+ std::string channelName = recvPacket.ReadString(length);
+
+ sLog->outDebug(LOG_FILTER_CHATSYS, "%s %s Channel: %s",
+ recvPacket.GetOpcode() == CMSG_CHANNEL_DISPLAY_LIST ? "CMSG_CHANNEL_DISPLAY_LIST" : "CMSG_CHANNEL_LIST",
+ GetPlayerInfo().c_str(), channelName.c_str());
- if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->List(_player);
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->List(GetPlayer());
}
void WorldSession::HandleChannelPassword(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
uint32 nameLength = recvPacket.ReadBits(8);
uint32 passLength = recvPacket.ReadBits(7);
- std::string channelname = recvPacket.ReadString(nameLength);
- std::string pass = recvPacket.ReadString(passLength);
+ std::string channelName = recvPacket.ReadString(nameLength);
+ std::string password = recvPacket.ReadString(passLength);
- if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->Password(_player->GetGUID(), pass.c_str());
+ 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(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->Password(GetPlayer(), password);
}
void WorldSession::HandleChannelSetOwner(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
-
uint32 channelLength = recvPacket.ReadBits(8);
uint32 nameLength = recvPacket.ReadBits(7);
- std::string newp = recvPacket.ReadString(nameLength);
- std::string channelname = recvPacket.ReadString(channelLength);
+ std::string targetName = recvPacket.ReadString(nameLength);
+ std::string channelName = recvPacket.ReadString(channelLength);
- if (!normalizePlayerName(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(targetName))
return;
- if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->SetOwner(_player->GetGUID(), newp.c_str());
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->SetOwner(GetPlayer(), targetName);
}
void WorldSession::HandleChannelOwner(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
uint32 length = recvPacket.ReadBits(8);
- std::string channelname = recvPacket.ReadString(length);
+ std::string channelName = recvPacket.ReadString(length);
+
+ sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_OWNER %s Channel: %s",
+ GetPlayerInfo().c_str(), channelName.c_str());
- if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- 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)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
-
uint32 channelLength = recvPacket.ReadBits(8);
uint32 nameLength = recvPacket.ReadBits(7);
- std::string otp = recvPacket.ReadString(nameLength);
- std::string channelname = recvPacket.ReadString(channelLength);
+ std::string targetName = recvPacket.ReadString(nameLength);
+ std::string channelName = recvPacket.ReadString(channelLength);
+
+ 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;
- if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->SetModerator(_player->GetGUID(), otp.c_str());
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->SetModerator(GetPlayer(), targetName);
}
void WorldSession::HandleChannelUnmoderator(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
-
uint32 nameLength = recvPacket.ReadBits(7);
uint32 channelLength = recvPacket.ReadBits(8);
- std::string channelname = recvPacket.ReadString(channelLength);
- std::string otp = recvPacket.ReadString(nameLength);
+ std::string channelName = recvPacket.ReadString(channelLength);
+ std::string targetName = recvPacket.ReadString(nameLength);
+
+ 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;
- if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->UnsetModerator(_player->GetGUID(), otp.c_str());
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->UnsetModerator(GetPlayer(), targetName);
}
void WorldSession::HandleChannelMute(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
uint32 channelLength = recvPacket.ReadBits(8);
uint32 nameLength = recvPacket.ReadBits(7);
- std::string channelname = recvPacket.ReadString(channelLength);
- std::string otp = recvPacket.ReadString(nameLength);
+ std::string channelName = recvPacket.ReadString(channelLength);
+ std::string targetName = recvPacket.ReadString(nameLength);
- if (!normalizePlayerName(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(targetName))
return;
- if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->SetMute(_player->GetGUID(), otp.c_str());
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->SetMute(GetPlayer(), targetName);
}
void WorldSession::HandleChannelUnmute(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
-
uint32 nameLength = recvPacket.ReadBits(8);
uint32 channelLength = recvPacket.ReadBits(7);
- std::string otp = recvPacket.ReadString(nameLength);
- std::string channelname = recvPacket.ReadString(channelLength);
+ std::string targetName = recvPacket.ReadString(nameLength);
+ std::string channelName = recvPacket.ReadString(channelLength);
- if (!normalizePlayerName(otp))
+ sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_UNMUTE %s Channel: %s, Target: %s",
+ GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
+
+ if (!normalizePlayerName(targetName))
return;
- if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->UnsetMute(_player->GetGUID(), otp.c_str());
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->UnsetMute(GetPlayer(), targetName);
}
void WorldSession::HandleChannelInvite(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
uint32 nameLength = recvPacket.ReadBits(7);
uint32 channelLength = recvPacket.ReadBits(8);
- std::string otp = recvPacket.ReadString(nameLength);
- std::string channelname = recvPacket.ReadString(channelLength);
+ std::string targetName = recvPacket.ReadString(nameLength);
+ std::string channelName = recvPacket.ReadString(channelLength);
+
+ 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;
- if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->Invite(_player->GetGUID(), otp.c_str());
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->Invite(GetPlayer(), targetName);
}
void WorldSession::HandleChannelKick(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
uint32 channelLength = recvPacket.ReadBits(8);
uint32 nameLength = recvPacket.ReadBits(7);
- std::string channelname = recvPacket.ReadString(channelLength);
- std::string otp = recvPacket.ReadString(nameLength);
+ std::string channelName = recvPacket.ReadString(channelLength);
+ std::string targetName = recvPacket.ReadString(nameLength);
- if (!normalizePlayerName(otp))
+ sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_KICK %s Channel: %s, Target: %s",
+ GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
+
+ if (!normalizePlayerName(targetName))
return;
- if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->Kick(_player->GetGUID(), otp.c_str());
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->Kick(GetPlayer(), targetName);
}
void WorldSession::HandleChannelBan(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
uint32 channelLength, nameLength;
- std::string channelname, otp;
+ std::string channelName, targetName;
channelLength = recvPacket.ReadBits(8);
nameLength = recvPacket.ReadBits(7);
- otp = recvPacket.ReadString(nameLength);
- channelname = recvPacket.ReadString(channelLength);
+ targetName = recvPacket.ReadString(nameLength);
+ channelName = recvPacket.ReadString(channelLength);
+
+ 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;
- if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->Ban(_player->GetGUID(), otp.c_str());
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->Ban(GetPlayer(), targetName);
}
void WorldSession::HandleChannelUnban(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
-
uint32 channelLength = recvPacket.ReadBits(7);
uint32 nameLength = recvPacket.ReadBits(8);
- std::string otp = recvPacket.ReadString(nameLength);
- std::string channelname = recvPacket.ReadString(channelLength);
+ std::string targetName = recvPacket.ReadString(nameLength);
+ std::string channelName = recvPacket.ReadString(channelLength);
- if (!normalizePlayerName(otp))
+ sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_UNBAN %s Channel: %s, Target: %s",
+ GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
+
+ if (!normalizePlayerName(targetName))
return;
- if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->UnBan(_player->GetGUID(), otp.c_str());
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->UnBan(GetPlayer(), targetName);
}
void WorldSession::HandleChannelAnnouncements(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
-
uint32 length = recvPacket.ReadBits(8);
- std::string channelname = recvPacket.ReadString(length);
+ std::string channelName = recvPacket.ReadString(length);
- if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->Announce(_player->GetGUID());
+ sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_ANNOUNCEMENTS %s Channel: %s",
+ GetPlayerInfo().c_str(), channelName.c_str());
+
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->Announce(GetPlayer());
}
void WorldSession::HandleChannelDisplayListQuery(WorldPacket &recvPacket)
@@ -301,17 +320,23 @@ void WorldSession::HandleChannelDisplayListQuery(WorldPacket &recvPacket)
void WorldSession::HandleGetChannelMemberCount(WorldPacket &recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
- std::string channelname;
- recvPacket >> channelname;
- if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam()))
+ std::string channelName;
+ recvPacket >> channelName;
+
+ 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);
- data << chn->GetName();
- data << uint8(chn->GetFlags());
- data << uint32(chn->GetNumPlayers());
+ sLog->outDebug(LOG_FILTER_CHATSYS, "SMSG_CHANNEL_MEMBER_COUNT %s Channel: %s Count: %u",
+ GetPlayerInfo().c_str(), channelName.c_str(), channel->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);
}
}
@@ -319,10 +344,15 @@ void WorldSession::HandleGetChannelMemberCount(WorldPacket &recvPacket)
void WorldSession::HandleSetChannelWatch(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
- std::string channelname;
- recvPacket >> channelname;
- /*if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelName, _player))
- chn->JoinNotify(_player->GetGUID());*/
+ std::string channelName;
+ recvPacket >> channelName;
+
+ sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_SET_CHANNEL_WATCH %s Channel: %s",
+ GetPlayerInfo().c_str(), channelName.c_str());
+
+ /*
+ if (ChannelMgr* cMgr = channelMgr(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->JoinNotify(GetPlayer());
+ */
}
diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp
index 9c08abf8045..c413fdaa4fc 100755
--- a/src/server/game/Handlers/LFGHandler.cpp
+++ b/src/server/game/Handlers/LFGHandler.cpp
@@ -15,15 +15,13 @@
* 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 "ObjectMgr.h"
-#include "GroupMgr.h"
+#include "Group.h"
+#include "Player.h"
#include "Opcodes.h"
+#include "WorldPacket.h"
+#include "WorldSession.h"
void BuildPlayerLockDungeonBlock(WorldPacket& data, const LfgLockMap& lock)
{
@@ -62,11 +60,11 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData)
uint32 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;
if (!numDungeons)
{
- sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_JOIN [" UI64FMTD "] no dungeons selected", GetPlayer()->GetGUID());
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_JOIN %s no dungeons selected", GetPlayerInfo().c_str());
recvData.rfinish();
return;
}
@@ -75,14 +73,15 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData)
for (int8 i = 0; i < numDungeons; ++i)
{
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;
recvData >> comment;
- sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_JOIN [" UI64FMTD "] roles: %u, Dungeons: %u, Comment: %s", GetPlayer()->GetGUID(), roles, uint8(newDungeons.size()), comment.c_str());
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_JOIN %s roles: %u, Dungeons: %u, Comment: %s",
+ GetPlayerInfo().c_str(), roles, uint8(newDungeons.size()), comment.c_str());
sLFGMgr->JoinLfg(GetPlayer(), uint8(roles), newDungeons, comment);
}
@@ -92,7 +91,8 @@ void WorldSession::HandleLfgLeaveOpcode(WorldPacket& /*recvData*/)
uint64 guid = GetPlayer()->GetGUID();
uint64 gguid = grp ? grp->GetGUID() : guid;
- sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_LEAVE [" UI64FMTD "] in group: %u", guid, grp ? 1 : 0);
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_LEAVE %s in group: %u",
+ GetPlayerInfo().c_str(), grp ? 1 : 0);
// Check cheating - only leader can leave the queue
if (!grp || grp->GetLeaderGUID() == GetPlayer()->GetGUID())
@@ -101,28 +101,31 @@ void WorldSession::HandleLfgLeaveOpcode(WorldPacket& /*recvData*/)
void WorldSession::HandleLfgProposalResultOpcode(WorldPacket& recvData)
{
- uint32 lfgGroupID; // Internal lfgGroupID
+ uint32 lfgGroupID; // Internal lfgGroupID
bool accept; // Accept to join?
recvData >> lfgGroupID;
recvData >> accept;
- sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_PROPOSAL_RESULT [" UI64FMTD "] proposal: %u accept: %u", GetPlayer()->GetGUID(), lfgGroupID, accept ? 1 : 0);
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_PROPOSAL_RESULT %s proposal: %u accept: %u",
+ GetPlayerInfo().c_str(), lfgGroupID, accept ? 1 : 0);
sLFGMgr->UpdateProposal(lfgGroupID, GetPlayer()->GetGUID(), accept);
}
void WorldSession::HandleLfgSetRolesOpcode(WorldPacket& recvData)
{
uint8 roles;
- recvData >> roles; // Player Group Roles
+ recvData >> roles; // Player Group Roles
uint64 guid = GetPlayer()->GetGUID();
Group* grp = GetPlayer()->GetGroup();
if (!grp)
{
- sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_SET_ROLES [" UI64FMTD "] Not in group", guid);
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_SET_ROLES %s Not in group",
+ GetPlayerInfo().c_str());
return;
}
uint64 gguid = grp->GetGUID();
- sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_SET_ROLES: Group [" UI64FMTD "], Player [" UI64FMTD "], Roles: %u", gguid, guid, roles);
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_SET_ROLES: Group %u, Player %s, Roles: %u",
+ GUID_LOPART(gguid), GetPlayerInfo().c_str(), roles);
sLFGMgr->UpdateRoleCheck(gguid, guid, roles);
}
@@ -131,7 +134,8 @@ void WorldSession::HandleLfgSetCommentOpcode(WorldPacket& recvData)
std::string comment;
recvData >> comment;
uint64 guid = GetPlayer()->GetGUID();
- sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_SET_COMMENT [" UI64FMTD "] comment: %s", guid, comment.c_str());
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_SET_COMMENT %s comment: %s",
+ GetPlayerInfo().c_str(), comment.c_str());
sLFGMgr->SetComment(guid, comment);
}
@@ -142,7 +146,8 @@ void WorldSession::HandleLfgSetBootVoteOpcode(WorldPacket& recvData)
recvData >> agree;
uint64 guid = GetPlayer()->GetGUID();
- sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_SET_BOOT_VOTE [" UI64FMTD "] agree: %u", guid, agree ? 1 : 0);
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_SET_BOOT_VOTE %s agree: %u",
+ GetPlayerInfo().c_str(), agree ? 1 : 0);
sLFGMgr->UpdateBoot(guid, agree);
}
@@ -151,14 +156,16 @@ void WorldSession::HandleLfgTeleportOpcode(WorldPacket& recvData)
bool out;
recvData >> out;
- sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_TELEPORT [" UI64FMTD "] out: %u", GetPlayer()->GetGUID(), out ? 1 : 0);
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_TELEPORT %s out: %u",
+ GetPlayerInfo().c_str(), out ? 1 : 0);
sLFGMgr->TeleportPlayer(GetPlayer(), out, true);
}
void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData*/)
{
uint64 guid = GetPlayer()->GetGUID();
- sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_PLAYER_LOCK_INFO_REQUEST [" UI64FMTD "]", guid);
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_PLAYER_LOCK_INFO_REQUEST %s",
+ GetPlayerInfo().c_str());
// Get Random dungeons that can be done at a certain level and expansion
LfgDungeonSet randomDungeons;
@@ -179,7 +186,7 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData*
uint32 rsize = uint32(randomDungeons.size());
uint32 lsize = uint32(lock.size());
- sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PLAYER_INFO [" UI64FMTD "]", guid);
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PLAYER_INFO %s", GetPlayerInfo().c_str());
WorldPacket data(SMSG_LFG_PLAYER_INFO, 1 + rsize * (4 + 1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4) + 4 + lsize * (1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4));
data << uint8(randomDungeons.size()); // Random Dungeon count
@@ -237,7 +244,7 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData*
void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recvData*/)
{
uint64 guid = GetPlayer()->GetGUID();
- sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_PARTY_LOCK_INFO_REQUEST [" UI64FMTD "]", guid);
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_PARTY_LOCK_INFO_REQUEST %s", GetPlayerInfo().c_str());
Group* grp = GetPlayer()->GetGroup();
if (!grp)
@@ -262,7 +269,7 @@ void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recvData*
for (LfgLockPartyMap::const_iterator it = lockMap.begin(); it != lockMap.end(); ++it)
size += 8 + 4 + uint32(it->second.size()) * (4 + 4 + 4 + 4);
- sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PARTY_INFO [" UI64FMTD "]", guid);
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PARTY_INFO %s", GetPlayerInfo().c_str());
WorldPacket data(SMSG_LFG_PARTY_INFO, 1 + size);
BuildPartyLockDungeonBlock(data, lockMap);
SendPacket(&data);
@@ -272,7 +279,8 @@ void WorldSession::HandleLfrJoinOpcode(WorldPacket& recvData)
{
uint32 entry; // Raid id to search
recvData >> entry;
- sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_LFR_JOIN [" UI64FMTD "] dungeon entry: %u", GetPlayer()->GetGUID(), entry);
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_LFR_JOIN %s dungeon entry: %u",
+ GetPlayerInfo().c_str(), entry);
//SendLfrUpdateListOpcode(entry);
}
@@ -280,48 +288,64 @@ void WorldSession::HandleLfrLeaveOpcode(WorldPacket& recvData)
{
uint32 dungeonId; // Raid id queue to leave
recvData >> dungeonId;
- sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_LFR_LEAVE [" UI64FMTD "] dungeonId: %u", GetPlayer()->GetGUID(), dungeonId);
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_LFR_LEAVE %s dungeonId: %u",
+ GetPlayerInfo().c_str(), dungeonId);
//sLFGMgr->LeaveLfr(GetPlayer(), dungeonId);
}
+void WorldSession::HandleLfgGetStatus(WorldPacket& /*recvData*/)
+{
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_GET_STATUS %s", GetPlayerInfo().c_str());
+
+ uint64 guid = GetPlayer()->GetGUID();
+ LfgUpdateData updateData = sLFGMgr->GetLfgStatus(guid);
+
+ if (GetPlayer()->GetGroup())
+ {
+ SendLfgUpdateParty(updateData);
+ updateData.dungeons.clear();
+ SendLfgUpdatePlayer(updateData);
+ }
+ else
+ {
+ SendLfgUpdatePlayer(updateData);
+ updateData.dungeons.clear();
+ SendLfgUpdateParty(updateData);
+ }
+}
+
void WorldSession::SendLfgUpdatePlayer(const LfgUpdateData& updateData)
{
bool queued = false;
- bool extrainfo = false;
- uint64 guid = GetPlayer()->GetGUID();
uint8 size = uint8(updateData.dungeons.size());
switch (updateData.updateType)
{
- case LFG_UPDATETYPE_JOIN_PROPOSAL:
+ case LFG_UPDATETYPE_JOIN_QUEUE:
case LFG_UPDATETYPE_ADDED_TO_QUEUE:
queued = true;
- extrainfo = true;
break;
case LFG_UPDATETYPE_UPDATE_STATUS:
- extrainfo = size > 0;
- break;
- case LFG_UPDATETYPE_PROPOSAL_BEGIN:
- extrainfo = true;
+ queued = updateData.state == LFG_STATE_QUEUED;
break;
default:
break;
}
- sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_UPDATE_PLAYER [" UI64FMTD "] updatetype: %u", guid, updateData.updateType);
- WorldPacket data(SMSG_LFG_UPDATE_PLAYER, 1 + 1 + (extrainfo ? 1 : 0) * (1 + 1 + 1 + 1 + size * 4 + updateData.comment.length()));
- data << uint8(updateData.updateType); // Lfg Update type
- data << uint8(extrainfo); // Extra info
- if (extrainfo)
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_UPDATE_PLAYER %s updatetype: %u",
+ 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()));
+ data << uint8(updateData.updateType); // Lfg Update type
+ data << uint8(size > 0); // Extra info
+ if (size)
{
- data << uint8(queued); // Join the queue
- data << uint8(0); // unk - Always 0
- data << uint8(0); // unk - Always 0
+ data << uint8(queued); // Join the queue
+ data << uint8(0); // unk - Always 0
+ data << uint8(0); // unk - Always 0
data << uint8(size);
- if (size)
- for (LfgDungeonSet::const_iterator it = updateData.dungeons.begin(); it != updateData.dungeons.end(); ++it)
- data << uint32(*it);
+ for (LfgDungeonSet::const_iterator it = updateData.dungeons.begin(); it != updateData.dungeons.end(); ++it)
+ data << uint32(*it);
data << updateData.comment;
}
SendPacket(&data);
@@ -330,51 +354,42 @@ void WorldSession::SendLfgUpdatePlayer(const LfgUpdateData& updateData)
void WorldSession::SendLfgUpdateParty(const LfgUpdateData& updateData)
{
bool join = false;
- bool extrainfo = false;
bool queued = false;
- uint64 guid = GetPlayer()->GetGUID();
uint8 size = uint8(updateData.dungeons.size());
switch (updateData.updateType)
{
- case LFG_UPDATETYPE_JOIN_PROPOSAL:
- extrainfo = true;
- break;
- case LFG_UPDATETYPE_ADDED_TO_QUEUE:
- extrainfo = true;
- join = true;
+ case LFG_UPDATETYPE_ADDED_TO_QUEUE: // Rolecheck Success
queued = true;
- break;
- case LFG_UPDATETYPE_UPDATE_STATUS:
- extrainfo = size > 0;
- join = true;
- queued = true;
- break;
+ // no break on purpose
case LFG_UPDATETYPE_PROPOSAL_BEGIN:
- extrainfo = true;
join = true;
break;
+ case LFG_UPDATETYPE_UPDATE_STATUS:
+ join = updateData.state != LFG_STATE_ROLECHECK && updateData.state != LFG_STATE_NONE;
+ queued = updateData.state == LFG_STATE_QUEUED;
+ break;
default:
break;
}
- sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_UPDATE_PARTY [" UI64FMTD "] updatetype: %u", guid, updateData.updateType);
- WorldPacket data(SMSG_LFG_UPDATE_PARTY, 1 + 1 + (extrainfo ? 1 : 0) * (1 + 1 + 1 + 1 + 1 + size * 4 + updateData.comment.length()));
- data << uint8(updateData.updateType); // Lfg Update type
- data << uint8(extrainfo); // Extra info
- if (extrainfo)
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_UPDATE_PARTY %s updatetype: %u",
+ 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()));
+ data << uint8(updateData.updateType); // Lfg Update type
+ data << uint8(size > 0); // Extra info
+ if (size)
{
- data << uint8(join); // LFG Join
- data << uint8(queued); // Join the queue
- data << uint8(0); // unk - Always 0
- data << uint8(0); // unk - Always 0
+ data << uint8(join); // LFG Join
+ data << uint8(queued); // Join the queue
+ data << uint8(0); // unk - Always 0
+ data << uint8(0); // unk - Always 0
for (uint8 i = 0; i < 3; ++i)
- data << uint8(0); // unk - Always 0
+ data << uint8(0); // unk - Always 0
data << uint8(size);
- if (size)
- for (LfgDungeonSet::const_iterator it = updateData.dungeons.begin(); it != updateData.dungeons.end(); ++it)
- data << uint32(*it);
+ for (LfgDungeonSet::const_iterator it = updateData.dungeons.begin(); it != updateData.dungeons.end(); ++it)
+ data << uint32(*it);
data << updateData.comment;
}
SendPacket(&data);
@@ -382,7 +397,8 @@ void WorldSession::SendLfgUpdateParty(const LfgUpdateData& updateData)
void WorldSession::SendLfgRoleChosen(uint64 guid, uint8 roles)
{
- sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_ROLE_CHOSEN [" UI64FMTD "] guid: [" UI64FMTD "] roles: %u", GetPlayer()->GetGUID(), guid, roles);
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_ROLE_CHOSEN %s guid: %u roles: %u",
+ GetPlayerInfo().c_str(), GUID_LOPART(guid), roles);
WorldPacket data(SMSG_LFG_ROLE_CHOSEN, 8 + 1 + 4);
data << uint64(guid); // Guid
@@ -399,7 +415,7 @@ void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck& roleCheck)
else
dungeons = roleCheck.dungeons;
- sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_ROLE_CHECK_UPDATE [" UI64FMTD "]", GetPlayer()->GetGUID());
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_ROLE_CHECK_UPDATE %s", GetPlayerInfo().c_str());
WorldPacket data(SMSG_LFG_ROLE_CHECK_UPDATE, 4 + 1 + 1 + dungeons.size() * 4 + 1 + roleCheck.roles.size() * (8 + 1 + 4 + 1));
data << uint32(roleCheck.state); // Check result
@@ -424,7 +440,7 @@ void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck& roleCheck)
data << uint8(roles > 0); // Ready
data << uint32(roles); // Roles
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)
{
@@ -437,7 +453,7 @@ void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck& roleCheck)
data << uint8(roles > 0); // Ready
data << uint32(roles); // Roles
player = ObjectAccessor::FindPlayer(guid);
- data << uint8(player ? player->getLevel() : 0); // Level
+ data << uint8(player ? player->getLevel() : 0);// Level
}
}
SendPacket(&data);
@@ -449,7 +465,8 @@ void WorldSession::SendLfgJoinResult(const LfgJoinResultData& joinData)
for (LfgLockPartyMap::const_iterator it = joinData.lockmap.begin(); it != joinData.lockmap.end(); ++it)
size += 8 + 4 + uint32(it->second.size()) * (4 + 4 + 4 + 4);
- sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_JOIN_RESULT [" UI64FMTD "] checkResult: %u checkValue: %u", GetPlayer()->GetGUID(), joinData.result, joinData.state);
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_JOIN_RESULT %s checkResult: %u checkValue: %u",
+ GetPlayerInfo().c_str(), joinData.result, joinData.state);
WorldPacket data(SMSG_LFG_JOIN_RESULT, 4 + 4 + size);
data << uint32(joinData.result); // Check Result
data << uint32(joinData.state); // Check Value
@@ -460,8 +477,8 @@ void WorldSession::SendLfgJoinResult(const LfgJoinResultData& joinData)
void WorldSession::SendLfgQueueStatus(const LfgQueueStatusData& queueData)
{
- sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_QUEUE_STATUS [" UI64FMTD "] dungeon: %u - waitTime: %d - avgWaitTime: %d - waitTimeTanks: %d - waitTimeHealer: %d - waitTimeDps: %d - queuedTime: %u - tanks: %u - healers: %u - dps: %u",
- GetPlayer()->GetGUID(), queueData.dungeonId, queueData.waitTime, queueData.waitTimeAvg, queueData.waitTimeTank, queueData.waitTimeHealer, queueData.waitTimeDps, queueData.queuedTime, queueData.tanks, queueData.healers, queueData.dps);
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_QUEUE_STATUS %s dungeon: %u - waitTime: %d - avgWaitTime: %d - waitTimeTanks: %d - waitTimeHealer: %d - waitTimeDps: %d - queuedTime: %u - tanks: %u - healers: %u - dps: %u",
+ GetPlayerInfo().c_str(), queueData.dungeonId, queueData.waitTime, queueData.waitTimeAvg, queueData.waitTimeTank, queueData.waitTimeHealer, queueData.waitTimeDps, queueData.queuedTime, queueData.tanks, queueData.healers, queueData.dps);
WorldPacket data(SMSG_LFG_QUEUE_STATUS, 4 + 4 + 4 + 4 + 4 +4 + 1 + 1 + 1 + 4);
data << uint32(queueData.dungeonId); // Dungeon
@@ -484,7 +501,8 @@ void WorldSession::SendLfgPlayerReward(uint32 rdungeonEntry, uint32 sdungeonEntr
uint8 itemNum = uint8(quest ? quest->GetRewItemsCount() : 0);
- sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PLAYER_REWARD [" UI64FMTD "] rdungeonEntry: %u - sdungeonEntry: %u - done: %u", GetPlayer()->GetGUID(), rdungeonEntry, sdungeonEntry, done);
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PLAYER_REWARD %s rdungeonEntry: %u - sdungeonEntry: %u - done: %u",
+ GetPlayerInfo().c_str(), rdungeonEntry, sdungeonEntry, done);
WorldPacket data(SMSG_LFG_PLAYER_REWARD, 4 + 4 + 1 + 4 + 4 + 4 + 4 + 4 + 1 + itemNum * (4 + 4 + 4));
data << uint32(rdungeonEntry); // Random Dungeon Finished
data << uint32(sdungeonEntry); // Dungeon Finished
@@ -525,8 +543,12 @@ void WorldSession::SendLfgBootProposalUpdate(const LfgPlayerBoot& boot)
++agreeNum;
}
}
- sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_BOOT_PROPOSAL_UPDATE [" UI64FMTD "] inProgress: %u - didVote: %u - agree: %u - victim: [" UI64FMTD "] votes: %u - agrees: %u - left: %u - needed: %u - reason %s",
- guid, uint8(boot.inProgress), uint8(playerVote != LFG_ANSWER_PENDING), uint8(playerVote == LFG_ANSWER_AGREE), boot.victim, votesNum, agreeNum, secsleft, LFG_GROUP_KICK_VOTES_NEEDED, boot.reason.c_str());
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_BOOT_PROPOSAL_UPDATE %s inProgress: %u - "
+ "didVote: %u - agree: %u - victim: %u votes: %u - agrees: %u - left: %u - "
+ "needed: %u - reason %s",
+ GetPlayerInfo().c_str(), uint8(boot.inProgress), uint8(playerVote != LFG_ANSWER_PENDING),
+ uint8(playerVote == LFG_ANSWER_AGREE), GUID_LOPART(boot.victim), votesNum, agreeNum,
+ secsleft, LFG_GROUP_KICK_VOTES_NEEDED, boot.reason.c_str());
WorldPacket data(SMSG_LFG_BOOT_PROPOSAL_UPDATE, 1 + 1 + 1 + 8 + 4 + 4 + 4 + 4 + boot.reason.length());
data << uint8(boot.inProgress); // Vote in progress
data << uint8(playerVote != LFG_ANSWER_PENDING); // Did Vote
@@ -548,7 +570,8 @@ void WorldSession::SendLfgUpdateProposal(uint32 proposalId, LfgProposal const& p
bool silent = !proposal.isNew && gguid == proposal.group;
uint32 dungeonEntry = proposal.dungeonId;
- sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PROPOSAL_UPDATE [" UI64FMTD "] state: %u", guid, proposal.state);
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PROPOSAL_UPDATE %s state: %u",
+ GetPlayerInfo().c_str(), proposal.state);
WorldPacket data(SMSG_LFG_PROPOSAL_UPDATE, 4 + 1 + 4 + 4 + 1 + 1 + proposal.players.size() * (4 + 1 + 1 + 1 + 1 +1));
// show random dungeon if player selected random dungeon and it's not lfg group
@@ -581,18 +604,19 @@ void WorldSession::SendLfgUpdateProposal(uint32 proposalId, LfgProposal const& p
}
else
{
- data << uint8(player.group == proposal.group); // In dungeon (silent)
- data << uint8(player.group == gguid); // Same Group than player
+ data << uint8(player.group == proposal.group); // In dungeon (silent)
+ data << uint8(player.group == gguid); // Same Group than player
}
- data << uint8(player.accept != LFG_ANSWER_PENDING); // Answered
- data << uint8(player.accept == LFG_ANSWER_AGREE); // Accepted
+ data << uint8(player.accept != LFG_ANSWER_PENDING);// Answered
+ data << uint8(player.accept == LFG_ANSWER_AGREE); // Accepted
}
SendPacket(&data);
}
void WorldSession::SendLfgLfrList(bool update)
{
- sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_LFR_LIST [" UI64FMTD "] update: %u", GetPlayer()->GetGUID(), update ? 1 : 0);
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_LFR_LIST %s update: %u",
+ GetPlayerInfo().c_str(), update ? 1 : 0);
WorldPacket data(SMSG_LFG_UPDATE_SEARCH, 1);
data << uint8(update); // In Lfg Queue?
SendPacket(&data);
@@ -600,14 +624,15 @@ void WorldSession::SendLfgLfrList(bool update)
void WorldSession::SendLfgDisabled()
{
- sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_DISABLED [" UI64FMTD "]", GetPlayer()->GetGUID());
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_DISABLED %s", GetPlayerInfo().c_str());
WorldPacket data(SMSG_LFG_DISABLED, 0);
SendPacket(&data);
}
void WorldSession::SendLfgOfferContinue(uint32 dungeonEntry)
{
- sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_OFFER_CONTINUE [" UI64FMTD "] dungeon entry: %u", GetPlayer()->GetGUID(), dungeonEntry);
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_OFFER_CONTINUE %s dungeon entry: %u",
+ GetPlayerInfo().c_str(), dungeonEntry);
WorldPacket data(SMSG_LFG_OFFER_CONTINUE, 4);
data << uint32(dungeonEntry);
SendPacket(&data);
@@ -615,48 +640,18 @@ void WorldSession::SendLfgOfferContinue(uint32 dungeonEntry)
void WorldSession::SendLfgTeleportError(uint8 err)
{
- sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_TELEPORT_DENIED [" UI64FMTD "] reason: %u", GetPlayer()->GetGUID(), err);
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_TELEPORT_DENIED %s reason: %u",
+ GetPlayerInfo().c_str(), err);
WorldPacket data(SMSG_LFG_TELEPORT_DENIED, 4);
data << uint32(err); // Error
SendPacket(&data);
}
-void WorldSession::HandleLfgGetStatus(WorldPacket& /*recvData*/)
-{
- uint64 guid = GetPlayer()->GetGUID();
- sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_GET_STATUS [" UI64FMTD "]", guid);
-
- LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_UPDATE_STATUS);
- LfgState state = sLFGMgr->GetLfgStatus(guid, updateData);
-
- if (state == LFG_STATE_NONE || updateData.dungeons.empty())
- {
- SendLfgUpdatePlayer(updateData);
- SendLfgUpdateParty(updateData);
- return;
- }
-
- if (state != LFG_STATE_QUEUED)
- return;
-
- if (GetPlayer()->GetGroup())
- {
- SendLfgUpdateParty(updateData);
- updateData.dungeons.clear();
- SendLfgUpdatePlayer(updateData);
- }
- else
- {
- SendLfgUpdatePlayer(updateData);
- updateData.dungeons.clear();
- SendLfgUpdateParty(updateData);
- }
-}
-
/*
void WorldSession::SendLfrUpdateListOpcode(uint32 dungeonEntry)
{
- sLog->outDebug(LOG_FILTER_PACKETIO, "SMSG_LFG_UPDATE_LIST [" UI64FMTD "] dungeon entry: %u", GetPlayer()->GetGUID(), dungeonEntry);
+ sLog->outDebug(LOG_FILTER_PACKETIO, "SMSG_LFG_UPDATE_LIST %s dungeon entry: %u",
+ GetPlayerInfo().c_str(), dungeonEntry);
WorldPacket data(SMSG_LFG_UPDATE_LIST);
SendPacket(&data);
}