public static void NewGameInit() { var memory = Randomizer.Memory; if (!memory.IsLoadingGame()) { Randomizer.Log("New Game Init", false); SaveController.SetAbility(AbilityType.SpiritEdge); foreach (UberState s in DefaultUberStates) { memory.WriteUberState(s); } foreach (UberState s in Kuberstates) { memory.WriteUberState(s); } foreach (UberState s in DialogAndRumors) { memory.WriteUberState(s); } if (SeedController.KSDoorsOpen) { foreach (UberState s in KeystoneDoors) { memory.WriteUberState(s); } } if (!AHK.IniFlag("ShowShortCutscenes")) { foreach (UberState s in ShortCutscenes) { memory.WriteUberState(s); } } if (!AHK.IniFlag("ShowLongCutscenes")) { foreach (UberState s in LongCutscenes) { memory.WriteUberState(s); } } if (PsuedoLocs.GAME_START.Pickup().NonEmpty) { Randomizer.InputUnlockCallback = () => { PsuedoLocs.GAME_START.Pickup().Grant(); InterOp.magic_function(); InterOp.save(); }; } InterOp.discover_everything(); InterOp.bind_sword(); InterOp.save(); NeedsNewGameInit = false; } }
public static bool FilterEnabled(int filterId) { var f = (FilterType)filterId; switch (f) { // TODO case FilterType.Quests: return(!AHK.IniFlag("HideQuestFilter")); case FilterType.Teleports: return(!AHK.IniFlag("HideWarpFilter")); case FilterType.Collectibles: return(!AHK.IniFlag("HideCollectableFilter")); case FilterType.InLogic: return(SeedController.HasInternalSpoilers); case FilterType.Spoilers: return(UberGet.value(34543, 11226).Bool); default: return(true); } }
public static void Log(string message, bool printIfDev = true, string level = "INFO") { if (AHK.IniFlag("MuteCSLogs")) { return; } logQueue.Add($"{DateTime.Now:[yyyy-MM-dd HH:mm:ss.fff]} [{level}]: {message}\n"); if (Dev && printIfDev) { AHK.Print(message, 180, toMessageLog: false); } }
public static void Log(string message, bool printIfDev = true, string level = "INFO") { if (AHK.IniFlag("MuteCSLogs")) { return; } if (level == "DEBUG" && !Dev) { return; } File.AppendAllText(LogFile, $"{DateTime.Now.ToString("[yyyy-MM-dd HH:mm:ss.fff]")} [{level}]: {message}\n"); if (Dev && printIfDev) { AHK.Print(message, 180, false); } }
public static void Initialize() { Disabled = AHK.IniFlag("DisableNetcode"); if (Disabled) { Randomizer.Log("Netcode disabled, skipping discord init", false, "DEBUG"); return; } if (InitRunning) { Randomizer.Log("Init running already, skipping", false, "DEBUG"); return; } InitRunning = true; new Thread(() => { try { if (discord == null) { discord = new Discord.Discord(CLIENT_ID, (UInt64)CreateFlags.Default); } if (UserManager == null) { UserManager = discord.GetUserManager(); } if (ApplicationManager == null) { ApplicationManager = discord.GetApplicationManager(); } Initialized = true; if (GetUser() != null) { Randomizer.Log("User already known, skipping rest of discord init", false, "DEBUG"); Randomizer.Client.Connect(); return; } discord.SetLogHook(LogLevel.Debug, (level, message) => Randomizer.Log($"discord: {message}", level.CompareTo(LogLevel.Info) > 0, level.ToString())); UserManager.OnCurrentUserUpdate += DiscordInitComplete; } catch (Exception e) { Randomizer.Error("DiscInitThread", e); } InitRunning = false; }).Start(); }
public static void Log(string message, bool printIfDev = true) { if (AHK.IniFlag("MuteCSLogs")) { return; } if (LastMessage == message && message.Length > 60) { repeats++; if (repeats > 180) { repeats = 0; File.AppendAllText(LogFile, "suppressed repeats x180\n"); } return; } LastMessage = message; File.AppendAllText(LogFile, message + "\n"); if (Dev && printIfDev) { AHK.Print(message); } }
public static bool InjectDebugEnabled() { return(AHK.IniFlag("DebugInjectLogs")); }
public static bool InjectLogEnabled() { return(!AHK.IniFlag("MuteInjectLogs")); }
public static void NewGameInit() { if (!InterOp.is_loading_game()) { InterOp.clear_quest_messages(); Randomizer.Log($"New Game Init - {SeedController.SeedName}", false); ShopController.SetCostsAfterInit(); foreach (UberState s in DefaultUberStates) { s.Write(); } foreach (UberState s in Kuberstates) { s.Write(); } foreach (UberState s in DialogAndRumors) { s.Write(); } if (SeedController.KSDoorsOpen) { foreach (UberState s in KeystoneDoors) { s.Write(); } } if (!AHK.IniFlag("ShowShortCutscenes")) { foreach (UberState s in ShortCutscenes) { s.Write(); } } if (!AHK.IniFlag("ShowLongCutscenes")) { foreach (UberState s in LongCutscenes) { s.Write(); } } InterOp.discover_everything(); if (SeedController.Settings.LegacySeedgen && !SeedController.Flags.Contains(Flag.NOSWORD)) { SaveController.SetAbility(AbilityType.SpiritEdge); var slotRaw = AHK.IniString("Misc", "SpawnSlot"); var slot = 0; if (slotRaw != string.Empty) { slot = slotRaw.ParseToInt("Spawn Slot Ini") - 1; if (slot > 2 || slot < 0) { AHK.Print($"Ignoring invalid slot specifier {slotRaw}", toMessageLog: false); slot = 0; } } InterOp.bind(slot, 1002); } if (PsuedoLocs.GAME_START.Pickup().NonEmpty) { Randomizer.InputUnlockCallback = () => { MapController.UpdateReachable(2000); PsuedoLocs.GAME_START.OnCollect(); InterOp.save(); }; } else { MapController.UpdateReachable(); } InterOp.set_shard_slots(3); InterOp.save(); NeedsNewGameInit = false; } }
private static bool ShouldRevert(UberState state) { if (NeedsNewGameInit || SkipListeners) { return(false); } if (state.Name == "cleanseWellspringQuestUberState" && state.Value.Int < 2 && !AHK.IniFlag("ShowShortCutscenes")) { return(true); } else if (state.Name == "findKuQuest" && state.Value.Int < 4) { return(true); } return(false); }