TrinityCore
Loading...
Searching...
No Matches
Channel Class Reference

#include <Channel.h>

Classes

struct  PlayerInfo
 

Public Member Functions

 Channel (ObjectGuid const &guid, uint32 channelId, uint32 team=0, AreaTableEntry const *zoneEntry=nullptr)
 
 Channel (ObjectGuid const &guid, std::string const &name, uint32 team=0, std::string const &banList="")
 
 Channel (Channel const &)=delete
 
 Channel (Channel &&)=delete
 
Channel & operator= (Channel const &)=delete
 
Channel & operator= (Channel &&)=delete
 
 ~Channel ()
 
std::string GetName (LocaleConstant locale=DEFAULT_LOCALE) const
 
uint32 GetChannelId () const
 
bool IsConstant () const
 
ObjectGuid GetGUID () const
 
bool IsLFG () const
 
bool IsAnnounce () const
 
void SetAnnounce (bool announce)
 
void SetDirty ()
 
void UpdateChannelInDB ()
 
void SetPassword (std::string const &password)
 
bool CheckPassword (std::string const &password) const
 
uint32 GetNumPlayers () const
 
uint8 GetFlags () const
 
bool HasFlag (uint8 flag) const
 
AreaTableEntry const * GetZoneEntry () const
 
void JoinChannel (Player *player, std::string const &pass="")
 
void LeaveChannel (Player *player, bool send=true, bool suspend=false)
 
void KickOrBan (Player const *player, std::string const &badname, bool ban)
 
void Kick (Player const *player, std::string const &badname)
 
void Ban (Player const *player, std::string const &badname)
 
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 SetInvisible (Player const *player, bool on)
 
void SetOwner (ObjectGuid const &guid, bool exclaim=true)
 
void SetOwner (Player const *player, std::string const &name)
 
void SendWhoOwner (Player const *player)
 
void SetModerator (Player const *player, std::string const &newname)
 
void UnsetModerator (Player const *player, std::string const &newname)
 
void SetMute (Player const *player, std::string const &newname)
 
void UnsetMute (Player const *player, std::string const &newname)
 
void SilenceAll (Player const *player, std::string const &name)
 
void UnsilenceAll (Player const *player, std::string const &name)
 
void List (Player const *player) const
 
void Announce (Player const *player)
 
void Say (ObjectGuid const &guid, std::string const &what, uint32 lang) const
 
void AddonSay (ObjectGuid const &guid, std::string const &prefix, std::string const &what, bool isLogged) const
 
void DeclineInvite (Player const *player)
 
void Invite (Player const *player, std::string const &newp)
 
void JoinNotify (ObjectGuid const &guid) const
 
void LeaveNotify (ObjectGuid const &guid) const
 
void SetOwnership (bool ownership)
 

Static Public Member Functions

static void GetChannelName (std::string &channelName, uint32 channelId, LocaleConstant locale, AreaTableEntry const *zoneEntry)
 

Private Types

typedef std::map< ObjectGuid, PlayerInfo > PlayerContainer
 
typedef GuidUnorderedSet BannedContainer
 

Private Member Functions

template<class Builder >
void SendToAll (Builder &builder, ObjectGuid const &guid=ObjectGuid::Empty, ObjectGuid const &accountGuid=ObjectGuid::Empty) const
 
template<class Builder >
void SendToAllButOne (Builder &builder, ObjectGuid const &who) const
 
template<class Builder >
void SendToOne (Builder &builder, ObjectGuid const &who) const
 
template<class Builder >
void SendToAllWithAddon (Builder &builder, std::string const &addonPrefix, ObjectGuid const &guid=ObjectGuid::Empty, ObjectGuid const &accountGuid=ObjectGuid::Empty) const
 
bool IsOn (ObjectGuid who) const
 
bool IsBanned (ObjectGuid guid) const
 
uint8 GetPlayerFlags (ObjectGuid const &guid) const
 
