diff --git a/ZkLobbyServer/ServerBattle.cs b/ZkLobbyServer/ServerBattle.cs index 69b6e4734..d64ae2b00 100644 --- a/ZkLobbyServer/ServerBattle.cs +++ b/ZkLobbyServer/ServerBattle.cs @@ -55,6 +55,7 @@ public class ServerBattle : Battle protected bool IsPollsBlocked => IsAutohost && DateTime.UtcNow < BlockPollsUntil; private List kickedPlayers = new List(); + private List previousGamePlayers = new List(); public List Debriefings { get; private set; } = new List(); private Timer pollTimer; @@ -207,6 +208,13 @@ public ConnectSpring GetConnectSpringStructure(string scriptPassword, bool isSpe }; } + public bool IsInPreviousGame(string name) + { + var inPrevious = false; + if (previousGamePlayers.Any(y => y == name)) inPrevious = true; + return inPrevious; + } + public bool IsKicked(string name) { var kicked = false; @@ -1053,7 +1061,11 @@ public virtual void ValidateBattleStatus(UserBattleStatus ubs) SayBattle("Your Rank (" + Ranks.RankNames[ubs.LobbyUser.Rank] + ") is too low. The minimum Rank to play in this battle is " + Ranks.RankNames[MinRank] + ".", ubs.Name); } } - if (ubs.QueueOrder <= 0) ubs.QueueOrder = ++QueueCounter; + if (ubs.QueueOrder <= 0) + { + ubs.QueueOrder = ++QueueCounter; + if (IsInPreviousGame(ubs.Name)) ubs.QueueOrder += 1000; + } } else { @@ -1122,6 +1134,16 @@ protected virtual async Task OnDedicatedExited(SpringBattleContext springBattleC //Initiate discussion time, then map vote, then start vote discussionTimer.Interval = (DiscussionSeconds - 1) * 1000; discussionTimer.Start(); + previousGamePlayers = springBattleContext.ActualPlayers.Select(x => x.Name).ToList(); + foreach (var n in previousGamePlayers) + { + UserBattleStatus ubs; + if (Users.TryGetValue(n, out ubs)) + { + ubs.QueueOrder = -1; + ValidateBattleStatus(ubs); + } + } } } await CheckCloseBattle(); diff --git a/ZkLobbyServer/autohost/Commands/CmdEngine.cs b/ZkLobbyServer/autohost/Commands/CmdEngine.cs index fffa9a13d..326d56dd9 100644 --- a/ZkLobbyServer/autohost/Commands/CmdEngine.cs +++ b/ZkLobbyServer/autohost/Commands/CmdEngine.cs @@ -23,7 +23,7 @@ public override string Arm(ServerBattle battle, Say e, string arguments = null) if ((battle.Mode != AutohostMode.None || !battle.IsPassworded) && engine != battle.server.Engine && !battle.IsAutohost) { - battle.Respond(e, $"You cannot change engine to version other than {battle.server.Engine} here, use custom passworded room"); + battle.Respond(e, $"You cannot change engine to version other than {battle.server.Engine} here, must be the Custom room type (say '!type custom') and passworded (say '!password bla', can remove it afterwards via '!password')"); return null; }