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