diff --git a/Modules/OptionHolder.cs b/Modules/OptionHolder.cs
index 1c2f090df..a4b9ea0d5 100644
--- a/Modules/OptionHolder.cs
+++ b/Modules/OptionHolder.cs
@@ -1035,7 +1035,7 @@ public static class Options
sb.AppendLine("| Command | Description | Arguments | Usage Level | Usage Time | Hidden |");
sb.AppendLine("|---------|-------------|-----------|-------------|------------|--------|");
- foreach ((String key, Command command) in Command.AllCommands)
+ foreach (Command command in Command.AllCommands)
{
string forms = command.CommandForms.TakeWhile(x => x.All(char.IsAscii)).Join(x => $"/{x}", "
");
string description = command.Description;
diff --git a/Modules/RPC.cs b/Modules/RPC.cs
index e651d1a2a..0d9dff919 100644
--- a/Modules/RPC.cs
+++ b/Modules/RPC.cs
@@ -158,10 +158,6 @@ public enum CustomRPC
SyncAllergic,
SyncAsthmatic,
InspectorCommand,
- ImitatorClick,
- RetributionistClick,
- StarspawnClick,
- VentriloquistClick,
Invisibility,
ResetAbilityCooldown,
SyncCamouflage,
@@ -255,7 +251,7 @@ internal static class RPCHandlerPatch
{
if (id == 115) return true;
if (SubmergedCompatibility.IsSubmerged() && id is >= 120 and <= 124) return true;
- return (CustomRPC)id is CustomRPC.VersionCheck or CustomRPC.RequestRetryVersionCheck or CustomRPC.AntiBlackout or CustomRPC.SyncNameNotify or CustomRPC.RequestCommandProcessing or CustomRPC.Judge or CustomRPC.SetSwapperVotes or CustomRPC.MeetingKill or CustomRPC.Guess or CustomRPC.NemesisRevenge or CustomRPC.BAU or CustomRPC.FFAKill or CustomRPC.TMGSync or CustomRPC.InspectorCommand or CustomRPC.ImitatorClick or CustomRPC.RetributionistClick or CustomRPC.StarspawnClick or CustomRPC.VentriloquistClick;
+ return (CustomRPC)id is CustomRPC.VersionCheck or CustomRPC.RequestRetryVersionCheck or CustomRPC.AntiBlackout or CustomRPC.SyncNameNotify or CustomRPC.RequestCommandProcessing or CustomRPC.Judge or CustomRPC.SetSwapperVotes or CustomRPC.MeetingKill or CustomRPC.Guess or CustomRPC.NemesisRevenge or CustomRPC.BAU or CustomRPC.FFAKill or CustomRPC.TMGSync or CustomRPC.InspectorCommand;
}
private static bool CheckRateLimit(PlayerControl __instance, RpcCalls rpcType)
@@ -656,19 +652,26 @@ internal static class RPCHandlerPatch
if (!AmongUsClient.Instance.AmHost) break;
string commandKey = reader.ReadString();
- PlayerControl player = reader.ReadByte().GetPlayer();
string text = reader.ReadString();
- if (!Command.AllCommands.TryGetValue(commandKey, out Command command))
+ if (__instance == null || !__instance.IsModdedClient())
+ {
+ Logger.Error("Player is null or not a modded client", "RequestCommandProcessingFromHost");
+ break;
+ }
+
+ Command command = Command.AllCommands.Find(x => x.Key == commandKey);
+
+ if (command == null)
{
Logger.Error($"Invalid Command {commandKey}.", "RequestCommandProcessingFromHost");
break;
}
- if (!command.CanUseCommand(player)) break;
+ if (!command.CanUseCommand(__instance)) break;
- command.Action(player, commandKey, text, text.Split(' '));
- Logger.Info($"Invoke Command: {command.Action.Method.Name} ({player?.Data?.PlayerName}, {text})", "RequestCommandProcessing");
+ command.Action(__instance, text, text.Split(' '));
+ Logger.Info($"Invoke Command: {command.Action.Method.Name} ({__instance.Data?.PlayerName}, {text})", "RequestCommandProcessing");
break;
}
case CustomRPC.SyncPostman:
@@ -1342,29 +1345,6 @@ internal static class RPCHandlerPatch
Inspector.ReceiveRPC(reader);
break;
}
- case CustomRPC.ImitatorClick:
- {
- Imitator.ReceiveRPC(reader, __instance);
- break;
- }
- case CustomRPC.RetributionistClick:
- {
- int playerId = reader.ReadByte();
- var command = $"/retribute {playerId}";
- ChatCommands.RetributeCommand(__instance, "Command.Retribute", command, command.Split(' '));
- break;
- }
- case CustomRPC.StarspawnClick:
- {
- var command = $"/daybreak";
- ChatCommands.DayBreakCommand(__instance, "Command.DayBreak", command, command.Split(' '));
- break;
- }
- case CustomRPC.VentriloquistClick:
- {
- Ventriloquist.ReceiveRPC(reader, __instance);
- break;
- }
case CustomRPC.Invisibility:
{
int num = reader.ReadPackedInt32();
diff --git a/Modules/Utils.cs b/Modules/Utils.cs
index 013cecdb8..b6e299f7e 100644
--- a/Modules/Utils.cs
+++ b/Modules/Utils.cs
@@ -1717,23 +1717,22 @@ public static class Utils
public static void ShowHelp(byte id)
{
PlayerControl player = GetPlayerById(id);
- SendMessage(Command.AllCommands.Values.Where(x => x.CanUseCommand(player, false) && !x.CommandForms.Contains("help")).Aggregate("", (s, c) => s + $"\n/{c.CommandForms.TakeWhile(f => f.All(char.IsAscii)).MinBy(f => f.Length)}{(c.Arguments.Length == 0 ? string.Empty : $" {c.Arguments.Split(' ').Select((x, i) => id == 0 ? ColorString(GetColor(i), x) : x).Join(delimiter: " ")}")} \u2192 {c.Description}"), id, GetString("CommandList"));
+ SendMessage(Command.AllCommands.FindAll(x => x.CanUseCommand(player, false) && !x.CommandForms.Contains("help")).Aggregate("", (s, c) => s + $"\n/{c.CommandForms.TakeWhile(f => f.All(char.IsAscii)).MinBy(f => f.Length)}{(c.Arguments.Length == 0 ? string.Empty : $" {c.Arguments.Split(' ').Select((x, i) => id == 0 ? ColorString(GetColor(i), x) : x).Join(delimiter: " ")}")} \u2192 {c.Description}"), id, GetString("CommandList"));
return;
- Color GetColor(int i) =>
- i switch
- {
- 0 => Palette.Orange,
- 1 => Color.magenta,
- 2 => id == 0 && Main.DarkTheme.Value ? Color.yellow : Color.blue,
- 3 => Color.red,
- 4 => Color.cyan,
- 5 => Color.green,
- 6 => Palette.Brown,
- 7 => Palette.Purple,
+ Color GetColor(int i) => i switch
+ {
+ 0 => Palette.Orange,
+ 1 => Color.magenta,
+ 2 => id == 0 && Main.DarkTheme.Value ? Color.yellow : Color.blue,
+ 3 => Color.red,
+ 4 => Color.cyan,
+ 5 => Color.green,
+ 6 => Palette.Brown,
+ 7 => Palette.Purple,
- _ => Color.white
- };
+ _ => Color.white
+ };
}
private static void CheckTerroristWin(NetworkedPlayerInfo terrorist)
diff --git a/Patches/ChatCommandPatch.cs b/Patches/ChatCommandPatch.cs
index 52df14ced..77600c646 100644
--- a/Patches/ChatCommandPatch.cs
+++ b/Patches/ChatCommandPatch.cs
@@ -22,7 +22,7 @@ using static EHR.Translator;
namespace EHR;
-internal class Command(string[] commandForms, string arguments, string description, Command.UsageLevels usageLevel, Command.UsageTimes usageTime, Action action, bool isCanceled, bool alwaysHidden, string[] argsDescriptions = null)
+internal class Command(string key, string arguments, string description, Command.UsageLevels usageLevel, Command.UsageTimes usageTime, Action action, bool isCanceled, bool alwaysHidden, string[] argsDescriptions = null)
{
public enum UsageLevels
{
@@ -43,15 +43,16 @@ internal class Command(string[] commandForms, string arguments, string descripti
AfterDeathOrLobby
}
- public static Dictionary AllCommands = [];
+ public static List AllCommands = [];
- public string[] CommandForms => commandForms;
+ public string[] CommandForms = GetString($"CommandForms.{key}").Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
+ public string Key => key;
public string Arguments => arguments;
public string Description => description;
public string[] ArgsDescriptions => argsDescriptions ?? [];
public UsageLevels UsageLevel => usageLevel;
public UsageTimes UsageTime => usageTime;
- public Action Action => action;
+ public Action Action => action;
public bool IsCanceled => isCanceled;
public bool AlwaysHidden => alwaysHidden;
@@ -129,116 +130,115 @@ internal static class ChatCommands
public static void LoadCommands()
{
- Command.AllCommands = new Dictionary
- {
- ["Command.LT"] = new(["lt", "лт", "大厅关闭时间"], "", GetString("CommandDescription.LT"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, LTCommand, false, false),
- ["Command.Dump"] = new(["dump", "дамп", "лог", "导出日志"], "", GetString("CommandDescription.Dump"), Command.UsageLevels.Modded, Command.UsageTimes.Always, DumpCommand, false, false),
- ["Command.Version"] = new(["v", "version", "в", "версия", "检查版本", "versão"], "", GetString("CommandDescription.Version"), Command.UsageLevels.Modded, Command.UsageTimes.Always, VersionCommand, false, false),
- ["Command.ChangeSetting"] = new(["cs", "changesetting", "измнастр", "修改设置", "mudarconfig", "mudarconfiguração"], "{name} {?} [?]", GetString("CommandDescription.ChangeSetting"), Command.UsageLevels.Host, Command.UsageTimes.InLobby, ChangeSettingCommand, true, false, [GetString("CommandArgs.ChangeSetting.Name"), GetString("CommandArgs.ChangeSetting.UnknownValue"), GetString("CommandArgs.ChangeSetting.UnknownValue")]),
- ["Command.Winner"] = new(["win", "winner", "победители", "获胜者", "vencedor"], "", GetString("CommandDescription.Winner"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, WinnerCommand, true, false),
- ["Command.LastResult"] = new(["l", "lastresult", "л", "对局职业信息", "resultados", "ultimoresultado"], "", GetString("CommandDescription.LastResult"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, LastResultCommand, true, false),
- ["Command.Rename"] = new(["rn", "rename", "name", "рн", "ренейм", "переименовать", "修改名称", "renomear"], "{name}", GetString("CommandDescription.Rename"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, RenameCommand, true, false, [GetString("CommandArgs.Rename.Name")]),
- ["Command.HideName"] = new(["hn", "hidename", "хн", "спрник", "隐藏姓名", "semnome", "escondernome"], "", GetString("CommandDescription.HideName"), Command.UsageLevels.Host, Command.UsageTimes.InLobby, HideNameCommand, true, false),
- ["Command.Level"] = new(["level", "лвл", "уровень", "修改等级", "nível"], "{level}", GetString("CommandDescription.Level"), Command.UsageLevels.Host, Command.UsageTimes.InLobby, LevelCommand, true, false, [GetString("CommandArgs.Level.Level")]),
- ["Command.Now"] = new(["n", "now", "н", "当前设置", "atual"], "", GetString("CommandDescription.Now"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, NowCommand, true, false),
- ["Command.Disconnect"] = new(["dis", "disconnect", "дис", "断连"], "{team}", GetString("CommandDescription.Disconnect"), Command.UsageLevels.Host, Command.UsageTimes.InGame, DisconnectCommand, true, false, [GetString("CommandArgs.Disconnect.Team")]),
- ["Command.R"] = new(["r", "р", "função"], "[role]", GetString("CommandDescription.R"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, RCommand, true, false, [GetString("CommandArgs.R.Role")]),
- ["Command.Up"] = new(["up", "指定"], "{role}", GetString("CommandDescription.Up"), Command.UsageLevels.Host, Command.UsageTimes.InLobby, UpCommand, true, false, [GetString("CommandArgs.Up.Role")]),
- ["Command.SetRole"] = new(["setrole", "setaddon", "сетроль", "预设职业", "definir-função"], "{id} {role}", GetString("CommandDescription.SetRole"), Command.UsageLevels.Host, Command.UsageTimes.InLobby, SetRoleCommand, true, false, [GetString("CommandArgs.SetRole.Id"), GetString("CommandArgs.SetRole.Role")]),
- ["Command.Help"] = new(["h", "help", "хэлп", "хелп", "помощь", "帮助", "ajuda"], "", GetString("CommandDescription.Help"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, HelpCommand, true, false),
- ["Command.KCount"] = new(["gamestate", "gstate", "gs", "kcount", "kc", "кубийц", "гс", "статигры", "对局状态", "estadojogo", "status"], "", GetString("CommandDescription.KCount"), Command.UsageLevels.Everyone, Command.UsageTimes.InGame, KCountCommand, true, false),
- ["Command.AddMod"] = new(["addmod", "добмодера", "指定协管", "moderador-add"], "{id}", GetString("CommandDescription.AddMod"), Command.UsageLevels.Host, Command.UsageTimes.Always, AddModCommand, true, false, [GetString("CommandArgs.AddMod.Id")]),
- ["Command.DeleteMod"] = new(["deletemod", "убрмодера", "удмодера", "убратьмодера", "удалитьмодера", "移除协管", "moderador-remover"], "{id}", GetString("CommandDescription.DeleteMod"), Command.UsageLevels.Host, Command.UsageTimes.Always, DeleteModCommand, true, false, [GetString("CommandArgs.DeleteMod.Id")]),
- ["Command.Combo"] = new(["combo", "комбо", "设置不会同时出现的职业", "combinação", "combinar"], "{mode} {role} {addon} [all]", GetString("CommandDescription.Combo"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, ComboCommand, true, false, [GetString("CommandArgs.Combo.Mode"), GetString("CommandArgs.Combo.Role"), GetString("CommandArgs.Combo.Addon"), GetString("CommandArgs.Combo.All")]),
- ["Command.Effect"] = new(["eff", "effect", "эффект", "效果", "efeito"], "{effect}", GetString("CommandDescription.Effect"), Command.UsageLevels.Host, Command.UsageTimes.InGame, EffectCommand, true, false, [GetString("CommandArgs.Effect.Effect")]),
- ["Command.AFKExempt"] = new(["afkexempt", "освафк", "афкосв", "挂机检测器不会检测", "afk-isentar"], "{id}", GetString("CommandDescription.AFKExempt"), Command.UsageLevels.HostOrAdmin, Command.UsageTimes.Always, AFKExemptCommand, true, false, [GetString("CommandArgs.AFKExempt.Id")]),
- ["Command.MyRole"] = new(["m", "myrole", "м", "мояроль", "我的职业", "minhafunção"], "", GetString("CommandDescription.MyRole"), Command.UsageLevels.Everyone, Command.UsageTimes.InGame, MyRoleCommand, true, false),
- ["Command.TPOut"] = new(["tpout", "тпаут", "传送出"], "", GetString("CommandDescription.TPOut"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, TPOutCommand, true, false),
- ["Command.TPIn"] = new(["tpin", "тпин", "传送进"], "", GetString("CommandDescription.TPIn"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, TPInCommand, true, false),
- ["Command.Template"] = new(["t", "template", "т", "темплейт", "模板"], "{tag}", GetString("CommandDescription.Template"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, TemplateCommand, true, false, [GetString("CommandArgs.Template.Tag")]),
- ["Command.MessageWait"] = new(["mw", "messagewait", "мв", "медленныйрежим", "消息冷却", "espera-mensagens"], "{duration}", GetString("CommandDescription.MessageWait"), Command.UsageLevels.Host, Command.UsageTimes.Always, MessageWaitCommand, true, false, [GetString("CommandArgs.MessageWait.Duration")]),
- ["Command.Death"] = new(["death", "d", "д", "смерть", "死亡原因", "abate"], "[id]", GetString("CommandDescription.Death"), Command.UsageLevels.Everyone, Command.UsageTimes.AfterDeath, DeathCommand, true, false, [GetString("CommandArgs.Death.Id")]),
- ["Command.Say"] = new(["say", "s", "сказать", "с", "说", "falar", "dizer"], "{message}", GetString("CommandDescription.Say"), Command.UsageLevels.HostOrModerator, Command.UsageTimes.Always, SayCommand, true, false, [GetString("CommandArgs.Say.Message")]),
- ["Command.Vote"] = new(["vote", "голос", "投票给", "votar"], "{id}", GetString("CommandDescription.Vote"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, VoteCommand, true, true, [GetString("CommandArgs.Vote.Id")]),
- ["Command.Ask"] = new(["ask", "спр", "спросить", "数学家提问", "perguntar"], "{number1} {number2}", GetString("CommandDescription.Ask"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, AskCommand, true, true, [GetString("CommandArgs.Ask.Number1"), GetString("CommandArgs.Ask.Number2")]),
- ["Command.Answer"] = new(["ans", "answer", "отв", "ответить", "回答数学家问题", "responder"], "{number}", GetString("CommandDescription.Answer"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, AnswerCommand, true, false, [GetString("CommandArgs.Answer.Number")]),
- ["Command.QA"] = new(["qa", "вопротв", "回答测验大师问题", "questão-responder"], "{letter}", GetString("CommandDescription.QA"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, QACommand, true, false, [GetString("CommandArgs.QA.Letter")]),
- ["Command.QS"] = new(["qs", "вопрпоказать", "检查测验大师问题", "questão-ver"], "", GetString("CommandDescription.QS"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, QSCommand, true, false),
- ["Command.Target"] = new(["target", "цель", "腹语者标记", "alvo"], "{id}", GetString("CommandDescription.Target"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, TargetCommand, true, true, [GetString("CommandArgs.Target.Id")]),
- ["Command.Chat"] = new(["chat", "сообщение", "腹语者发送消息"], "{message}", GetString("CommandDescription.Chat"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, ChatCommand, true, true, [GetString("CommandArgs.Chat.Message")]),
- ["Command.Check"] = new(["check", "проверить", "检查", "veificar"], "{id} {role}", GetString("CommandDescription.Check"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, CheckCommand, true, true, [GetString("CommandArgs.Check.Id"), GetString("CommandArgs.Check.Role")]),
- ["Command.Ban"] = new(["ban", "kick", "бан", "кик", "забанить", "кикнуть", "封禁", "踢出", "banir", "expulsar"], "{id} [reason]", GetString("CommandDescription.Ban"), Command.UsageLevels.HostOrModerator, Command.UsageTimes.Always, BanKickCommand, true, false, [GetString("CommandArgs.Ban.Id"), GetString("CommandArgs.Ban.Reason")]),
- ["Command.Exe"] = new(["exe", "выкинуть", "驱逐", "executar"], "{id}", GetString("CommandDescription.Exe"), Command.UsageLevels.HostOrAdmin, Command.UsageTimes.Always, ExeCommand, true, false, [GetString("CommandArgs.Exe.Id")]),
- ["Command.Kill"] = new(["kill", "убить", "击杀", "matar"], "{id}", GetString("CommandDescription.Kill"), Command.UsageLevels.Host, Command.UsageTimes.Always, KillCommand, true, false, [GetString("CommandArgs.Kill.Id")]),
- ["Command.Colour"] = new(["colour", "color", "цвет", "更改颜色", "cor"], "{color}", GetString("CommandDescription.Colour"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, ColorCommand, true, false, [GetString("CommandArgs.Colour.Color")]),
- ["Command.ID"] = new(["id", "guesslist", "айди", "ID列表"], "", GetString("CommandDescription.ID"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, IDCommand, true, false),
- ["Command.ChangeRole"] = new(["changerole", "изменитьроль", "измроль", "修改职业", "mudar-função"], "{role}", GetString("CommandDescription.ChangeRole"), Command.UsageLevels.Host, Command.UsageTimes.InGame, ChangeRoleCommand, true, false, [GetString("CommandArgs.ChangeRole.Role")]),
- ["Command.End"] = new(["end", "закончить", "завершить", "结束游戏", "encerrar", "finalizar", "fim"], "", GetString("CommandDescription.End"), Command.UsageLevels.HostOrAdmin, Command.UsageTimes.InGame, EndCommand, true, false),
- ["Command.CosID"] = new(["cosid", "костюм", "одежда", "服装ID"], "", GetString("CommandDescription.CosID"), Command.UsageLevels.Modded, Command.UsageTimes.Always, CosIDCommand, true, false),
- ["Command.MTHY"] = new(["mt", "hy", "собрание", "开会/结束会议"], "", GetString("CommandDescription.MTHY"), Command.UsageLevels.Host, Command.UsageTimes.InGame, MTHYCommand, true, false),
- ["Command.CSD"] = new(["csd", "кзвук", "自定义播放声音"], "{sound}", GetString("CommandDescription.CSD"), Command.UsageLevels.Modded, Command.UsageTimes.Always, CSDCommand, true, false, [GetString("CommandArgs.CSD.Sound")]),
- ["Command.SD"] = new(["sd", "взвук", "游戏中播放声音"], "{sound}", GetString("CommandDescription.SD"), Command.UsageLevels.Modded, Command.UsageTimes.Always, SDCommand, true, false, [GetString("CommandArgs.SD.Sound")]),
- ["Command.GNO"] = new(["gno", "гно", "猜数字"], "{number}", GetString("CommandDescription.GNO"), Command.UsageLevels.Everyone, Command.UsageTimes.AfterDeathOrLobby, GNOCommand, true, false, [GetString("CommandArgs.GNO.Number")]),
- ["Command.Poll"] = new(["poll", "опрос", "发起调查", "enquete"], "{question} {answerA} {answerB} [answerC] [answerD]", GetString("CommandDescription.Poll"), Command.UsageLevels.HostOrModerator, Command.UsageTimes.Always, PollCommand, true, false, [GetString("CommandArgs.Poll.Question"), GetString("CommandArgs.Poll.AnswerA"), GetString("CommandArgs.Poll.AnswerB"), GetString("CommandArgs.Poll.AnswerC"), GetString("CommandArgs.Poll.AnswerD")]),
- ["Command.PV"] = new(["pv", "проголосовать", "选择调查选项"], "{vote}", GetString("CommandDescription.PV"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, PVCommand, false, false, [GetString("CommandArgs.PV.Vote")]),
- ["Command.HM"] = new(["hm", "мс", "мессенджер", "送信"], "{id}", GetString("CommandDescription.HM"), Command.UsageLevels.Everyone, Command.UsageTimes.AfterDeath, HMCommand, true, false, [GetString("CommandArgs.HM.Id")]),
- ["Command.Decree"] = new(["decree", "указ", "总统命令", "decretar"], "{number}", GetString("CommandDescription.Decree"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, DecreeCommand, true, true, [GetString("CommandArgs.Decree.Number")]),
- ["Command.AddVIP"] = new(["addvip", "добавитьвип", "добвип", "指定会员", "vip-add"], "{id}", GetString("CommandDescription.AddVIP"), Command.UsageLevels.Host, Command.UsageTimes.Always, AddVIPCommand, true, false, [GetString("CommandArgs.AddVIP.Id")]),
- ["Command.DeleteVIP"] = new(["deletevip", "удвип", "убрвип", "удалитьвип", "убратьвип", "删除会员", "vip-remover"], "{id}", GetString("CommandDescription.DeleteVIP"), Command.UsageLevels.Host, Command.UsageTimes.Always, DeleteVIPCommand, true, false, [GetString("CommandArgs.DeleteVIP.Id")]),
- ["Command.Assume"] = new(["assume", "предположить", "传销头目预测投票", "assumir"], "{id} {number}", GetString("CommandDescription.Assume"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, AssumeCommand, true, true, [GetString("CommandArgs.Assume.Id"), GetString("CommandArgs.Assume.Number")]),
- ["Command.Note"] = new(["note", "заметка", "记者管理笔记", "nota", "anotar"], "{action} [?]", GetString("CommandDescription.Note"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, NoteCommand, true, true, [GetString("CommandArgs.Note.Action"), GetString("CommandArgs.Note.UnknownValue")]),
- ["Command.OS"] = new(["os", "optionset", "шансроли", "设置职业生成概率"], "{chance} {role}", GetString("CommandDescription.OS"), Command.UsageLevels.HostOrAdmin, Command.UsageTimes.InLobby, OSCommand, true, false, [GetString("CommandArgs.OS.Chance"), GetString("CommandArgs.OS.Role")]),
- ["Command.Negotiation"] = new(["negotiation", "neg", "наказание", "谈判方式", "negociar", "negociação"], "{number}", GetString("CommandDescription.Negotiation"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, NegotiationCommand, true, false, [GetString("CommandArgs.Negotiation.Number")]),
- ["Command.Mute"] = new(["mute", "замутить", "мут", "禁言", "mutar", "silenciar"], "{id} [duration]", GetString("CommandDescription.Mute"), Command.UsageLevels.HostOrModerator, Command.UsageTimes.AfterDeathOrLobby, MuteCommand, true, false, [GetString("CommandArgs.Mute.Id"), GetString("CommandArgs.Mute.Duration")]),
- ["Command.Unmute"] = new(["unmute", "размутить", "размут", "解禁", "desmutar", "desilenciar"], "{id}", GetString("CommandDescription.Unmute"), Command.UsageLevels.HostOrAdmin, Command.UsageTimes.Always, UnmuteCommand, true, false, [GetString("CommandArgs.Unmute.Id")]),
- ["Command.DraftStart"] = new(["draftstart", "ds", "драфтстарт", "启用草稿", "todosescolhem-iniciar"], "", GetString("CommandDescription.DraftStart"), Command.UsageLevels.HostOrModerator, Command.UsageTimes.InLobby, DraftStartCommand, true, false),
- ["Command.DraftDescription"] = new(["dd", "draftdesc", "draftdescription", "драфтописание", "драфтопис", "草稿描述", "todosescolhem-descricao"], "{index}", GetString("CommandDescription.DraftDescription"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, DraftDescriptionCommand, false, false, [GetString("CommandArgs.DraftDescription.Index")]),
- ["Command.Draft"] = new(["draft", "драфт", "选择草稿", "todosescolhem-escolher"], "{number}", GetString("CommandDescription.Draft"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, DraftCommand, false, false, [GetString("CommandArgs.Draft.Number")]),
- ["Command.ReadyCheck"] = new(["rc", "readycheck", "проверитьготовность", "准备检测", "verificação-de-prontidão"], "", GetString("CommandDescription.ReadyCheck"), Command.UsageLevels.HostOrModerator, Command.UsageTimes.InLobby, ReadyCheckCommand, true, false),
- ["Command.Ready"] = new(["ready", "готов", "准备", "pronto"], "", GetString("CommandDescription.Ready"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, ReadyCommand, true, false),
- ["Command.EnableAllRoles"] = new(["enableallroles", "вклвсероли", "启用所有职业", "habilitar-todas-as-funções"], "", GetString("CommandDescription.EnableAllRoles"), Command.UsageLevels.Host, Command.UsageTimes.InLobby, EnableAllRolesCommand, true, false),
- ["Command.Achievements"] = new(["achievements", "достижения", "成就", "conquistas"], "", GetString("CommandDescription.Achievements"), Command.UsageLevels.Modded, Command.UsageTimes.Always, AchievementsCommand, true, false),
- ["Command.DeathNote"] = new(["dn", "deathnote", "угадатьимя", "отгадатьимя", "死亡笔记"], "{name}", GetString("CommandDescription.DeathNote"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, DeathNoteCommand, true, true, [GetString("CommandArgs.DeathNote.Name")]),
- ["Command.Whisper"] = new(["w", "whisper", "шёпот", "ш", "私聊", "sussurrar"], "{id} {message}", GetString("CommandDescription.Whisper"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, WhisperCommand, true, true, [GetString("CommandArgs.Whisper.Id"), GetString("CommandArgs.Whisper.Message")]),
- ["Command.HWhisper"] = new(["hw", "hwhisper", "хш", "хшёпот"], "{id} {message}", GetString("CommandDescription.HWhisper"), Command.UsageLevels.Host, Command.UsageTimes.Always, HWhisperCommand, true, false, [GetString("CommandArgs.HWhisper.Id"), GetString("CommandArgs.HWhisper.Message")]),
- ["Command.Spectate"] = new(["spectate", "наблюдатель", "спектатор", "观战", "espectar"], "[id]", GetString("CommandDescription.Spectate"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, SpectateCommand, false, false, [GetString("CommandArgs.Spectate.Id")]),
- ["Command.Anagram"] = new(["anagram", "анаграмма"], "", GetString("CommandDescription.Anagram"), Command.UsageLevels.Everyone, Command.UsageTimes.AfterDeathOrLobby, AnagramCommand, true, false),
- ["Command.RoleList"] = new(["rl", "rolelist", "роли"], "", GetString("CommandDescription.RoleList"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, RoleListCommand, true, false),
- ["Command.JailTalk"] = new(["jt", "jailtalk", "监狱谈话"], "{message}", GetString("CommandDescription.JailTalk"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, JailTalkCommand, true, true, [GetString("CommandArgs.JailTalk.Message")]),
- ["Command.GameModeList"] = new(["gm", "gml", "gamemodes", "gamemodelist", "режимы", "模式列表"], "", GetString("CommandDescription.GameModeList"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, GameModeListCommand, true, false),
- ["Command.GameModePoll"] = new(["gmp", "gmpoll", "pollgm", "gamemodepoll", "гмполл", "模式投票"], "", GetString("CommandDescription.GameModePoll"), Command.UsageLevels.HostOrModerator, Command.UsageTimes.InLobby, GameModePollCommand, true, false),
- ["Command.MapPoll"] = new(["mp", "mpoll", "pollm", "mappoll", "мполл"], "", GetString("CommandDescription.MapPoll"), Command.UsageLevels.HostOrModerator, Command.UsageTimes.InLobby, MapPollCommand, true, false),
- ["Command.EightBall"] = new(["8ball", "шар", "八球"], "[question]", GetString("CommandDescription.EightBall"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, EightBallCommand, false, false, [GetString("CommandArgs.EightBall.Question")]),
- ["Command.AddTag"] = new(["addtag", "createtag", "добавитьтег", "создатьтег", "добтег", "添加标签", "adicionartag"], "{id} {color} {tag}", GetString("CommandDescription.AddTag"), Command.UsageLevels.Host, Command.UsageTimes.Always, AddTagCommand, true, false, [GetString("CommandArgs.AddTag.Id"), GetString("CommandArgs.AddTag.Color"), GetString("CommandArgs.AddTag.Tag")]),
- ["Command.DeleteTag"] = new(["deletetag", "удалитьтег", "убратьтег", "удтег", "убртег", "删除标签"], "{id}", GetString("CommandDescription.DeleteTag"), Command.UsageLevels.Host, Command.UsageTimes.InLobby, DeleteTagCommand, true, false, [GetString("CommandArgs.DeleteTag.Id")]),
- ["Command.DayBreak"] = new(["daybreak", "db", "дейбрейк", "破晓"], "", GetString("CommandDescription.DayBreak"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, DayBreakCommand, true, true),
- ["Command.Fix"] = new(["fix", "blackscreenfix", "fixblackscreen", "фикс", "исправить", "修复"], "{id}", GetString("CommandDescription.Fix"), Command.UsageLevels.HostOrModerator, Command.UsageTimes.InGame, FixCommand, true, false, [GetString("CommandArgs.Fix.Id")]),
- ["Command.XOR"] = new(["xor", "异或命令"], "{role} {role}", GetString("CommandDescription.XOR"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, XORCommand, true, false, [GetString("CommandArgs.XOR.Role"), GetString("CommandArgs.XOR.Role")]),
- ["Command.ChemistInfo"] = new(["ci", "chemistinfo", "химик", "化学家"], "", GetString("CommandDescription.ChemistInfo"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, ChemistInfoCommand, true, false),
- ["Command.Forge"] = new(["forge"], "{id} {role}", GetString("CommandDescription.Forge"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, ForgeCommand, true, true, [GetString("CommandArgs.Forge.Id"), GetString("CommandArgs.Forge.Role")]),
- ["Command.Choose"] = new(["choose", "pick", "выбрать", "选择", "escolher"], "{role}", GetString("CommandDescription.Choose"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, ChooseCommand, true, true, [GetString("CommandArgs.Choose.Role")]),
- ["Command.CopyPreset"] = new(["copypreset", "presetcopy", "скопироватьсохранение", "скопироватьсохр", "复制预设", "copiar"], "{sourcepreset} {targetpreset}", GetString("CommandDescription.CopyPreset"), Command.UsageLevels.Host, Command.UsageTimes.InLobby, CopyPresetCommand, true, false, [GetString("CommandArgs.CopyPreset.SourcePreset"), GetString("CommandArgs.CopyPreset.TargetPreset")]),
- ["Command.AddAdmin"] = new(["addadmin", "добавитьадмин", "добадмин", "指定管理员", "admin-add"], "{id}", GetString("CommandDescription.AddAdmin"), Command.UsageLevels.Host, Command.UsageTimes.Always, AddAdminCommand, true, false, [GetString("CommandArgs.AddAdmin.Id")]),
- ["Command.DeleteAdmin"] = new(["deleteadmin", "удалитьадмин", "убратьадмин", "удалитьадминку", "убратьадминку", "删除管理员", "admin-remover"], "{id}", GetString("CommandDescription.DeleteAdmin"), Command.UsageLevels.Host, Command.UsageTimes.Always, DeleteAdminCommand, true, false, [GetString("CommandArgs.DeleteAdmin.Id")]),
- ["Command.VoteStart"] = new(["vs", "votestart", "голосованиестарт", "投票开始"], "", GetString("CommandDescription.VoteStart"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, VoteStartCommand, true, false),
- ["Command.Imitate"] = new(["imitate", "имитировать", "模仿"], "{id}", GetString("CommandDescription.Imitate"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, ImitateCommand, true, true, [GetString("CommandArgs.Imitate.Id")]),
- ["Command.Retribute"] = new(["ret", "retribute", "воздать", "报复"], "{id}", GetString("CommandDescription.Retribute"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, RetributeCommand, true, true, [GetString("CommandArgs.Retribute.Id")]),
- ["Command.Revive"] = new(["revive", "воскрешение", "воскрешать", "复活", "reviver"], "{id}", GetString("CommandDescription.Revive"), Command.UsageLevels.Host, Command.UsageTimes.InGame, ReviveCommand, true, false, [GetString("CommandArgs.Revive.Id")]),
- ["Command.Select"] = new(["select", "выбратьигрока", "选择玩家", "selecionar"], "{id} {role}", GetString("CommandDescription.Select"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, SelectCommand, true, true, [GetString("CommandArgs.Select.Id"), GetString("CommandArgs.Select.Role")]),
- ["Command.UIScale"] = new(["uiscale", "масштаб"], "{scale}", GetString("CommandDescription.UIScale"), Command.UsageLevels.Modded, Command.UsageTimes.Always, UIScaleCommand, true, false, [GetString("CommandArgs.UIScale.Scale")]),
- ["Command.Fabricate"] = new(["fabricate", "фабриковать", "伪造", "fabricar"], "{deathreason}", GetString("CommandDescription.Fabricate"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, FabricateCommand, true, true, [GetString("CommandArgs.Fabricate.DeathReason")]),
- ["Command.Start"] = new(["start", "старт", "开始"], "", GetString("CommandDescription.Start"), Command.UsageLevels.HostOrModerator, Command.UsageTimes.InLobby, StartCommand, false, false),
- ["Command.ConfirmAuth"] = new(["confirmauth"], "{uuid}", GetString("CommandDescription.ConfirmAuth"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, ConfirmAuthCommand, true, false, [GetString("CommandArgs.ConfirmAuth.UUID")]),
-
- // Commands with action handled elsewhere
- ["Command.Guess"] = new(["shoot", "guess", "bet", "bt", "st", "угадать", "бт", "猜测", "赌", "adivinhar"], "{id} {role}", GetString("CommandDescription.Guess"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, (_, _, _, _) => { }, true, false, [GetString("CommandArgs.Guess.Id"), GetString("CommandArgs.Guess.Role")]),
- ["Command.Trial"] = new(["tl", "sp", "jj", "trial", "суд", "засудить", "审判", "判", "julgar"], "{id}", GetString("CommandDescription.Trial"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, (_, _, _, _) => { }, true, false, [GetString("CommandArgs.Trial.Id")]),
- ["Command.Swap"] = new(["sw", "swap", "st", "свап", "свапнуть", "换票", "trocar"], "{id}", GetString("CommandDescription.Swap"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, (_, _, _, _) => { }, true, false, [GetString("CommandArgs.Swap.Id")]),
- ["Command.Compare"] = new(["compare", "cp", "cmp", "сравнить", "ср", "检查", "comparar"], "{id1} {id2}", GetString("CommandDescription.Compare"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, (_, _, _, _) => { }, true, false, [GetString("CommandArgs.Compare.Id1"), GetString("CommandArgs.Compare.Id2")]),
- ["Command.Medium"] = new(["ms", "mediumship", "medium", "медиум", "回答"], "{answer}", GetString("CommandDescription.Medium"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, (_, _, _, _) => { }, true, false, [GetString("CommandArgs.Medium.Answer")]),
- ["Command.Revenge"] = new(["rv", "месть", "отомстить", "复仇"], "{id}", GetString("CommandDescription.Revenge"), Command.UsageLevels.Everyone, Command.UsageTimes.AfterDeath, (_, _, _, _) => { }, true, false, [GetString("CommandArgs.Revenge.Id")]),
+ Command.AllCommands =
+ [
+ new("LT", "", GetString("CommandDescription.LT"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, LTCommand, false, false),
+ new("Dump", "", GetString("CommandDescription.Dump"), Command.UsageLevels.Modded, Command.UsageTimes.Always, DumpCommand, false, false),
+ new("Version", "", GetString("CommandDescription.Version"), Command.UsageLevels.Modded, Command.UsageTimes.Always, VersionCommand, false, false),
+ new("ChangeSetting", "{name} {?} [?]", GetString("CommandDescription.ChangeSetting"), Command.UsageLevels.Host, Command.UsageTimes.InLobby, ChangeSettingCommand, true, false, [GetString("CommandArgs.ChangeSetting.Name"), GetString("CommandArgs.ChangeSetting.UnknownValue"), GetString("CommandArgs.ChangeSetting.UnknownValue")]),
+ new("Winner", "", GetString("CommandDescription.Winner"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, WinnerCommand, true, false),
+ new("LastResult", "", GetString("CommandDescription.LastResult"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, LastResultCommand, true, false),
+ new("Rename", "{name}", GetString("CommandDescription.Rename"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, RenameCommand, true, false, [GetString("CommandArgs.Rename.Name")]),
+ new("HideName", "", GetString("CommandDescription.HideName"), Command.UsageLevels.Host, Command.UsageTimes.InLobby, HideNameCommand, true, false),
+ new("Level", "{level}", GetString("CommandDescription.Level"), Command.UsageLevels.Host, Command.UsageTimes.InLobby, LevelCommand, true, false, [GetString("CommandArgs.Level.Level")]),
+ new("Now", "", GetString("CommandDescription.Now"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, NowCommand, true, false),
+ new("Disconnect", "{team}", GetString("CommandDescription.Disconnect"), Command.UsageLevels.Host, Command.UsageTimes.InGame, DisconnectCommand, true, false, [GetString("CommandArgs.Disconnect.Team")]),
+ new("R", "[role]", GetString("CommandDescription.R"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, RCommand, true, false, [GetString("CommandArgs.R.Role")]),
+ new("Up", "{role}", GetString("CommandDescription.Up"), Command.UsageLevels.Host, Command.UsageTimes.InLobby, UpCommand, true, false, [GetString("CommandArgs.Up.Role")]),
+ new("SetRole", "{id} {role}", GetString("CommandDescription.SetRole"), Command.UsageLevels.Host, Command.UsageTimes.InLobby, SetRoleCommand, true, false, [GetString("CommandArgs.SetRole.Id"), GetString("CommandArgs.SetRole.Role")]),
+ new("Help", "", GetString("CommandDescription.Help"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, HelpCommand, true, false),
+ new("KCount", "", GetString("CommandDescription.KCount"), Command.UsageLevels.Everyone, Command.UsageTimes.InGame, KCountCommand, true, false),
+ new("AddMod", "{id}", GetString("CommandDescription.AddMod"), Command.UsageLevels.Host, Command.UsageTimes.Always, AddModCommand, true, false, [GetString("CommandArgs.AddMod.Id")]),
+ new("DeleteMod", "{id}", GetString("CommandDescription.DeleteMod"), Command.UsageLevels.Host, Command.UsageTimes.Always, DeleteModCommand, true, false, [GetString("CommandArgs.DeleteMod.Id")]),
+ new("Combo", "{mode} {role} {addon} [all]", GetString("CommandDescription.Combo"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, ComboCommand, true, false, [GetString("CommandArgs.Combo.Mode"), GetString("CommandArgs.Combo.Role"), GetString("CommandArgs.Combo.Addon"), GetString("CommandArgs.Combo.All")]),
+ new("Effect", "{effect}", GetString("CommandDescription.Effect"), Command.UsageLevels.Host, Command.UsageTimes.InGame, EffectCommand, true, false, [GetString("CommandArgs.Effect.Effect")]),
+ new("AFKExempt", "{id}", GetString("CommandDescription.AFKExempt"), Command.UsageLevels.HostOrAdmin, Command.UsageTimes.Always, AFKExemptCommand, true, false, [GetString("CommandArgs.AFKExempt.Id")]),
+ new("MyRole", "", GetString("CommandDescription.MyRole"), Command.UsageLevels.Everyone, Command.UsageTimes.InGame, MyRoleCommand, true, false),
+ new("TPOut", "", GetString("CommandDescription.TPOut"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, TPOutCommand, true, false),
+ new("TPIn", "", GetString("CommandDescription.TPIn"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, TPInCommand, true, false),
+ new("Template", "{tag}", GetString("CommandDescription.Template"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, TemplateCommand, true, false, [GetString("CommandArgs.Template.Tag")]),
+ new("MessageWait", "{duration}", GetString("CommandDescription.MessageWait"), Command.UsageLevels.Host, Command.UsageTimes.Always, MessageWaitCommand, true, false, [GetString("CommandArgs.MessageWait.Duration")]),
+ new("Death", "[id]", GetString("CommandDescription.Death"), Command.UsageLevels.Everyone, Command.UsageTimes.AfterDeath, DeathCommand, true, false, [GetString("CommandArgs.Death.Id")]),
+ new("Say", "{message}", GetString("CommandDescription.Say"), Command.UsageLevels.HostOrModerator, Command.UsageTimes.Always, SayCommand, true, false, [GetString("CommandArgs.Say.Message")]),
+ new("Vote", "{id}", GetString("CommandDescription.Vote"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, VoteCommand, true, true, [GetString("CommandArgs.Vote.Id")]),
+ new("Ask", "{number1} {number2}", GetString("CommandDescription.Ask"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, AskCommand, true, true, [GetString("CommandArgs.Ask.Number1"), GetString("CommandArgs.Ask.Number2")]),
+ new("Answer", "{number}", GetString("CommandDescription.Answer"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, AnswerCommand, true, false, [GetString("CommandArgs.Answer.Number")]),
+ new("QA", "{letter}", GetString("CommandDescription.QA"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, QACommand, true, false, [GetString("CommandArgs.QA.Letter")]),
+ new("QS", "", GetString("CommandDescription.QS"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, QSCommand, true, false),
+ new("Target", "{id}", GetString("CommandDescription.Target"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, TargetCommand, true, true, [GetString("CommandArgs.Target.Id")]),
+ new("Chat", "{message}", GetString("CommandDescription.Chat"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, ChatCommand, true, true, [GetString("CommandArgs.Chat.Message")]),
+ new("Check", "{id} {role}", GetString("CommandDescription.Check"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, CheckCommand, true, true, [GetString("CommandArgs.Check.Id"), GetString("CommandArgs.Check.Role")]),
+ new("Ban", "{id} [reason]", GetString("CommandDescription.Ban"), Command.UsageLevels.HostOrModerator, Command.UsageTimes.Always, BanKickCommand, true, false, [GetString("CommandArgs.Ban.Id"), GetString("CommandArgs.Ban.Reason")]),
+ new("Exe", "{id}", GetString("CommandDescription.Exe"), Command.UsageLevels.HostOrAdmin, Command.UsageTimes.Always, ExeCommand, true, false, [GetString("CommandArgs.Exe.Id")]),
+ new("Kill", "{id}", GetString("CommandDescription.Kill"), Command.UsageLevels.Host, Command.UsageTimes.Always, KillCommand, true, false, [GetString("CommandArgs.Kill.Id")]),
+ new("Colour", "{color}", GetString("CommandDescription.Colour"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, ColorCommand, true, false, [GetString("CommandArgs.Colour.Color")]),
+ new("ID", "", GetString("CommandDescription.ID"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, IDCommand, true, false),
+ new("ChangeRole", "{role}", GetString("CommandDescription.ChangeRole"), Command.UsageLevels.Host, Command.UsageTimes.InGame, ChangeRoleCommand, true, false, [GetString("CommandArgs.ChangeRole.Role")]),
+ new("End", "", GetString("CommandDescription.End"), Command.UsageLevels.HostOrAdmin, Command.UsageTimes.InGame, EndCommand, true, false),
+ new("CosID", "", GetString("CommandDescription.CosID"), Command.UsageLevels.Modded, Command.UsageTimes.Always, CosIDCommand, true, false),
+ new("MTHY", "", GetString("CommandDescription.MTHY"), Command.UsageLevels.Host, Command.UsageTimes.InGame, MTHYCommand, true, false),
+ new("CSD", "{sound}", GetString("CommandDescription.CSD"), Command.UsageLevels.Modded, Command.UsageTimes.Always, CSDCommand, true, false, [GetString("CommandArgs.CSD.Sound")]),
+ new("SD", "{sound}", GetString("CommandDescription.SD"), Command.UsageLevels.Modded, Command.UsageTimes.Always, SDCommand, true, false, [GetString("CommandArgs.SD.Sound")]),
+ new("GNO", "{number}", GetString("CommandDescription.GNO"), Command.UsageLevels.Everyone, Command.UsageTimes.AfterDeathOrLobby, GNOCommand, true, false, [GetString("CommandArgs.GNO.Number")]),
+ new("Poll", "{question} {answerA} {answerB} [answerC] [answerD]", GetString("CommandDescription.Poll"), Command.UsageLevels.HostOrModerator, Command.UsageTimes.Always, PollCommand, true, false, [GetString("CommandArgs.Poll.Question"), GetString("CommandArgs.Poll.AnswerA"), GetString("CommandArgs.Poll.AnswerB"), GetString("CommandArgs.Poll.AnswerC"), GetString("CommandArgs.Poll.AnswerD")]),
+ new("PV", "{vote}", GetString("CommandDescription.PV"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, PVCommand, false, false, [GetString("CommandArgs.PV.Vote")]),
+ new("HM", "{id}", GetString("CommandDescription.HM"), Command.UsageLevels.Everyone, Command.UsageTimes.AfterDeath, HMCommand, true, false, [GetString("CommandArgs.HM.Id")]),
+ new("Decree", "{number}", GetString("CommandDescription.Decree"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, DecreeCommand, true, true, [GetString("CommandArgs.Decree.Number")]),
+ new("AddVIP", "{id}", GetString("CommandDescription.AddVIP"), Command.UsageLevels.Host, Command.UsageTimes.Always, AddVIPCommand, true, false, [GetString("CommandArgs.AddVIP.Id")]),
+ new("DeleteVIP", "{id}", GetString("CommandDescription.DeleteVIP"), Command.UsageLevels.Host, Command.UsageTimes.Always, DeleteVIPCommand, true, false, [GetString("CommandArgs.DeleteVIP.Id")]),
+ new("Assume", "{id} {number}", GetString("CommandDescription.Assume"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, AssumeCommand, true, true, [GetString("CommandArgs.Assume.Id"), GetString("CommandArgs.Assume.Number")]),
+ new("Note", "{action} [?]", GetString("CommandDescription.Note"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, NoteCommand, true, true, [GetString("CommandArgs.Note.Action"), GetString("CommandArgs.Note.UnknownValue")]),
+ new("OS", "{chance} {role}", GetString("CommandDescription.OS"), Command.UsageLevels.HostOrAdmin, Command.UsageTimes.InLobby, OSCommand, true, false, [GetString("CommandArgs.OS.Chance"), GetString("CommandArgs.OS.Role")]),
+ new("Negotiation", "{number}", GetString("CommandDescription.Negotiation"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, NegotiationCommand, true, false, [GetString("CommandArgs.Negotiation.Number")]),
+ new("Mute", "{id} [duration]", GetString("CommandDescription.Mute"), Command.UsageLevels.HostOrModerator, Command.UsageTimes.AfterDeathOrLobby, MuteCommand, true, false, [GetString("CommandArgs.Mute.Id"), GetString("CommandArgs.Mute.Duration")]),
+ new("Unmute", "{id}", GetString("CommandDescription.Unmute"), Command.UsageLevels.HostOrAdmin, Command.UsageTimes.Always, UnmuteCommand, true, false, [GetString("CommandArgs.Unmute.Id")]),
+ new("DraftStart", "", GetString("CommandDescription.DraftStart"), Command.UsageLevels.HostOrModerator, Command.UsageTimes.InLobby, DraftStartCommand, true, false),
+ new("DraftDescription", "{index}", GetString("CommandDescription.DraftDescription"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, DraftDescriptionCommand, false, false, [GetString("CommandArgs.DraftDescription.Index")]),
+ new("Draft", "{number}", GetString("CommandDescription.Draft"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, DraftCommand, false, false, [GetString("CommandArgs.Draft.Number")]),
+ new("ReadyCheck", "", GetString("CommandDescription.ReadyCheck"), Command.UsageLevels.HostOrModerator, Command.UsageTimes.InLobby, ReadyCheckCommand, true, false),
+ new("Ready", "", GetString("CommandDescription.Ready"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, ReadyCommand, true, false),
+ new("EnableAllRoles", "", GetString("CommandDescription.EnableAllRoles"), Command.UsageLevels.Host, Command.UsageTimes.InLobby, EnableAllRolesCommand, true, false),
+ new("Achievements", "", GetString("CommandDescription.Achievements"), Command.UsageLevels.Modded, Command.UsageTimes.Always, AchievementsCommand, true, false),
+ new("DeathNote", "{name}", GetString("CommandDescription.DeathNote"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, DeathNoteCommand, true, true, [GetString("CommandArgs.DeathNote.Name")]),
+ new("Whisper", "{id} {message}", GetString("CommandDescription.Whisper"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, WhisperCommand, true, true, [GetString("CommandArgs.Whisper.Id"), GetString("CommandArgs.Whisper.Message")]),
+ new("HWhisper", "{id} {message}", GetString("CommandDescription.HWhisper"), Command.UsageLevels.Host, Command.UsageTimes.Always, HWhisperCommand, true, false, [GetString("CommandArgs.HWhisper.Id"), GetString("CommandArgs.HWhisper.Message")]),
+ new("Spectate", "[id]", GetString("CommandDescription.Spectate"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, SpectateCommand, false, false, [GetString("CommandArgs.Spectate.Id")]),
+ new("Anagram", "", GetString("CommandDescription.Anagram"), Command.UsageLevels.Everyone, Command.UsageTimes.AfterDeathOrLobby, AnagramCommand, true, false),
+ new("RoleList", "", GetString("CommandDescription.RoleList"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, RoleListCommand, true, false),
+ new("JailTalk", "{message}", GetString("CommandDescription.JailTalk"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, JailTalkCommand, true, true, [GetString("CommandArgs.JailTalk.Message")]),
+ new("GameModeList", "", GetString("CommandDescription.GameModeList"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, GameModeListCommand, true, false),
+ new("GameModePoll", "", GetString("CommandDescription.GameModePoll"), Command.UsageLevels.HostOrModerator, Command.UsageTimes.InLobby, GameModePollCommand, true, false),
+ new("MapPoll", "", GetString("CommandDescription.MapPoll"), Command.UsageLevels.HostOrModerator, Command.UsageTimes.InLobby, MapPollCommand, true, false),
+ new("EightBall", "[question]", GetString("CommandDescription.EightBall"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, EightBallCommand, false, false, [GetString("CommandArgs.EightBall.Question")]),
+ new("AddTag", "{id} {color} {tag}", GetString("CommandDescription.AddTag"), Command.UsageLevels.Host, Command.UsageTimes.Always, AddTagCommand, true, false, [GetString("CommandArgs.AddTag.Id"), GetString("CommandArgs.AddTag.Color"), GetString("CommandArgs.AddTag.Tag")]),
+ new("DeleteTag", "{id}", GetString("CommandDescription.DeleteTag"), Command.UsageLevels.Host, Command.UsageTimes.InLobby, DeleteTagCommand, true, false, [GetString("CommandArgs.DeleteTag.Id")]),
+ new("DayBreak", "", GetString("CommandDescription.DayBreak"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, DayBreakCommand, true, true),
+ new("Fix", "{id}", GetString("CommandDescription.Fix"), Command.UsageLevels.HostOrModerator, Command.UsageTimes.InGame, FixCommand, true, false, [GetString("CommandArgs.Fix.Id")]),
+ new("XOR", "{role} {role}", GetString("CommandDescription.XOR"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, XORCommand, true, false, [GetString("CommandArgs.XOR.Role"), GetString("CommandArgs.XOR.Role")]),
+ new("ChemistInfo", "", GetString("CommandDescription.ChemistInfo"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, ChemistInfoCommand, true, false),
+ new("Forge", "{id} {role}", GetString("CommandDescription.Forge"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, ForgeCommand, true, true, [GetString("CommandArgs.Forge.Id"), GetString("CommandArgs.Forge.Role")]),
+ new("Choose", "{role}", GetString("CommandDescription.Choose"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, ChooseCommand, true, true, [GetString("CommandArgs.Choose.Role")]),
+ new("CopyPreset", "{sourcepreset} {targetpreset}", GetString("CommandDescription.CopyPreset"), Command.UsageLevels.Host, Command.UsageTimes.InLobby, CopyPresetCommand, true, false, [GetString("CommandArgs.CopyPreset.SourcePreset"), GetString("CommandArgs.CopyPreset.TargetPreset")]),
+ new("AddAdmin", "{id}", GetString("CommandDescription.AddAdmin"), Command.UsageLevels.Host, Command.UsageTimes.Always, AddAdminCommand, true, false, [GetString("CommandArgs.AddAdmin.Id")]),
+ new("DeleteAdmin", "{id}", GetString("CommandDescription.DeleteAdmin"), Command.UsageLevels.Host, Command.UsageTimes.Always, DeleteAdminCommand, true, false, [GetString("CommandArgs.DeleteAdmin.Id")]),
+ new("VoteStart", "", GetString("CommandDescription.VoteStart"), Command.UsageLevels.Everyone, Command.UsageTimes.InLobby, VoteStartCommand, true, false),
+ new("Imitate", "{id}", GetString("CommandDescription.Imitate"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, ImitateCommand, true, true, [GetString("CommandArgs.Imitate.Id")]),
+ new("Retribute", "{id}", GetString("CommandDescription.Retribute"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, RetributeCommand, true, true, [GetString("CommandArgs.Retribute.Id")]),
+ new("Revive", "{id}", GetString("CommandDescription.Revive"), Command.UsageLevels.Host, Command.UsageTimes.InGame, ReviveCommand, true, false, [GetString("CommandArgs.Revive.Id")]),
+ new("Select", "{id} {role}", GetString("CommandDescription.Select"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, SelectCommand, true, true, [GetString("CommandArgs.Select.Id"), GetString("CommandArgs.Select.Role")]),
+ new("UIScale", "{scale}", GetString("CommandDescription.UIScale"), Command.UsageLevels.Modded, Command.UsageTimes.Always, UIScaleCommand, true, false, [GetString("CommandArgs.UIScale.Scale")]),
+ new("Fabricate", "{deathreason}", GetString("CommandDescription.Fabricate"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, FabricateCommand, true, true, [GetString("CommandArgs.Fabricate.DeathReason")]),
+ new("Start", "", GetString("CommandDescription.Start"), Command.UsageLevels.HostOrModerator, Command.UsageTimes.InLobby, StartCommand, false, false),
+ new("ConfirmAuth", "{uuid}", GetString("CommandDescription.ConfirmAuth"), Command.UsageLevels.Everyone, Command.UsageTimes.Always, ConfirmAuthCommand, true, false, [GetString("CommandArgs.ConfirmAuth.UUID")]),
- };
+ // Commands with action handled elsewhere
+ new("Guess", "{id} {role}", GetString("CommandDescription.Guess"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, (_, _, _) => { }, true, false, [GetString("CommandArgs.Guess.Id"), GetString("CommandArgs.Guess.Role")]),
+ new("Trial", "{id}", GetString("CommandDescription.Trial"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, (_, _, _) => { }, true, false, [GetString("CommandArgs.Trial.Id")]),
+ new("Swap", "{id}", GetString("CommandDescription.Swap"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, (_, _, _) => { }, true, false, [GetString("CommandArgs.Swap.Id")]),
+ new("Compare", "{id1} {id2}", GetString("CommandDescription.Compare"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, (_, _, _) => { }, true, false, [GetString("CommandArgs.Compare.Id1"), GetString("CommandArgs.Compare.Id2")]),
+ new("Medium", "{answer}", GetString("CommandDescription.Medium"), Command.UsageLevels.Everyone, Command.UsageTimes.InMeeting, (_, _, _) => { }, true, false, [GetString("CommandArgs.Medium.Answer")]),
+ new("Revenge", "{id}", GetString("CommandDescription.Revenge"), Command.UsageLevels.Everyone, Command.UsageTimes.AfterDeath, (_, _, _) => { }, true, false, [GetString("CommandArgs.Revenge.Id")])
+ ];
}
private static string[] ModsFileCache = [];
@@ -405,7 +405,7 @@ internal static class ChatCommands
Utils.CheckServerCommand(ref text, out _);
string[] args = text.Split(' ');
- foreach ((string key, Command command) in Command.AllCommands)
+ foreach (Command command in Command.AllCommands)
{
if (!command.IsThisCommand(text)) continue;
@@ -415,9 +415,16 @@ internal static class ChatCommands
if (!command.CanUseCommand(PlayerControl.LocalPlayer, sendErrorMessage: true))
goto Canceled;
- command.Action(PlayerControl.LocalPlayer, key, text, args);
- if (command.IsCanceled) goto Canceled;
+ if (!AmongUsClient.Instance.AmHost && command.UsageLevel != Command.UsageLevels.Modded && command.Key != "ChemistInfo")
+ {
+ RequestCommandProcessingFromHost(text, command.Key);
+ if (command.IsCanceled) goto Canceled;
+ break;
+ }
+
+ command.Action(PlayerControl.LocalPlayer, text, args);
+ if (command.IsCanceled) goto Canceled;
break;
}
@@ -498,39 +505,25 @@ internal static class ChatCommands
}
}
- private static void RequestCommandProcessingFromHost(string text, string commandKey)
+ public static void RequestCommandProcessingFromHost(string text, string commandKey)
{
- PlayerControl pc = PlayerControl.LocalPlayer;
- MessageWriter w = AmongUsClient.Instance.StartRpcImmediately(pc.NetId, (byte)CustomRPC.RequestCommandProcessing, SendOption.Reliable, AmongUsClient.Instance.HostId);
- w.Write(commandKey);
- w.Write(pc.PlayerId);
- w.Write(text);
- AmongUsClient.Instance.FinishRpcImmediately(w);
+ MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.RequestCommandProcessing, SendOption.Reliable, AmongUsClient.Instance.HostId);
+ writer.Write(commandKey);
+ writer.Write(text);
+ AmongUsClient.Instance.FinishRpcImmediately(writer);
}
// ---------------------------------------------------------------------------------------------------------------------------------------------
- private static void StartCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void StartCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
VotedToStart.UnionWith(Main.AllPlayerControls.Select(x => x.PlayerId));
}
- private static void FabricateCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void FabricateCommand(PlayerControl player, string text, string[] args)
{
if (Starspawn.IsDayBreak) return;
-
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
+
if (!Main.PlayerStates.TryGetValue(player.PlayerId, out PlayerState state) || state.IsDead || state.Role is not Fabricator fab) return;
if (args.Length < 2 || !Enum.GetValues().FindFirst(x => GetString($"DeathReason.{x}").Replace(" ", string.Empty).Equals(args[1].Replace(" ", string.Empty), StringComparison.OrdinalIgnoreCase), out PlayerState.DeathReason newDeathReason))
@@ -546,22 +539,16 @@ internal static class ChatCommands
MeetingManager.SendCommandUsedMessage(args[0]);
}
- private static void UIScaleCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void UIScaleCommand(PlayerControl player, string text, string[] args)
{
if (args.Length < 2 || !float.TryParse(args[1], out float scale) || scale == 0f) return;
HudManagerStartPatch.TryResizeUI(scale);
}
- private static void SelectCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void SelectCommand(PlayerControl player, string text, string[] args)
{
if (Starspawn.IsDayBreak) return;
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!Main.PlayerStates.TryGetValue(player.PlayerId, out PlayerState state) || state.IsDead || state.Role is not Loner loner || loner.Done) return;
if (args.Length < 3 || !GuessManager.MsgToPlayerAndRole(text[7..], out byte targetId, out CustomRoles pickedRole, out _) || targetId == player.PlayerId) return;
if (!pickedRole.IsImpostor() || pickedRole.IsVanilla() || CustomRoleSelector.RoleResult.ContainsValue(pickedRole) || pickedRole.GetMode() == 0) return;
@@ -575,7 +562,7 @@ internal static class ChatCommands
MeetingManager.SendCommandUsedMessage(args[0]);
}
- private static void ReviveCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void ReviveCommand(PlayerControl player, string text, string[] args)
{
if ((!Options.NoGameEnd.GetBool() && !player.FriendCode.GetDevUser().up) || args.Length < 2 || !byte.TryParse(args[1], out byte targetId)) return;
@@ -585,14 +572,8 @@ internal static class ChatCommands
target.RpcRevive();
}
- private static void ConfirmAuthCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void ConfirmAuthCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (GameStates.CurrentServerType != GameStates.ServerType.Vanilla)
{
Utils.SendMessage("\n", player.PlayerId, GetString("ConfirmAuth.ErrorNotVanilla"));
@@ -660,16 +641,10 @@ internal static class ChatCommands
}
}
- public static void RetributeCommand(PlayerControl player, string commandKey, string text, string[] args)
+ public static void RetributeCommand(PlayerControl player, string text, string[] args)
{
if (Starspawn.IsDayBreak) return;
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!player.IsAlive() || !Main.PlayerStates.TryGetValue(player.PlayerId, out PlayerState state) || state.Role is not Retributionist { Notified: true } rb || rb.Camping == byte.MaxValue) return;
PlayerControl campTarget = Utils.GetPlayerById(rb.Camping);
@@ -709,16 +684,10 @@ internal static class ChatCommands
MeetingManager.SendCommandUsedMessage(args[0]);
}
- public static void ImitateCommand(PlayerControl player, string commandKey, string text, string[] args)
+ public static void ImitateCommand(PlayerControl player, string text, string[] args)
{
if (Starspawn.IsDayBreak) return;
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!Imitator.PlayerIdList.Contains(player.PlayerId) || !player.IsAlive() || args.Length < 2 || !byte.TryParse(args[1], out byte targetId) || !Main.PlayerStates.TryGetValue(targetId, out PlayerState targetState)) return;
if (!targetState.IsDead)
@@ -743,14 +712,8 @@ internal static class ChatCommands
MeetingManager.SendCommandUsedMessage(args[0]);
}
- private static void VoteStartCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void VoteStartCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (Options.DisableVoteStartCommand.GetBool())
{
Utils.SendMessage("\n", player.PlayerId, GetString("VoteStartDisabled"));
@@ -767,14 +730,8 @@ internal static class ChatCommands
}
}
- private static void DeleteAdminCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void DeleteAdminCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (args.Length < 2 || !byte.TryParse(args[1], out byte remAdminId)) return;
PlayerControl remAdminPc = Utils.GetPlayerById(remAdminId);
@@ -792,14 +749,8 @@ internal static class ChatCommands
Utils.SendMessage(GetString("PlayerRemovedFromAdminList"), player.PlayerId);
}
- private static void AddAdminCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void AddAdminCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (args.Length < 2 || !byte.TryParse(args[1], out byte newAdminId)) return;
PlayerControl newAdminPc = Utils.GetPlayerById(newAdminId);
@@ -812,7 +763,7 @@ internal static class ChatCommands
Utils.SendMessage(GetString("PlayerAddedToAdminList"), player.PlayerId);
}
- private static void CopyPresetCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void CopyPresetCommand(PlayerControl player, string text, string[] args)
{
if (args.Length < 3 || !int.TryParse(args[1], out int sourcePresetId) || sourcePresetId is < 1 or > 10 || (!int.TryParse(args[2], out int targetPreset) && targetPreset is < 1 or > 10)) return;
@@ -835,14 +786,8 @@ internal static class ChatCommands
}
}
- private static void ChooseCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void ChooseCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!player.IsAlive() || !player.Is(CustomRoles.Pawn) || !Main.PlayerStates.TryGetValue(player.PlayerId, out var state)) return;
if (args.Length < 2 || !GetRoleByName(string.Join(' ', args[1..]), out var role) || role.GetMode() == 0) return;
@@ -851,16 +796,10 @@ internal static class ChatCommands
MeetingManager.SendCommandUsedMessage(args[0]);
}
- private static void ForgeCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void ForgeCommand(PlayerControl player, string text, string[] args)
{
if (Starspawn.IsDayBreak) return;
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!player.IsAlive() || !player.Is(CustomRoles.Forger) || player.GetAbilityUseLimit() < 1) return;
if (args.Length < 3 || !GuessManager.MsgToPlayerAndRole(text[6..], out byte targetId, out CustomRoles forgeRole, out _)) return;
@@ -872,19 +811,13 @@ internal static class ChatCommands
MeetingManager.SendCommandUsedMessage(args[0]);
}
- private static void ChemistInfoCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void ChemistInfoCommand(PlayerControl player, string text, string[] args)
{
Utils.SendMessage(Chemist.GetProcessesInfo(), player.PlayerId, CustomRoles.Chemist.ToColoredString());
}
- private static void XORCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void XORCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if ((!player.IsHost() && !IsPlayerAdmin(player.FriendCode)) || args.Length < 3 || !GetRoleByName(args[1], out CustomRoles role1) || !GetRoleByName(args[2], out CustomRoles role2))
{
Utils.SendMessage(string.Join('\n', Main.XORRoles.ConvertAll(x => $"{x.Item1.ToColoredString()} ⊕ {x.Item2.ToColoredString()}")), player.PlayerId, GetString("XORListTitle"));
@@ -913,14 +846,8 @@ internal static class ChatCommands
Utils.SendMessage("\n", player.PlayerId, string.Format(GetString("XORAdded"), role1.ToColoredString(), role2.ToColoredString()));
}
- private static void FixCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void FixCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (args.Length < 2 || !byte.TryParse(args[1], out byte id)) return;
var pc = id.GetPlayer();
@@ -932,14 +859,8 @@ internal static class ChatCommands
Logger.SendInGame(GetString("FixBlackScreenWaitForDead"), Color.yellow);
}
- public static void DayBreakCommand(PlayerControl player, string commandKey, string text, string[] args)
+ public static void DayBreakCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!player.IsAlive() || Main.PlayerStates[player.PlayerId].Role is not Starspawn sp || sp.HasUsedDayBreak) return;
Starspawn.IsDayBreak = true;
@@ -949,7 +870,7 @@ internal static class ChatCommands
Utils.SendMessage("\n", title: string.Format(GetString("StarspawnUsedDayBreak"), CustomRoles.Starspawn.ToColoredString()));
}
- private static void AddTagCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void AddTagCommand(PlayerControl player, string text, string[] args)
{
if (args.Length < 4 || !byte.TryParse(args[1], out byte id)) return;
@@ -963,7 +884,7 @@ internal static class ChatCommands
Utils.SendMessage("\n", player.PlayerId, string.Format(GetString("AddTagSuccess"), tag, id.ColoredPlayerName(), id));
}
- private static void DeleteTagCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void DeleteTagCommand(PlayerControl player, string text, string[] args)
{
if (args.Length < 2 || !byte.TryParse(args[1], out byte id)) return;
@@ -975,7 +896,7 @@ internal static class ChatCommands
Utils.DirtyName.Add(pc.PlayerId);
}
- private static void EightBallCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void EightBallCommand(PlayerControl player, string text, string[] args)
{
if (Options.Disable8ballCommand.GetBool())
{
@@ -983,51 +904,27 @@ internal static class ChatCommands
return;
}
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
Utils.SendMessage(GetString($"8BallResponse.{IRandom.Instance.Next(20)}"), player.IsAlive() ? byte.MaxValue : player.PlayerId, GetString("8BallResponseTitle"));
}
- public static void GameModePollCommand(PlayerControl player, string commandKey, string text, string[] args)
+ public static void GameModePollCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
GMPollGameModes = Enum.GetValues()[..^1].Where(x => Options.GMPollGameModesSettings[x].GetBool()).ToList();
string gmNames = string.Join(' ', GMPollGameModes.Select(x => GetString(x.ToString()).Replace(' ', '_')));
var msg = $"/poll {GetString("GameModePoll.Question").TrimEnd('?')}? {gmNames}";
- PollCommand(player, "Command.Poll", msg, msg.Split(' '));
+ PollCommand(player, msg, msg.Split(' '));
}
- public static void MapPollCommand(PlayerControl player, string commandKey, string text, string[] args)
+ public static void MapPollCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
MPollMaps = Enum.GetValues().Where(x => Options.MPollMapsSettings[x].GetBool()).ToList();
string mNames = string.Join(' ', MPollMaps.Select(x => GetString(x.ToString()).Replace(' ', '_')));
var msg = $"/poll {GetString("MapPoll.Question").TrimEnd('?')}? {mNames}";
- PollCommand(player, "Command.Poll", msg, msg.Split(' '));
+ PollCommand(player, msg, msg.Split(' '));
}
- private static void GameModeListCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void GameModeListCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
string info = string.Join("\n\n", Enum.GetValues()[1..^1]
.Select(x => (GameMode: x, Color: Main.RoleColors.GetValueOrDefault(CustomRoleSelector.GameModeRoles.TryGetValue(x, out CustomRoles role) ? role : x == CustomGameMode.HideAndSeek ? CustomRoles.Hider : CustomRoles.Witness, "#000000")))
.Select(x => $"<{x.Color}>{GetString($"{x.GameMode}")}\n{GetString($"ModeDescribe.{x.GameMode}").Split("\n\n")[0]}"));
@@ -1035,16 +932,10 @@ internal static class ChatCommands
Utils.SendMessage(info, player.PlayerId, GetString("GameModeListTitle"));
}
- private static void JailTalkCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void JailTalkCommand(PlayerControl player, string text, string[] args)
{
if (args.Length < 2) return;
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
Jailor jailor = Main.PlayerStates[player.PlayerId].Role as Jailor ?? Main.PlayerStates.Select(x => x.Value.Role as Jailor).FirstOrDefault(x => x != null);
if (jailor == null) return;
@@ -1062,14 +953,8 @@ internal static class ChatCommands
MeetingManager.SendCommandUsedMessage(args[0]);
}
- private static void RoleListCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void RoleListCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
StringBuilder sb = new("");
Dictionary rot = Enum.GetValues()
@@ -1153,14 +1038,8 @@ internal static class ChatCommands
Utils.SendMessage("\n", player.PlayerId, sb.ToString().Trim() + "");
}
- private static void AnagramCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void AnagramCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
Main.Instance.StartCoroutine(Main.GetRandomWord(CreateAnagram));
return;
@@ -1173,14 +1052,8 @@ internal static class ChatCommands
}
}
- private static void SpectateCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void SpectateCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (player.IsHost() && args.Length > 1 && byte.TryParse(args[1], out byte targetId))
{
PlayerControl pc = targetId.GetPlayer();
@@ -1216,14 +1089,8 @@ internal static class ChatCommands
Utils.SendMessage("\n", player.PlayerId, GetString("SpectateCommand.Success"));
}
- private static void WhisperCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void WhisperCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!player.IsAlive() || Silencer.ForSilencer.Contains(player.PlayerId)) return;
if (Options.DisableWhisperCommand.GetBool())
@@ -1267,7 +1134,7 @@ internal static class ChatCommands
}
}
- private static void HWhisperCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void HWhisperCommand(PlayerControl player, string text, string[] args)
{
if (args.Length < 3 || !byte.TryParse(args[1], out byte targetId)) return;
@@ -1278,16 +1145,10 @@ internal static class ChatCommands
ChatUpdatePatch.LastMessages.Add((msg, targetId, title, Utils.TimeStamp));
}
- private static void DeathNoteCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void DeathNoteCommand(PlayerControl player, string text, string[] args)
{
if (Starspawn.IsDayBreak) return;
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!player.Is(CustomRoles.NoteKiller) || args.Length < 2) return;
if (!NoteKiller.CanGuess)
@@ -1336,7 +1197,7 @@ internal static class ChatCommands
MeetingManager.SendCommandUsedMessage(args[0]);
}
- private static void AchievementsCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void AchievementsCommand(PlayerControl player, string text, string[] args)
{
Func ToAchievementString = x => $"{GetString($"Achievement.{x}")} - {GetString($"Achievement.{x}.Description")}";
@@ -1349,28 +1210,16 @@ internal static class ChatCommands
Utils.SendMessage(completedAchievements, player.PlayerId, GetString("CompletedAchievementsTitle") + $" <#00a5ff>(<#00ffa5>{union.Length}/{allAchievements.Length})");
}
- private static void EnableAllRolesCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void EnableAllRolesCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
Prompt.Show(
GetString("Promt.EnableAllRoles"),
() => Options.CustomRoleSpawnChances.Values.DoIf(x => x.GetValue() == 0, x => x.SetValue(1)),
() => Utils.EnterQuickSetupRoles(false));
}
- public static void ReadyCheckCommand(PlayerControl player, string commandKey, string text, string[] args)
+ public static void ReadyCheckCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
Utils.SendMessage(GetString("ReadyCheckMessage"), title: GetString("ReadyCheckTitle"));
ReadyPlayers = [player.PlayerId];
ReadyPlayers.UnionWith(Spectators);
@@ -1403,27 +1252,15 @@ internal static class ChatCommands
}
}
- private static void ReadyCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void ReadyCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
ReadyPlayers.Add(player.PlayerId);
}
- public static void DraftStartCommand(PlayerControl player, string commandKey, string text, string[] args)
+ public static void DraftStartCommand(PlayerControl player, string text, string[] args)
{
if (Options.CurrentGameMode != CustomGameMode.Standard) return;
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
DraftResult = [];
byte[] allPlayerIds = Main.AllPlayerControls.Select(x => x.PlayerId).ToArray();
@@ -1494,14 +1331,8 @@ internal static class ChatCommands
}
}
- private static void DraftDescriptionCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void DraftDescriptionCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (DraftRoles.Count == 0 || !DraftRoles.TryGetValue(player.PlayerId, out List roles) || args.Length < 2 || !int.TryParse(args[1], out int chosenIndex) || roles.Count < chosenIndex) return;
CustomRoles role = roles[chosenIndex - 1];
@@ -1527,14 +1358,8 @@ internal static class ChatCommands
}
}
- private static void DraftCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void DraftCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (DraftRoles.Count == 0 || !DraftRoles.TryGetValue(player.PlayerId, out List roles) || args.Length < 2 || !int.TryParse(args[1], out int chosenIndex)) return;
if (roles.Count < chosenIndex || chosenIndex < 1)
@@ -1551,14 +1376,8 @@ internal static class ChatCommands
if (DraftResult.Count >= DraftRoles.Count) Utils.SendMessage("\n", PlayerControl.LocalPlayer.PlayerId, GetString("EveryoneDrafted"));
}
- private static void MuteCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void MuteCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
bool host = player.IsHost();
if (!host && (GameStates.InGame || MutedPlayers.ContainsKey(player.PlayerId))) return;
if (!byte.TryParse(args[1], out byte id) || id.IsHost() || (!host && IsPlayerModerator(id.GetPlayer()?.FriendCode))) return;
@@ -1575,14 +1394,8 @@ internal static class ChatCommands
messages.SendMultipleMessages();
}
- private static void UnmuteCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void UnmuteCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (args.Length < 2 || !byte.TryParse(args[1], out byte id)) return;
MutedPlayers.Remove(id);
@@ -1591,14 +1404,8 @@ internal static class ChatCommands
if (!player.IsHost()) Utils.SendMessage("\n", 0, string.Format(GetString("AdminUnmuted"), player.PlayerId.ColoredPlayerName(), id.ColoredPlayerName()));
}
- private static void NegotiationCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void NegotiationCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!Negotiator.On || !player.IsAlive() || args.Length < 2 || !int.TryParse(args[1], out int index)) return;
Negotiator.ReceiveCommand(player, index);
@@ -1606,14 +1413,8 @@ internal static class ChatCommands
MeetingManager.SendCommandUsedMessage(args[0]);
}
- private static void OSCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void OSCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!GameStates.IsLobby || args.Length < 3 || !byte.TryParse(args[1], out byte chance) || chance > 100 || chance % 5 != 0 || !GetRoleByName(string.Join(' ', args[2..]), out CustomRoles role) || !Options.CustomRoleSpawnChances.TryGetValue(role, out StringOptionItem option)) return;
if (role.IsAdditionRole())
@@ -1626,16 +1427,10 @@ internal static class ChatCommands
option.SetValue(chance / 5);
}
- private static void NoteCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void NoteCommand(PlayerControl player, string text, string[] args)
{
if (Starspawn.IsDayBreak) return;
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!player.Is(CustomRoles.Journalist) || !player.IsAlive()) return;
Journalist.OnReceiveCommand(player, args);
@@ -1643,16 +1438,10 @@ internal static class ChatCommands
MeetingManager.SendCommandUsedMessage(args[0]);
}
- private static void AssumeCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void AssumeCommand(PlayerControl player, string text, string[] args)
{
if (Starspawn.IsDayBreak) return;
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (args.Length < 3 || !byte.TryParse(args[1], out byte id) || !int.TryParse(args[2], out int num) || !player.Is(CustomRoles.Assumer) || !player.IsAlive()) return;
Assumer.Assume(player.PlayerId, id, num);
@@ -1660,7 +1449,7 @@ internal static class ChatCommands
MeetingManager.SendCommandUsedMessage(args[0]);
}
- private static void DeleteVIPCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void DeleteVIPCommand(PlayerControl player, string text, string[] args)
{
if (args.Length < 2 || !byte.TryParse(args[1], out byte VIPId)) return;
@@ -1675,7 +1464,7 @@ internal static class ChatCommands
Utils.SendMessage(GetString("PlayerRemovedFromVIPList"), player.PlayerId);
}
- private static void AddVIPCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void AddVIPCommand(PlayerControl player, string text, string[] args)
{
if (args.Length < 2 || !byte.TryParse(args[1], out byte newVIPId)) return;
@@ -1689,16 +1478,10 @@ internal static class ChatCommands
Utils.SendMessage(GetString("PlayerAddedToVIPList"), player.PlayerId);
}
- private static void DecreeCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void DecreeCommand(PlayerControl player, string text, string[] args)
{
if (Starspawn.IsDayBreak) return;
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!player.Is(CustomRoles.President)) return;
LateTask.New(() =>
@@ -1713,14 +1496,8 @@ internal static class ChatCommands
}, 0.2f, log: false);
}
- private static void HMCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void HMCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!player.Is(CustomRoles.Messenger) || Messenger.Sent.Contains(player.PlayerId) || args.Length < 2 || !int.TryParse(args[1], out int id) || id is > 3 or < 1) return;
Main.Instance.StartCoroutine(SendOnMeeting());
@@ -1752,14 +1529,8 @@ internal static class ChatCommands
}
// Credit: Drakos for the base code
- private static void PollCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void PollCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
PollVotes.Clear();
PollAnswers.Clear();
PollVoted.Clear();
@@ -1857,14 +1628,8 @@ internal static class ChatCommands
}
}
- private static void PVCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void PVCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (PollVotes.Count == 0)
{
Utils.SendMessage(GetString("Poll.Inactive"), player.PlayerId, sendOption: SendOption.None);
@@ -1890,30 +1655,18 @@ internal static class ChatCommands
Utils.SendMessage(string.Format(GetString("Poll.YouVoted"), vote, PollVotes[vote]), player.PlayerId);
}
- private static void HelpCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void HelpCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
Utils.ShowHelp(player.PlayerId);
}
- private static void DumpCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void DumpCommand(PlayerControl player, string text, string[] args)
{
Utils.DumpLog();
}
- private static void GNOCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void GNOCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!GameStates.IsLobby && player.IsAlive())
{
Utils.SendMessage(GetString("GNoCommandInfo"), player.PlayerId, sendOption: SendOption.None);
@@ -1964,39 +1717,20 @@ internal static class ChatCommands
Main.GuessNumber[player.PlayerId][1] = 7;
}
- private static void SDCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void SDCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (args.Length < 1 || !int.TryParse(args[1], out int sound1)) return;
-
- RPC.PlaySoundRPC(player.PlayerId, (Sounds)sound1);
+ RPC.PlaySound(player.PlayerId, (Sounds)sound1);
}
- private static void CSDCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void CSDCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
string subArgs = text.Remove(0, 3);
- player.RPCPlayCustomSound(subArgs.Trim());
+ CustomSoundsManager.Play(subArgs.Trim());
}
- private static void MTHYCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void MTHYCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (GameStates.IsMeeting)
{
MeetingHudRpcClosePatch.AllowClose = true;
@@ -2006,14 +1740,8 @@ internal static class ChatCommands
player.NoCheckStartMeeting(null, true);
}
- private static void CosIDCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void CosIDCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
NetworkedPlayerInfo.PlayerOutfit of = player.Data.DefaultOutfit;
Logger.Warn($"ColorId: {of.ColorId}", "Get Cos Id");
Logger.Warn($"PetId: {of.PetId}", "Get Cos Id");
@@ -2023,28 +1751,16 @@ internal static class ChatCommands
Logger.Warn($"NamePlateId: {of.NamePlateId}", "Get Cos Id");
}
- private static void EndCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void EndCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!player.IsHost() && !IsPlayerAdmin(player.FriendCode)) return;
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Draw);
GameManager.Instance.LogicFlow.CheckEndCriteria();
}
- private static void ChangeRoleCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void ChangeRoleCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (GameStates.IsLobby || !player.FriendCode.GetDevUser().up) return;
string subArgs = text.Remove(0, 8);
@@ -2071,28 +1787,16 @@ internal static class ChatCommands
}
}
- private static void IDCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void IDCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
string msgText = GetString("PlayerIdList");
msgText = Main.AllPlayerControls.Aggregate(msgText, (current, pc) => $"{current}\n{pc.PlayerId} \u2192 {pc.GetRealName()}");
Utils.SendMessage(msgText, player.PlayerId);
}
- private static void ColorCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void ColorCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (GameStates.IsInGame)
{
Utils.SendMessage(GetString("Message.OnlyCanUseInLobby"), player.PlayerId, sendOption: SendOption.None);
@@ -2118,14 +1822,8 @@ internal static class ChatCommands
Utils.SendMessage(string.Format(GetString("Message.SetColor"), subArgs), player.PlayerId, sendOption: SendOption.None);
}
- private static void KillCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void KillCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (GameStates.IsLobby)
{
Utils.SendMessage(GetString("Message.CanNotUseInLobby"), player.PlayerId, sendOption: SendOption.None);
@@ -2147,14 +1845,8 @@ internal static class ChatCommands
}
}
- private static void ExeCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void ExeCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (GameStates.IsLobby)
{
Utils.SendMessage(GetString("Message.CanNotUseInLobby"), player.PlayerId, sendOption: SendOption.None);
@@ -2180,14 +1872,8 @@ internal static class ChatCommands
}
}
- private static void BanKickCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void BanKickCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
// Check if the Kick command is enabled in the settings
if (!Options.ApplyModeratorList.GetBool() && !player.IsHost())
{
@@ -2257,16 +1943,10 @@ internal static class ChatCommands
AmongUsClient.Instance.KickPlayer(kickedPlayer.OwnerId, args[0] == "/ban");
}
- private static void CheckCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void CheckCommand(PlayerControl player, string text, string[] args)
{
if (Starspawn.IsDayBreak) return;
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!player.IsAlive() || !player.Is(CustomRoles.Inquirer) || player.GetAbilityUseLimit() < 1) return;
if (args.Length < 3 || !GuessManager.MsgToPlayerAndRole(text[6..], out byte checkId, out CustomRoles checkRole, out _)) return;
@@ -2280,16 +1960,10 @@ internal static class ChatCommands
MeetingManager.SendCommandUsedMessage(args[0]);
}
- private static void ChatCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void ChatCommand(PlayerControl player, string text, string[] args)
{
if (Starspawn.IsDayBreak) return;
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!Ventriloquist.On || !player.IsAlive() || !player.Is(CustomRoles.Ventriloquist) || player.PlayerId.GetAbilityUseLimit() < 1) return;
var vl2 = (Ventriloquist)Main.PlayerStates[player.PlayerId].Role;
@@ -2305,16 +1979,10 @@ internal static class ChatCommands
MeetingManager.SendCommandUsedMessage(args[0]);
}
- public static void TargetCommand(PlayerControl player, string commandKey, string text, string[] args)
+ public static void TargetCommand(PlayerControl player, string text, string[] args)
{
if (Starspawn.IsDayBreak) return;
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!Ventriloquist.On || !player.IsAlive() || !player.Is(CustomRoles.Ventriloquist) || player.PlayerId.GetAbilityUseLimit() < 1) return;
var vl = (Ventriloquist)Main.PlayerStates[player.PlayerId].Role;
@@ -2325,14 +1993,8 @@ internal static class ChatCommands
MeetingManager.SendCommandUsedMessage(args[0]);
}
- private static void QSCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void QSCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!QuizMaster.On || !player.IsAlive()) return;
var qm2 = (QuizMaster)Main.PlayerStates.Values.First(x => x.Role is QuizMaster).Role;
@@ -2343,14 +2005,8 @@ internal static class ChatCommands
MeetingManager.SendCommandUsedMessage(args[0]);
}
- private static void QACommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void QACommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (args.Length < 2 || !QuizMaster.On || !player.IsAlive()) return;
var qm = (QuizMaster)Main.PlayerStates.Values.First(x => x.Role is QuizMaster).Role;
@@ -2361,42 +2017,23 @@ internal static class ChatCommands
MeetingManager.SendCommandUsedMessage(args[0]);
}
- private static void AnswerCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void AnswerCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (args.Length < 2) return;
-
Mathematician.Reply(player, args[1]);
}
- private static void AskCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void AskCommand(PlayerControl player, string text, string[] args)
{
if (Starspawn.IsDayBreak) return;
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (args.Length < 3 || !player.Is(CustomRoles.Mathematician)) return;
Mathematician.Ask(player, args[1], args[2]);
}
- private static void VoteCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void VoteCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (text.Length < 6 || !GameStates.IsMeeting) return;
string toVote = text[6..].Replace(" ", string.Empty);
@@ -2410,27 +2047,14 @@ internal static class ChatCommands
MeetingHud.Instance.CastVote(player.PlayerId, voteId);
}
- private static void SayCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void SayCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!player.IsHost() && !IsPlayerModerator(player.FriendCode)) return;
-
if (args.Length > 1) Utils.SendMessage(args[1..].Join(delimiter: " "), title: $"{GetString(player.IsHost() ? "MessageFromTheHost" : "SayTitle")}");
}
- private static void DeathCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void DeathCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!GameStates.IsInGame) return;
if (Main.DiedThisRound.Contains(player.PlayerId) && Utils.IsRevivingRoleAlive()) return;
@@ -2448,7 +2072,7 @@ internal static class ChatCommands
Utils.SendMessage("\n", player.PlayerId, string.Format(GetString("DeathCommand"), killer.PlayerId.ColoredPlayerName(), (killer.Is(CustomRoles.Bloodlust) ? $"{CustomRoles.Bloodlust.ToColoredString()} " : string.Empty) + killer.GetCustomRole().ToColoredString()));
}
- private static void MessageWaitCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void MessageWaitCommand(PlayerControl player, string text, string[] args)
{
if (args.Length > 1 && int.TryParse(args[1], out int sec))
{
@@ -2459,14 +2083,8 @@ internal static class ChatCommands
Utils.SendMessage($"{GetString("Message.MessageWaitHelp")}\n{GetString("ForExample")}:\n{args[0]} 3", 0);
}
- private static void TemplateCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void TemplateCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (player.AmOwner)
{
if (args.Length > 1)
@@ -2483,14 +2101,8 @@ internal static class ChatCommands
}
}
- private static void TPInCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void TPInCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!GameStates.IsLobby) return;
if (!Options.PlayerCanTPInAndOut.GetBool() && !IsPlayerVIP(player.FriendCode) && !player.FriendCode.GetDevUser().up)
@@ -2502,14 +2114,8 @@ internal static class ChatCommands
player.TP(new Vector2(-0.2f, 1.3f));
}
- private static void TPOutCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void TPOutCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!GameStates.IsLobby) return;
if (!Options.PlayerCanTPInAndOut.GetBool() && !IsPlayerVIP(player.FriendCode) && !player.FriendCode.GetDevUser().up)
@@ -2521,14 +2127,8 @@ internal static class ChatCommands
player.TP(new Vector2(0.1f, 3.8f));
}
- private static void MyRoleCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void MyRoleCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
CustomRoles role = player.GetCustomRole();
if (GameStates.IsInGame)
@@ -2568,41 +2168,23 @@ internal static class ChatCommands
Utils.SendMessage((player.FriendCode.GetDevUser().HasTag() ? "\n" : string.Empty) + GetString("Message.CanNotUseInLobby"), player.PlayerId);
}
- private static void AFKExemptCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void AFKExemptCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (args.Length < 2 || !byte.TryParse(args[1], out byte afkId)) return;
AFKDetector.ExemptedPlayers.Add(afkId);
Utils.SendMessage("\n", player.PlayerId, string.Format(GetString("PlayerExemptedFromAFK"), afkId.ColoredPlayerName()));
}
- private static void EffectCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void EffectCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (args.Length < 2 || !GameStates.IsInTask || !Randomizer.Exists) return;
if (Enum.TryParse(args[1], true, out Randomizer.Effect effect)) effect.Apply(player);
}
- private static void ComboCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void ComboCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if ((!player.IsHost() && !IsPlayerAdmin(player.FriendCode)) || args.Length < 4)
{
if (Main.AlwaysSpawnTogetherCombos.Count == 0 && Main.NeverSpawnTogetherCombos.Count == 0) return;
@@ -2749,14 +2331,8 @@ internal static class ChatCommands
}
}
- private static void DeleteModCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void DeleteModCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (args.Length < 2 || !byte.TryParse(args[1], out byte remModId)) return;
PlayerControl remModPc = Utils.GetPlayerById(remModId);
@@ -2774,14 +2350,8 @@ internal static class ChatCommands
Utils.SendMessage(GetString("PlayerRemovedFromModList"), player.PlayerId);
}
- private static void AddModCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void AddModCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (args.Length < 2 || !byte.TryParse(args[1], out byte newModId)) return;
PlayerControl newModPc = Utils.GetPlayerById(newModId);
@@ -2799,14 +2369,8 @@ internal static class ChatCommands
Utils.SendMessage(GetString("PlayerAddedToModList"), player.PlayerId);
}
- private static void KCountCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void KCountCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (GameStates.IsLobby || !Options.EnableKillerLeftCommand.GetBool() || Main.AllAlivePlayerControls.Length < Options.MinPlayersForGameStateCommand.GetInt())
{
Utils.SendMessage(GetString("Message.CommandUnavailable"), player.PlayerId, sendOption: SendOption.None);
@@ -2816,7 +2380,7 @@ internal static class ChatCommands
Utils.SendMessage("\n", player.PlayerId, Utils.GetGameStateData());
}
- private static void SetRoleCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void SetRoleCommand(PlayerControl player, string text, string[] args)
{
string subArgs = string.Join(' ', args[1..]);
@@ -2853,38 +2417,20 @@ internal static class ChatCommands
Prompt.Show(GetString("Promt.SetRoleRequiresPets"), () => Options.UsePets.SetValue(1), () => { });
}
- private static void UpCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void UpCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
Utils.SendMessage($"{GetString("UpReplacedMessage")}", player.PlayerId);
}
- private static void RCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void RCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
string subArgs = text.Remove(0, 2);
byte to = player.AmOwner && Input.GetKeyDown(KeyCode.LeftShift) ? byte.MaxValue : player.PlayerId;
SendRolesInfo(subArgs, to);
}
- private static void DisconnectCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void DisconnectCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
string subArgs = args.Length < 2 ? string.Empty : args[1];
switch (subArgs)
@@ -2916,14 +2462,8 @@ internal static class ChatCommands
ShipStatus.Instance.RpcUpdateSystem(SystemTypes.Admin, 0);
}
- private static void NowCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void NowCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
string subArgs = args.Length < 2 ? string.Empty : args[1];
switch (subArgs)
@@ -2942,14 +2482,8 @@ internal static class ChatCommands
}
}
- private static void LevelCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void LevelCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
string subArgs = args.Length < 2 ? string.Empty : args[1];
Utils.SendMessage(string.Format(GetString("Message.SetLevel"), subArgs), player.PlayerId);
_ = int.TryParse(subArgs, out int input);
@@ -2964,14 +2498,8 @@ internal static class ChatCommands
player.RpcSetLevel(number - 1);
}
- private static void HideNameCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void HideNameCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
Main.HideName.Value = args.Length > 1 ? string.Join(' ', args[1..]) : Main.HideName.DefaultValue.ToString();
GameStartManagerPatch.GameStartManagerStartPatch.HideName.text =
@@ -2980,14 +2508,8 @@ internal static class ChatCommands
: $"{Main.HideName.Value}";
}
- private static void RenameCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void RenameCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (args.Length < 2) return;
string name = Regex.Replace(string.Join(' ', args[1..]), "]*>", string.Empty).Trim();
@@ -3018,42 +2540,24 @@ internal static class ChatCommands
}
}
- private static void LastResultCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void LastResultCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
Utils.ShowKillLog(player.PlayerId);
Utils.ShowLastAddOns(player.PlayerId);
Utils.ShowLastRoles(player.PlayerId);
Utils.ShowLastResult(player.PlayerId);
}
- private static void WinnerCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void WinnerCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (Main.WinnerNameList.Count == 0)
Utils.SendMessage(GetString("NoInfoExists"), sendOption: SendOption.None);
else
Utils.SendMessage("Winners:\n" + string.Join(", ", Main.WinnerNameList));
}
- private static void ChangeSettingCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void ChangeSettingCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
string subArgs = args.Length < 2 ? "" : args[1];
switch (subArgs)
@@ -3425,20 +2929,14 @@ internal static class ChatCommands
GameManager.Instance.LogicOptions.SyncOptions();
}
- private static void VersionCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void VersionCommand(PlayerControl player, string text, string[] args)
{
string versionText = Main.PlayerVersion.OrderBy(pair => pair.Key).Aggregate(string.Empty, (current, kvp) => current + $"{kvp.Key}: ({Main.AllPlayerNames[kvp.Key]}) {kvp.Value.forkId}/{kvp.Value.version}({kvp.Value.tag})\n");
if (versionText != string.Empty && HudManager.InstanceExists) HudManager.Instance.Chat.AddChat(player, (player.FriendCode.GetDevUser().HasTag() ? "\n" : string.Empty) + versionText);
}
- private static void LTCommand(PlayerControl player, string commandKey, string text, string[] args)
+ private static void LTCommand(PlayerControl player, string text, string[] args)
{
- if (!AmongUsClient.Instance.AmHost)
- {
- RequestCommandProcessingFromHost(text, commandKey);
- return;
- }
-
if (!GameStates.IsLobby) return;
float timer = GameStartManagerPatch.Timer;
@@ -3677,7 +3175,7 @@ internal static class ChatCommands
Utils.CheckServerCommand(ref text, out bool spamRequired);
string[] args = text.Split(' ');
- foreach ((string key, Command command) in Command.AllCommands)
+ foreach (Command command in Command.AllCommands)
{
if (!command.IsThisCommand(text)) continue;
@@ -3691,7 +3189,7 @@ internal static class ChatCommands
}
if (command.AlwaysHidden && spamRequired) ChatManager.SendPreviousMessagesToAll();
- command.Action(player, key, text, args);
+ command.Action(player, text, args);
if (command.IsCanceled) canceled = command.AlwaysHidden || !Options.HostSeesCommandsEnteredByOthers.GetBool();
break;
}
diff --git a/Patches/PlayerJoinAndLeftPatch.cs b/Patches/PlayerJoinAndLeftPatch.cs
index 974756b40..f76e765c8 100644
--- a/Patches/PlayerJoinAndLeftPatch.cs
+++ b/Patches/PlayerJoinAndLeftPatch.cs
@@ -140,7 +140,7 @@ internal static class OnGameJoinedPatch
}
if (Options.AutoGMPollCommandAfterJoin.GetBool() && !Options.AutoGMRotationEnabled)
- ChatCommands.GameModePollCommand(PlayerControl.LocalPlayer, "Command.GameModePoll", "/gmpoll", ["/gmpoll"]);
+ ChatCommands.GameModePollCommand(PlayerControl.LocalPlayer, "/gmpoll", ["/gmpoll"]);
}
}
@@ -160,7 +160,7 @@ internal static class OnGameJoinedPatch
}
if (Options.AutoMPollCommandAfterJoin.GetBool() && !Options.RandomMapsMode.GetBool())
- ChatCommands.MapPollCommand(PlayerControl.LocalPlayer, "Command.MapPoll", "/mpoll", ["/mpoll"]);
+ ChatCommands.MapPollCommand(PlayerControl.LocalPlayer, "/mpoll", ["/mpoll"]);
}
}
@@ -180,7 +180,7 @@ internal static class OnGameJoinedPatch
}
if (Options.AutoDraftStartCommandAfterJoin.GetBool())
- ChatCommands.DraftStartCommand(PlayerControl.LocalPlayer, "Command.DraftStart", "/draftstart", ["/draftstart"]);
+ ChatCommands.DraftStartCommand(PlayerControl.LocalPlayer, "/draftstart", ["/draftstart"]);
}
}
@@ -200,7 +200,7 @@ internal static class OnGameJoinedPatch
}
if (Options.AutoReadyCheckCommandAfterJoin.GetBool())
- ChatCommands.ReadyCheckCommand(PlayerControl.LocalPlayer, "Command.ReadyCheck", "/readycheck", ["/readycheck"]);
+ ChatCommands.ReadyCheckCommand(PlayerControl.LocalPlayer, "/readycheck", ["/readycheck"]);
}
}
@@ -236,7 +236,7 @@ internal static class OnGameJoinedPatch
if (Options.AutoGMRotationEnabled)
{
- if (nextGM == CustomGameMode.All) ChatCommands.GameModePollCommand(PlayerControl.LocalPlayer, "Command.GameModePoll", "/gmpoll", ["/gmpoll"]);
+ if (nextGM == CustomGameMode.All) ChatCommands.GameModePollCommand(PlayerControl.LocalPlayer, "/gmpoll", ["/gmpoll"]);
else Options.GameMode.SetValue((int)nextGM - 1);
Logger.Info($"Auto GM Rotation: Next Game Mode = {nextGM}", "Auto GM Rotation");
diff --git a/Patches/TextBoxPatch.cs b/Patches/TextBoxPatch.cs
index ba52695af..0b15a4c5c 100644
--- a/Patches/TextBoxPatch.cs
+++ b/Patches/TextBoxPatch.cs
@@ -135,7 +135,7 @@ public static class TextBoxPatch
var exactMatch = false;
bool english = TranslationController.Instance.currentLanguage.languageID == SupportedLangs.English;
- foreach (Command cmd in Command.AllCommands.Values)
+ foreach (Command cmd in Command.AllCommands)
{
string[] commandForms = english ? [.. cmd.CommandForms.TakeWhile(x => x.All(char.IsAscii))] : cmd.CommandForms;
diff --git a/Resources/Lang/en_US.json b/Resources/Lang/en_US.json
index c88aa8ddf..64893e3ec 100644
--- a/Resources/Lang/en_US.json
+++ b/Resources/Lang/en_US.json
@@ -2414,6 +2414,110 @@
"Commands.NoAccess.Time.InMeeting": "<#ff5555>X <#bb0000>This command can only be used <#ffffff>In Meetings",
"Commands.NoAccess.Time.AfterDeath": "<#ff5555>X <#bb0000>This command can only be used <#ffffff>After Death",
"Commands.NoAccess.Time.AfterDeathOrLobby": "<#ff5555>X <#bb0000>This command can only be used <#ffffff>In Lobby & After Death",
+ "CommandForms.LT": "lt",
+ "CommandForms.Dump": "dump",
+ "CommandForms.Version": "v,version",
+ "CommandForms.ChangeSetting": "cs,changesetting",
+ "CommandForms.Winner": "win,winner",
+ "CommandForms.LastResult": "l,lastresult",
+ "CommandForms.Rename": "rn,rename,name",
+ "CommandForms.HideName": "hn,hidename",
+ "CommandForms.Level": "level",
+ "CommandForms.Now": "n,now",
+ "CommandForms.Disconnect": "dis,disconnect",
+ "CommandForms.R": "r",
+ "CommandForms.Up": "up",
+ "CommandForms.SetRole": "setrole,setaddon",
+ "CommandForms.Help": "h,help",
+ "CommandForms.KCount": "gamestate,gstate,gs,kcount,kc",
+ "CommandForms.AddMod": "addmod",
+ "CommandForms.DeleteMod": "deletemod",
+ "CommandForms.Combo": "combo",
+ "CommandForms.Effect": "eff,effect",
+ "CommandForms.AFKExempt": "afkexempt",
+ "CommandForms.MyRole": "m,myrole",
+ "CommandForms.TPOut": "tpout",
+ "CommandForms.TPIn": "tpin",
+ "CommandForms.Template": "t,template",
+ "CommandForms.MessageWait": "mw,messagewait",
+ "CommandForms.Death": "death,d",
+ "CommandForms.Say": "say,s",
+ "CommandForms.Vote": "vote",
+ "CommandForms.Ask": "ask",
+ "CommandForms.Answer": "ans,answer",
+ "CommandForms.QA": "qa",
+ "CommandForms.QS": "qs",
+ "CommandForms.Target": "target",
+ "CommandForms.Chat": "chat",
+ "CommandForms.Check": "check",
+ "CommandForms.Ban": "ban,kick",
+ "CommandForms.Exe": "exe",
+ "CommandForms.Kill": "kill",
+ "CommandForms.Colour": "colour,color",
+ "CommandForms.ID": "id,guesslist",
+ "CommandForms.ChangeRole": "changerole",
+ "CommandForms.End": "end",
+ "CommandForms.CosID": "cosid",
+ "CommandForms.MTHY": "mt,hy",
+ "CommandForms.CSD": "csd",
+ "CommandForms.SD": "sd",
+ "CommandForms.GNO": "gno",
+ "CommandForms.Poll": "poll",
+ "CommandForms.PV": "pv",
+ "CommandForms.HM": "hm",
+ "CommandForms.Decree": "decree",
+ "CommandForms.AddVIP": "addvip",
+ "CommandForms.DeleteVIP": "deletevip",
+ "CommandForms.Assume": "assume",
+ "CommandForms.Note": "note",
+ "CommandForms.OS": "os,optionset",
+ "CommandForms.Negotiation": "negotiation,neg",
+ "CommandForms.Mute": "mute",
+ "CommandForms.Unmute": "unmute",
+ "CommandForms.DraftStart": "draftstart,ds",
+ "CommandForms.DraftDescription": "dd,draftdesc,draftdescription",
+ "CommandForms.Draft": "draft",
+ "CommandForms.ReadyCheck": "rc,readycheck",
+ "CommandForms.Ready": "ready",
+ "CommandForms.EnableAllRoles": "enableallroles",
+ "CommandForms.Achievements": "achievements",
+ "CommandForms.DeathNote": "dn,deathnote",
+ "CommandForms.Whisper": "w,whisper",
+ "CommandForms.HWhisper": "hw,hwhisper",
+ "CommandForms.Spectate": "spectate",
+ "CommandForms.Anagram": "anagram",
+ "CommandForms.RoleList": "rl,rolelist",
+ "CommandForms.JailTalk": "jt,jailtalk",
+ "CommandForms.GameModeList": "gm,gml,gamemodes,gamemodelist",
+ "CommandForms.GameModePoll": "gmp,gmpoll,pollgm,gamemodepoll",
+ "CommandForms.MapPoll": "mp,mpoll,pollm,mappoll",
+ "CommandForms.EightBall": "8ball",
+ "CommandForms.AddTag": "addtag,createtag",
+ "CommandForms.DeleteTag": "deletetag",
+ "CommandForms.DayBreak": "daybreak,db",
+ "CommandForms.Fix": "fix,blackscreenfix,fixblackscreen",
+ "CommandForms.XOR": "xor",
+ "CommandForms.ChemistInfo": "ci,chemistinfo",
+ "CommandForms.Forge": "forge",
+ "CommandForms.Choose": "choose,pick",
+ "CommandForms.CopyPreset": "copypreset,presetcopy",
+ "CommandForms.AddAdmin": "addadmin",
+ "CommandForms.DeleteAdmin": "deleteadmin",
+ "CommandForms.VoteStart": "vs,votestart",
+ "CommandForms.Imitate": "imitate",
+ "CommandForms.Retribute": "ret,retribute",
+ "CommandForms.Revive": "revive",
+ "CommandForms.Select": "select",
+ "CommandForms.UIScale": "uiscale",
+ "CommandForms.Fabricate": "fabricate",
+ "CommandForms.Start": "start",
+ "CommandForms.ConfirmAuth": "confirmauth",
+ "CommandForms.Guess": "shoot,guess,bet,bt,st",
+ "CommandForms.Trial": "tl,sp,jj,trial",
+ "CommandForms.Swap": "sw,swap,st",
+ "CommandForms.Compare": "compare,cp,cmp",
+ "CommandForms.Medium": "ms,mediumship,medium",
+ "CommandForms.Revenge": "rv",
"CommandDescription.LT": "View the lobby timer",
"CommandDescription.Dump": "Dumps the log file to the desktop",
"CommandDescription.Version": "View the current version of EHR",
diff --git a/Roles/RoleBase.cs b/Roles/RoleBase.cs
index d03b18c13..54253fd8a 100644
--- a/Roles/RoleBase.cs
+++ b/Roles/RoleBase.cs
@@ -129,7 +129,7 @@ public abstract class RoleBase : IComparable
if (Imitator.PlayerIdList.Contains(pc.PlayerId))
{
string command = $"/imitate {target.PlayerId}";
- ChatCommands.ImitateCommand(pc, "Command.Imitate", command, command.Split(' '));
+ ChatCommands.ImitateCommand(pc, command, command.Split(' '));
}
}
diff --git a/Roles/Standard/Crewmate/Investigate/Imitator.cs b/Roles/Standard/Crewmate/Investigate/Imitator.cs
index 7469513b7..7135e8d5b 100644
--- a/Roles/Standard/Crewmate/Investigate/Imitator.cs
+++ b/Roles/Standard/Crewmate/Investigate/Imitator.cs
@@ -58,30 +58,17 @@ public class Imitator : RoleBase
}
}
- private static void SendRPC(byte playerId)
- {
- MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ImitatorClick, SendOption.Reliable, AmongUsClient.Instance.HostId);
- writer.Write(playerId);
- AmongUsClient.Instance.FinishRpcImmediately(writer);
- }
-
- public static void ReceiveRPC(MessageReader reader, PlayerControl pc)
- {
- int playerId = reader.ReadByte();
- var command = $"/imitate {playerId}";
- ChatCommands.ImitateCommand(pc, "Command.Imitate", command, command.Split(' '));
- }
-
private static void ImitatorOnClick(byte playerId /*, MeetingHud __instance*/)
{
Logger.Msg($"Click: ID {playerId}", "Imitator UI");
PlayerControl pc = Utils.GetPlayerById(playerId);
if (pc == null || pc.IsAlive() || !GameStates.IsVoting || Starspawn.IsDayBreak) return;
+ var command = $"/imitate {playerId}";
+
if (AmongUsClient.Instance.AmHost)
{
- var command = $"/imitate {playerId}";
- ChatCommands.ImitateCommand(PlayerControl.LocalPlayer, "Command.Imitate", command, command.Split(' '));
+ ChatCommands.ImitateCommand(PlayerControl.LocalPlayer, command, command.Split(' '));
if (ImitatingRole.ContainsKey(PlayerControl.LocalPlayer.PlayerId))
{
@@ -93,7 +80,7 @@ public class Imitator : RoleBase
}
}
else
- SendRPC(playerId);
+ ChatCommands.RequestCommandProcessingFromHost(command, "Imitate");
}
private static void CreateImitatorButton(MeetingHud __instance)
diff --git a/Roles/Standard/Crewmate/Killing/Retributionist.cs b/Roles/Standard/Crewmate/Killing/Retributionist.cs
index 633512ff0..c627e8150 100644
--- a/Roles/Standard/Crewmate/Killing/Retributionist.cs
+++ b/Roles/Standard/Crewmate/Killing/Retributionist.cs
@@ -108,7 +108,7 @@ public class Retributionist : RoleBase
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{
var command = $"/retribute {target.PlayerId}";
- ChatCommands.RetributeCommand(shapeshifter, "Command.Retribute", command, command.Split(' '));
+ ChatCommands.RetributeCommand(shapeshifter, command, command.Split(' '));
}
public void ReceiveRPC(MessageReader reader)
@@ -121,18 +121,13 @@ public class Retributionist : RoleBase
Logger.Msg($"Click: ID {playerId}", "Retributionist UI");
PlayerControl pc = Utils.GetPlayerById(playerId);
if (pc == null || !pc.IsAlive() || !GameStates.IsVoting || Starspawn.IsDayBreak) return;
+
+ var command = $"/retribute {playerId}";
if (AmongUsClient.Instance.AmHost)
- {
- var command = $"/retribute {playerId}";
- ChatCommands.RetributeCommand(PlayerControl.LocalPlayer, "Command.Retribute", command, command.Split(' '));
- }
+ ChatCommands.RetributeCommand(PlayerControl.LocalPlayer, command, command.Split(' '));
else
- {
- MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.RetributionistClick, SendOption.Reliable, AmongUsClient.Instance.HostId);
- writer.Write(playerId);
- AmongUsClient.Instance.FinishRpcImmediately(writer);
- }
+ ChatCommands.RequestCommandProcessingFromHost(command, "Retribute");
}
public static void CreateRetributionistButton(MeetingHud __instance)
diff --git a/Roles/Standard/Impostor/Support/Ventriloquist.cs b/Roles/Standard/Impostor/Support/Ventriloquist.cs
index 30ad9947b..6f7fd291f 100644
--- a/Roles/Standard/Impostor/Support/Ventriloquist.cs
+++ b/Roles/Standard/Impostor/Support/Ventriloquist.cs
@@ -44,14 +44,7 @@ public class Ventriloquist : RoleBase
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{
var command = $"/target {target.PlayerId}";
- ChatCommands.TargetCommand(shapeshifter, "Command.Target", command, command.Split(' '));
- }
-
- public static void ReceiveRPC(MessageReader reader, PlayerControl pc)
- {
- int playerId = reader.ReadByte();
- var command = $"/target {playerId}";
- ChatCommands.TargetCommand(pc, "Command.Target", command, command.Split(' '));
+ ChatCommands.TargetCommand(shapeshifter, command, command.Split(' '));
}
private static void VentriloquisttOnClick(byte playerId /*, MeetingHud __instance*/)
@@ -59,18 +52,13 @@ public class Ventriloquist : RoleBase
Logger.Msg($"Click: ID {playerId}", "Ventriloquist UI");
PlayerControl pc = Utils.GetPlayerById(playerId);
if (pc == null || !pc.IsAlive() || !GameStates.IsVoting || Starspawn.IsDayBreak) return;
+
+ var command = $"/target {playerId}";
if (AmongUsClient.Instance.AmHost)
- {
- var command = $"/target {playerId}";
- ChatCommands.TargetCommand(PlayerControl.LocalPlayer, "Command.Target", command, command.Split(' '));
- }
+ ChatCommands.TargetCommand(PlayerControl.LocalPlayer, command, command.Split(' '));
else
- {
- MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.VentriloquistClick, SendOption.Reliable, AmongUsClient.Instance.HostId);
- writer.Write(playerId);
- AmongUsClient.Instance.FinishRpcImmediately(writer);
- }
+ ChatCommands.RequestCommandProcessingFromHost(command, "Target");
}
public static void CreateVentriloquistButton(MeetingHud __instance)
diff --git a/Roles/Standard/Neutral/Pariah/Starspawn.cs b/Roles/Standard/Neutral/Pariah/Starspawn.cs
index b6c067ac0..e03bd02c3 100644
--- a/Roles/Standard/Neutral/Pariah/Starspawn.cs
+++ b/Roles/Standard/Neutral/Pariah/Starspawn.cs
@@ -79,7 +79,7 @@ public class Starspawn : RoleBase
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{
const string command = "/daybreak";
- ChatCommands.DayBreakCommand(shapeshifter, "Command.Daybreak", command, command.Split(' '));
+ ChatCommands.DayBreakCommand(shapeshifter, command, command.Split(' '));
}
public void ReceiveRPC(MessageReader reader)
@@ -92,16 +92,12 @@ public class Starspawn : RoleBase
Logger.Msg($"Starspawn Click: ID {PlayerControl.LocalPlayer.PlayerId}", "Starspawn UI");
if (PlayerControl.LocalPlayer == null || !PlayerControl.LocalPlayer.IsAlive() || !GameStates.IsVoting) return;
+ const string command = "/daybreak";
+
if (AmongUsClient.Instance.AmHost)
- {
- const string command = "/daybreak";
- ChatCommands.DayBreakCommand(PlayerControl.LocalPlayer, "Command.Daybreak", command, command.Split(' '));
- }
+ ChatCommands.DayBreakCommand(PlayerControl.LocalPlayer, command, command.Split(' '));
else
- {
- MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.StarspawnClick, SendOption.Reliable, AmongUsClient.Instance.HostId);
- AmongUsClient.Instance.FinishRpcImmediately(writer);
- }
+ ChatCommands.RequestCommandProcessingFromHost(command, "DayBreak");
starspawnButton.SetActive(false);
LateTask.New(() => starspawnButton.SetActive(true), 1f, "StarspawnButton");