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 TripleJump v0.1.1
TripleJumpTool.dll
Decompiled a month agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using GlobalSettings; using HarmonyLib; using Microsoft.CodeAnalysis; using Needleforge; using Needleforge.Data; using Newtonsoft.Json; using TeamCherry.Localization; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("TripleJumpTool")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.1.1.0")] [assembly: AssemblyInformationalVersion("0.1.1+286c533c1ae0607e2bfcb8a47d032198fccc5c8a")] [assembly: AssemblyProduct("TripleJumpTool")] [assembly: AssemblyTitle("TripleJump")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/JasonForNian/TripleJumpTool")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.1.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace TripleJumpTool { [BepInPlugin("io.github.jasonfornian.triplejumptool", "TripleJump", "0.1.1")] public class TripleJumpToolPlugin : BaseUnityPlugin { public static Config config; public const string Id = "io.github.jasonfornian.triplejumptool"; public static string Name => "TripleJump"; public static string Version => "0.1.1"; private void Awake() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)("Plugin " + Name + " (io.github.jasonfornian.triplejumptool) has loaded!")); Harmony val = new Harmony("io.github.jasonfornian.triplejumptool"); val.PatchAll(); RegisterTrippleJump(); Initialize(); } private void RegisterTrippleJump() { //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogInfo((object)"TripleJumpToolPlugin: aaaaa"); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); ((BaseUnityPlugin)this).Logger.LogInfo((object)("TripleJumpToolPlugin: " + directoryName)); string text = Path.Combine(directoryName, "TripleJump.json"); ((BaseUnityPlugin)this).Logger.LogInfo((object)("TripleJumpToolPlugin: " + text)); if (File.Exists(text)) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("TripleJumpToolPlugin: " + text + ",has file")); string text2 = File.ReadAllText(text); config = JsonConvert.DeserializeObject<Config>(text2); ((BaseUnityPlugin)this).Logger.LogInfo((object)("TripleJumpToolPlugin: " + config.Name + " " + config.Desc)); ToolData val = NeedleforgePlugin.AddTool("TripleJump", ParseType(config.Type), new LocalisedString { Sheet = "", Key = "TripleJump_Name" }, new LocalisedString { Sheet = "", Key = "TripleJump_Desc" }, FromFile(config.Icon)); val.UnlockedAtStart = false; } } private static ToolItemType ParseType(string typeStr) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (Enum.TryParse<ToolItemType>(typeStr, ignoreCase: true, out ToolItemType result)) { return result; } return (ToolItemType)2; } private static Sprite FromFile(string fileName) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string path = Path.Combine(directoryName, fileName); if (!File.Exists(path)) { return null; } byte[] array = File.ReadAllBytes(path); Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, array); return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } public static void Initialize() { SceneManager.sceneLoaded += OnSceneLoaded; } private static void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)("TripleJumpToolPlugin: OnSceneLoaded " + ((Scene)(ref scene)).name + "," + config.MapID)); if (!(((Scene)(ref scene)).name != config.MapID) && PlayerData.instance != null) { FieldInfo field = typeof(PlayerData).GetField(config.state, BindingFlags.Instance | BindingFlags.Public); if (!(field == null) && (bool)field.GetValue(PlayerData.instance) && !ToolItemManager.GetToolByName("TripleJump").IsUnlocked) { Debug.Log((object)("TripleJumpToolPlugin: " + config.Name + " " + config.Desc)); Vector3 position = HeroController.instance.transform.position; GameObject val = new GameObject("TempSpawnPoint"); val.transform.position = new Vector3(config.Position[0], config.Position[1], 0f); CollectableItemPickup val2 = Object.Instantiate<CollectableItemPickup>(Gameplay.CollectableItemPickupPrefab); CollectableItemPickup component = ((Component)val2).GetComponent<CollectableItemPickup>(); component.SetPlayerDataBool("TripleJump"); component.SetItem((SavedItem)null, false); Config val3 = default(Config); val3.Prefab = ((Component)component).gameObject; val3.AmountMin = 1; val3.AmountMax = 1; val3.SpeedMin = 10f; val3.SpeedMax = 10f; val3.AngleMin = 90f; val3.AngleMax = 90f; FlingUtils.SpawnAndFling(val3, val.transform, Vector3.zero, (List<GameObject>)null, -1f); } } } } public class Config { public string Name; public string Desc; public string Icon; public string Type; public string MapID; public float[] Position; public string state; } [HarmonyPatch(typeof(HeroController))] public class TripleJump { private static bool TripleJumping; [HarmonyPatch("StartFloat")] [HarmonyPrefix] public static bool StartFloat_Prefix(HeroController __instance) { if (!ToolItemManager.IsToolEquipped("TripleJump")) { return true; } if (__instance.doubleJumped && !TripleJumping) { TripleJumping = true; DoTripleJump(__instance); return false; } if (TripleJumping) { __instance.CancelQueuedBounces(); __instance.umbrellaFSM.SendEvent("FLOAT"); return false; } return true; } [HarmonyPatch("DoDoubleJump")] [HarmonyPrefix] public static bool DoDoubleJump_Prefix(HeroController __instance) { TripleJumping = false; return true; } public static void DoTripleJump(HeroController __instance) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) if (SlideSurface.IsInJumpGracePeriod) { return; } if (__instance.cState.inUpdraft && __instance.CanFloat(true)) { __instance.fsm_brollyControl.SendEvent("FORCE UPDRAFT ENTER"); } else if (__instance.shuttleCockJumpSteps <= 0) { if (__instance.cState.dashing && __instance.dashingDown) { __instance.FinishedDashing(true); } if (__instance.cState.jumping) { __instance.Jump(); } ObjectPoolExtensions.Spawn(__instance.doubleJumpEffectPrefab, __instance.transform, Vector3.zero); if (((ToolBase)Gameplay.BrollySpikeTool).IsEquipped) { GameObject val = ObjectPoolExtensions.Spawn(Gameplay.BrollySpikeObject_dj, __instance.transform); val.transform.Translate(0f, 0f, -0.001f); val.transform.Rotate(0f, 0f, -10f); } __instance.vibrationCtrl.PlayDoubleJump(); if (Object.op_Implicit((Object)(object)__instance.audioSource) && Object.op_Implicit((Object)(object)__instance.doubleJumpClip)) { __instance.audioSource.PlayOneShot(__instance.doubleJumpClip, 1f); } Vector2 linearVelocity = __instance.rb2d.linearVelocity; if (linearVelocity.y < 0f - __instance.MAX_FALL_VELOCITY_DJUMP) { __instance.rb2d.linearVelocity = new Vector2(linearVelocity.x, 0f - __instance.MAX_FALL_VELOCITY_DJUMP); } __instance.ShuttleCockCancel(); __instance.ResetLook(); __instance.startWithDownSpikeBounceShort = false; __instance.cState.downSpikeBouncingShort = false; __instance.startWithDownSpikeBounce = false; __instance.cState.downSpikeBouncing = false; __instance.cState.jumping = false; __instance.cState.doubleJumping = true; __instance.cState.downSpikeRecovery = false; __instance.animCtrl.AllowDoubleJumpReEntry(); if (__instance.jumped_steps < __instance.JUMP_STEPS_MIN) { __instance.jumped_steps = __instance.JUMP_STEPS_MIN; } __instance.doubleJump_steps = 0; __instance.doubleJumped = true; __instance.ResetHardLandingTimer(); Traverse.Create((object)__instance).Field("OnDoubleJumped").GetValue<Action>()?.Invoke(); } } } [HarmonyPatch(typeof(CollectableItemPickup))] public class Pickup { [HarmonyPatch("DoPickupAction")] [HarmonyPostfix] public static void DoPickupPostfix(CollectableItemPickup __instance, bool __result) { if (__result) { string value = Traverse.Create((object)__instance).Field("playerDataBool").GetValue<string>(); if (value == "TripleJump") { ToolItemManager.GetToolByName(value).Unlock((Action)null, (PopupFlags)3); } } } } [HarmonyPatch(typeof(LocalisedString))] [HarmonyPatch("ToString", new Type[] { typeof(bool) })] public static class LocalisedStringOverride { [HarmonyPostfix] private static void Postfix(LocalisedString __instance, ref string __result) { string text = __result; if (string.IsNullOrEmpty(text) || !text.StartsWith("!!/")) { return; } string text2 = text.Substring("!!/".Length, text.Length - "!!/".Length - 2); int num = text2.LastIndexOf('_'); if (num >= 0) { string text3 = text2.Substring(0, num); string text4 = text2.Substring(num + 1); if (text4 == "Name") { __result = TripleJumpToolPlugin.config.Name; } else if (text4 == "Desc") { __result = TripleJumpToolPlugin.config.Desc; } else { Debug.LogWarning((object)("Unknown suffix " + text4 + " in localised string " + text)); } } } } }