aboutsummaryrefslogtreecommitdiff
path: root/src/game/Channel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Channel.cpp')
-rw-r--r--src/game/Channel.cpp156
1 files changed, 78 insertions, 78 deletions
diff --git a/src/game/Channel.cpp b/src/game/Channel.cpp
index c09a6fc30e8..f8f59e596fb 100644
--- a/src/game/Channel.cpp
+++ b/src/game/Channel.cpp
@@ -29,20 +29,20 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
{
// set special flags if built-in channel
ChatChannelsEntry const* ch = GetChannelEntryFor(channel_id);
- if(ch) // it's built-in channel
+ if (ch) // it's built-in channel
{
channel_id = ch->ChannelID; // built-in channel
m_announce = false; // no join/leave announces
m_flags |= CHANNEL_FLAG_GENERAL; // for all built-in channels
- if(ch->flags & CHANNEL_DBC_FLAG_TRADE) // for trade channel
+ if (ch->flags & CHANNEL_DBC_FLAG_TRADE) // for trade channel
m_flags |= CHANNEL_FLAG_TRADE;
- if(ch->flags & CHANNEL_DBC_FLAG_CITY_ONLY2) // for city only channels
+ if (ch->flags & CHANNEL_DBC_FLAG_CITY_ONLY2) // for city only channels
m_flags |= CHANNEL_FLAG_CITY;
- if(ch->flags & CHANNEL_DBC_FLAG_LFG) // for LFG channel
+ if (ch->flags & CHANNEL_DBC_FLAG_LFG) // for LFG channel
m_flags |= CHANNEL_FLAG_LFG;
else // for all other channels
m_flags |= CHANNEL_FLAG_NOT_LFG;
@@ -75,7 +75,7 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
for (iter = tokens.begin(); iter != tokens.end(); ++iter)
{
uint64 banned_guid = atol((*iter).c_str());
- if(banned_guid)
+ if (banned_guid)
{
sLog.outDebug("Channel(%s) loaded banned guid: %u",name.c_str(), banned_guid);
banned.insert(banned_guid);
@@ -134,9 +134,9 @@ void Channel::_UpdateBanListInDB() const
void Channel::Join(uint64 p, const char *pass)
{
WorldPacket data;
- if(IsOn(p))
+ if (IsOn(p))
{
- if(!IsConstant()) // non send error message for built-in channels
+ if (!IsConstant()) // non send error message for built-in channels
{
MakePlayerAlreadyMember(&data, p);
SendToOne(&data, p);
@@ -144,14 +144,14 @@ void Channel::Join(uint64 p, const char *pass)
return;
}
- if(IsBanned(p))
+ if (IsBanned(p))
{
MakeBanned(&data);
SendToOne(&data, p);
return;
}
- if(m_password.length() > 0 && strcmp(pass, m_password.c_str()))
+ if (m_password.length() > 0 && strcmp(pass, m_password.c_str()))
{
MakeWrongPassword(&data);
SendToOne(&data, p);
@@ -160,9 +160,9 @@ void Channel::Join(uint64 p, const char *pass)
Player *plr = objmgr.GetPlayer(p);
- if(plr)
+ if (plr)
{
- if(HasFlag(CHANNEL_FLAG_LFG) &&
+ if (HasFlag(CHANNEL_FLAG_LFG) &&
sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER &&
(plr->GetGroup() || plr->m_lookingForGroup.Empty()) )
{
@@ -171,13 +171,13 @@ void Channel::Join(uint64 p, const char *pass)
return;
}
- if(plr->GetGuildId() && (GetFlags() == 0x38))
+ if (plr->GetGuildId() && (GetFlags() == 0x38))
return;
plr->JoinedChannel(this);
}
- if(m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL) ))
+ if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL) ))
{
MakeJoined(&data, p);
SendToAll(&data);
@@ -196,13 +196,13 @@ void Channel::Join(uint64 p, const char *pass)
JoinNotify(p);
// if no owner first logged will become
- if(!IsConstant() && !m_ownerGUID)
+ if (!IsConstant() && !m_ownerGUID)
{
SetOwner(p, (players.size() > 1 ? true : false));
players[p].SetModerator(true);
}
/*
- else if(!IsConstant() && m_ownerGUID && plr && m_ownerGUID == plr->GetGUID() ))
+ else if (!IsConstant() && m_ownerGUID && plr && m_ownerGUID == plr->GetGUID() ))
{
SetOwner(p, (players.size() > 1 ? true : false));
players[p].SetModerator(true);
@@ -211,9 +211,9 @@ void Channel::Join(uint64 p, const char *pass)
void Channel::Leave(uint64 p, bool send)
{
- if(!IsOn(p))
+ if (!IsOn(p))
{
- if(send)
+ if (send)
{
WorldPacket data;
MakeNotMember(&data);
@@ -224,12 +224,12 @@ void Channel::Leave(uint64 p, bool send)
{
Player *plr = objmgr.GetPlayer(p);
- if(send)
+ if (send)
{
WorldPacket data;
MakeYouLeft(&data);
SendToOne(&data, p);
- if(plr)
+ if (plr)
plr->LeftChannel(this);
data.clear();
}
@@ -237,7 +237,7 @@ void Channel::Leave(uint64 p, bool send)
bool changeowner = players[p].IsOwner();
players.erase(p);
- if(m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL) ))
+ if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL) ))
{
WorldPacket data;
MakeLeft(&data, p);
@@ -246,7 +246,7 @@ void Channel::Leave(uint64 p, bool send)
LeaveNotify(p);
- if(changeowner)
+ if (changeowner)
{
uint64 newowner = !players.empty() ? players.begin()->second.player : 0;
players[newowner].SetModerator(true);
@@ -259,16 +259,16 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
{
AccountTypes sec = SEC_PLAYER;
Player *gplr = objmgr.GetPlayer(good);
- if(gplr)
+ if (gplr)
sec = gplr->GetSession()->GetSecurity();
- if(!IsOn(good))
+ if (!IsOn(good))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, good);
}
- else if(!players[good].IsModerator() && sec < SEC_GAMEMASTER)
+ else if (!players[good].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@@ -277,13 +277,13 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
else
{
Player *bad = objmgr.GetPlayer(badname);
- if(bad == NULL || !IsOn(bad->GetGUID()))
+ if (bad == NULL || !IsOn(bad->GetGUID()))
{
WorldPacket data;
MakePlayerNotFound(&data, badname);
SendToOne(&data, good);
}
- else if(sec < SEC_GAMEMASTER && bad->GetGUID() == m_ownerGUID && good != m_ownerGUID)
+ else if (sec < SEC_GAMEMASTER && bad->GetGUID() == m_ownerGUID && good != m_ownerGUID)
{
WorldPacket data;
MakeNotOwner(&data);
@@ -295,7 +295,7 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
WorldPacket data;
- if(ban && !IsBanned(bad->GetGUID()))
+ if (ban && !IsBanned(bad->GetGUID()))
{
banned.insert(bad->GetGUID());
MakePlayerBanned(&data, bad->GetGUID(), good);
@@ -309,7 +309,7 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
players.erase(bad->GetGUID());
bad->LeftChannel(this);
- if(changeowner)
+ if (changeowner)
{
uint64 newowner = !players.empty() ? good : false;
players[newowner].SetModerator(true);
@@ -323,16 +323,16 @@ void Channel::UnBan(uint64 good, const char *badname)
{
uint32 sec = 0;
Player *gplr = objmgr.GetPlayer(good);
- if(gplr)
+ if (gplr)
sec = gplr->GetSession()->GetSecurity();
- if(!IsOn(good))
+ if (!IsOn(good))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, good);
}
- else if(!players[good].IsModerator() && sec < SEC_GAMEMASTER)
+ else if (!players[good].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@@ -341,7 +341,7 @@ void Channel::UnBan(uint64 good, const char *badname)
else
{
Player *bad = objmgr.GetPlayer(badname);
- if(bad == NULL || !IsBanned(bad->GetGUID()))
+ if (bad == NULL || !IsBanned(bad->GetGUID()))
{
WorldPacket data;
MakePlayerNotFound(&data, badname);
@@ -365,24 +365,24 @@ void Channel::Password(uint64 p, const char *pass)
std::string plName;
uint32 sec = 0;
Player *plr = objmgr.GetPlayer(p);
- if(plr)
+ if (plr)
sec = plr->GetSession()->GetSecurity();
ChatHandler chat(plr);
- if(!m_public && sec <= SEC_MODERATOR)
+ if (!m_public && sec <= SEC_MODERATOR)
{
chat.PSendSysMessage(LANG_CHANNEL_NOT_PUBLIC);
return;
}
- if(!IsOn(p))
+ if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
}
- else if(!players[p].IsModerator() && sec < SEC_GAMEMASTER)
+ else if (!players[p].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@@ -408,13 +408,13 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
uint32 sec = plr->GetSession()->GetSecurity();
- if(!IsOn(p))
+ if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
}
- else if(!players[p].IsModerator() && sec < SEC_GAMEMASTER)
+ else if (!players[p].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@@ -423,7 +423,7 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
else
{
Player *newp = objmgr.GetPlayer(p2n);
- if(!newp)
+ if (!newp)
{
WorldPacket data;
MakePlayerNotFound(&data, p2n);
@@ -432,10 +432,10 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
}
PlayerInfo inf = players[newp->GetGUID()];
- if(p == m_ownerGUID && newp->GetGUID() == m_ownerGUID && mod)
+ if (p == m_ownerGUID && newp->GetGUID() == m_ownerGUID && mod)
return;
- if(!IsOn(newp->GetGUID()))
+ if (!IsOn(newp->GetGUID()))
{
WorldPacket data;
MakePlayerNotFound(&data, p2n);
@@ -445,7 +445,7 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
// 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( (plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || newp->GetSession()->GetSecurity() < SEC_GAMEMASTER) &&
+ if ( (plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || newp->GetSession()->GetSecurity() < SEC_GAMEMASTER) &&
plr->GetTeam() != newp->GetTeam() && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL) )
{
WorldPacket data;
@@ -454,7 +454,7 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
return;
}
- if(m_ownerGUID == newp->GetGUID() && m_ownerGUID != p)
+ if (m_ownerGUID == newp->GetGUID() && m_ownerGUID != p)
{
WorldPacket data;
MakeNotOwner(&data);
@@ -462,7 +462,7 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
return;
}
- if(mod)
+ if (mod)
SetModerator(newp->GetGUID(), set);
else
SetMute(newp->GetGUID(), set);
@@ -477,7 +477,7 @@ void Channel::SetOwner(uint64 p, const char *newname)
uint32 sec = plr->GetSession()->GetSecurity();
- if(!IsOn(p))
+ if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
@@ -485,7 +485,7 @@ void Channel::SetOwner(uint64 p, const char *newname)
return;
}
- if(sec < SEC_GAMEMASTER && p != m_ownerGUID)
+ if (sec < SEC_GAMEMASTER && p != m_ownerGUID)
{
WorldPacket data;
MakeNotOwner(&data);
@@ -494,7 +494,7 @@ void Channel::SetOwner(uint64 p, const char *newname)
}
Player *newp = objmgr.GetPlayer(newname);
- if(newp == NULL || !IsOn(newp->GetGUID()))
+ if (newp == NULL || !IsOn(newp->GetGUID()))
{
WorldPacket data;
MakePlayerNotFound(&data, newname);
@@ -502,7 +502,7 @@ void Channel::SetOwner(uint64 p, const char *newname)
return;
}
- if(newp->GetTeam() != plr->GetTeam() && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
+ if (newp->GetTeam() != plr->GetTeam() && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
{
WorldPacket data;
MakePlayerNotFound(&data, newname);
@@ -516,7 +516,7 @@ void Channel::SetOwner(uint64 p, const char *newname)
void Channel::SendWhoOwner(uint64 p)
{
- if(!IsOn(p))
+ if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
@@ -534,7 +534,7 @@ void Channel::List(Player* player)
{
uint64 p = player->GetGUID();
- if(!IsOn(p))
+ if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
@@ -578,16 +578,16 @@ void Channel::Announce(uint64 p)
{
uint32 sec = 0;
Player *plr = objmgr.GetPlayer(p);
- if(plr)
+ if (plr)
sec = plr->GetSession()->GetSecurity();
- if(!IsOn(p))
+ if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
}
- else if(!players[p].IsModerator() && sec < SEC_GAMEMASTER)
+ else if (!players[p].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@@ -598,7 +598,7 @@ void Channel::Announce(uint64 p)
m_announce = !m_announce;
WorldPacket data;
- if(m_announce)
+ if (m_announce)
MakeAnnouncementsOn(&data, p);
else
MakeAnnouncementsOff(&data, p);
@@ -613,16 +613,16 @@ void Channel::Moderate(uint64 p)
{
uint32 sec = 0;
Player *plr = objmgr.GetPlayer(p);
- if(plr)
+ if (plr)
sec = plr->GetSession()->GetSecurity();
- if(!IsOn(p))
+ if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
}
- else if(!players[p].IsModerator() && sec < SEC_GAMEMASTER)
+ else if (!players[p].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@@ -633,7 +633,7 @@ void Channel::Moderate(uint64 p)
m_moderate = !m_moderate;
WorldPacket data;
- if(m_moderate)
+ if (m_moderate)
MakeModerationOn(&data, p);
else
MakeModerationOff(&data, p);
@@ -645,29 +645,29 @@ void Channel::Moderate(uint64 p)
void Channel::Say(uint64 p, const char *what, uint32 lang)
{
- if(!what)
+ if (!what)
return;
if (sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
lang = LANG_UNIVERSAL;
uint32 sec = 0;
Player *plr = objmgr.GetPlayer(p);
- if(plr)
+ if (plr)
sec = plr->GetSession()->GetSecurity();
- if(!IsOn(p))
+ if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, p);
}
- else if(players[p].IsMuted())
+ else if (players[p].IsMuted())
{
WorldPacket data;
MakeMuted(&data);
SendToOne(&data, p);
}
- else if(m_moderate && !players[p].IsModerator() && sec < SEC_GAMEMASTER)
+ else if (m_moderate && !players[p].IsModerator() && sec < SEC_GAMEMASTER)
{
WorldPacket data;
MakeNotModerator(&data);
@@ -694,7 +694,7 @@ void Channel::Say(uint64 p, const char *what, uint32 lang)
void Channel::Invite(uint64 p, const char *newname)
{
- if(!IsOn(p))
+ if (!IsOn(p))
{
WorldPacket data;
MakeNotMember(&data);
@@ -703,7 +703,7 @@ void Channel::Invite(uint64 p, const char *newname)
}
Player *newp = objmgr.GetPlayer(newname);
- if(!newp)
+ if (!newp)
{
WorldPacket data;
MakePlayerNotFound(&data, newname);
@@ -723,7 +723,7 @@ void Channel::Invite(uint64 p, const char *newname)
return;
}
- if(IsOn(newp->GetGUID()))
+ if (IsOn(newp->GetGUID()))
{
WorldPacket data;
MakePlayerAlreadyMember(&data, newp->GetGUID());
@@ -732,7 +732,7 @@ void Channel::Invite(uint64 p, const char *newname)
}
WorldPacket data;
- if(!newp->GetSocial()->HasIgnore(GUID_LOPART(p)))
+ if (!newp->GetSocial()->HasIgnore(GUID_LOPART(p)))
{
MakeInvite(&data, p);
SendToOne(&data, newp->GetGUID());
@@ -744,16 +744,16 @@ void Channel::Invite(uint64 p, const char *newname)
void Channel::SetOwner(uint64 guid, bool exclaim)
{
- if(m_ownerGUID)
+ if (m_ownerGUID)
{
// [] will re-add player after it possible removed
PlayerList::iterator p_itr = players.find(m_ownerGUID);
- if(p_itr != players.end())
+ if (p_itr != players.end())
p_itr->second.SetOwner(false);
}
m_ownerGUID = guid;
- if(m_ownerGUID)
+ if (m_ownerGUID)
{
uint8 oldFlag = GetPlayerFlags(m_ownerGUID);
players[m_ownerGUID].SetModerator(true);
@@ -763,7 +763,7 @@ void Channel::SetOwner(uint64 guid, bool exclaim)
MakeModeChange(&data, m_ownerGUID, oldFlag);
SendToAll(&data);
- if(exclaim)
+ if (exclaim)
{
MakeOwnerChanged(&data, m_ownerGUID);
SendToAll(&data);
@@ -779,9 +779,9 @@ void Channel::SendToAll(WorldPacket *data, uint64 p)
for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
{
Player *plr = objmgr.GetPlayer(i->first);
- if(plr)
+ if (plr)
{
- if(!p || !plr->GetSocial()->HasIgnore(GUID_LOPART(p)))
+ if (!p || !plr->GetSocial()->HasIgnore(GUID_LOPART(p)))
plr->GetSession()->SendPacket(data);
}
}
@@ -791,10 +791,10 @@ void Channel::SendToAllButOne(WorldPacket *data, uint64 who)
{
for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
{
- if(i->first != who)
+ if (i->first != who)
{
Player *plr = objmgr.GetPlayer(i->first);
- if(plr)
+ if (plr)
plr->GetSession()->SendPacket(data);
}
}
@@ -803,7 +803,7 @@ void Channel::SendToAllButOne(WorldPacket *data, uint64 who)
void Channel::SendToOne(WorldPacket *data, uint64 who)
{
Player *plr = objmgr.GetPlayer(who);
- if(plr)
+ if (plr)
plr->GetSession()->SendPacket(data);
}
@@ -906,7 +906,7 @@ void Channel::MakeChannelOwner(WorldPacket *data)
{
std::string name = "";
- if(!objmgr.GetPlayerNameByGUID(m_ownerGUID, name) || name.empty())
+ if (!objmgr.GetPlayerNameByGUID(m_ownerGUID, name) || name.empty())
name = "PLAYER_NOT_FOUND";
MakeNotifyPacket(data, CHAT_CHANNEL_OWNER_NOTICE);
@@ -1081,7 +1081,7 @@ void Channel::JoinNotify(uint64 guid)
{
WorldPacket data;
- if(IsConstant())
+ 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);