void SetModerator (ObjectGuid const &guid, bool set)
 
void SetMute (ObjectGuid const &guid, bool set)
 

Private Attributes

bool _isDirty
 
time_t _nextActivityUpdateTime
 
bool _announceEnabled
 
bool _ownershipEnabled
 
bool _isOwnerInvisible
 
uint8 _channelFlags
 
uint32 _channelId
 
uint32 _channelTeam
 
ObjectGuid _channelGuid
 
ObjectGuid _ownerGuid
 
std::string _channelName
 
std::string _channelPassword
 
PlayerContainer _playersStore
 
BannedContainer _bannedStore
 
AreaTableEntry const * _zoneEntry
 

Detailed Description

Definition at line 107 of file Channel.h.

Member Typedef Documentation

◆ BannedContainer

Definition at line 249 of file Channel.h.

◆ PlayerContainer

typedef std::map<ObjectGuid, PlayerInfo> Channel::PlayerContainer
private

Definition at line 248 of file Channel.h.

Constructor & Destructor Documentation

◆ Channel() [1/4]

Channel::Channel ( ObjectGuid const &  guid,
uint32  channelId,
uint32  team = 0,
AreaTableEntry const *  zoneEntry = nullptr 
)

◆ Channel() [2/4]

Channel::Channel ( ObjectGuid const &  guid,
std::string const &  name,
uint32  team = 0,
std::string const &  banList = "" 
)

◆ Channel() [3/4]

Channel::Channel ( Channel const &  )
delete

◆ Channel() [4/4]

Channel::Channel ( Channel &&  )
delete

◆ ~Channel()

Channel::~Channel ( )
default

Member Function Documentation

◆ AddonSay()

◆ Announce()

◆ Ban()

void Channel::Ban ( Player const *  player,
std::string const &  badname 
)
inline

Definition at line 195 of file Channel.h.

◆ CheckPassword()

bool Channel::CheckPassword ( std::string const &  password) const
inline

Definition at line 181 of file Channel.h.

Referenced by JoinChannel().

◆ DeclineInvite()

void Channel::DeclineInvite ( Player const *  player)

Definition at line 904 of file Channel.cpp.

◆ GetChannelId()

◆ GetChannelName()

void Channel::GetChannelName ( std::string &  channelName,
uint32  channelId,
LocaleConstant  locale,
AreaTableEntry const *  zoneEntry 
)
static

◆ GetFlags()

uint8 Channel::GetFlags ( ) const
inline

Definition at line 185 of file Channel.h.

Referenced by JoinNotify(), LeaveNotify(), and List().

◆ GetGUID()

ObjectGuid Channel::GetGUID ( ) const
inline

Definition at line 169 of file Channel.h.

◆ GetName()

◆ GetNumPlayers()

uint32 Channel::GetNumPlayers ( ) const
inline

Definition at line 183 of file Channel.h.

Referenced by ChannelMgr::LeftChannel().

◆ GetPlayerFlags()

uint8 Channel::GetPlayerFlags ( ObjectGuid const &  guid) const
inlineprivate

Definition at line 239 of file Channel.h.

Referenced by JoinChannel(), and JoinNotify().

◆ GetZoneEntry()

AreaTableEntry const * Channel::GetZoneEntry ( ) const
inline

Definition at line 188 of file Channel.h.

Referenced by Player::CleanupChannels(), and Player::UpdateLocalChannels().

◆ HasFlag()

bool Channel::HasFlag ( uint8  flag) const
inline

Definition at line 186 of file Channel.h.

Referenced by JoinChannel(), and ChatLogScript::OnChat().

◆ Invite()

◆ IsAnnounce()

bool Channel::IsAnnounce ( ) const
inline

Definition at line 173 of file Channel.h.

◆ IsBanned()

bool Channel::IsBanned ( ObjectGuid  guid) const
inlineprivate

Definition at line 237 of file Channel.h.

