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:
@@ -2317,11 +2317,11 @@ namespace Game.Entities
|
||||
{
|
||||
case 179785: // Silverwing Flag
|
||||
case 179786: // Warsong Flag
|
||||
if (bg.GetTypeID(true) == BattlegroundTypeId.WS)
|
||||
if (bg.GetTypeID() == BattlegroundTypeId.WS)
|
||||
bg.EventPlayerClickedOnFlag(player, this);
|
||||
break;
|
||||
case 184142: // Netherstorm Flag
|
||||
if (bg.GetTypeID(true) == BattlegroundTypeId.EY)
|
||||
if (bg.GetTypeID() == BattlegroundTypeId.EY)
|
||||
bg.EventPlayerClickedOnFlag(player, this);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1606,14 +1606,15 @@ namespace Game.Entities
|
||||
return;
|
||||
|
||||
// Expecting only one row
|
||||
// 0 1 2 3 4 5 6 7 8 9
|
||||
// SELECT instanceId, team, joinX, joinY, joinZ, joinO, joinMapId, taxiStart, taxiEnd, mountSpell FROM character_Battleground_data WHERE guid = ?
|
||||
// 0 1 2 3 4 5 6 7 8 9 10
|
||||
// SELECT instanceId, team, joinX, joinY, joinZ, joinO, joinMapId, taxiStart, taxiEnd, mountSpell, queueTypeId FROM character_Battleground_data WHERE guid = ?
|
||||
m_bgData.bgInstanceID = result.Read<uint>(0);
|
||||
m_bgData.bgTeam = result.Read<ushort>(1);
|
||||
m_bgData.joinPos = new WorldLocation(result.Read<ushort>(6), result.Read<float>(2), result.Read<float>(3), result.Read<float>(4), result.Read<float>(5));
|
||||
m_bgData.taxiPath[0] = result.Read<uint>(7);
|
||||
m_bgData.taxiPath[1] = result.Read<uint>(8);
|
||||
m_bgData.mountSpell = result.Read<uint>(9);
|
||||
m_bgData.queueId = BattlegroundQueueTypeId.FromPacked(result.Read<ulong>(10));
|
||||
}
|
||||
void _LoadPetStable(uint summonedPetNumber, SQLResult result)
|
||||
{
|
||||
@@ -2776,6 +2777,7 @@ namespace Game.Entities
|
||||
stmt.AddValue(8, m_bgData.taxiPath[0]);
|
||||
stmt.AddValue(9, m_bgData.taxiPath[1]);
|
||||
stmt.AddValue(10, m_bgData.mountSpell);
|
||||
stmt.AddValue(11, m_bgData.queueId.GetPacked());
|
||||
trans.Append(stmt);
|
||||
}
|
||||
|
||||
@@ -3031,16 +3033,18 @@ namespace Game.Entities
|
||||
{
|
||||
map = currentBg.GetBgMap();
|
||||
|
||||
BattlegroundQueueTypeId bgQueueTypeId = currentBg.GetQueueId();
|
||||
AddBattlegroundQueueId(bgQueueTypeId);
|
||||
BattlegroundPlayer bgPlayer = currentBg.GetBattlegroundPlayerData(GetGUID());
|
||||
if (bgPlayer != null)
|
||||
{
|
||||
AddBattlegroundQueueId(bgPlayer.queueTypeId);
|
||||
m_bgData.bgTypeID = (BattlegroundTypeId)bgPlayer.queueTypeId.BattlemasterListId;
|
||||
|
||||
m_bgData.bgTypeID = currentBg.GetTypeID();
|
||||
//join player to Battlegroundgroup
|
||||
currentBg.EventPlayerLoggedIn(this);
|
||||
|
||||
//join player to Battlegroundgroup
|
||||
currentBg.EventPlayerLoggedIn(this);
|
||||
|
||||
SetInviteForBattlegroundQueueType(bgQueueTypeId, currentBg.GetInstanceID());
|
||||
SetMercenaryForBattlegroundQueueType(bgQueueTypeId, currentBg.IsPlayerMercenaryInBattleground(GetGUID()));
|
||||
SetInviteForBattlegroundQueueType(bgPlayer.queueTypeId, currentBg.GetInstanceID());
|
||||
SetMercenaryForBattlegroundQueueType(bgPlayer.queueTypeId, currentBg.IsPlayerMercenaryInBattleground(GetGUID()));
|
||||
}
|
||||
}
|
||||
// Bg was not found - go to Entry Point
|
||||
else
|
||||
@@ -3256,7 +3260,7 @@ namespace Game.Entities
|
||||
m_InstanceValid = false;
|
||||
|
||||
if (player_at_bg)
|
||||
map.ToBattlegroundMap().GetBG().AddPlayer(this);
|
||||
map.ToBattlegroundMap().GetBG().AddPlayer(this, m_bgData.queueId);
|
||||
|
||||
// randomize first save time in range [CONFIG_INTERVAL_SAVE] around [CONFIG_INTERVAL_SAVE]
|
||||
// this must help in case next save after mass player load after server startup
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Game.Entities
|
||||
|
||||
//PVP
|
||||
BgBattlegroundQueueID_Rec[] m_bgBattlegroundQueueID = new BgBattlegroundQueueID_Rec[SharedConst.MaxPlayerBGQueues];
|
||||
BGData m_bgData;
|
||||
public BGData m_bgData;
|
||||
bool m_IsBGRandomWinner;
|
||||
public PvPInfo pvpInfo;
|
||||
uint m_ArenaTeamIdInvited;
|
||||
@@ -583,6 +583,7 @@ namespace Game.Entities
|
||||
public uint[] taxiPath = new uint[2];
|
||||
|
||||
public WorldLocation joinPos; //< From where player entered BG
|
||||
public BattlegroundQueueTypeId queueId;
|
||||
|
||||
public void ClearTaxiPath() { taxiPath[0] = taxiPath[1] = 0; }
|
||||
public bool HasTaxiPath() { return taxiPath[0] != 0 && taxiPath[1] != 0; }
|
||||
|
||||
@@ -6174,7 +6174,7 @@ namespace Game.Entities
|
||||
Battleground bg = GetBattleground();
|
||||
if (bg != null)
|
||||
{
|
||||
if (bg.GetTypeID(true) == BattlegroundTypeId.AV)
|
||||
if (bg.GetTypeID() == BattlegroundTypeId.AV)
|
||||
bones.loot.FillLoot(1, LootStorage.Creature, this, true);
|
||||
}
|
||||
// For wintergrasp Quests
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user