public void PatchUnlocks() { // synchronize some fields Patcher.Postfix(typeof(Unlocks), nameof(Unlocks.AddUnlock), new Type[] { typeof(string), typeof(string), typeof(bool), typeof(int), typeof(int), typeof(int), typeof(Unlock) }); // pseudo-prefix + replace the entire foreach loop in the end Patcher.Transpiler(typeof(Unlocks), nameof(Unlocks.LoadInitialUnlocks)); Patcher.Prefix(typeof(Unlocks), nameof(Unlocks.CanDoUnlocks)); Patcher.Prefix(typeof(Unlocks), nameof(Unlocks.SaveUnlockData2)); Patcher.Prefix(typeof(Unlocks), nameof(Unlocks.LoadUnlockData2)); if (Patcher.AnyErrors()) { Logger.LogError("One of the unlock patches failed!"); Logger.LogError("Terminating the process to keep the save file safe."); Environment.Exit(1); return; } RogueLibs.CreateCustomName("UnlockFor", NameTypes.Unlock, new CustomNameInfo { English = "Unlock for", Russian = "Разблокировать за", }); }
public void PatchScrollingMenu() { Patcher.Prefix(typeof(ScrollingMenu), nameof(ScrollingMenu.OpenScrollingMenu), nameof(ScrollingMenu_OpenScrollingMenu_Prefix)); Patcher.Postfix(typeof(ScrollingMenu), nameof(ScrollingMenu.OpenScrollingMenu)); Patcher.Prefix(typeof(ScrollingMenu), nameof(ScrollingMenu.SetupChallenges)); Patcher.Prefix(typeof(ScrollingMenu), nameof(ScrollingMenu.SetupFreeItems)); Patcher.Prefix(typeof(ScrollingMenu), nameof(ScrollingMenu.SetupItemUnlocks)); Patcher.Prefix(typeof(ScrollingMenu), nameof(ScrollingMenu.SetupTraitUnlocks)); Patcher.Prefix(typeof(ScrollingMenu), nameof(ScrollingMenu.SetupLoadouts)); Patcher.Prefix(typeof(ScrollingMenu), nameof(ScrollingMenu.SetupChangeTraitsRandom)); Patcher.Prefix(typeof(ScrollingMenu), nameof(ScrollingMenu.SetupRemoveTraits)); Patcher.Prefix(typeof(ScrollingMenu), nameof(ScrollingMenu.SetupUpgradeTraits)); Patcher.Prefix(typeof(ScrollingMenu), nameof(ScrollingMenu.SortUnlocks)); Patcher.Prefix(typeof(ScrollingMenu), nameof(ScrollingMenu.PushedButton)); Patcher.Prefix(typeof(ScrollingMenu), nameof(ScrollingMenu.ShowDetails)); Patcher.Postfix(typeof(ScrollingMenu), nameof(ScrollingMenu.RefreshLoadouts)); Patcher.Postfix(typeof(ScrollingMenu), nameof(ScrollingMenu.CanHaveTrait)); Patcher.AnyErrors(); RogueLibs.CreateCustomName("GiveNuggetsDebug", NameTypes.Unlock, new CustomNameInfo("[DEBUG] +10 Nuggets")); RogueLibs.CreateCustomName("D_GiveNuggetsDebug", NameTypes.Unlock, new CustomNameInfo("A debug tool that gives you 10 nuggets.")); }