feat(Core/Battlegrounds): Add PvP announce opt-out flags (#25957)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Andrew
2026-05-24 18:32:20 -03:00
committed by GitHub
parent 921caed718
commit 110cb0874d
3 changed files with 24 additions and 3 deletions
@@ -675,7 +675,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
// Announce BG starting
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE))
ChatHandler(nullptr).SendWorldText(LANG_BG_STARTED_ANNOUNCE_WORLD, GetName(), std::min(GetMinLevel(), (uint32)80), std::min(GetMaxLevel(), (uint32)80));
ChatHandler(nullptr).SendWorldTextOptional(LANG_BG_STARTED_ANNOUNCE_WORLD, ANNOUNCER_FLAG_DISABLE_PVP_START, GetName(), std::min(GetMinLevel(), (uint32)80), std::min(GetMaxLevel(), (uint32)80));
sScriptMgr->OnBattlegroundStart(this);
}
@@ -33,7 +33,11 @@ enum AnnouncerFlags : uint8
{
ANNOUNCER_FLAG_DISABLE_BG_QUEUE = 1,
ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE = 2,
ANNOUNCER_FLAG_DISABLE_AUTOBROADCAST = 4
ANNOUNCER_FLAG_DISABLE_AUTOBROADCAST = 4,
ANNOUNCER_FLAG_DISABLE_PVP_START = 8,
ANNOUNCER_FLAG_DISABLE_PVP_ALL = ANNOUNCER_FLAG_DISABLE_BG_QUEUE
| ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE
| ANNOUNCER_FLAG_DISABLE_PVP_START
};
struct PlayerSetting
@@ -48,15 +48,31 @@ public:
PlayerSetting setting;
setting = player->GetPlayerSetting(AzerothcorePSSource, SETTING_ANNOUNCER_FLAGS);
char const* label = nullptr;
if (type == "bg")
{
on ? setting.RemoveFlag(ANNOUNCER_FLAG_DISABLE_BG_QUEUE) : setting.AddFlag(ANNOUNCER_FLAG_DISABLE_BG_QUEUE);
player->UpdatePlayerSetting(AzerothcorePSSource, SETTING_ANNOUNCER_FLAGS, setting.value);
label = "battleground queue";
}
else if (type == "arena")
{
on ? setting.RemoveFlag(ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE) : setting.AddFlag(ANNOUNCER_FLAG_DISABLE_ARENA_QUEUE);
player->UpdatePlayerSetting(AzerothcorePSSource, SETTING_ANNOUNCER_FLAGS, setting.value);
label = "arena queue";
}
else if (type == "pvpstart")
{
on ? setting.RemoveFlag(ANNOUNCER_FLAG_DISABLE_PVP_START) : setting.AddFlag(ANNOUNCER_FLAG_DISABLE_PVP_START);
player->UpdatePlayerSetting(AzerothcorePSSource, SETTING_ANNOUNCER_FLAGS, setting.value);
label = "PvP start";
}
else if (type == "pvpall")
{
on ? setting.RemoveFlag(ANNOUNCER_FLAG_DISABLE_PVP_ALL) : setting.AddFlag(ANNOUNCER_FLAG_DISABLE_PVP_ALL);
player->UpdatePlayerSetting(AzerothcorePSSource, SETTING_ANNOUNCER_FLAGS, setting.value);
label = "PvP";
}
else if (type == "autobroadcast")
{
@@ -68,10 +84,11 @@ public:
on ? setting.RemoveFlag(ANNOUNCER_FLAG_DISABLE_AUTOBROADCAST) : setting.AddFlag(ANNOUNCER_FLAG_DISABLE_AUTOBROADCAST);
player->UpdatePlayerSetting(AzerothcorePSSource, SETTING_ANNOUNCER_FLAGS, setting.value);
label = "autobroadcast";
}
handler->SetSentErrorMessage(false);
handler->PSendSysMessage(on ? LANG_CMD_SETTINGS_ANNOUNCER_ON : LANG_CMD_SETTINGS_ANNOUNCER_OFF, type);
handler->PSendSysMessage(on ? LANG_CMD_SETTINGS_ANNOUNCER_ON : LANG_CMD_SETTINGS_ANNOUNCER_OFF, label ? label : type.c_str());
return true;
}
};