Add untested stage change command
This commit is contained in:
parent
3525ac2099
commit
661763b23f
|
@ -124,6 +124,26 @@ server.PacketHandler = (c, p) => {
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CommandHandler.RegisterCommand("send", args => {
|
||||||
|
const string optionUsage = "Usage: send <stage> <id> <scenario[0..255]> <player/*>";
|
||||||
|
if (args.Length < 4)
|
||||||
|
return optionUsage;
|
||||||
|
|
||||||
|
string stage = args[0];
|
||||||
|
string id = args[1];
|
||||||
|
if (!byte.TryParse(args[2], out byte scenario)) return $"Invalid scenario number {args[2]} (range: [0-255])";
|
||||||
|
Client[] players = args[3] == "*" ? server.Clients.Where(c => c.Connected).ToArray() : server.Clients.Where(c => c.Connected && args[3..].Contains(c.Name)).ToArray();
|
||||||
|
Parallel.ForEachAsync(players, async (c,_) => {
|
||||||
|
await c.Send(new ChangeStagePacket {
|
||||||
|
Stage = stage,
|
||||||
|
Id = id,
|
||||||
|
Scenario = scenario,
|
||||||
|
SubScenarioType = 0
|
||||||
|
});
|
||||||
|
}).Wait();
|
||||||
|
return $"Sent players to {stage}:{scenario}";
|
||||||
|
});
|
||||||
|
|
||||||
CommandHandler.RegisterCommand("scenario", args => {
|
CommandHandler.RegisterCommand("scenario", args => {
|
||||||
const string optionUsage = "Valid options: merge <true/false>";
|
const string optionUsage = "Valid options: merge <true/false>";
|
||||||
if (args.Length < 1)
|
if (args.Length < 1)
|
||||||
|
|
Loading…
Reference in New Issue