private static void HandleSpecial(UberState state) { if (state.Name == "arenaBByteStateSerialized" && state.Value.Byte == 4) { // lumaPoolsStateGroup.arenaByteStateSerialized new UberId(5377, 1373).State().Write(state.Value); } else if (state.Name == "craftCutsceneState" && 0 < state.Value.Byte && state.Value.Byte < 3) { state.Write(new UberValue((byte)3)); // Give diamond in the rough pickup. new UberId(23987, 14832).State().Write(new UberValue(true)); } // the below is a fix for a vanilla bug where you can just miss getting voice if you else if (state.Name == "findToadQuestUberState" && state.Value.Int == 2 || // (a) skip the kwolok cutscene too fast state.Name == "cleanseWellspringQuestUberState" && state.Value.Int == 4 // (b) come to kwolok after wellspring and get the cutscenes stacked awkwardly ) { Randomizer.InputUnlockCallback = () => { // this is really questionable!! var voiceState = new UberId(46462, 59806).State(); if (!voiceState.Value.Bool) { voiceState.Write(new UberValue(true)); InterOp.set_max_health(InterOp.get_max_health() + 10); InterOp.set_max_energy(InterOp.get_max_energy() + 1); InterOp.fill_health(); InterOp.fill_energy(); InterOp.save(); } // should happen in both branches if (SeedController.Flags.Contains(Flag.ALLWISPS)) { HintsController.ProgressWithHints(); } } } ; }
public static void HandleSignal(string signal) { switch (signal) { case "reload": if (FramesTillUnlockReload == 0) { iniFlagCache.Clear(); FramesTillNextSend = 0; Randomizer.Client.Connect(); SeedController.ReadSeed(); if (InterOp.get_game_state() == GameState.Game) { PsuedoLocs.RELOAD_SEED.OnCollect(); } FramesTillUnlockReload = 120; } break; case "lastPickup": FramesTillNextSend = 1; // the only reason this isn't = 0 is that spamming this could get really annoying MessageQueue.Enqueue(Last); break; case "progressAndHints": HintsController.ProgressWithHints(); break; case "dev": Randomizer.Dev = !Randomizer.Dev; Randomizer.Log($"Dev: {Randomizer.Dev}"); break; case "exitapp": Environment.Exit(Environment.ExitCode); break; case "toggleDebug": InterOp.set_debug_controls(!InterOp.get_debug_controls()); Print($"Debug {(InterOp.get_debug_controls() ? "enabled" : "disabled")}", toMessageLog: false); break; case "toggleCursorLock": Print($"Cursor Lock {(InterOp.toggle_cursorlock() ? "enabled" : "disabled")}", toMessageLog: false); break; case "binding1": PsuedoLocs.BINDING_ONE.OnCollect(); break; case "binding2": PsuedoLocs.BINDING_TWO.OnCollect(); break; case "binding3": PsuedoLocs.BINDING_THREE.OnCollect(); break; case "binding4": PsuedoLocs.BINDING_FOUR.OnCollect(); break; case "binding5": PsuedoLocs.BINDING_FIVE.OnCollect(); break; case "unlockSpoiers": if (SeedController.Settings.RaceMode) { return; // no cheat } UberSet.Bool(GameComplete, true); Print("spoiler unlocked", toMessageLog: false); break; case "tpCheat": if (SeedController.Settings.RaceMode) { return; // no cheat } tpCheatToggle = !tpCheatToggle; Print($"TPCheat {(tpCheatToggle ? "enabled" : "disabled")}", toMessageLog: false); break; case "warpCredits": if (UberGet.Bool(GameComplete)) { InterOp.start_credits(); } else { Print($"Credit warp not unlocked!", toMessageLog: false); } break; case "printCoords": var pos = InterOp.get_position(); Print($"{pos.X}, {pos.Y}", toMessageLog: false); break; case "nameSpoilerToggle": MapController.NameLabels = !MapController.NameLabels; Print($"Loc name labels {(MapController.NameLabels ? "enabled" : "disabled")}", toMessageLog: false); break; case "logicprovidertoggle": MapController.RustLogic = !MapController.RustLogic; Print($"Logic Provider: {(MapController.RustLogic ? "Rust" : "Java")}", toMessageLog: false); MapController.UpdateReachable(); break; default: Randomizer.Log($"Recieved unknown signal {signal}"); break; } }
public static void Tick() { var signal = Engine.ExecFunction("Tick"); if (signal != null && signal != "none") { Engine.SetVar("signal", "none"); switch (signal) { case "reload": if (FramesTillUnlockReload == 0) { iniFlagCache.Clear(); FramesTillNextSend = 0; Randomizer.Client.Connect(); SeedController.ReadSeed(); if (InterOp.get_game_state() == GameState.Game) { PsuedoLocs.RELOAD_SEED.OnCollect(); } FramesTillUnlockReload = 120; } break; case "lastPickup": FramesTillNextSend = 1; // the only reason this isn't = 0 is that spamming this could get really annoying MessageQueue.Enqueue(Last); break; case "hintMessage": HintsController.ProgressWithHints(); break; case "dev": Randomizer.Dev = !Randomizer.Dev; Randomizer.Log($"Dev: {Randomizer.Dev}"); break; case "exitapp": Environment.Exit(Environment.ExitCode); break; case "toggleDebug": InterOp.set_debug_controls(!InterOp.get_debug_controls()); Print($"Debug {(InterOp.get_debug_controls() ? "enabled" : "disabled")}", toMessageLog: false); break; case "toggleCursorLock": Print($"Cursor Lock {(InterOp.toggle_cursorlock() ? "enabled" : "disabled")}", toMessageLog: false); break; case "test1": PsuedoLocs.BINDING_ONE.OnCollect(); break; case "test2": PsuedoLocs.BINDING_TWO.OnCollect(); break; case "test3": PsuedoLocs.BINDING_THREE.OnCollect(); break; case "test4": if (SeedController.HasInternalSpoilers) { UberSet.Bool(34543, 11226, true); Print("spoiler unlocked", toMessageLog: false); } break; case "test5": tpCheatToggle = !tpCheatToggle; Print($"TPCheat {(tpCheatToggle ? "enabled" : "disabled")}", toMessageLog: false); break; case "printcoords": var pos = InterOp.get_position(); Print($"{pos.X}, {pos.Y}", toMessageLog: false); break; case "namespoilertoggle": MapController.NameLabels = !MapController.NameLabels; Print($"Loc name labels {(MapController.NameLabels ? "enabled" : "disabled")}", toMessageLog: false); break; default: Randomizer.Log($"Recieved unknown signal {signal}"); break; } } FramesTillUnlockReload = Math.Max(0, FramesTillUnlockReload - 1); if (FramesTillNextSend > 0) { FramesTillNextSend--; } else { if (CanPrint) { Current = MessageQueue.Peek(); FramesTillNextSend = Current.Frames; try { InterOp.clear_visible_hints(); InterOp.display_hint(Current.Text, Current.Frames / 60f, Current.Pos); if (IniFlag("LogOnPrint")) { Randomizer.Log($"Sending {Current.Text} for {Current.Frames} ({MessageQueue.Count} remaining in queue)", false); } MessageQueue.Dequeue(); } catch (Exception e) { Randomizer.Error("AHK.sendMsg", e, false); } } else { Current = null; } } }