mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-24 14:16:31 +00:00
feat(Core/Opcodes): Implement CMSG_CHANNEL_MODERATE (#4021)
* Core/Opcodes: Implement CMSG_CHANNEL_MODERATE * Cleanup, prettify * fix build * whitespaces
This commit is contained in:
@@ -1258,3 +1258,54 @@ void Channel::RemoveWatching(Player* p)
|
||||
if (itr != playersWatchingStore.end())
|
||||
playersWatchingStore.erase(itr);
|
||||
}
|
||||
|
||||
void Channel::ToggleModeration(Player* player)
|
||||
{
|
||||
uint64 guid = player->GetGUIDLow();
|
||||
|
||||
if (!IsOn(guid))
|
||||
{
|
||||
WorldPacket data;
|
||||
MakeNotMember(&data);
|
||||
SendToOne(&data, guid);
|
||||
return;
|
||||
}
|
||||
|
||||
const uint32 level = sWorld->getIntConfig(CONFIG_GM_LEVEL_CHANNEL_MODERATION);
|
||||
const bool gm = (level && player->GetSession()->GetSecurity() >= level);
|
||||
|
||||
if (!playersStore[guid].IsModerator() && !gm)
|
||||
{
|
||||
WorldPacket data;
|
||||
MakeNotModerator(&data);
|
||||
SendToOne(&data, guid);
|
||||
return;
|
||||
}
|
||||
|
||||
// toggle channel moderation
|
||||
_moderation = !_moderation;
|
||||
|
||||
WorldPacket data;
|
||||
if (_moderation)
|
||||
{
|
||||
MakeModerationOn(&data, guid);
|
||||
}
|
||||
else
|
||||
{
|
||||
MakeModerationOff(&data, guid);
|
||||
}
|
||||
|
||||
SendToAll(&data);
|
||||
}
|
||||
|
||||
void Channel::MakeModerationOn(WorldPacket* data, uint64 guid)
|
||||
{
|
||||
MakeNotifyPacket(data, CHAT_MODERATION_ON_NOTICE);
|
||||
*data << uint64(guid);
|
||||
}
|
||||
|
||||
void Channel::MakeModerationOff(WorldPacket* data, uint64 guid)
|
||||
{
|
||||
MakeNotifyPacket(data, CHAT_MODERATION_OFF_NOTICE);
|
||||
*data << uint64(guid);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user