Skip to content
24 changes: 23 additions & 1 deletion ZkLobbyServer/ServerBattle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public class ServerBattle : Battle
protected bool IsPollsBlocked => IsAutohost && DateTime.UtcNow < BlockPollsUntil;

private List<KickedPlayer> kickedPlayers = new List<KickedPlayer>();
private List<string> previousGamePlayers = new List<string>();
public List<BattleDebriefing> Debriefings { get; private set; } = new List<BattleDebriefing>();

private Timer pollTimer;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion ZkLobbyServer/autohost/Commands/CmdEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Loading