Misc fixes
This commit is contained in:
@@ -73,13 +73,8 @@ namespace Game.BattleGrounds
|
|||||||
List<ScheduledQueueUpdate> scheduled = new();
|
List<ScheduledQueueUpdate> scheduled = new();
|
||||||
Extensions.Swap(ref scheduled, ref m_QueueUpdateScheduler);
|
Extensions.Swap(ref scheduled, ref m_QueueUpdateScheduler);
|
||||||
|
|
||||||
for (byte i = 0; i < scheduled.Count; i++)
|
foreach (var scheduledQueueUpdate in scheduled)
|
||||||
{
|
GetBattlegroundQueue(scheduledQueueUpdate.QueueId).BattlegroundQueueUpdate(diff, scheduledQueueUpdate.BracketId, scheduledQueueUpdate.ArenaMatchmakerRating);
|
||||||
uint arenaMMRating = scheduled[i].ArenaMatchmakerRating;
|
|
||||||
BattlegroundQueueTypeId bgQueueTypeId = scheduled[i].QueueId;
|
|
||||||
BattlegroundBracketId bracket_id = scheduled[i].BracketId;
|
|
||||||
GetBattlegroundQueue(bgQueueTypeId).BattlegroundQueueUpdate(diff, bracket_id, arenaMMRating);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if rating difference counts, maybe force-update queues
|
// if rating difference counts, maybe force-update queues
|
||||||
@@ -645,18 +640,15 @@ namespace Game.BattleGrounds
|
|||||||
BattlegroundTemplate bgTemplate = GetBattlegroundTemplateByTypeId(bgTypeId);
|
BattlegroundTemplate bgTemplate = GetBattlegroundTemplateByTypeId(bgTypeId);
|
||||||
if (bgTemplate != null)
|
if (bgTemplate != null)
|
||||||
{
|
{
|
||||||
Dictionary<BattlegroundTypeId, float> selectionWeights = new();
|
List<BattlegroundTemplate> ids = new();
|
||||||
|
|
||||||
foreach (var mapId in bgTemplate.MapIDs)
|
foreach (var mapId in bgTemplate.MapIDs)
|
||||||
{
|
{
|
||||||
BattlegroundTemplate bg = GetBattlegroundTemplateByMapId((uint)mapId);
|
BattlegroundTemplate bg = GetBattlegroundTemplateByMapId((uint)mapId);
|
||||||
if (bg != null)
|
if (bg != null)
|
||||||
{
|
ids.Add(bg);
|
||||||
selectionWeights.Add(bg.Id, bg.Weight);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return selectionWeights.SelectRandomElementByWeight(i => i.Value).Key;
|
return ids.SelectRandomElementByWeight(i => i.Weight).Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
return BattlegroundTypeId.None;
|
return BattlegroundTypeId.None;
|
||||||
|
|||||||
@@ -1166,7 +1166,8 @@ namespace Game.Groups
|
|||||||
|
|
||||||
public GroupJoinBattlegroundResult CanJoinBattlegroundQueue(BattlegroundTemplate bgOrTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint MinPlayerCount, uint MaxPlayerCount, bool isRated, uint arenaSlot, out ObjectGuid errorGuid)
|
public GroupJoinBattlegroundResult CanJoinBattlegroundQueue(BattlegroundTemplate bgOrTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint MinPlayerCount, uint MaxPlayerCount, bool isRated, uint arenaSlot, out ObjectGuid errorGuid)
|
||||||
{
|
{
|
||||||
errorGuid = new ObjectGuid();
|
errorGuid = ObjectGuid.Empty;
|
||||||
|
|
||||||
// check if this group is LFG group
|
// check if this group is LFG group
|
||||||
if (IsLFGGroup())
|
if (IsLFGGroup())
|
||||||
return GroupJoinBattlegroundResult.LfgCantUseBattleground;
|
return GroupJoinBattlegroundResult.LfgCantUseBattleground;
|
||||||
@@ -1203,15 +1204,13 @@ namespace Game.Groups
|
|||||||
// offline member? don't let join
|
// offline member? don't let join
|
||||||
if (member == null)
|
if (member == null)
|
||||||
return GroupJoinBattlegroundResult.BattlegroundJoinFailed;
|
return GroupJoinBattlegroundResult.BattlegroundJoinFailed;
|
||||||
|
errorGuid = member.GetGUID();
|
||||||
// rbac permissions
|
// rbac permissions
|
||||||
if (!member.CanJoinToBattleground(bgOrTemplate))
|
if (!member.CanJoinToBattleground(bgOrTemplate))
|
||||||
return GroupJoinBattlegroundResult.JoinTimedOut;
|
return GroupJoinBattlegroundResult.JoinTimedOut;
|
||||||
// don't allow cross-faction join as group
|
// don't allow cross-faction join as group
|
||||||
if (member.GetTeam() != team)
|
if (member.GetTeam() != team)
|
||||||
{
|
|
||||||
errorGuid = member.GetGUID();
|
|
||||||
return GroupJoinBattlegroundResult.JoinTimedOut;
|
return GroupJoinBattlegroundResult.JoinTimedOut;
|
||||||
}
|
|
||||||
// not in the same Battleground level braket, don't let join
|
// not in the same Battleground level braket, don't let join
|
||||||
PvpDifficultyRecord memberBracketEntry = Global.DB2Mgr.GetBattlegroundBracketByLevel(bracketEntry.MapID, member.GetLevel());
|
PvpDifficultyRecord memberBracketEntry = Global.DB2Mgr.GetBattlegroundBracketByLevel(bracketEntry.MapID, member.GetLevel());
|
||||||
if (memberBracketEntry != bracketEntry)
|
if (memberBracketEntry != bracketEntry)
|
||||||
@@ -1246,6 +1245,8 @@ namespace Game.Groups
|
|||||||
return GroupJoinBattlegroundResult.BattlegroundJoinMercenary;
|
return GroupJoinBattlegroundResult.BattlegroundJoinMercenary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
errorGuid = ObjectGuid.Empty;
|
||||||
|
|
||||||
// only check for MinPlayerCount since MinPlayerCount == MaxPlayerCount for arenas...
|
// only check for MinPlayerCount since MinPlayerCount == MaxPlayerCount for arenas...
|
||||||
if (bgOrTemplate.IsArena() && memberscount != MinPlayerCount)
|
if (bgOrTemplate.IsArena() && memberscount != MinPlayerCount)
|
||||||
return GroupJoinBattlegroundResult.ArenaTeamPartySize;
|
return GroupJoinBattlegroundResult.ArenaTeamPartySize;
|
||||||
|
|||||||
@@ -459,7 +459,7 @@ namespace Game
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
BattlefieldStatusNeedConfirmation battlefieldStatus;
|
BattlefieldStatusNeedConfirmation battlefieldStatus;
|
||||||
Global.BattlegroundMgr.BuildBattlegroundStatusNeedConfirmation(out battlefieldStatus, bg, GetPlayer(), i, GetPlayer().GetBattlegroundQueueJoinTime(bgQueueTypeId), Time.GetMSTimeDiff(Time.GetMSTime(), ginfo.RemoveInviteTime), bgQueueTypeId);
|
Global.BattlegroundMgr.BuildBattlegroundStatusNeedConfirmation(out battlefieldStatus, bg, GetPlayer(), i, GetPlayer().GetBattlegroundQueueJoinTime(bgQueueTypeId), Time.GetMSTimeDiff(GameTime.GetGameTimeMS(), ginfo.RemoveInviteTime), bgQueueTypeId);
|
||||||
SendPacket(battlefieldStatus);
|
SendPacket(battlefieldStatus);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user