Core/Events: refactored battleground holiday assignments. Instead of going with shitty bitmasks we now accept plain battleground ids instead

Port From (https://github.com/TrinityCore/TrinityCore/commit/7a5529eb58daad9216416c9c632543b1a931ce1f)
This commit is contained in:
hondacrx
2022-02-27 23:44:42 -05:00
parent bb094c585b
commit cb58698045
2 changed files with 24 additions and 19 deletions
@@ -501,17 +501,23 @@ namespace Game.BattleGrounds
Global.WorldMgr.SendWorldText(m_ArenaTesting ? CypherStrings.DebugArenaOn : CypherStrings.DebugArenaOff);
}
public void SetHolidayWeekends(uint mask)
public void ResetHolidays()
{
// The current code supports battlegrounds up to BattlegroundTypeId(31)
for (var bgtype = 1; bgtype < (int)BattlegroundTypeId.Max && bgtype < 32; ++bgtype)
for (var i = BattlegroundTypeId.AV; i < BattlegroundTypeId.Max; i++)
{
Battleground bg = GetBattlegroundTemplate((BattlegroundTypeId)bgtype);
if (bg)
bg.SetHoliday(Convert.ToBoolean(mask & (1 << bgtype)));
Battleground bg = GetBattlegroundTemplate(i);
if (bg != null)
bg.SetHoliday(false);
}
}
public void SetHolidayActive(uint battlegroundId)
{
Battleground bg = GetBattlegroundTemplate((BattlegroundTypeId)battlegroundId);
if (bg != null)
bg.SetHoliday(true);
}
public bool IsValidQueueId(BattlegroundQueueTypeId bgQueueTypeId)
{
BattlemasterListRecord battlemasterList = CliDB.BattlemasterListStorage.LookupByKey(bgQueueTypeId.BattlemasterListId);