Пример #1
0
        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 = "Разблокировать за",
            });
        }
Пример #2
0
        public void PatchItems()
        {
            // Create and initialize item hooks
            Patcher.Postfix(typeof(InvItem), nameof(InvItem.SetupDetails));

            // CustomItem, IItemUsable patch
            Patcher.Prefix(typeof(ItemFunctions), nameof(ItemFunctions.UseItem));

            // CustomItem, IItemCombinable and IItemTargetable
            Patcher.Prefix(typeof(InvItem), nameof(InvItem.CombineItems));
            Patcher.Prefix(typeof(InvItem), nameof(InvItem.TargetObject));

            // CustomItem, IItemTargetable.TargetTooltip(.) patches
            Patcher.Postfix(typeof(InvInterface), nameof(InvInterface.ShowTarget), new Type[] { typeof(InvItem) });
            Patcher.Postfix(typeof(InvInterface), nameof(InvInterface.ShowCursorText),
                            new Type[] { typeof(string), typeof(string), typeof(PlayfieldObject), typeof(int) });
            Patcher.Postfix(typeof(InvInterface), nameof(InvInterface.HideCursorText));

            // CustomItem, IItemCombinable.CombineTooltip(.) patch
            Patcher.Postfix(typeof(InvSlot), nameof(InvSlot.SetColor));
            // CustomItem.GetCount(.) patch
            Patcher.Postfix(typeof(InvSlot), "LateUpdate");
            Patcher.Postfix(typeof(EquippedItemSlot), nameof(EquippedItemSlot.LateUpdateEquippedItemSlot));

            // CustomItem, IItemTargetableAnywhere patches
            Patcher.Postfix(typeof(InvInterface), nameof(InvInterface.TargetAnywhere));

            Patcher.AnyErrors();

            DefaultInventoryChecks.SubscribeChecks();
        }
Пример #3
0
        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."));
        }
Пример #4
0
        public void PatchTraitsAndStatusEffects()
        {
#pragma warning disable CS0618 // NetworkInstanceId is obsolete
            Patcher.Transpiler(typeof(StatusEffects), nameof(StatusEffects.AddStatusEffect),
                               new Type[] { typeof(string), typeof(bool), typeof(Agent), typeof(NetworkInstanceId), typeof(bool), typeof(int) });
#pragma warning restore CS0618
            Patcher.Transpiler(typeof(StatusEffects), nameof(StatusEffects.AddTrait),
                               new Type[] { typeof(string), typeof(bool), typeof(bool) });

            Patcher.Prefix(typeof(StatusEffects), nameof(StatusEffects.RemoveTrait), nameof(StatusEffects_RemoveTrait_Prefix),
                           new Type[] { typeof(string), typeof(bool) });
            Patcher.Postfix(typeof(StatusEffects), nameof(StatusEffects.RemoveTrait),
                            new Type[] { typeof(string), typeof(bool) });

#pragma warning disable CS0618 // NetworkInstanceId is obsolete
            Patcher.Prefix(typeof(StatusEffects), nameof(StatusEffects.RemoveStatusEffect), nameof(StatusEffects_RemoveStatusEffect_Prefix),
                           new Type[] { typeof(string), typeof(bool), typeof(NetworkInstanceId), typeof(bool) });
            Patcher.Postfix(typeof(StatusEffects), nameof(StatusEffects.RemoveStatusEffect),
                            new Type[] { typeof(string), typeof(bool), typeof(NetworkInstanceId), typeof(bool) });
#pragma warning restore CS0618

            Patcher.Transpiler(typeof(StatusEffects), nameof(StatusEffects.GetStatusEffectTime));
            Patcher.Postfix(typeof(StatusEffects), nameof(StatusEffects.GetStatusEffectHate));

            Patcher.Prefix(typeof(StatusEffects), nameof(StatusEffects.UpdateStatusEffect));
            Patcher.Prefix(typeof(StatusEffects), nameof(StatusEffects.UpdateTrait));

            Patcher.AnyErrors();
        }
Пример #5
0
        public void PatchAgents()
        {
            // GetLastFiredBullet() extension
            Patcher.Postfix(typeof(Gun), nameof(Gun.spawnBullet),
                            new Type[5] {
                typeof(bulletStatus), typeof(InvItem), typeof(int), typeof(bool), typeof(string)
            });



            Patcher.AnyErrors();
        }
        public void PatchCharacterCreation()
        {
            Patcher.Prefix(typeof(CharacterCreation), nameof(CharacterCreation.SetupItems));
            Patcher.Prefix(typeof(CharacterCreation), nameof(CharacterCreation.SetupTraits));
            Patcher.Prefix(typeof(CharacterCreation), nameof(CharacterCreation.SetupAbilities));
            Patcher.Prefix(typeof(CharacterCreation), nameof(CharacterCreation.SetupBigQuests));

            Patcher.Prefix(typeof(CharacterCreation), nameof(CharacterCreation.SortUnlocks));

            Patcher.Prefix(typeof(CharacterCreation), nameof(CharacterCreation.PushedButton));

            Patcher.Prefix(typeof(CharacterCreation), nameof(CharacterCreation.ShowDetails));

            Patcher.AnyErrors();
        }
Пример #7
0
        public void PatchAbilities()
        {
            Patcher.Postfix(typeof(StatusEffects), nameof(StatusEffects.GiveSpecialAbility));

            Patcher.Postfix(typeof(StatusEffects), nameof(StatusEffects.PressedSpecialAbility));
            Patcher.Postfix(typeof(StatusEffects), nameof(StatusEffects.HeldSpecialAbility));
            Patcher.Postfix(typeof(StatusEffects), nameof(StatusEffects.ReleasedSpecialAbility));

            Patcher.Prefix(typeof(StatusEffects), "RechargeSpecialAbility2");
            Patcher.Prefix(typeof(StatusEffects), "SpecialAbilityInterfaceCheck2");

            Patcher.Postfix(typeof(SpecialAbilityIndicator), nameof(SpecialAbilityIndicator.ShowIndicator),
                            new Type[3] {
                typeof(PlayfieldObject), typeof(string), typeof(string)
            });

            Patcher.AnyErrors();
        }
Пример #8
0
        public void PatchMisc()
        {
            // initialize LanguageService
            Patcher.Postfix(typeof(NameDB), nameof(NameDB.RealAwake));
            // CustomNames
            Patcher.Postfix(typeof(NameDB), nameof(NameDB.GetName));

            // IDoUpdate.Update
            Patcher.Postfix(typeof(Updater), "Update");
            // IDoFixedUpdate.FixedUpdate
            Patcher.Postfix(typeof(Updater), nameof(Updater.FixedUpdate));

            // load prepared AudioClips
            Patcher.Prefix(typeof(AudioHandler), nameof(AudioHandler.SetupDics), nameof(AudioHandler_SetupDics_Prefix));
            Patcher.Postfix(typeof(AudioHandler), nameof(AudioHandler.SetupDics));

            // remove 99 nuggets max limit
            Patcher.Prefix(typeof(Unlocks), nameof(Unlocks.AddNuggets));

            Patcher.AnyErrors();
        }