Core: Improve constant channel handling
- Implement area restrictions - Disable constant channels in arenas - Implement city requirement - Implement global constant channels - Fix some packets --HG-- branch : trunk
This commit is contained in:
@@ -26,10 +26,8 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
|
||||
: m_announce(true), m_moderate(false), m_name(name), m_password(""), m_flags(0), m_channelId(channel_id), m_ownerGUID(0), m_Team(Team)
|
||||
{
|
||||
// set special flags if built-in channel
|
||||
ChatChannelsEntry const* ch = GetChannelEntryFor(channel_id);
|
||||
if (ch) // it's built-in channel
|
||||
if (ChatChannelsEntry const* ch = sChatChannelsStore.LookupEntry(channel_id)) // check whether it's a 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
|
||||
@@ -48,6 +46,7 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
|
||||
}
|
||||
else // it's custom channel
|
||||
{
|
||||
channel_id = 0;
|
||||
m_flags |= CHANNEL_FLAG_CUSTOM;
|
||||
//load not built in channel if saved
|
||||
std::string _name(name);
|
||||
@@ -852,7 +851,7 @@ void Channel::MakeYouLeft(WorldPacket *data)
|
||||
{
|
||||
MakeNotifyPacket(data, CHAT_YOU_LEFT_NOTICE);
|
||||
*data << uint32(GetChannelId());
|
||||
*data << uint8(0); // can be 0x00 and 0x01
|
||||
*data << uint8(IsConstant());
|
||||
}
|
||||
|
||||
// done 0x04
|
||||
@@ -1090,7 +1089,11 @@ void Channel::JoinNotify(uint64 guid)
|
||||
data << uint8(GetFlags());
|
||||
data << uint32(GetNumPlayers());
|
||||
data << GetName();
|
||||
SendToAll(&data);
|
||||
|
||||
if (IsConstant())
|
||||
SendToAllButOne(&data, guid);
|
||||
else
|
||||
SendToAll(&data);
|
||||
}
|
||||
|
||||
void Channel::LeaveNotify(uint64 guid)
|
||||
@@ -1100,6 +1103,10 @@ void Channel::LeaveNotify(uint64 guid)
|
||||
data << uint8(GetFlags());
|
||||
data << uint32(GetNumPlayers());
|
||||
data << GetName();
|
||||
SendToAll(&data);
|
||||
|
||||
if (IsConstant())
|
||||
SendToAllButOne(&data, guid);
|
||||
else
|
||||
SendToAll(&data);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user