protected internal override IEnumerator RespondToCommandInternal(string inputCommand) { inputCommand = inputCommand.Trim(); string[] commandParts = inputCommand.Split(' '); if (commandParts.Length == 1 && commandParts[0].Equals("toggle", StringComparison.InvariantCultureIgnoreCase)) { yield return("password"); for (int i = 0; i < 5; i++) { yield return(DoInteractionClick(_downButtons[i])); } yield break; } if (commandParts.Length > 0 && commandParts[0].Equals("cycle", StringComparison.InvariantCultureIgnoreCase)) { HashSet <int> alreadyCycled = new HashSet <int>(); foreach (string cycle in commandParts.Skip(1)) { if (!int.TryParse(cycle, out int spinnerIndex) || !alreadyCycled.Add(spinnerIndex) || spinnerIndex < 1 || spinnerIndex > _downButtons.Length) { continue; } IEnumerator spinnerCoroutine = CycleCharacterSpinnerCoroutine(spinnerIndex - 1); while (spinnerCoroutine.MoveNext()) { yield return(spinnerCoroutine.Current); } } yield break; } string lettersToSubmit = // Special case for Korean (convert Hangul to Jamos) commandParts[0].Length > 0 && commandParts[0][0] >= '가' && commandParts[0][0] <= '힣' ? commandParts[0].SelectMany(ch => TranslatedModulesSettings.CallMethod <string>("DeconstructHangulSyllableToJamos", null, ch)).Select(ch => SimilarJamos.ContainsKey(ch) ? SimilarJamos[ch] : ch).Join("") : // Special case for Hebrew (expects input back to front) TranslatedModuleHelper.GetLanguageCode(_component, PasswordComponentType) == "he" ? commandParts[0].Reverse().Join("") : // Usual case commandParts[0]; if (lettersToSubmit.Length != 5) { yield break; } yield return("password"); IEnumerator solveCoroutine = SolveCoroutine(lettersToSubmit); while (solveCoroutine.MoveNext()) { yield return(solveCoroutine.Current); } }
public TranslatedNeedyVentComponentSolver(TwitchModule module) : base(module) { _yesButton = (MonoBehaviour)YesButtonField.GetValue(module.BombComponent.GetComponent(NeedyVentComponentSolverType)); _noButton = (MonoBehaviour)NoButtonField.GetValue(module.BombComponent.GetComponent(NeedyVentComponentSolverType)); ModInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "!{0} yes, !{0} y [answer yes] | !{0} no, !{0} n [answer no]").Clone(); LanguageCode = TranslatedModuleHelper.GetLanguageCode(module.BombComponent.GetComponent(NeedyVentComponentSolverType), NeedyVentComponentSolverType); ModInfo.moduleDisplayName = $"Needy Vent Gas Translated{TranslatedModuleHelper.GetModuleDisplayNameAddon(module.BombComponent.GetComponent(NeedyVentComponentSolverType), NeedyVentComponentSolverType)}"; Module.HeaderText = ModInfo.moduleDisplayName; }
public TranslatedWhosOnFirstComponentSolver(TwitchModule module) : base(module) { Component component = module.BombComponent.GetComponent(ComponentType); _buttons = (KMSelectable[])ButtonsField.GetValue(component); ModInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "!{0} what? [press the button that says \"WHAT?\"] | !{0} press 3 [press the third button in english reading order] | The phrase must match exactly | Not case sensitive | If the language used asks for pressing a literally blank button, use \"!{0} literally blank\"").Clone(); LanguageCode = TranslatedModuleHelper.GetLanguageCode(component, ComponentType); ModInfo.moduleDisplayName = $"Who's on First Translated{TranslatedModuleHelper.GetModuleDisplayNameAddon(component, ComponentType)}"; Module.HeaderText = ModInfo.moduleDisplayName; }
public TranslatedPasswordComponentSolver(TwitchModule module) : base(module) { _component = module.BombComponent.GetComponent(PasswordComponentType); _downButtons = (KMSelectable[])DownButtonField.GetValue(_component); _submitButton = (MonoBehaviour)SubmitButtonField.GetValue(_component); _display = (TextMesh[])DisplayField.GetValue(_component); ModInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "!{0} cycle 1 3 5 [cycle through the letters in columns 1, 3, and 5] | !{0} toggle [move all columns down one letter] | !{0} world [try to submit a word]").Clone(); LanguageCode = TranslatedModuleHelper.GetLanguageCode(_component, PasswordComponentType); ModInfo.moduleDisplayName = $"Passwords Translated{TranslatedModuleHelper.GetModuleDisplayNameAddon(_component, PasswordComponentType)}"; Module.HeaderText = ModInfo.moduleDisplayName; }
public TranslatedMorseCodeComponentSolver(TwitchModule module) : base(module) { _component = module.BombComponent.GetComponent(MorseCodeComponentType); _upButton = (MonoBehaviour)UpButtonField.GetValue(_component); _downButton = (MonoBehaviour)DownButtonField.GetValue(_component); _transmitButton = (MonoBehaviour)TransmitButtonField.GetValue(_component); ModInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "!{0} transmit 3.573, !{0} trans 573, !{0} transmit 3.573 MHz, !{0} tx 573 [transmit frequency 3.573]").Clone(); LanguageCode = TranslatedModuleHelper.GetLanguageCode(_component, MorseCodeComponentType); ModInfo.moduleDisplayName = $"Morse Code Translated{TranslatedModuleHelper.GetModuleDisplayNameAddon(_component, MorseCodeComponentType)}"; Module.HeaderText = ModInfo.moduleDisplayName; }
public TranslatedPasswordComponentSolver(TwitchModule module) : base(module) { _downButtons = (KMSelectable[])DownButtonField.GetValue(module.BombComponent.GetComponent(PasswordComponentType)); _submitButton = (MonoBehaviour)SubmitButtonField.GetValue(module.BombComponent.GetComponent(PasswordComponentType)); _display = (TextMesh[])DisplayField.GetValue(module.BombComponent.GetComponent(PasswordComponentType)); ModInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "!{0} cycle 1 3 5 [cycle through the letters in columns 1, 3, and 5] | !{0} cycle [cycle through all columns] | !{0} toggle [move all columns down one letter] | !{0} world [try to submit a word]").Clone(); string language = TranslatedModuleHelper.GetManualCodeAddOn(module.BombComponent.GetComponent(PasswordComponentType), PasswordComponentType); if (language != null) { ManualCode = $"Password{language}"; } ModInfo.moduleDisplayName = $"Passwords Translated{TranslatedModuleHelper.GetModuleDisplayNameAddon(module.BombComponent.GetComponent(PasswordComponentType), PasswordComponentType)}"; module.Bomb.Bomb.StartCoroutine(SetHeaderText()); }
public TranslatedNeedyVentComponentSolver(TwitchModule module) : base(module) { _yesButton = (MonoBehaviour)YesButtonField.GetValue(module.BombComponent.GetComponent(NeedyVentComponentSolverType)); _noButton = (MonoBehaviour)NoButtonField.GetValue(module.BombComponent.GetComponent(NeedyVentComponentSolverType)); ModInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "!{0} yes, !{0} y [answer yes] | !{0} no, !{0} n [answer no]").Clone(); string language = TranslatedModuleHelper.GetManualCodeAddOn(module.BombComponent.GetComponent(NeedyVentComponentSolverType), NeedyVentComponentSolverType); if (language != null) { ManualCode = "Venting%20Gas"; } //if (language != null) ManualCode = $"Venting%20Gas{language}"; ModInfo.moduleDisplayName = $"Needy Vent Gas Translated{TranslatedModuleHelper.GetModuleDisplayNameAddon(module.BombComponent.GetComponent(NeedyVentComponentSolverType), NeedyVentComponentSolverType)}"; Module.Bomb.Bomb.StartCoroutine(SetHeaderText()); }
public TranslatedWhosOnFirstComponentSolver(BombCommander bombCommander, BombComponent bombComponent) : base(bombCommander, bombComponent) { _component = bombComponent.GetComponent(_componentType); _buttons = (KMSelectable[])_buttonsField.GetValue(_component); modInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "!{0} what? [press the button that says \"WHAT?\"] | The phrase must match exactly | Not case sensitive| If the language used asks for pressing a literally blank button, use \"!{0} literally blank\""); if (bombCommander != null) { string language = TranslatedModuleHelper.GetManualCodeAddOn(bombComponent); if (language != null) { modInfo.manualCode = $"Who%E2%80%99s%20on%20First{language}"; } modInfo.moduleDisplayName = $"Who's on First Translated{TranslatedModuleHelper.GetModuleDisplayNameAddon(bombComponent)}"; bombComponent.StartCoroutine(SetHeaderText()); } }
public TranslatedMorseCodeComponentSolver(TwitchModule module) : base(module) { _component = module.BombComponent.GetComponent(MorseCodeComponentType); _upButton = (MonoBehaviour)UpButtonField.GetValue(_component); _downButton = (MonoBehaviour)DownButtonField.GetValue(_component); _transmitButton = (MonoBehaviour)TransmitButtonField.GetValue(_component); ModInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "!{0} transmit 3.573, !{0} trans 573, !{0} transmit 3.573 MHz, !{0} tx 573 [transmit frequency 3.573]").Clone(); string language = TranslatedModuleHelper.GetManualCodeAddOn(_component, MorseCodeComponentType); if (language != null) { ManualCode = $"Morse%20Code{language}"; } ModInfo.moduleDisplayName = $"Morse Code Translated{TranslatedModuleHelper.GetModuleDisplayNameAddon(_component, MorseCodeComponentType)}"; module.BombComponent.StartCoroutine(SetHeaderText()); }
public TranslatedPasswordComponentSolver(BombCommander bombCommander, BombComponent bombComponent) : base(bombCommander, bombComponent) { _downButtons = (KMSelectable[])_downButtonField.GetValue(bombComponent.GetComponent(_passwordComponentType)); _submitButton = (MonoBehaviour)_submitButtonField.GetValue(bombComponent.GetComponent(_passwordComponentType)); _display = (TextMesh[])_displayField.GetValue(bombComponent.GetComponent(_passwordComponentType)); modInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "!{0} cycle 3 [cycle through the letters in column 3] | !{0} cycle 1 3 5 [cycle through the letters in columns 1, 3, and 5] | !{0} world [try to submit a word]"); if (bombCommander != null) { string language = TranslatedModuleHelper.GetManualCodeAddOn(bombComponent); if (language != null) { modInfo.manualCode = $"Password{language}"; } modInfo.moduleDisplayName = $"Passwords Translated{TranslatedModuleHelper.GetModuleDisplayNameAddon(bombComponent)}"; bombComponent.StartCoroutine(SetHeaderText()); } }
public TranslatedNeedyVentComponentSolver(BombCommander bombCommander, BombComponent bombComponent) : base(bombCommander, bombComponent) { _yesButton = (MonoBehaviour)_yesButtonField.GetValue(bombComponent.GetComponent(_needyVentComponentSolverType)); _noButton = (MonoBehaviour)_noButtonField.GetValue(bombComponent.GetComponent(_needyVentComponentSolverType)); modInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "!{0} yes, !{0} y [answer yes] | !{0} no, !{0} n [answer no]"); if (bombCommander != null) { string language = TranslatedModuleHelper.GetManualCodeAddOn(bombComponent); if (language != null) { modInfo.manualCode = "Venting%20Gas"; } //if (language != null) modInfo.manualCode = $"Venting%20Gas{language}"; modInfo.moduleDisplayName = $"Needy Vent Gas Translated{TranslatedModuleHelper.GetModuleDisplayNameAddon(bombComponent)}"; bombComponent.StartCoroutine(SetHeaderText()); } }
public TranslatedButtonComponentSolver(TwitchModule module) : base(module) { var component = module.BombComponent.GetComponent(ComponentType); _button = (KMSelectable)ButtonField.GetValue(component); ModInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "!{0} tap [tap the button] | !{0} hold [hold the button] | !{0} release 7 [release when the digit shows 7]").Clone(); Selectable selectable = module.BombComponent.GetComponent <Selectable>(); selectable.OnCancel += () => { SelectedField.SetValue(component, false); return(true); }; LanguageCode = TranslatedModuleHelper.GetLanguageCode(component, ComponentType); ModInfo.moduleDisplayName = $"Big Button Translated{TranslatedModuleHelper.GetModuleDisplayNameAddon(component, ComponentType)}"; Module.HeaderText = ModInfo.moduleDisplayName; var mat = (Material)StripMaterialField.GetValue(component); StripMaterialField.SetValue(component, Object.Instantiate(mat)); }
public TranslatedButtonComponentSolver(BombCommander bombCommander, BombComponent bombComponent) : base(bombCommander, bombComponent) { _button = (KMSelectable)_buttonField.GetValue(bombComponent.GetComponent(_componentType)); modInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "!{0} tap [tap the button] | !{0} hold [hold the button] | !{0} release 7 [release when the digit shows 7] | (Important - Take note of the strip color on hold, it will change as other translated buttons get held, and the answer retains original color.)"); Selectable selectable = bombComponent.GetComponent <Selectable>(); selectable.OnCancel += () => { _selectedField.SetValue(bombComponent.GetComponent(_componentType), false); return(true); }; if (bombCommander != null) { string language = TranslatedModuleHelper.GetManualCodeAddOn(bombComponent); if (language != null) { modInfo.manualCode = $"The%20Button{language}"; } modInfo.moduleDisplayName = $"Big Button Translated{TranslatedModuleHelper.GetModuleDisplayNameAddon(bombComponent)}"; bombComponent.StartCoroutine(SetHeaderText()); } }
public TranslatedMorseCodeComponentSolver(BombCommander bombCommander, BombComponent bombComponent) : base(bombCommander, bombComponent) { _component = bombComponent.GetComponent(_morseCodeComponentType); _upButton = (MonoBehaviour)_upButtonField.GetValue(_component); _downButton = (MonoBehaviour)_downButtonField.GetValue(_component); _transmitButton = (MonoBehaviour)_transmitButtonField.GetValue(_component); modInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "!{0} transmit 3.573, !{0} trans 573, !{0} tx 573 [transmit frequency 3.573]"); if (bombCommander != null) { string language = TranslatedModuleHelper.GetManualCodeAddOn(bombComponent); if (language != null) { modInfo.manualCode = $"Morse%20Code{language}"; } modInfo.moduleDisplayName = $"Morse Code Translated{TranslatedModuleHelper.GetModuleDisplayNameAddon(bombComponent)}"; bombComponent.StartCoroutine(SetHeaderText()); } }
public static void Help(TwitchModule module, [Group(1)] bool pdf) { string manualType = pdf ? "pdf" : "html"; string manualText = (Repository.GetManual(module.BombComponent.GetModuleID()) ?? module.BombComponent.GetModuleDisplayName()) + TranslatedModuleHelper.GetManualCodeAddOn(module.Solver.LanguageCode); string helpText = string.IsNullOrEmpty(module.Solver.HelpMessage) ? string.Empty : string.Format(module.Solver.HelpMessage, module.Code, module.HeaderText); IRCConnection.SendMessage($"{module.HeaderText} : {helpText} : {UrlHelper.ManualFor(manualText, manualType, VanillaRuleModifier.GetModuleRuleSeed(module.Solver.ModInfo.moduleID) != 1)}"); }