Referenced by Invite(), JoinChannel(), KickOrBan(), and UnBan().

◆ IsConstant()

bool Channel::IsConstant ( ) const
inline

◆ IsLFG()

bool Channel::IsLFG ( ) const
inline

Definition at line 171 of file Channel.h.

References CHANNEL_FLAG_LFG.

◆ IsOn()

bool Channel::IsOn ( ObjectGuid  who) const
inlineprivate

◆ JoinChannel()

◆ JoinNotify()

void Channel::JoinNotify ( ObjectGuid const &  guid) const

◆ Kick()

void Channel::Kick ( Player const *  player,
std::string const &  badname 
)
inline

Definition at line 194 of file Channel.h.

◆ KickOrBan()

◆ LeaveChannel()

◆ LeaveNotify()

void Channel::LeaveNotify ( ObjectGuid const &  guid) const

◆ List()

◆ operator=() [1/2]

Channel & Channel::operator= ( Channel &&  )
delete

◆ operator=() [2/2]

Channel & Channel::operator= ( Channel const &  )
delete

◆ Password()

◆ Say()

◆ SendToAll()

template<class Builder >
void Channel::SendToAll ( Builder &  builder,
ObjectGuid const &  guid = ObjectGuid::Empty,
ObjectGuid const &  accountGuid = ObjectGuid::Empty 
) const
private

◆ SendToAllButOne()

template<class Builder >
void Channel::SendToAllButOne ( Builder &  builder,
ObjectGuid const &  who 
) const
private

Definition at line 981 of file Channel.cpp.

References _playersStore, and ObjectAccessor::FindConnectedPlayer().

Referenced by JoinNotify(), and LeaveNotify().

◆ SendToAllWithAddon()

template<class Builder >
void Channel::SendToAllWithAddon ( Builder &  builder,
std::string const &  addonPrefix,
ObjectGuid const &  guid = ObjectGuid::Empty,
ObjectGuid const &  accountGuid = ObjectGuid::Empty 
) const
private

Definition at line 1001 of file Channel.cpp.

References _playersStore, ObjectAccessor::FindConnectedPlayer(), and ObjectGuid::IsEmpty().

Referenced by AddonSay().

◆ SendToOne()

template<class Builder >
void Channel::SendToOne ( Builder &  builder,
ObjectGuid const &  who 
) const
private

◆ SendWhoOwner()

void Channel::SendWhoOwner ( Player const *  player)

Definition at line 605 of file Channel.cpp.

References _ownerGuid, BaseEntity::GetGUID(), IsOn(), and SendToOne().

◆ SetAnnounce()

void Channel::SetAnnounce ( bool  announce)
inline

Definition at line 174 of file Channel.h.

Referenced by ChannelMgr::LoadFromDB().

◆ SetDirty()

void Channel::SetDirty ( )
inline

Definition at line 177 of file Channel.h.

Referenced by ChannelMgr::CreateCustomChannel().

◆ SetInvisible()

void Channel::SetInvisible ( Player const *  player,
bool  on 
)

Definition at line 519 of file Channel.cpp.

References _isOwnerInvisible, _ownerGuid, _playersStore, and BaseEntity::GetGUID().

◆ SetMode()

◆ SetModerator() [1/2]

void Channel::SetModerator ( ObjectGuid const &  guid,
bool  set 
)
private

◆ SetModerator() [2/2]

void Channel::SetModerator ( Player const *  player,
std::string const &  newname 
)
inline

Definition at line 207 of file Channel.h.

Referenced by SetMode().

◆ SetMute() [1/2]

void Channel::SetMute ( ObjectGuid const &  guid,
bool  set 
)
private

◆ SetMute() [2/2]

void Channel::SetMute ( Player const *  player,
std::string const &  newname 
)
inline

Definition at line 209 of file Channel.h.

Referenced by SetMode().

◆ SetOwner() [1/2]

