using System; 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 GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; 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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("NoMoreJetsplosions")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("NoMoreJetsplosions")] [assembly: AssemblyTitle("NoMoreJetsplosions")] [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 NoMoreJetsplosions { [BepInPlugin("NoMoreJetsplosions", "No More Jetsplosions", "1.1.2")] public class Plugin : BaseUnityPlugin { public const string ModGUID = "NoMoreJetsplosions"; private void Awake() { Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"NoMoreJetsplosions: Mandatory network sync active."); } } [HarmonyPatch(typeof(NetworkManager))] internal static class NetworkPrefabPatch2 { [HarmonyPostfix] [HarmonyPatch("SetSingleton")] private static void RegisterPrefab() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_000e: 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) GameObject val = new GameObject("NoMoreJetsplosions Prefab"); ((Object)val).hideFlags = (HideFlags)(((Object)val).hideFlags | 0x3D); Object.DontDestroyOnLoad((Object)(object)val); NetworkObject obj = val.AddComponent(); FieldInfo field = typeof(NetworkObject).GetField("GlobalObjectIdHash", BindingFlags.Instance | BindingFlags.NonPublic); field.SetValue(obj, GetHash("NoMoreJetsplosions")); NetworkManager.Singleton.PrefabHandler.AddNetworkPrefab(val); } private static uint GetHash(string value) { return value?.Aggregate(17u, (uint current, char c) => (current * 31) ^ c) ?? 0; } } [HarmonyPatch] internal class JetpackPatch { [HarmonyPatch(typeof(JetpackItem), "ExplodeJetpackClientRpc")] [HarmonyPrefix] private static bool DisableExplosion() { return false; } [HarmonyPatch(typeof(JetpackItem), "ExplodeJetpackServerRpc")] [HarmonyPrefix] private static bool DisableServerExplosion() { return false; } [HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")] [HarmonyPrefix] private static bool PreventMidAirDeath(PlayerControllerB __instance, Vector3 bodyVelocity, bool spawnBody, CauseOfDeath causeOfDeath) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 if (__instance.isHoldingObject && __instance.currentlyHeldObjectServer is JetpackItem && ((int)causeOfDeath == 2 || (int)causeOfDeath == 0)) { Debug.Log((object)"[NoMoreJetsplosions] Blocked instant-kill trigger mid-air."); return false; } return true; } [HarmonyPatch(typeof(PlayerControllerB), "DamagePlayer")] [HarmonyPrefix] private static bool PreventSplat(PlayerControllerB __instance, int damageNumber, bool fallDamage, CauseOfDeath causeOfDeath) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 if ((fallDamage || (int)causeOfDeath == 2) && __instance.isHoldingObject && __instance.currentlyHeldObjectServer is JetpackItem) { return false; } return true; } } }