Skip to content

Commit 264e128

Browse files
committed
try to improve !predict
1 parent 23b9696 commit 264e128

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

ZkLobbyServer/ServerBattle.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ public async Task SayBattle(string text, string privateUser = null)
330330
foreach (var line in text.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries))
331331
{
332332
if ((privateUser == null) && (spring?.IsRunning == true)) spring.SayGame(line);
333+
if ((privateUser != null) && (spring?.IsRunning == true)) spring.SayGame(Format("/w {0} {1}", privateUser, line));
333334
await
334335
server.GhostSay(
335336
new Say()

ZkLobbyServer/autohost/Commands/CmdPredict.cs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,32 @@ public override async Task ExecuteArmed(ServerBattle battle, Say e)
3939
using (var db = new ZkDataContext())
4040
{
4141
if (battle.IsInGame)
42+
{
4243
teams = b.spring.LobbyStartContext?.Players.Where(u => !u.IsSpectator)
4344
.GroupBy(u => u.AllyID)
4445
.Select(x => x.Select(p => Account.AccountByName(db, p.Name))).ToList();
46+
}
4547
else
46-
teams = b.Users.Values.Where(u => !u.IsSpectator)
47-
.GroupBy(u => u.AllyNumber)
48-
.Select(x => x.Select(p => Account.AccountByName(db, p.Name))).ToList();
48+
{
49+
switch (battle.Mode)
50+
{
51+
case PlasmaShared.AutohostMode.Game1v1:
52+
teams = b.Users.Values.Where(u => !u.IsSpectator)
53+
.GroupBy(u => u.Name)
54+
.Select(x => x.Select(p => Account.AccountByName(db, p.Name))).ToList();
55+
break;
56+
57+
case PlasmaShared.AutohostMode.Teams:
58+
await battle.Respond(e, $"The battle will be balanced when it starts");
59+
return;
60+
61+
default:
62+
teams = b.Users.Values.Where(u => !u.IsSpectator)
63+
.GroupBy(u => u.AllyNumber)
64+
.Select(x => x.Select(p => Account.AccountByName(db, p.Name))).ToList();
65+
break;
66+
}
67+
}
4968

5069
if (teams.Count < 2)
5170
{

0 commit comments

Comments
 (0)