void Channel::SetOwner ( ObjectGuid const &  guid,
bool  exclaim = true 
)

◆ SetOwner() [2/2]

◆ SetOwnership()

void Channel::SetOwnership ( bool  ownership)
inline

◆ SetPassword()

void Channel::SetPassword ( std::string const &  password)
inline

Definition at line 180 of file Channel.h.

Referenced by ChannelMgr::LoadFromDB().

◆ SilenceAll()

void Channel::SilenceAll ( Player const *  player,
std::string const &  name 
)

Definition at line 896 of file Channel.cpp.

◆ UnBan()

◆ UnsetModerator()

void Channel::UnsetModerator ( Player const *  player,
std::string const &  newname 
)
inline

Definition at line 208 of file Channel.h.

◆ UnsetMute()

void Channel::UnsetMute ( Player const *  player,
std::string const &  newname 
)
inline

Definition at line 210 of file Channel.h.

◆ UnsilenceAll()

void Channel::UnsilenceAll ( Player const *  player,
std::string const &  name 
)

Definition at line 900 of file Channel.cpp.

◆ UpdateChannelInDB()

Member Data Documentation

◆ _announceEnabled

bool Channel::_announceEnabled
private

Definition at line 254 of file Channel.h.

Referenced by Announce(), JoinChannel(), LeaveChannel(), and UpdateChannelInDB().

◆ _bannedStore

BannedContainer Channel::_bannedStore
private

Definition at line 266 of file Channel.h.

Referenced by Channel(), KickOrBan(), UnBan(), and UpdateChannelInDB().

◆ _channelFlags

uint8 Channel::_channelFlags
private

Definition at line 258 of file Channel.h.

Referenced by Channel(), and JoinChannel().

◆ _channelGuid

ObjectGuid Channel::_channelGuid
private

Definition at line 261 of file Channel.h.

Referenced by AddonSay(), JoinChannel(), and Say().

◆ _channelId

uint32 Channel::_channelId
private

Definition at line 259 of file Channel.h.

Referenced by GetName(), JoinChannel(), and LeaveChannel().

◆ _channelName

std::string Channel::_channelName
private

Definition at line 263 of file Channel.h.

Referenced by GetName(), and UpdateChannelInDB().

◆ _channelPassword

std::string Channel::_channelPassword
private

Definition at line 264 of file Channel.h.

Referenced by Password(), and UpdateChannelInDB().

◆ _channelTeam

uint32 Channel::_channelTeam
private

Definition at line 260 of file Channel.h.

Referenced by UpdateChannelInDB().

◆ _isDirty

bool Channel::_isDirty
private

Definition at line 251 of file Channel.h.

Referenced by Announce(), KickOrBan(), Password(), SetOwner(), UnBan(), and UpdateChannelInDB().

◆ _isOwnerInvisible

bool Channel::_isOwnerInvisible
private

Definition at line 256 of file Channel.h.

Referenced by JoinChannel(), LeaveChannel(), and SetInvisible().

◆ _nextActivityUpdateTime

time_t Channel::_nextActivityUpdateTime
private

Definition at line 252 of file Channel.h.

Referenced by JoinChannel(), and UpdateChannelInDB().

◆ _ownerGuid

ObjectGuid Channel::_ownerGuid
private

Definition at line 262 of file Channel.h.

Referenced by JoinChannel(), KickOrBan(), SendWhoOwner(), SetInvisible(), SetMode(), SetOwner(), and SetOwner().

◆ _ownershipEnabled

bool Channel::_ownershipEnabled
private

Definition at line 255 of file Channel.h.

Referenced by JoinChannel(), KickOrBan(), LeaveChannel(), and UpdateChannelInDB().

◆ _playersStore

◆ _zoneEntry

AreaTableEntry const* Channel::_zoneEntry
private

Definition at line 268 of file Channel.h.

Referenced by GetName().


The documentation for this class was generated from the following files: