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 FruityJumps v1.4.0
JumpRework.dll
Decompiled 2 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using EntityStates; using EntityStates.ClayBoss; using EntityStates.Headstompers; using HG.Reflection; using IL.EntityStates; using IL.EntityStates.Headstompers; using MissileRework; using Mono.Cecil.Cil; using MonoMod.Cil; using MoreStats; using On.RoR2.Items; using R2API; using R2API.Utils; using RoR2; using RoR2.Items; using RoR2.Projectile; using UnityEngine; using UnityEngine.AddressableAssets; [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 = "")] [assembly: AssemblyCompany("JumpRework")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("JumpRework")] [assembly: AssemblyTitle("JumpRework")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace JumpRework; [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.RiskOfBrainrot.FruityJumps", "FruityJumps", "1.3.2")] [R2APISubmoduleDependency(new string[] { "LanguageAPI", "ContentAddition" })] public class JumpReworkPlugin : BaseUnityPlugin { public float hopooDamageBuffDuration = 0.5f; public static float hopooDamageIncreasePerBuff = 0.1f; private float featherBaseDuration = 0.75f; private float featherStackDuration = 0.5f; public static float featherJumpPowerBase = 0.15f; public static float featherJumpPowerStack = 0.15f; public const string guid = "com.RiskOfBrainrot.FruityJumps"; public const string teamName = "RiskOfBrainrot"; public const string modName = "FruityJumps"; public const string version = "1.3.2"; public static int urnBallCountBase = 3; public static int urnBallCountStack = 0; public static float urnBallYawSpread = 25f; public static GameObject miredUrnTarball; public static PluginInfo PInfo { get; private set; } internal static ConfigFile CustomConfigFile { get; private set; } public static ConfigEntry<bool> NerfDoubleJumps { get; set; } public static ConfigEntry<bool> ReworkFeather { get; set; } public static ConfigEntry<bool> ReworkHeadstomper { get; set; } public static ConfigEntry<bool> ReworkUrn { get; set; } public static ConfigEntry<float> DoubleJumpVBonus { get; set; } public static ConfigEntry<float> DoubleJumpHBonus { get; set; } public static ConfigEntry<int> FeatherJumpCount { get; set; } public static ConfigEntry<int> UrnJumpCount { get; set; } public static ConfigEntry<int> HeadstomperJumpCount { get; set; } public static ConfigEntry<bool> HeadstomperBoostLast { get; set; } public static ConfigEntry<float> HeadstomperBoostStrengthFirst { get; set; } public static ConfigEntry<float> HeadstomperBoostStrengthLast { get; set; } public static ConfigEntry<int> UrnBallInterval { get; set; } public static ConfigEntry<float> UrnBallDamageCoefficient { get; set; } public static int urnBallInterval => UrnBallInterval.Value; private void FeatherRework() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown JumpAPI.OnJumpEvent += new OnJumpSynergyHandler(FeatherJumpPowerBoost); RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(FeatherJumpPower); LanguageAPI.Add("ITEM_FEATHER_PICKUP", "Double jump with increased jump height."); LanguageAPI.Add("ITEM_FEATHER_DESC", ((FeatherJumpCount.Value == 1) ? "Gain an additional jump. " : $"Gain <style=cIsUtility>{FeatherJumpCount.Value}</style> jumps. ") + "Increase jump power by <style=cIsUtility>" + featherJumpPowerBase.AsPercent() + "</style> <style=cStack>(+" + featherJumpPowerStack.AsPercent() + " per stack)</style>."); } private void FeatherJumpPower(CharacterBody sender, StatHookEventArgs args) { Inventory inventory = sender.inventory; if (Object.op_Implicit((Object)(object)inventory)) { int itemCountEffective = inventory.GetItemCountEffective(Items.Feather); if (itemCountEffective > 0) { float num = featherJumpPowerBase + featherJumpPowerStack * (float)(itemCountEffective - 1); args.jumpPowerMultAdd += num; } } } private void FeatherJumpPowerBoost(CharacterMotor sender, JumpSynergyInfo jumpSynergyInfo) { CharacterBody body = sender.body; Inventory inventory = body.inventory; if (Object.op_Implicit((Object)(object)inventory)) { int itemCountEffective = inventory.GetItemCountEffective(Items.Feather); if (itemCountEffective > 0 && JumpAPI.IsDoubleJump(sender)) { float num = featherJumpPowerBase + featherJumpPowerStack * (float)(itemCountEffective - 1); JumpAPI.ProposeJumpPowerBonusForCurrentJump(0f, num); } } } private void FeatherOnJump(CharacterMotor motor, JumpSynergyInfo synergyInfo) { CharacterBody body = motor.body; Inventory inventory = body.inventory; if (Object.op_Implicit((Object)(object)inventory)) { int itemCountEffective = inventory.GetItemCountEffective(Items.Feather); if (itemCountEffective > 0 && !JumpAPI.IsDoubleJump(motor)) { } } } private void StompersRework() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown HeadstompersIdle.FixedUpdateAuthority += new Manipulator(HeadstompersJumpBoost); LanguageAPI.Add("ITEM_FALLBOOTS_PICKUP", "Quadruple jump. Hold 'Interact' to slam down to the ground."); LanguageAPI.Add("ITEM_FALLBOOTS_DESC", $"Gain <style=cIsUtility>{HeadstomperJumpCount.Value}</style> jumps. " + "Creates a <style=cIsDamage>5m-100m</style> radius <style=cIsDamage>kinetic explosion</style> on hitting the ground, dealing <style=cIsDamage>1000%-10000%</style> base damage that scales up with <style=cIsDamage>fall distance</style>. Recharges in <style=cIsDamage>10</style> <style=cStack>(-50% per stack)</style> seconds."); } private void HeadstompersJumpBoost(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<BaseHeadstompersState>(x, "get_isGrounded") }); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<bool, HeadstompersIdle, bool>>((Func<bool, HeadstompersIdle, bool>)delegate(bool isGrounded, HeadstompersIdle self) { bool result = isGrounded; if (HeadstomperBoostLast.Value) { CharacterMotor bodyMotor = ((BaseHeadstompersState)self).bodyMotor; if (Object.op_Implicit((Object)(object)bodyMotor)) { result = JumpAPI.IsLastJump(bodyMotor); } } return result; }); val.GotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdflda<Vector3>(x, "y"), (Instruction x) => ILPatternMatchingExt.MatchDup(x) }); float num = default(float); val.GotoNext((MoveType)0, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchMul(x) }); val.Remove(); val.Emit(OpCodes.Ldc_R4, HeadstomperBoostLast.Value ? HeadstomperBoostStrengthLast.Value : HeadstomperBoostStrengthFirst.Value); } public static bool IsMissileArtifactEnabled() { if (Tools.isLoaded("com.RiskOfBrainrot.IAmBecomeMissiles")) { return GetMissileArtifactEnabled(); } return false; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static bool GetMissileArtifactEnabled() { return RunArtifactManager.instance.IsArtifactEnabled(MissileReworkPlugin.MissileArtifact); } public void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Expected O, but got Unknown //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Expected O, but got Unknown CustomConfigFile = new ConfigFile(Paths.ConfigPath + "\\FruityJumps.cfg", true); NerfDoubleJumps = CustomConfigFile.Bind<bool>("Reworks", "Nerf Double Jump Strength", true, ""); ReworkFeather = CustomConfigFile.Bind<bool>("Reworks", "Rework Hopoo Feather", true, ""); ReworkHeadstomper = CustomConfigFile.Bind<bool>("Reworks", "Rework Hopoo Feather", true, ""); ReworkUrn = CustomConfigFile.Bind<bool>("Reworks", "Rework Hopoo Feather", true, ""); DoubleJumpVBonus = CustomConfigFile.Bind<float>("Jump Strength", "Double Jump Vertical Strength", 0.8f, "Vertical strength bonus of double jumps. Vanilla base jumps are 1, double jumps 1.5"); DoubleJumpHBonus = CustomConfigFile.Bind<float>("Jump Strength", "Double Jump Horizontal Strength", 1.1f, "Horizontal strength bonus of double jumps. Vanilla base jumps are 1, double jumps 1.3"); FeatherJumpCount = CustomConfigFile.Bind<int>("Jump Counts", "Hopoo Feather Jump Count", 1, "Only applies if its respective rework is enabled."); HeadstomperJumpCount = CustomConfigFile.Bind<int>("Jump Counts", "Headstomper Jump Count", 3, "Only applies if its respective rework is enabled."); UrnJumpCount = CustomConfigFile.Bind<int>("Jump Counts", "Mired Urn Jump Count", 2, "Only applies if its respective rework is enabled."); HeadstomperBoostLast = CustomConfigFile.Bind<bool>("Headstompers", "Should Headstompers boost the last jump instead of the first?", true, ""); HeadstomperBoostStrengthFirst = CustomConfigFile.Bind<float>("Headstompers", "Headstompers First Super Jump Strength", 1.2f, "Only applies if the Super Jump is configured to be first. Vanilla is 2"); HeadstomperBoostStrengthLast = CustomConfigFile.Bind<float>("Headstompers", "Headstompers Final Super Jump Strength", 2f, "Only applies if the Super Jump is configured to be last"); UrnBallInterval = CustomConfigFile.Bind<int>("Mired Urn", "Mired Urn Ball Interval", 2, "Mired Urn fires a tar ball on every Nth air jump, based on this interval."); UrnBallDamageCoefficient = CustomConfigFile.Bind<float>("Mired Urn", "Urn Ball Damage Coefficient", 6.5f, "Multiply by 100 for %, ie 6.5 is 650%"); CreateMiredUrnTarball(); if (ReworkUrn.Value || ReworkHeadstomper.Value) { StatHooks.GetMoreStatCoefficients += new MoreStatHookEventHandler(JumpCounts); } if (NerfDoubleJumps.Value) { GenericCharacterMain.ProcessJump_bool += new Manipulator(DoubleJumpStrengthNerf); } if (ReworkFeather.Value) { BaseStats.FeatherJumpCountBase = FeatherJumpCount.Value; BaseStats.FeatherJumpCountStack = 0; FeatherRework(); } if (ReworkHeadstomper.Value) { StompersRework(); } if (ReworkUrn.Value) { MiredUrnRework(); } } private void JumpCounts(CharacterBody sender, MoreStatHookEventArgs args) { Inventory inventory = sender.inventory; if (Object.op_Implicit((Object)(object)inventory)) { if (inventory.GetItemCountEffective(Items.SiphonOnLowHealth) > 0 && ReworkUrn.Value) { args.jumpCountAdd += UrnJumpCount.Value; } if (inventory.GetItemCountEffective(Items.FallBoots) > 0 && ReworkHeadstomper.Value) { args.jumpCountAdd += HeadstomperJumpCount.Value; } } } private void DoubleJumpStrengthNerf(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<EntityState>(x, "get_characterBody"), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseJumpCount") }); int horizontalBoostLoc = 3; float num = default(float); val.GotoNext((MoveType)0, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref horizontalBoostLoc) }); val.Remove(); val.Emit(OpCodes.Ldc_R4, DoubleJumpHBonus.Value); int index = val.Index; val.Index = index + 1; int verticalBoostLoc = 4; val.GotoNext((MoveType)0, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref verticalBoostLoc) }); val.Remove(); val.Emit(OpCodes.Ldc_R4, DoubleJumpVBonus.Value); } private void MiredUrnRework() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown SiphonOnLowHealthItemBodyBehavior.OnEnable += new hook_OnEnable(VoidVanillaUrnBehavior); LanguageAPI.Add("ITEM_SIPHONONLOWHEALTH_PICKUP", "Triple jump. Jumping fires tar balls in front of you."); LanguageAPI.Add("ITEM_SIPHONONLOWHEALTH_DESC", $"Gain <style=cIsUtility>{UrnJumpCount.Value}</style> jumps. " + $"After every <style=cIsUtility>{urnBallInterval}</style> air jumps, " + "roll a <style=cIsDamage>sentient tar pot</style>, dealing <style=cIsDamage>" + Tools.ConvertDecimal(UrnBallDamageCoefficient.Value) + "</style> base damage and <style=cIsUtility>tarring</style> enemies hit."); } private void CreateMiredUrnTarball() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) miredUrnTarball = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ClayBoss/TarSeeker.prefab").WaitForCompletion(), "MiredUrnTarball", true); ProjectileImpactExplosion component = miredUrnTarball.GetComponent<ProjectileImpactExplosion>(); if (Object.op_Implicit((Object)(object)component)) { component.lifetime = 2f; } ContentAddition.AddProjectile(miredUrnTarball); } private void VoidVanillaUrnBehavior(orig_OnEnable orig, SiphonOnLowHealthItemBodyBehavior self) { self.DestroyAttachment(); Object.Destroy((Object)(object)self); } } public static class Extensions { public static string AsPercent(this float d) { return d * 100f + "%"; } } public static class Tools { internal static bool isLoaded(string modguid) { foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos) { string key = pluginInfo.Key; PluginInfo value = pluginInfo.Value; if (key == modguid) { return true; } } return false; } internal static string ConvertDecimal(float d) { return d * 100f + "%"; } public static void ClearDotStacksForType(this DotController dotController, DotIndex dotIndex) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) for (int num = dotController.dotStackList.Count - 1; num >= 0; num--) { if (dotController.dotStackList[num].dotIndex == dotIndex) { dotController.RemoveDotStackAtServer(num); } } } } public class UrnOnJumpBehavior : BaseItemBodyBehavior { private int jumpCount = 0; [ItemDefAssociation(useOnServer = true, useOnClient = false)] private static ItemDef GetItemDef() { return Items.SiphonOnLowHealth; } private void OnEnable() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown JumpAPI.OnJumpEvent += new OnJumpSynergyHandler(UrnJumpSynergy); } private void OnDisable() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown JumpAPI.OnJumpEvent -= new OnJumpSynergyHandler(UrnJumpSynergy); } private void UrnJumpSynergy(CharacterMotor sender, JumpSynergyInfo jumpSynergyInfo) { if (IsThisJumpUrnJump(sender, jumpSynergyInfo)) { UrnOnJump(); } } private bool IsThisJumpUrnJump(CharacterMotor sender, JumpSynergyInfo info) { if (JumpAPI.IsBaseJump(sender, true) && !info.isConditionalJump) { return false; } jumpCount++; if (jumpCount % JumpReworkPlugin.urnBallInterval == 0) { jumpCount = 0; return true; } return false; } private void UrnOnJump() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) Util.PlaySound(FireTarball.attackSoundString, ((Component)((BaseItemBodyBehavior)this).body).gameObject); Ray aimRay = ((BaseItemBodyBehavior)this).body.inputBank.GetAimRay(); if (Object.op_Implicit((Object)(object)FireTarball.effectPrefab)) { EffectManager.SimpleMuzzleFlash(FireTarball.effectPrefab, ((Component)((BaseItemBodyBehavior)this).body).gameObject, "", false); } if (JumpReworkPlugin.IsMissileArtifactEnabled()) { int num = 3; float num2 = JumpReworkPlugin.urnBallYawSpread * 2f / (float)(num + 1); float num3 = (float)(num - 1) * JumpReworkPlugin.urnBallYawSpread; float num4 = num3 / 2f; for (int i = 0; i < num; i++) { float num5 = (float)(i / (num - 1)) * num3 - num4; float num6 = JumpReworkPlugin.urnBallYawSpread * (float)i - num2 * 2f; Vector3 forward = Util.ApplySpread(((Ray)(ref aimRay)).direction, 0f, 0f, 1f, 0f, num6, 0f); FireTarballProjectile(((BaseItemBodyBehavior)this).body, ((Ray)(ref aimRay)).origin, forward); } } else { FireTarballProjectile(((BaseItemBodyBehavior)this).body, ((Ray)(ref aimRay)).origin, ((Ray)(ref aimRay)).direction); } ((BaseItemBodyBehavior)this).body.AddSpreadBloom(FireTarball.spreadBloomValue); } private void FireTarballProjectile(CharacterBody body, Vector3 origin, Vector3 forward) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) ProjectileManager.instance.FireProjectile(JumpReworkPlugin.miredUrnTarball, origin, Util.QuaternionSafeLookRotation(forward), ((Component)body).gameObject, body.damage * JumpReworkPlugin.UrnBallDamageCoefficient.Value, 0f, Util.CheckRoll(body.crit, body.master), (DamageColorIndex)0, (GameObject)null, -1f, (DamageTypeCombo?)null); } }