using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using ShotgunRoulette.Network; using ShotgunRoulette.Patches; using ShotgunRoulette.Players; using ShotgunRoulette.UI; using ShotgunRoulette.Utils; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.SceneManagement; using zeeblo.ShotgunRoulette.NetcodePatcher; [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("zeeblo.ShotgunRoulette")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.1.1.0")] [assembly: AssemblyInformationalVersion("0.1.1+cf07a2bf6e827a893859d1d705fd4db2c1685b5a")] [assembly: AssemblyProduct("ShotgunRoulette")] [assembly: AssemblyTitle("zeeblo.ShotgunRoulette")] [assembly: AssemblyVersion("0.1.1.0")] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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 ShotgunRoulette { [BepInPlugin("ShotgunRoulette.zeeblo.dev", "zeeblo.ShotgunRoulette", "0.2.1")] public class Plugin : BaseUnityPlugin { private const string MOD_GUID = "ShotgunRoulette.zeeblo.dev"; private const string MOD_Name = "zeeblo.ShotgunRoulette"; private const string MOD_Version = "0.2.1"; private readonly Harmony _harmony = new Harmony("ShotgunRoulette.zeeblo.dev"); public static Plugin? instance; internal static ManualLogSource mls = Logger.CreateLogSource("ShotgunRoulette.zeeblo.dev"); public static bool gunIsOnFace = false; public static List> AllHotkeys = new List>(); public static Random random = new Random(); public static int rouletteNumber = random.Next(1, 5); public static int randomDamage = random.Next(95, 145); public static string MainDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase).Replace("file:\\", ""); public static string BundleDir = GetAssetPath(); public static AssetBundle myBundle = AssetBundle.LoadFromFile(BundleDir); public static AudioClip? SFX_revolverSpin; private void Awake() { instance = this; LConfig.AllConfigs(((BaseUnityPlugin)this).Config); NetcodePatcher(); PatchAll(); AssetLoader(); Controls.InitControls(); } private void PatchAll() { _harmony.PatchAll(typeof(PlayerControllerBPatch)); _harmony.PatchAll(typeof(HUDManagerPatch)); _harmony.PatchAll(typeof(ShotgunItemPatch)); _harmony.PatchAll(typeof(KeybindsUI)); _harmony.PatchAll(typeof(NetObjectManager)); } private void NetcodePatcher() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } public static bool ToggleGunRotation(PlayerControllerB __instance) { //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)__instance.ItemSlots[__instance.currentItemSlot] == (Object)null) { return false; } if ((Object)(object)((Component)__instance.ItemSlots[__instance.currentItemSlot]).GetComponent() == (Object)null) { return false; } gunIsOnFace = !gunIsOnFace; if (gunIsOnFace) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(0.28f, 0.28f, -0.28f); ((Component)__instance.ItemSlots[__instance.currentItemSlot]).transform.localScale = val; NetObjectManager.RequestFromPlayer(localPlayerController.playerClientId, __instance.currentItemSlot, val); } else { Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(0.28f, 0.28f, 0.28f); ((Component)__instance.ItemSlots[__instance.currentItemSlot]).transform.localScale = val2; NetObjectManager.RequestFromPlayer(localPlayerController.playerClientId, __instance.currentItemSlot, val2); } return gunIsOnFace; } private static string GetAssetPath() { string text = MainDir + "\\Assets\\Assetbundles\\roulette"; string result = MainDir + "/roulette"; if (File.Exists(text)) { return text; } return result; } private static void AssetLoader() { AudioClip sFX_revolverSpin = myBundle.LoadAsset("revolver-spin.mp3"); SFX_revolverSpin = sFX_revolverSpin; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "zeeblo.ShotgunRoulette"; public const string PLUGIN_NAME = "ShotgunRoulette"; public const string PLUGIN_VERSION = "0.1.1"; } } namespace ShotgunRoulette.Utils { [HarmonyPatch] internal class GunTests { public static bool spawnedNut; [HarmonyPatch(typeof(NutcrackerEnemyAI), "Update")] [HarmonyPrefix] private static bool UpdatePatch(NutcrackerEnemyAI __instance) { if (!spawnedNut) { ((EnemyAI)__instance).KillEnemy(false); spawnedNut = true; ((MonoBehaviour)StartOfRound.Instance).StartCoroutine(DespawnEnemies()); } return true; } [HarmonyPatch(typeof(ShotgunItem), "Update")] [HarmonyPostfix] private static void UpdatePatch(ShotgunItem __instance) { __instance.shellsLoaded = 2; } public static void InitTestControls() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown Plugin.mls.LogInfo((object)">> added keybind"); InputAction val = new InputAction("spawn", (InputActionType)1, "/J", (string)null, (string)null, (string)null); val.performed += KeyPressed_performed; val.Enable(); } private static void KeyPressed_performed(CallbackContext context) { Plugin.mls.LogInfo((object)"pressed"); SpawnShotgun(); spawnedNut = false; } public static void SpawnShotgun() { //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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)GameNetworkManager.Instance.localPlayerController).transform.position; SelectableLevel val = RoundManager.Instance.playersManager.levels[6]; Object.Instantiate(val.Enemies[9].enemyType.enemyPrefab, position, Quaternion.identity).gameObject.GetComponentInChildren().Spawn(true); } public static IEnumerator DespawnEnemies() { yield return (object)new WaitForSeconds(3f); Scene SampleScene = SceneManager.GetSceneAt(0); GameObject[] rootGameObjects = ((Scene)(ref SampleScene)).GetRootGameObjects(); foreach (GameObject obj in rootGameObjects) { if (((Object)obj).name.Contains("Nutcracker")) { Object.Destroy((Object)(object)obj.gameObject); } } } } public class LConfig { public static ConfigFile _config; public static ConfigEntry gunRotationBind; public static ConfigEntry defaultShowRoulette; public static ConfigEntry defaultShowSuicide; public static void AllConfigs(ConfigFile cfg) { _config = cfg; gunRotationBind = cfg.Bind("Gameplay Controls", "Aim at you", "h", "Point the gun at yourself"); Plugin.AllHotkeys.Add(gunRotationBind); defaultShowRoulette = cfg.Bind("UI Settings", "Show Roulette Mode", true, "show/hide this UI text when holding item"); defaultShowSuicide = cfg.Bind("UI Settings", "Show Shoot Yourself", true, "show/hide this UI text when holding item"); } } } namespace ShotgunRoulette.UI { [HarmonyPatch] internal class KeybindsUI { private static List allCustomBinds = new List(); private static List ControlNames = new List(); public static void AddCustomBinds() { //IL_0012: 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_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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown if (!((Object)(object)Controls.gunRotationRef == (Object)null)) { RemappableKey item = new RemappableKey { ControlName = "Aim at you", currentInput = Controls.gunRotationRef, rebindingIndex = 0, gamepadOnly = false }; allCustomBinds.Add(item); } } [HarmonyPatch(typeof(KepRemapPanel), "LoadKeybindsUI")] [HarmonyPrefix] private static bool LoadBindsPatch(KepRemapPanel __instance) { __instance.maxVertical += 1f; Controls.userControls.Disable(); for (int i = 0; i < __instance.remappableKeys.Count; i++) { ControlNames.Add(__instance.remappableKeys[i].ControlName.ToLower()); } int j; for (j = 0; j < allCustomBinds.Count; j++) { string value = Array.Find(ControlNames.ToArray(), (string elem) => elem.Equals(allCustomBinds[j].ControlName.ToLower())); if (string.IsNullOrEmpty(value)) { __instance.remappableKeys.Insert(0, allCustomBinds[j]); } } return true; } [HarmonyPatch(typeof(IngamePlayerSettings), "CompleteRebind")] [HarmonyPostfix] private static void CompleteRebindPatch(SettingsOption optionUI) { for (int i = 0; i < Plugin.AllHotkeys.Count; i++) { if (((ConfigEntryBase)Plugin.AllHotkeys[i]).Definition.Key.ToLower() == ((TMP_Text)optionUI.textElement).text.ToLower()) { Plugin.AllHotkeys[i].Value = ((TMP_Text)optionUI.currentlyUsedKeyText).text; ((ConfigEntryBase)Plugin.AllHotkeys[i]).ConfigFile.Save(); InputActionRebindingExtensions.ApplyBindingOverride(Controls.userControls.FindAction(((ConfigEntryBase)Plugin.AllHotkeys[i]).Definition.Key.ToLower(), false), "/" + ((TMP_Text)optionUI.currentlyUsedKeyText).text.ToLower(), (string)null, (string)null); break; } } } [HarmonyPatch(typeof(KepRemapPanel), "OnDisable")] [HarmonyPostfix] private static void KepOnDisablePatch() { ControlNames.Clear(); if (!Controls.userControls.enabled) { Controls.userControls.Enable(); } } } } namespace ShotgunRoulette.Players { internal class Controls { private static InputActionAsset actionAsset = ScriptableObject.CreateInstance(); public static InputActionMap userControls = InputActionSetupExtensions.AddActionMap(actionAsset, "UserControls"); public static InputActionReference? gunRotationRef; public static void InitControls() { if (LConfig.gunRotationBind != null) { InputAction val = InputActionSetupExtensions.AddAction(userControls, "aim at you", (InputActionType)1, "/" + LConfig.gunRotationBind.Value, (string)null, (string)null, (string)null, (string)null); val.performed += GunRotation_performed; userControls.Enable(); gunRotationRef = InputActionReference.Create(val); KeybindsUI.AddCustomBinds(); } } private static void GunRotation_performed(CallbackContext context) { if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null) { Plugin.ToggleGunRotation(GameNetworkManager.Instance.localPlayerController); } } } } namespace ShotgunRoulette.Patches { [HarmonyPatch(typeof(HUDManager))] internal class HUDManagerPatch { [HarmonyPatch("PingScan_performed")] [HarmonyPrefix] private static bool Roulette() { if (Plugin.gunIsOnFace) { Plugin.rouletteNumber = Plugin.random.Next(1, 5); Plugin.randomDamage = Plugin.random.Next(95, 145); PlayerControllerBPatch.rouletteMode = !PlayerControllerBPatch.rouletteMode; if (PlayerControllerBPatch.rouletteMode) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; ((Component)localPlayerController.currentlyHeldObjectServer).gameObject.GetComponent().PlayOneShot(Plugin.SFX_revolverSpin, 0.6f); } return false; } return true; } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { public static bool rouletteMode; [HarmonyPatch("Update")] [HarmonyPostfix] private static void UpdatePatch(PlayerControllerB __instance) { if (Plugin.gunIsOnFace) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } if ((Object)(object)__instance.ItemSlots[__instance.currentItemSlot] != (Object)null && (Object)(object)((Component)__instance.ItemSlots[__instance.currentItemSlot]).GetComponent() != (Object)null && __instance.ItemSlots[__instance.currentItemSlot].playerHeldBy.playerClientId == GameNetworkManager.Instance.localPlayerController.playerClientId) { ConfigEntry defaultShowRoulette = LConfig.defaultShowRoulette; string text = ((defaultShowRoulette != null && defaultShowRoulette.Value) ? $"\n Roulette Mode ({rouletteMode}) : [RMB]" : ""); ConfigEntry defaultShowSuicide = LConfig.defaultShowSuicide; string text2 = ((defaultShowSuicide != null && defaultShowSuicide.Value) ? "\n Shoot Yourself : [LMB]" : ""); string text3 = (Plugin.gunIsOnFace ? (text + " " + text2) : ""); string text4 = (((Component)__instance.ItemSlots[__instance.currentItemSlot]).GetComponent().safetyOn ? "off" : "on"); ((TMP_Text)HUDManager.Instance.controlTipLines.Last()).text = "Turn Safety " + text4 + " : [Q] \n Aim at you : [" + LConfig.gunRotationBind?.Value.ToUpper() + "] " + text3; } } [HarmonyPatch("KillPlayer")] [HarmonyPrefix] private static void KillPlayerPatch(PlayerControllerB __instance) { Plugin.gunIsOnFace = false; } [HarmonyPatch("ScrollMouse_performed")] [HarmonyPrefix] private static void ScrollPatch(PlayerControllerB __instance) { if (Plugin.gunIsOnFace) { Plugin.ToggleGunRotation(__instance); } } [HarmonyPatch("SwitchToItemSlot")] [HarmonyPrefix] private static void SwitchToItemSlotPatch(PlayerControllerB __instance) { if (Plugin.gunIsOnFace) { Plugin.ToggleGunRotation(__instance); } } [HarmonyPatch("DiscardHeldObject")] [HarmonyPrefix] private static void DiscardHeldObjectPatch(PlayerControllerB __instance) { if (Plugin.gunIsOnFace) { Plugin.ToggleGunRotation(__instance); } } [HarmonyPatch("OnDisable")] [HarmonyPrefix] private static void OnDisablePatch(PlayerControllerB __instance) { if (Plugin.gunIsOnFace) { Plugin.ToggleGunRotation(__instance); } } } [HarmonyPatch(typeof(ShotgunItem))] internal class ShotgunItemPatch { [HarmonyPatch("ShootGunAndSync")] [HarmonyPrefix] private static bool ShootFace(ShotgunItem __instance) { //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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) if (StartOfRound.Instance.inShipPhase && Plugin.gunIsOnFace) { __instance.gunAudio.PlayOneShot(__instance.noAmmoSFX); return false; } if (Plugin.gunIsOnFace && __instance.shellsLoaded >= 1 && !__instance.safetyOn) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; MethodInfo method = typeof(PlayerControllerB).GetMethod("CanUseItem", BindingFlags.Instance | BindingFlags.NonPublic); bool flag = (bool)method.Invoke(localPlayerController, null); if (StartOfRound.Instance.inShipPhase) { return true; } if (!Plugin.gunIsOnFace) { return true; } if ((Object)(object)localPlayerController.currentlyHeldObjectServer == (Object)null) { return true; } if (!flag) { return true; } if (PlayerControllerBPatch.rouletteMode) { if (Plugin.rouletteNumber == 1) { RotatePlayer(); localPlayerController.DamagePlayer(Plugin.randomDamage, true, true, (CauseOfDeath)7, 0, false, default(Vector3)); return true; } __instance.gunAudio.PlayOneShot(__instance.noAmmoSFX); return false; } RotatePlayer(); localPlayerController.DamagePlayer(Plugin.randomDamage, true, true, (CauseOfDeath)7, 0, false, default(Vector3)); } return true; } private static void RotatePlayer() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; ((Component)localPlayerController.thisPlayerBody).transform.Rotate(0f, 180f, 0f); ((Component)localPlayerController.gameplayCamera).transform.localEulerAngles = new Vector3(0f, 0f, ((Component)localPlayerController.gameplayCamera).transform.localEulerAngles.z); } } } namespace ShotgunRoulette.Network { public class NetHandler : NetworkBehaviour { public static NetHandler instance { get; private set; } public override void OnNetworkSpawn() { instance = this; ((NetworkBehaviour)this).OnNetworkSpawn(); } [ClientRpc] public void RotateGunClientRpc(ulong plrID, int itemPos, Vector3 gunRotation) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0071: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1213105983u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, plrID); BytePacker.WriteValueBitPacked(val, itemPos); ((FastBufferWriter)(ref val)).WriteValueSafe(ref gunRotation); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1213105983u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (GameNetworkManager.Instance.localPlayerController.playerClientId != plrID) { ((Component)StartOfRound.Instance.allPlayerScripts[plrID].ItemSlots[itemPos]).transform.localScale = gunRotation; } } } [ServerRpc(RequireOwnership = false)] public void RotateGunServerRpc(ulong plrID, int itemPos, Vector3 gunRotation) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0071: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1383985616u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, plrID); BytePacker.WriteValueBitPacked(val, itemPos); ((FastBufferWriter)(ref val)).WriteValueSafe(ref gunRotation); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1383985616u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; RotateGunClientRpc(plrID, itemPos, gunRotation); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1213105983u, new RpcReceiveHandler(__rpc_handler_1213105983), "RotateGunClientRpc"); ((NetworkBehaviour)this).__registerRpc(1383985616u, new RpcReceiveHandler(__rpc_handler_1383985616), "RotateGunServerRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_1213105983(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong plrID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref plrID); int itemPos = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref itemPos); Vector3 gunRotation = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref gunRotation); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetHandler)(object)target).RotateGunClientRpc(plrID, itemPos, gunRotation); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1383985616(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong plrID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref plrID); int itemPos = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref itemPos); Vector3 gunRotation = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref gunRotation); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetHandler)(object)target).RotateGunServerRpc(plrID, itemPos, gunRotation); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "NetHandler"; } } [HarmonyPatch] internal class NetObjectManager { private static GameObject networkPrefab; [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] private static void StartPatch(GameNetworkManager __instance) { if (!((Object)(object)networkPrefab != (Object)null)) { networkPrefab = Plugin.myBundle.LoadAsset("NetworkManager_roulette.prefab"); networkPrefab.AddComponent(); NetworkManager.Singleton.AddNetworkPrefab(networkPrefab); } } [HarmonyPatch(typeof(StartOfRound), "Awake")] [HarmonyPostfix] private static void SpawnNetworkHandler() { //IL_0035: 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) if ((NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) && !((Object)(object)networkPrefab == (Object)null)) { GameObject val = Object.Instantiate(networkPrefab, Vector3.zero, Quaternion.identity); val.GetComponent().Spawn(false); } } public static void RequestFromPlayer(ulong plrID, int itemPos, Vector3 gunRotation) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)NetHandler.instance == (Object)null)) { if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { NetHandler.instance.RotateGunClientRpc(plrID, itemPos, gunRotation); } else { NetHandler.instance.RotateGunServerRpc(plrID, itemPos, gunRotation); } } } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace zeeblo.ShotgunRoulette.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }