Call match from MatchQueueStatus
This commit is contained in:
parent
fb56fe7e50
commit
75c78bec4c
9 changed files with 14 additions and 34 deletions
|
|
@ -461,7 +461,7 @@ namespace MHServerEmu.Core.Network
|
|||
/// <summary>
|
||||
/// [Game -> PlayerManager] Relays a match region request command from a client.
|
||||
/// </summary>
|
||||
public readonly struct MatchRegionRequestQueueCommand(ulong playerDbId, ulong regionProtoId, ulong difficultyTierProtoId, ulong metaStateProtoId, RegionRequestQueueCommandVar command, ulong regionRequestGroupId, ulong targetPlayerDbId)
|
||||
public readonly struct MatchRegionRequestQueueCommand(ulong playerDbId, ulong regionProtoId, ulong difficultyTierProtoId, ulong metaStateProtoId, RegionRequestQueueCommandVar command, ulong regionRequestGroupId, ulong targetPlayerDbId, int teamSizeOverride)
|
||||
: IGameServiceMessage
|
||||
{
|
||||
public readonly ulong PlayerDbId = playerDbId;
|
||||
|
|
@ -471,6 +471,7 @@ namespace MHServerEmu.Core.Network
|
|||
public readonly RegionRequestQueueCommandVar Command = command;
|
||||
public readonly ulong RegionRequestGroupId = regionRequestGroupId;
|
||||
public readonly ulong TargetPlayerDbId = targetPlayerDbId;
|
||||
public readonly int TeamSizeOverride = teamSizeOverride;
|
||||
}
|
||||
|
||||
// MatchQueueUpdate is based on PlayerMgrToGameServer.proto from 1.53
|
||||
|
|
|
|||
|
|
@ -2872,7 +2872,7 @@ namespace MHServerEmu.Games.Entities
|
|||
}
|
||||
|
||||
public bool SendRegionRequestQueueCommandToPlayerManager(PrototypeId regionRef, PrototypeId difficultyTierRef,
|
||||
RegionRequestQueueCommandVar command, ulong groupId = 0, ulong targetPlayerDbId = 0)
|
||||
RegionRequestQueueCommandVar command, ulong groupId = 0, ulong targetPlayerDbId = 0, int teamSizeOverride = -1)
|
||||
{
|
||||
ulong playerDbId = DatabaseUniqueId;
|
||||
ulong regionProtoId = (ulong)regionRef;
|
||||
|
|
@ -2904,7 +2904,7 @@ namespace MHServerEmu.Games.Entities
|
|||
break;
|
||||
}
|
||||
|
||||
ServiceMessage.MatchRegionRequestQueueCommand message = new(playerDbId, regionProtoId, difficultyTierProtoId, metaStateProtoId, command, groupId, targetPlayerDbId);
|
||||
ServiceMessage.MatchRegionRequestQueueCommand message = new(playerDbId, regionProtoId, difficultyTierProtoId, metaStateProtoId, command, groupId, targetPlayerDbId, teamSizeOverride);
|
||||
ServerManager.Instance.SendMessageToService(GameServiceType.PlayerManager, message);
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ namespace MHServerEmu.Games.Regions.MatchQueues
|
|||
/// Handles a <see cref="RegionRequestQueueCommandVar"/> request from a client.
|
||||
/// </summary>
|
||||
public bool TryRegionRequestCommand(PrototypeId regionRef, PrototypeId difficultyTierRef,
|
||||
ulong groupId, RegionRequestQueueCommandVar command)
|
||||
ulong groupId, RegionRequestQueueCommandVar command, int teamSizeOverride = -1)
|
||||
{
|
||||
if (regionRef == PrototypeId.Invalid) return Logger.WarnReturn(false, "TryRegionRequestCommand(): regionRef == PrototypeId.Invalid");
|
||||
|
||||
|
|
@ -272,7 +272,7 @@ namespace MHServerEmu.Games.Regions.MatchQueues
|
|||
if (command == RegionRequestQueueCommandVar.eRRQC_AddToQueueBypass && regionProto.AllowsQueueBypass == false)
|
||||
return false;
|
||||
|
||||
_owner.SendRegionRequestQueueCommandToPlayerManager(regionRef, difficultyTierRef, command, groupId);
|
||||
_owner.SendRegionRequestQueueCommandToPlayerManager(regionRef, difficultyTierRef, command, groupId, 0, teamSizeOverride);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,16 +28,12 @@ namespace MHServerEmu.PlayerManagement.Matchmaking
|
|||
|
||||
int[] teamLimits = Queue.Prototype.TeamLimits;
|
||||
|
||||
if (queueParams.TeamSizeOverride > 0)
|
||||
{
|
||||
_teams.Add(new MatchTeam(0, queueParams.TeamSizeOverride));
|
||||
_teams.Add(new MatchTeam(1, queueParams.TeamSizeOverride));
|
||||
}
|
||||
else if (teamLimits.HasValue())
|
||||
if (teamLimits.HasValue())
|
||||
{
|
||||
for (int i = 0; i < teamLimits.Length; i++)
|
||||
{
|
||||
MatchTeam team = new(i, teamLimits[i]);
|
||||
int teamLimit = (queueParams.TeamSizeOverride > 0) ? queueParams.TeamSizeOverride : teamLimits[i];
|
||||
MatchTeam team = new(i, teamLimit);
|
||||
_teams.Add(team);
|
||||
}
|
||||
}
|
||||
|
|
@ -103,11 +99,6 @@ namespace MHServerEmu.PlayerManagement.Matchmaking
|
|||
return true;
|
||||
}
|
||||
|
||||
public bool IsCompatibleWith(in RegionRequestQueueParams queueParams)
|
||||
{
|
||||
return QueueParams.TeamSizeOverride == queueParams.TeamSizeOverride;
|
||||
}
|
||||
|
||||
public bool IsReady()
|
||||
{
|
||||
if (IsFull() == false && IsBypass == false && Queue.Prototype.QueueDoNotWaitToFull == false)
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ namespace MHServerEmu.PlayerManagement.Matchmaking
|
|||
|
||||
foreach (Match match in _matches)
|
||||
{
|
||||
if (match.IsLookingForMore() && match.IsCompatibleWith(queueParams))
|
||||
if (match.IsLookingForMore())
|
||||
lfmMatches.Add(match);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -429,9 +429,10 @@ namespace MHServerEmu.PlayerManagement.Network
|
|||
RegionRequestQueueCommandVar command = matchRegionRequestQueueCommand.Command;
|
||||
ulong regionRequestGroupId = matchRegionRequestQueueCommand.RegionRequestGroupId;
|
||||
ulong targetPlayerDbId = matchRegionRequestQueueCommand.TargetPlayerDbId;
|
||||
int teamSizeOverride = matchRegionRequestQueueCommand.TeamSizeOverride;
|
||||
|
||||
PlayerHandle player = _playerManager.ClientManager.GetPlayer(playerDbId);
|
||||
player?.ReceiveRegionRequestQueueCommand(regionRef, difficultyTierRef, metaStateRef, command, regionRequestGroupId, targetPlayerDbId);
|
||||
player?.ReceiveRegionRequestQueueCommand(regionRef, difficultyTierRef, metaStateRef, command, regionRequestGroupId, targetPlayerDbId, teamSizeOverride);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -147,11 +147,6 @@ namespace MHServerEmu.PlayerManagement
|
|||
statusDict["PlayerManagerPendingSessions"] = SessionManager.PendingSessionCount;
|
||||
}
|
||||
|
||||
public PlayerHandle GetPlayer(ulong playerDbId)
|
||||
{
|
||||
return ClientManager.GetPlayer(playerDbId);
|
||||
}
|
||||
|
||||
private void OnRouteMessageBuffer(in ServiceMessage.RouteMessageBuffer routeMessageBuffer)
|
||||
{
|
||||
IFrontendClient client = routeMessageBuffer.Client;
|
||||
|
|
|
|||
|
|
@ -814,7 +814,7 @@ namespace MHServerEmu.PlayerManagement.Players
|
|||
}
|
||||
|
||||
public void ReceiveRegionRequestQueueCommand(PrototypeId regionRef, PrototypeId difficultyTierRef, PrototypeId metaStateRef,
|
||||
RegionRequestQueueCommandVar command, ulong regionRequestGroupId, ulong targetPlayerDbId, int teamSizeOverride = -1)
|
||||
RegionRequestQueueCommandVar command, ulong regionRequestGroupId, ulong targetPlayerDbId, int teamSizeOverride)
|
||||
{
|
||||
_regionRequestQueueCommandHandler.HandleCommand(regionRef, difficultyTierRef, metaStateRef, command, regionRequestGroupId, targetPlayerDbId, teamSizeOverride);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@ using MHServerEmu.Core.Network;
|
|||
using MHServerEmu.DatabaseAccess.Models;
|
||||
using MHServerEmu.Games.GameData;
|
||||
using MHServerEmu.Games.Network;
|
||||
using MHServerEmu.PlayerManagement;
|
||||
using MHServerEmu.PlayerManagement.Players;
|
||||
|
||||
namespace MHServerEmu.Commands.Implementations
|
||||
{
|
||||
|
|
@ -32,13 +30,7 @@ namespace MHServerEmu.Commands.Implementations
|
|||
: RegionRequestQueueCommandVar.eRRQC_AddToQueueSolo;
|
||||
|
||||
int limit = (size == 5) ? -1 : size;
|
||||
|
||||
var playerManager = ServerManager.Instance.GetGameService(GameServiceType.PlayerManager) as PlayerManagerService;
|
||||
if (playerManager == null) return "Failed to connect to the player manager.";
|
||||
|
||||
PlayerHandle destPlayer = playerManager.GetPlayer(playerConnection.PlayerDbId);
|
||||
destPlayer.ReceiveRegionRequestQueueCommand(RegionRef, DifficultyRef, PrototypeId.Invalid, command, 0, 0, limit);
|
||||
|
||||
player.MatchQueueStatus.TryRegionRequestCommand(RegionRef, DifficultyRef, 0, command, limit);
|
||||
return $"Queued for {size}v{size} PvP! ({(isInParty ? "Party" : "Solo")})";
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue