mirror of
https://github.com/Sanae6/SmoOnlineServer.git
synced 2024-11-28 06:03:05 +00:00
fix possible typos with send/sendall cmd
This commit is contained in:
parent
a0a53ff7bf
commit
7eb7c97c43
2 changed files with 27 additions and 17 deletions
|
@ -150,10 +150,14 @@ CommandHandler.RegisterCommand("send", args => {
|
|||
string stage = args[0];
|
||||
string id = args[1];
|
||||
|
||||
if (Constants.MapNames.TryGetValue(stage, out string? mapName)) {
|
||||
if (Constants.MapNames.TryGetValue(stage.ToLower(), out string? mapName)) {
|
||||
stage = mapName;
|
||||
}
|
||||
|
||||
if(!stage.Contains("Stage") && !stage.Contains("Zone")) {
|
||||
return "Invalid Stage Name!";
|
||||
}
|
||||
|
||||
if (!sbyte.TryParse(args[2], out sbyte scenario)) return $"Invalid scenario number {args[2]} (range: [-128 to 127])";
|
||||
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, _) => {
|
||||
|
@ -174,10 +178,14 @@ CommandHandler.RegisterCommand("sendall", args => {
|
|||
|
||||
string stage = args[0];
|
||||
|
||||
if (Constants.MapNames.TryGetValue(stage, out string? mapName)) {
|
||||
if (Constants.MapNames.TryGetValue(stage.ToLower(), out string? mapName)) {
|
||||
stage = mapName;
|
||||
}
|
||||
|
||||
if(!stage.Contains("Stage") && !stage.Contains("Zone")) {
|
||||
return "Invalid Stage Name!";
|
||||
}
|
||||
|
||||
Client[] players = server.Clients.Where(c => c.Connected).ToArray();
|
||||
|
||||
Parallel.ForEachAsync(players, async (c, _) => {
|
||||
|
|
|
@ -23,20 +23,22 @@ public static class Constants {
|
|||
public static int HeaderSize { get; } = Marshal.SizeOf<PacketHeader>();
|
||||
|
||||
public static readonly Dictionary<string, string> MapNames = new Dictionary<string, string>() {
|
||||
{"Cap", "CapWorldHomeStage"},
|
||||
{"Cascade", "WaterfallWorldHomeStage"},
|
||||
{"Sand", "SandWorldHomeStage"},
|
||||
{"Lake", "LakeWorldHomeStage"},
|
||||
{"Wooded", "ForestWorldHomeStage"},
|
||||
{"Cloud", "CloudWorldHomeStage"},
|
||||
{"Lost", "ClashWorldHomeStage"},
|
||||
{"Metro", "CityWorldHomeStage"},
|
||||
{"Sea", "SeaWorldHomeStage"},
|
||||
{"Snow", "SnowWorldHomeStage"},
|
||||
{"Lunch", "LavaWorldHomeStage"},
|
||||
{"Ruined", "BossRaidWorldHomeStage"},
|
||||
{"Bowser", "SkyWorldHomeStage"},
|
||||
{"Moon", "MoonWorldHomeStage"},
|
||||
{"Mush", "PeachWorldHomeStage"}
|
||||
{"cap", "CapWorldHomeStage"},
|
||||
{"cascade", "WaterfallWorldHomeStage"},
|
||||
{"sand", "SandWorldHomeStage"},
|
||||
{"lake", "LakeWorldHomeStage"},
|
||||
{"wooded", "ForestWorldHomeStage"},
|
||||
{"cloud", "CloudWorldHomeStage"},
|
||||
{"lost", "ClashWorldHomeStage"},
|
||||
{"metro", "CityWorldHomeStage"},
|
||||
{"sea", "SeaWorldHomeStage"},
|
||||
{"snow", "SnowWorldHomeStage"},
|
||||
{"lunch", "LavaWorldHomeStage"},
|
||||
{"ruined", "BossRaidWorldHomeStage"},
|
||||
{"bowser", "SkyWorldHomeStage"},
|
||||
{"moon", "MoonWorldHomeStage"},
|
||||
{"mush", "PeachWorldHomeStage"},
|
||||
{"dark", "Special1WorldHomeStage"},
|
||||
{"darker", "Special2WorldHomeStage"}
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue