Skip to content

Commit

Permalink
Add 3 new TP supports
Browse files Browse the repository at this point in the history
Includes Puzzling Buttons, Traffic Board (ported & modified from mod source) and Nonagon Infinity
  • Loading branch information
eXish authored and samfundev committed Sep 9, 2024
1 parent 60801e6 commit b305f42
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ static ComponentSolverFactory()
ModComponentSolverCreators["shapeshift"] = module => new ShapeShiftComponentSolver(module);
ModComponentSolverCreators["ThirdBase"] = module => new ThirdBaseComponentSolver(module);

//MaddyMoos Modules
ModComponentSolverCreators["gemory"] = module => new GemoryComponentSolver(module);
ModComponentSolverCreators["nonagonInfinity"] = module => new NonagonInfinityComponentSolver(module);

//Mock Army Modules
ModComponentSolverCreators["AnagramsModule"] = module => new AnagramsComponentSolver(module);
ModComponentSolverCreators["Emoji Math"] = module => new EmojiMathComponentSolver(module);
Expand Down Expand Up @@ -143,7 +147,6 @@ static ComponentSolverFactory()
ModComponentSolverCreators["weekDays"] = module => new WeekdaysComponentSolver(module);
ModComponentSolverCreators["draw"] = module => new DrawComponentSolver(module);
ModComponentSolverCreators["overKilo"] = module => new OverKiloComponentSolver(module);
ModComponentSolverCreators["gemory"] = module => new GemoryComponentSolver(module);
ModComponentSolverCreators["parliament"] = module => new ParliamentComponentSolver(module);
ModComponentSolverCreators["12321"] = module => new OneTwoThreeComponentSolver(module);
ModComponentSolverCreators["TechSupport"] = module => new TechSupportComponentSolver(module);
Expand All @@ -160,6 +163,8 @@ static ComponentSolverFactory()
ModComponentSolverCreators["redLightGreenLight"] = module => new RedLightGreenLightComponentSolver(module);
ModComponentSolverCreators["threeSentenceHorror"] = module => new ThreeSentenceHorrorComponentSolver(module);
ModComponentSolverCreators["GreenWires"] = module => new GreenWiresComponentSolver(module);
ModComponentSolverCreators["traffic_board"] = module => new TrafficBoardComponentSolver(module);
ModComponentSolverCreators["puzzlingButtons"] = module => new PuzzlingButtonsComponentSolver(module);

//ZekNikZ Modules
ModComponentSolverCreators["EdgeworkModule"] = module => new EdgeworkComponentSolver(module);
Expand Down Expand Up @@ -377,6 +382,10 @@ Typical ModuleInformation json entry
ModComponentSolverInformation["logicPlumbing"] = new ModuleInformation { builtIntoTwitchPlays = true, moduleDisplayName = "Logic Plumbing" };
ModComponentSolverInformation["flashingCube"] = new ModuleInformation { builtIntoTwitchPlays = true, moduleDisplayName = "Flashing Cube" };

//MaddyMoos
ModComponentSolverInformation["gemory"] = new ModuleInformation { builtIntoTwitchPlays = true, moduleDisplayName = "Gemory", announceModule = true };
ModComponentSolverInformation["nonagonInfinity"] = new ModuleInformation { builtIntoTwitchPlays = true, moduleDisplayName = "Nonagon Infinity" };

//Mock Army
ModComponentSolverInformation["AnagramsModule"] = new ModuleInformation { builtIntoTwitchPlays = true, moduleDisplayName = "Anagrams" };
ModComponentSolverInformation["Emoji Math"] = new ModuleInformation { builtIntoTwitchPlays = true, moduleDisplayName = "Emoji Math" };
Expand Down Expand Up @@ -455,7 +464,6 @@ Typical ModuleInformation json entry
ModComponentSolverInformation["weekDays"] = new ModuleInformation { builtIntoTwitchPlays = true, moduleDisplayName = "Weekdays" };
ModComponentSolverInformation["draw"] = new ModuleInformation { builtIntoTwitchPlays = true, moduleDisplayName = "Draw" };
ModComponentSolverInformation["overKilo"] = new ModuleInformation { builtIntoTwitchPlays = true, moduleDisplayName = "Over Kilo" };
ModComponentSolverInformation["gemory"] = new ModuleInformation { builtIntoTwitchPlays = true, moduleDisplayName = "Gemory", announceModule = true };
ModComponentSolverInformation["parliament"] = new ModuleInformation { builtIntoTwitchPlays = true, moduleDisplayName = "Parliament" };
ModComponentSolverInformation["12321"] = new ModuleInformation { builtIntoTwitchPlays = true, moduleDisplayName = "1-2-3-2-1" };
ModComponentSolverInformation["TechSupport"] = new ModuleInformation { builtIntoTwitchPlays = true, moduleDisplayName = "Tech Support" };
Expand All @@ -472,6 +480,8 @@ Typical ModuleInformation json entry
ModComponentSolverInformation["redLightGreenLight"] = new ModuleInformation { builtIntoTwitchPlays = true, moduleDisplayName = "Red Light Green Light", announceModule = true, unclaimable = true };
ModComponentSolverInformation["threeSentenceHorror"] = new ModuleInformation { builtIntoTwitchPlays = true, moduleDisplayName = "Three Sentence Horror", announceModule = true, unclaimable = true };
ModComponentSolverInformation["GreenWires"] = new ModuleInformation { builtIntoTwitchPlays = true, moduleDisplayName = "Green Wires" };
ModComponentSolverInformation["traffic_board"] = new ModuleInformation { builtIntoTwitchPlays = true, moduleDisplayName = "Traffic Board" };
ModComponentSolverInformation["puzzlingButtons"] = new ModuleInformation { builtIntoTwitchPlays = true, moduleDisplayName = "Puzzling Buttons" };

//GoodHood
ModComponentSolverInformation["buttonOrder"] = new ModuleInformation { builtIntoTwitchPlays = true, moduleDisplayName = "Button Order" };
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System;
using System.Collections;
using System.Linq;
using System.Text.RegularExpressions;

public class NonagonInfinityComponentSolver : CommandComponentSolver
{
public NonagonInfinityComponentSolver(TwitchModule module) :
base(module, "NonagonInfinity", "!{0} press <l1> <l2> [Presses the button with label 'l1' then 'l2']")
{
}

private IEnumerator Press(CommandParser _)
{
_.Literal("press");
_.Regex("([a-z]) ([a-z])", out Match match);

string l1 = match.Groups[1].Value.ToUpperInvariant();
string l2 = match.Groups[2].Value.ToUpperInvariant();
string[] buttonlabels = _component.GetValue<string[]>("buttonlabels");
if (!buttonlabels.Contains(l1) || !buttonlabels.Contains(l2))
yield break;

yield return null;
yield return Click(Array.IndexOf(buttonlabels, l1));
yield return Click(Array.IndexOf(buttonlabels, l2));
if (_component.GetValue<string>("input") == _component.GetValue<string>("solve"))
yield return "solve";
}

protected override IEnumerator ForcedSolveIEnumerator()
{
yield return null;
string input = _component.GetValue<string>("input");
string solve = _component.GetValue<string>("solve");
string[] buttonlabels = _component.GetValue<string[]>("buttonlabels");
if (input.Length == 1 && input[0] != solve[0])
yield break;
for (int i = input.Length; i < 2; i++)
yield return Click(Array.IndexOf(buttonlabels, solve[i].ToString()));
while (!Module.BombComponent.IsSolved) yield return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Collections;
using System.Linq;

public class PuzzlingButtonsComponentSolver : ReflectionComponentSolver
{
public PuzzlingButtonsComponentSolver(TwitchModule module) :
base(module, "PuzzleMod", "!{0} press <coord1> (coord2)... [Presses the button(s) at the specified coordinate(s)] | Valid coordinates are A1-E5 with letters as column and numbers as row")
{
}

public override IEnumerator Respond(string[] split, string command)
{
if (!command.StartsWith("press ")) yield break;
for (int i = 1; i < split.Length; i++)
{
if (!coordinates.Contains(split[i]))
yield break;
}

yield return null;
for (int i = 1; i < split.Length; i++)
yield return Click(Array.IndexOf(coordinates, split[i]));
}

private readonly string[] coordinates = { "a1", "b1", "c1", "d1", "e1", "a2", "b2", "c2", "d2", "e2", "a3", "b3", "c3", "d3", "e3", "a4", "b4", "c4", "d4", "e4", "a5", "b5", "c5", "d5", "e5" };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System;
using System.Collections;
using System.Text.RegularExpressions;

public class TrafficBoardComponentSolver : ReflectionComponentSolver
{
public TrafficBoardComponentSolver(TwitchModule module) :
base(module, "trafficBoardScript", "Use '!{0} <sign1> <sign2>' to submit signs (sign1 - top, sign2 - bottom). Possible signs: f - forward, fl - forward/left, fr - forward/right, l - left, lr - left/right, ls - left side (bottom-left arrow), r - right, rs - right side (bottom-right arrow)")
{
}

public override IEnumerator Respond(string[] split, string command)
{
var signRE = string.Join("|", sign_commands);
var match = Regex.Match(command, string.Format("^({0}) ({0})$", signRE));
if (match.Success)
{
yield return null;
while (_component.GetValue<int>("selrow") != Array.IndexOf(sign_commands, match.Groups[1].Value))
yield return Click(0);
while (_component.GetValue<int>("selcolumn") != Array.IndexOf(sign_commands, match.Groups[2].Value))
yield return Click(1);
yield return Click(2, 0);
}
}

protected override IEnumerator ForcedSolveIEnumerator()
{
yield return null;

while (_component.GetValue<int>("active") == 0) yield return true;
int ansrow = _component.GetValue<int>("ansrow");
int anscolumn = _component.GetValue<int>("anscolumn");
while (_component.GetValue<int>("selrow") != ansrow)
yield return Click(0);
while (_component.GetValue<int>("selcolumn") != anscolumn)
yield return Click(1);
yield return Click(2, 0);
}

private readonly string[] sign_commands = new[] { "f", "fl", "fr", "l", "lr", "ls", "r", "rs" };
}

0 comments on commit b305f42

Please sign in to comment.