Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of TweaksForDaltonGoesFast v1.1.0
TweaksForDaltonGoesFast.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using EntityStates; using EntityStates.Missions.BrotherEncounter; using HG.Reflection; using HarmonyLib; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.EntityStates.Missions.BrotherEncounter; using On.RoR2; using R2API.Utils; using RoR2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("TweaksForDaltonGoesFast")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("TweaksForDaltonGoesFast")] [assembly: AssemblyTitle("TweaksForDaltonGoesFast")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace TweaksForDaltonGoesFast { [BepInPlugin("GiGaGon.TweaksForDaltonGoesFast", "TweaksForDaltonGoesFast", "1.1.0")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class TweaksForDaltonGoesFast : BaseUnityPlugin { internal class ModConfig { public static ConfigEntry<bool> blockPortalInteraction; public static ConfigEntry<bool> blockSeerInteraction; public static ConfigEntry<bool> blockTeleporterInteraction; public static ConfigEntry<bool> blockSafeWardInteraction; public static ConfigEntry<string> trustedPlayerList; public static ConfigEntry<float> simulacrumRewardVectorMultiplyer; public static ConfigEntry<string> interactionBlockMessage; public static void InitConfig(ConfigFile config) { blockPortalInteraction = config.Bind<bool>("General", "Block Portal Interaction", true, "Block non-trusted players from interacting with Portals"); blockSeerInteraction = config.Bind<bool>("General", "Block Seer Interaction", true, "Block non-trusted players from interacting with Lunar Seers"); blockTeleporterInteraction = config.Bind<bool>("General", "Block Teleporter Interaction", true, "Block non-trusted players from interacting with Teleporters"); blockSafeWardInteraction = config.Bind<bool>("General", "Block SafeWard Interaction", true, "Block non-trusted players from interacting with the Safe Ward"); trustedPlayerList = config.Bind<string>("General", "Trusted Player List", "", "Comma seperated list of trusted player ids. Will get copied when installed from modpack code, so watch out."); simulacrumRewardVectorMultiplyer = config.Bind<float>("General", "Simulacrum Reward Vector Multiplyer", 1f, "Float to multiply the velocity of Simularcum reward item droplets by."); interactionBlockMessage = config.Bind<string>("General", "Interaction Blocked Message", "Non-trusted player {player_name} tried to activate {interactable_name}, interaction blocked.", "Message to send when an interaction is blocked. The special strings {player_name} and {interactable_name} will be replaced with the relevent details when sent."); } } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<ItemTierDef, bool> <>9__7_0; public static Func<ItemTierDef, ItemTier> <>9__7_1; public static Func<Instruction, bool> <>9__8_23; public static Func<Instruction, bool> <>9__8_24; public static Func<Instruction, bool> <>9__8_25; public static Func<Instruction, bool> <>9__8_27; public static Func<Instruction, bool> <>9__8_28; public static Func<Instruction, bool> <>9__8_29; public static Func<Vector3, int, Vector3> <>9__8_30; public static Func<Instruction, bool> <>9__8_31; public static Func<Instruction, bool> <>9__8_32; public static Func<Instruction, bool> <>9__8_33; public static Func<string, bool> <>9__8_37; public static hook_OnEnter <>9__8_9; internal bool <GetItemTiers>b__7_0(ItemTierDef x) { return (Object)(object)x != (Object)null; } internal ItemTier <GetItemTiers>b__7_1(ItemTierDef x) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return x.tier; } internal bool <Awake>b__8_23(Instruction x) { return ILPatternMatchingExt.MatchLdloca(x, 6); } internal bool <Awake>b__8_24(Instruction x) { return ILPatternMatchingExt.MatchLdarg(x, 0); } internal bool <Awake>b__8_25(Instruction x) { return ILPatternMatchingExt.MatchLdfld<InfiniteTowerWaveController>(x, "rewardOptionCount"); } internal bool <Awake>b__8_27(Instruction x) { return ILPatternMatchingExt.MatchLdloca(x, 6); } internal bool <Awake>b__8_28(Instruction x) { return ILPatternMatchingExt.MatchLdloc(x, 4); } internal bool <Awake>b__8_29(Instruction x) { return ILPatternMatchingExt.MatchStfld<CreatePickupInfo>(x, "position"); } internal Vector3 <Awake>b__8_30(Vector3 original_position, int index) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (index >= PlayerCharacterMasterController.instances.Count) { return original_position; } PlayerCharacterMasterController val = PlayerCharacterMasterController.instances[index]; if (!val.master.IsDeadAndOutOfLivesServer() && !((Object)(object)val.master.GetBody().transform == (Object)null)) { _ = val.master.GetBody().transform.position; if (0 == 0) { return val.master.GetBody().transform.position; } } return original_position; } internal bool <Awake>b__8_31(Instruction x) { return ILPatternMatchingExt.MatchDup(x); } internal bool <Awake>b__8_32(Instruction x) { return ILPatternMatchingExt.MatchLdfld<CreatePickupInfo>(x, "position"); } internal bool <Awake>b__8_33(Instruction x) { return ILPatternMatchingExt.MatchLdloc(x, 2); } internal bool <Awake>b__8_37(string x) { return x != ""; } internal void <Awake>b__8_9(orig_OnEnter orig, EncounterFinished self) { ((EntityState)self).outer.SetNextState((EntityState)(object)new BrotherEncounterLowerWalls()); } } public static TweaksForDaltonGoesFast instance; private static Harmony test; public const string PluginGUID = "GiGaGon.TweaksForDaltonGoesFast"; public const string PluginAuthor = "GiGaGon"; public const string PluginName = "TweaksForDaltonGoesFast"; public const string PluginVersion = "1.1.0"; private void GetItemTiers() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) foreach (ItemTier item in from x in (IEnumerable<ItemTierDef>)(object)ItemTierCatalog.allItemTierDefs where (Object)(object)x != (Object)null select x.tier) { ((BaseUnityPlugin)this).Config.Bind<int>("Simulacrum Reward Potential Settings", $"{item} Options", 1, $"How many options to give when a item potential of {item} is dropped as a simulacrum wave reward."); } } public void Awake() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown instance = this; test = Harmony.CreateAndPatchAll(typeof(MonoBehaviourCallbackHooks), (string)null); ModConfig.InitConfig(((BaseUnityPlugin)this).Config); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(GetItemTiers)); InfiniteTowerWaveController.DropRewards += (Manipulator)delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) ILCursor val4 = new ILCursor(il); val4.GotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdloca(x, 6), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<InfiniteTowerWaveController>(x, "rewardOptionCount") }); val4.Index += 3; val4.Emit(OpCodes.Ldarg_0); val4.EmitDelegate<Func<int, InfiniteTowerWaveController, int>>((Func<int, InfiniteTowerWaveController, int>)delegate(int original_count, InfiniteTowerWaveController wave_controller) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Config.Reload(); ConfigEntry<int> val7 = default(ConfigEntry<int>); if (((BaseUnityPlugin)this).Config.TryGetEntry<int>("Simulacrum Reward Potential Settings", $"{wave_controller.rewardDisplayTier} Options", ref val7)) { return val7.Value; } ((BaseUnityPlugin)this).Config.Bind<int>("Simulacrum Reward Potential Settings", $"{wave_controller.rewardDisplayTier} Options", original_count, $"How many options to give when a item potential of {wave_controller.rewardDisplayTier} is dropped as a simulacrum wave reward."); return original_count; }); val4.GotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdloca(x, 6), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 4), (Instruction x) => ILPatternMatchingExt.MatchStfld<CreatePickupInfo>(x, "position") }); val4.Index += 2; val4.Emit(OpCodes.Ldloc, 5); val4.EmitDelegate<Func<Vector3, int, Vector3>>((Func<Vector3, int, Vector3>)delegate(Vector3 original_position, int index) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (index >= PlayerCharacterMasterController.instances.Count) { return original_position; } PlayerCharacterMasterController val6 = PlayerCharacterMasterController.instances[index]; if (!val6.master.IsDeadAndOutOfLivesServer() && !((Object)(object)val6.master.GetBody().transform == (Object)null)) { _ = val6.master.GetBody().transform.position; if (0 == 0) { return val6.master.GetBody().transform.position; } } return original_position; }); val4.GotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchDup(x), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CreatePickupInfo>(x, "position"), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 2) }); val4.Index += 3; val4.Emit(OpCodes.Ldloc, 5); val4.EmitDelegate<Func<Vector3, int, Vector3>>((Func<Vector3, int, Vector3>)delegate(Vector3 original_velocity, int index) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) if (index >= PlayerCharacterMasterController.instances.Count) { ((BaseUnityPlugin)this).Config.Reload(); return original_velocity * ModConfig.simulacrumRewardVectorMultiplyer.Value; } PlayerCharacterMasterController val5 = PlayerCharacterMasterController.instances[index]; if (!val5.master.IsDeadAndOutOfLivesServer() && !((Object)(object)val5.master.GetBody().transform == (Object)null)) { _ = val5.master.GetBody().transform.position; if (0 == 0) { return Vector3.zero; } } ((BaseUnityPlugin)this).Config.Reload(); return original_velocity * ModConfig.simulacrumRewardVectorMultiplyer.Value; }); }; Interactor.PerformInteraction += (hook_PerformInteraction)delegate(orig_PerformInteraction orig, Interactor self, GameObject interactableObject) { //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Expected O, but got Unknown ((BaseUnityPlugin)this).Config.Reload(); string[] source = new string[4] { "Portal", "Seer", "Teleporter", "SafeWard" }; if ((Object)(object)interactableObject == (Object)null) { orig.Invoke(self, interactableObject); } else { string[] array = source.Where((string x) => ((Object)interactableObject).name.Contains(x)).ToArray(); if (array.Length == 0) { orig.Invoke(self, interactableObject); } else { ConfigEntry<bool> val2 = default(ConfigEntry<bool>); ((BaseUnityPlugin)this).Config.TryGetEntry<bool>("General", "Block " + array[0] + " Interaction", ref val2); if (!val2.Value) { orig.Invoke(self, interactableObject); } else if ((Object)(object)((Component)self).GetComponent<CharacterBody>() == (Object)(object)PlayerCharacterMasterController.instances[0].master.GetBody()) { orig.Invoke(self, interactableObject); } else { string[] array2 = (from x in ModConfig.trustedPlayerList.Value.Split(',') where x != "" select x).ToArray(); if (array2.Length != 0) { string[] array3 = array2; foreach (string value in array3) { if (((Component)self).GetComponent<CharacterBody>().GetUserName().Contains(value)) { orig.Invoke(self, interactableObject); return; } } } SimpleChatMessage val3 = new SimpleChatMessage(); val3.baseToken = "<color=#ff0000>{0}</color>"; val3.paramTokens = new string[1] { ModConfig.interactionBlockMessage.Value.Replace("{player_name}", ((Component)self).GetComponent<CharacterBody>().GetUserName()).Replace("{interactable_name}", array[0]) }; Chat.SendBroadcastChat((ChatMessageBase)(object)val3); } } } }; object obj = <>c.<>9__8_9; if (obj == null) { hook_OnEnter val = delegate(orig_OnEnter orig, EncounterFinished self) { ((EntityState)self).outer.SetNextState((EntityState)(object)new BrotherEncounterLowerWalls()); }; <>c.<>9__8_9 = val; obj = (object)val; } EncounterFinished.OnEnter += (hook_OnEnter)obj; } private void OnDestroy() { test.UnpatchSelf(); } } public class BrotherEncounterLowerWalls : BrotherEncounterBaseState { public override bool shouldEnableArenaWalls => false; public override void OnEnter() { ((BrotherEncounterBaseState)this).OnEnter(); } } }