using System; 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.Logging; using FishNet.Object; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("DinamiteExplosionLaunch")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Airborn trickshots? Gotcha, now you can explode your feet to hit that clip")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DinamiteExplosionLaunch")] [assembly: AssemblyTitle("DinamiteExplosionLaunch")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 ExplosionLaunchMod { internal static class LaunchValues { public const float HorizontalMultiplier = 18f; public const float VerticalMultiplier = 10f; public const float MinUpwardForce = 8.8f; public const float LaunchDecayPerTick = 0.94f; public const float MaxHorizontalSpeed = 60f; public const float MaxVerticalSpeed = 46f; } internal static class LaunchState { private class Holder { public Vector3 Velocity; } private static readonly ConditionalWeakTable _table = new ConditionalWeakTable(); private static Holder Get(PlayerMovement pm) { return _table.GetOrCreateValue(pm); } public static void Add(PlayerMovement pm, Vector3 horizontalVelocity) { //IL_000a: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_0060: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) Holder holder = Get(pm); holder.Velocity += horizontalVelocity; float num = 60f; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(holder.Velocity.x, 0f, holder.Velocity.z); if (((Vector3)(ref val)).sqrMagnitude > num * num) { val = ((Vector3)(ref val)).normalized * num; holder.Velocity = new Vector3(val.x, 0f, val.z); } } public static Vector3 Peek(PlayerMovement pm) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return Get(pm).Velocity; } public static void Decay(PlayerMovement pm, float factor) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Holder holder = Get(pm); holder.Velocity *= factor; if (((Vector3)(ref holder.Velocity)).sqrMagnitude < 0.0025f) { holder.Velocity = Vector3.zero; } } public static void Clear(PlayerMovement pm) { //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) Get(pm).Velocity = Vector3.zero; } } [HarmonyPatch(typeof(Server), "RpcLogic___HitPlayer___2449261505")] internal static class ExplosionHitPatch { private static void Postfix(Server __instance, Player __0, int __1, Vector3 __2, Vector3 __3, byte __4, Player __5) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00c5: 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) byte b = __4; if (b == 0 && Object.op_Implicit((Object)(object)__0) && !((NetworkBehaviour)__0).IsDeinitializing && __0.Vitals.Health > 0 && !(__2 == Vector3.zero) && !((Object)(object)__0.Movement == (Object)null)) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(__2.x * 18f, __2.y * 10f, __2.z * 18f); if (val.y < 8.8f) { val.y = 8.8f; } val.y = Mathf.Clamp(val.y, -46f, 46f); __0.Movement.RPCKnockback(((NetworkBehaviour)__0).Owner, val); } } } [HarmonyPatch(typeof(PlayerMovement), "Knockback")] internal static class KnockbackSplitPatch { private static readonly FieldInfo RigField = AccessTools.Field(typeof(PlayerMovement), "_rig"); private static bool Prefix(PlayerMovement __instance, Vector3 force) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) Rigidbody val = (Rigidbody)RigField.GetValue(__instance); if ((Object)(object)val == (Object)null) { return true; } Vector3 linearVelocity = val.linearVelocity; linearVelocity.y += force.y; val.linearVelocity = linearVelocity; LaunchState.Add(__instance, new Vector3(force.x, 0f, force.z)); return false; } } [HarmonyPatch(typeof(PlayerMovement), "Move")] internal static class ApplyLaunchPatch { private static readonly FieldInfo RigField = AccessTools.Field(typeof(PlayerMovement), "_rig"); private static void Postfix(PlayerMovement __instance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) Vector3 val = LaunchState.Peek(__instance); if (val == Vector3.zero) { return; } Rigidbody val2 = (Rigidbody)RigField.GetValue(__instance); if (!((Object)(object)val2 == (Object)null)) { Vector3 linearVelocity = val2.linearVelocity; linearVelocity.x += val.x; linearVelocity.z += val.z; val2.linearVelocity = linearVelocity; if (__instance.Grounded) { LaunchState.Clear(__instance); } else { LaunchState.Decay(__instance, 0.94f); } } } } public static class ExplosionLaunchModule { public static void Init(Harmony harmony) { harmony.PatchAll(typeof(ExplosionHitPatch)); harmony.PatchAll(typeof(KnockbackSplitPatch)); harmony.PatchAll(typeof(ApplyLaunchPatch)); } } [BepInPlugin("com.KingIDFK.explosionlaunch", "Explosion Launch Mod", "1.0.0")] public class Project : BaseUnityPlugin { public const string PluginGUID = "com.KingIDFK.explosionlaunch"; public const string PluginName = "Explosion Launch Mod"; public const string PluginVersion = "1.0.0"; internal static ManualLogSource Log; private Harmony _harmony; private void Awake() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"[Explosion Launch Mod] Cargando v1.0.0..."); _harmony = new Harmony("com.KingIDFK.explosionlaunch"); ExplosionLaunchModule.Init(_harmony); Log.LogInfo((object)"[Explosion Launch Mod] Patches aplicados correctamente."); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } Log.LogInfo((object)"[Explosion Launch Mod] Descargado y patches removidos."); } } }