Core/Battlegrounds: Rework queues

* No more copies of Battleground classes
* FreesSlotQueues now have as key the MapId instead of queue id
* Random queues can now popup already busy specific battelgrounds (queues are NOT merged)
* Removed Holiday handling, this should already be handled in BattlegroundMgr::IsBGWeekend
Port From (https://github.com/TrinityCore/TrinityCore/commit/0ede6c155605da602b3bafaa3a1212d9f924759b)
This commit is contained in:
hondacrx
2023-09-14 06:16:30 -04:00
parent bad3e89ee6
commit 4134796f1b
35 changed files with 364 additions and 418 deletions
+6 -5
View File
@@ -418,10 +418,11 @@ namespace Game.Entities
return GetBattlegroundQueueIndex(bgQueueTypeId) < SharedConst.MaxPlayerBGQueues;
}
public void SetBattlegroundId(uint val, BattlegroundTypeId bgTypeId)
public void SetBattlegroundId(uint val, BattlegroundTypeId bgTypeId, BattlegroundQueueTypeId queueId = default)
{
m_bgData.bgInstanceID = val;
m_bgData.bgTypeID = bgTypeId;
m_bgData.queueId = queueId;
}
public uint AddBattlegroundQueueId(BattlegroundQueueTypeId val)
@@ -615,12 +616,12 @@ namespace Game.Entities
public bool IsDeserter() { return HasAura(26013); }
public bool CanJoinToBattleground(Battleground bg)
public bool CanJoinToBattleground(BattlegroundTemplate bg)
{
RBACPermissions perm = RBACPermissions.JoinNormalBg;
if (bg.IsArena())
perm = RBACPermissions.JoinArenas;
else if (bg.IsRandom())
else if (Global.BattlegroundMgr.IsRandomBattleground(bg.Id))
perm = RBACPermissions.JoinRandomBg;
return GetSession().HasPermission(perm);
@@ -687,8 +688,8 @@ namespace Game.Entities
public bool GetBGAccessByLevel(BattlegroundTypeId bgTypeId)
{
// get a template bg instead of running one
Battleground bg = Global.BattlegroundMgr.GetBattlegroundTemplate(bgTypeId);
if (!bg)
BattlegroundTemplate bg = Global.BattlegroundMgr.GetBattlegroundTemplateByTypeId(bgTypeId);
if (bg == null)
return false;
// limit check leel to dbc compatible level range