using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using ComputerysModdingUtilities; using FishNet; using FishNet.Connection; using FishNet.Managing; using FishNet.Managing.Object; using FishNet.Managing.Server; using FishNet.Object; using HarmonyLib; using Microsoft.CodeAnalysis; using MyceliumNetworking; using Steamworks; using UnityEngine; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: StraftatMod(false)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Koki")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+989b3eeb281029cdf7114b7b0f5e8953cde9f711")] [assembly: AssemblyProduct("KokiWeapons")] [assembly: AssemblyTitle("KokiWeapons")] [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; } } } [HarmonyPatch(typeof(Settings))] public class SpawnWeaponOnTaunt { public static List weapons = new List(); [HarmonyPatch("IncreaseTauntsAmount")] public static void Prefix(Settings __instance) { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_00f9: 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) string text = ""; if (Input.GetKeyDown((KeyCode)49)) { text = "RC Car"; } else if (Input.GetKeyDown((KeyCode)50)) { text = "Repulsion Grenade"; } else if (Input.GetKeyDown((KeyCode)51)) { text = "HandGrenade"; } else if (Input.GetKeyDown((KeyCode)52)) { text = "Teleport Mine"; } else if (Input.GetKeyDown((KeyCode)53)) { text = "APMine"; } else if (Input.GetKeyDown((KeyCode)54)) { text = "Gun"; } if (!(text == "") && InstanceFinder.IsServer) { FirstPersonController[] array = Object.FindObjectsOfType(); foreach (FirstPersonController val in array) { Vector3 val2 = val.playerCameraHolder.transform.position + ((Vector3)(ref val.dirForward)).normalized; val2.y -= 0.5f; GameObject val3 = Object.Instantiate(SpawnerManager.NameToWeaponDict[text], val2, Quaternion.identity); val3.GetComponent().DispenserDrop(Vector3.zero); val3.GetComponent().isKinematic = true; ((NetworkBehaviour)val).ServerManager.Spawn(val3, (NetworkConnection)null); weapons.Add(val3); } } } } [HarmonyPatch(typeof(WeaponHandSpawner), "RpcLogic___SpawnObject_2587446063")] public static class CreatePlaceItemEvent { public class PlaceItemEventArgs : EventArgs { public WeaponHandSpawner spawner; public GameObject spawnedObj; public bool runOriginalCode = false; } public static event EventHandler PlaceItemEvent; public static bool TriggerPlaceItemEvent(WeaponHandSpawner __instance, GameObject obj) { PlaceItemEventArgs e = new PlaceItemEventArgs { spawner = __instance, spawnedObj = obj }; CreatePlaceItemEvent.PlaceItemEvent(null, e); return e.runOriginalCode; } private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(ServerManager), "Spawn", new Type[2] { typeof(GameObject), typeof(NetworkConnection) }, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(CreatePlaceItemEvent), "TriggerPlaceItemEvent", (Type[])null, (Type[])null); Label label = default(Label); return new CodeMatcher(instructions, generator).End().MatchBack(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ret, (object)null, (string)null) }).CreateLabel(ref label) .MatchBack(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Callvirt, (object)methodInfo, (string)null) }) .Advance(1) .Insert((CodeInstruction[])(object)new CodeInstruction[4] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldloc_0, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo2), new CodeInstruction(OpCodes.Brfalse, (object)label) }) .InstructionEnumeration(); } } [HarmonyPatch(typeof(Resources), "LoadAll", new Type[] { typeof(string), typeof(Type) })] public static class InsertWeaponsIntoResources { public static void Postfix(string path, ref Object[] __result) { if (!(path != "RandomWeapons")) { List list = new List(__result); list.AddRange((IEnumerable)KokiWeaponsPlugin.CustomWeapons); __result = list.ToArray(); } } } [HarmonyPatch(typeof(SpawnerManager), "PopulateAllWeapons")] public static class PostWeaponRegistration { internal static AssetBundle SharedAssets; public static void Postfix() { if (!KokiWeaponsPlugin.RegisteredWeapons) { KokiWeaponsPlugin.RegisteredWeapons = true; LoadDecals(); RegisterFishnet.Postfix(); } } public static void LoadDecals() { PhysicsGrenade component = SpawnerManager.NameToWeaponDict["HandGrenade"].GetComponent(); GameObject[] array = SharedAssets.LoadAllAssets(); foreach (GameObject val in array) { if (((Object)val).name.EndsWith("Decal")) { if (((Object)val).name == "explosionDecal") { Object.Instantiate(component.explosionDecal).transform.SetParent(val.transform); } else if (((Object)val).name == "bloodDecal") { Object.Instantiate(component.bloodSplatter).transform.SetParent(val.transform); } } } } } [HarmonyPatch(typeof(NetworkManager), "Start")] public static class RegisterFishnet { public static void Postfix() { if (!KokiWeaponsPlugin.RegisteredWeapons) { return; } PrefabObjects spawnablePrefabs = InstanceFinder.NetworkManager.SpawnablePrefabs; NetworkObject val = default(NetworkObject); foreach (GameObject networkObject in KokiWeaponsPlugin.NetworkObjects) { if (Object.op_Implicit((Object)(object)networkObject)) { networkObject.TryGetComponent(ref val); spawnablePrefabs.AddObject(val, false); } } spawnablePrefabs.InitializePrefabRange(0); } public static void DeregisterFishnet() { HashSet hashSet = new HashSet(); foreach (GameObject networkObject in KokiWeaponsPlugin.NetworkObjects) { hashSet.Add(networkObject.GetComponent()); } NetworkManager networkManager = InstanceFinder.NetworkManager; PrefabObjects spawnablePrefabs = networkManager.SpawnablePrefabs; int objectCount = spawnablePrefabs.GetObjectCount(); List list = new List(); for (int i = 0; i < objectCount; i++) { NetworkObject val = spawnablePrefabs.GetObject(true, i); if ((Object)(object)val != (Object)null && !hashSet.Contains(val)) { list.Add(val); } } spawnablePrefabs.Clear(); spawnablePrefabs.AddObjects(list, false); spawnablePrefabs.InitializePrefabRange(0); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.koki.kokiweapons", "Koki Weapons", "2.1.1")] internal class KokiWeaponsPlugin : BaseUnityPlugin { internal static KokiWeaponsPlugin Instance; private static Harmony Harmony; private static readonly string[] BundleNames = new string[4] { "kokiweapons_shared", "tptrap", "repulsiongrenade", "rccar" }; internal static List CustomWeapons = new List(); internal static List NetworkObjects = new List(); internal static bool RegisteredWeapons = false; internal static bool KWDebug = false; private void Awake() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown Instance = this; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Harmony = new Harmony("com.koki.kokiweapons"); Harmony.PatchAll(); foreach (AssetBundle allLoadedAssetBundle in AssetBundle.GetAllLoadedAssetBundles()) { if (BundleNames.Contains(((Object)allLoadedAssetBundle).name)) { allLoadedAssetBundle.Unload(true); } } LoadBundles(); ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.AddComponent(); UpdateTrapLinkOnPlace.Init(); RCCarLink.Init(); } private void OnDestroy() { Harmony.UnpatchSelf(); foreach (GameObject weapon in SpawnWeaponOnTaunt.weapons) { if (Object.op_Implicit((Object)(object)weapon)) { InstanceFinder.ServerManager.Despawn(weapon, (DespawnType?)null); } } ((Component)this).gameObject.GetComponent().Deregister(); ((Component)this).gameObject.AddComponent().Deregister(); if (RegisteredWeapons) { Array.Resize(ref SpawnerManager.AllWeapons, SpawnerManager.AllWeapons.Length - CustomWeapons.Count); RegisterFishnet.DeregisterFishnet(); } } private void LoadBundles() { string text = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); if (Utility.IsNullOrWhiteSpace(text)) { KWDebug = true; Debug.LogError((object)"DEBUG MODE ACTIVE"); text = Path.Combine(Paths.PluginPath, "DEVELOPMENT-BUILD-Koki Weapons"); } else { Harmony.Unpatch((MethodBase)typeof(Settings).GetMethod("IncreaseTauntsAmount"), (HarmonyPatchType)1, "com.koki.kokiweapons"); } AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(text, "kokiweapons_shared")); Material[] array = val.LoadAllAssets(); foreach (Material val2 in array) { val2.shader = Shader.Find(((Object)val2.shader).name); } PostWeaponRegistration.SharedAssets = val; string[] files = Directory.GetFiles(text); foreach (string path in files) { string fileName = Path.GetFileName(path); if (!BundleNames.Contains(fileName) || fileName == "kokiweapons_shared") { continue; } AssetBundle val3 = AssetBundle.LoadFromFile(Path.Combine(text, fileName)); GameObject[] array2 = val3.LoadAllAssets(); foreach (GameObject val4 in array2) { if (Object.op_Implicit((Object)(object)val4.GetComponent())) { CustomWeapons.Add(val4); } if (Object.op_Implicit((Object)(object)val4.GetComponent())) { NetworkObjects.Add(val4); } } } if (!KWDebug || !Object.op_Implicit((Object)(object)InstanceFinder.NetworkManager)) { return; } SpawnerManager.AllWeapons = null; SpawnerManager.PopulateAllWeapons(); Type[] array3 = new Type[2] { typeof(RCCar), typeof(RCCarItem) }; Dictionary dictionary = array3.Zip(array3.Select((Type type) => type.Name), (Type k2, string v) => new { k = k2, v = v }).ToDictionary(x => x.v, x => x.k); foreach (GameObject networkObject in NetworkObjects) { Component[] components = networkObject.GetComponents(); foreach (Component val5 in components) { if (dictionary.ContainsKey(((object)val5).GetType().Name)) { Component destination = networkObject.AddComponent(dictionary[((object)val5).GetType().Name]); CopyComponentData(val5, destination); Object.Destroy((Object)(object)val5); } } } } private static void CopyComponentData(Component source, Component destination) { try { string text = JsonUtility.ToJson((object)source); JsonUtility.FromJsonOverwrite(text, (object)destination); } catch (Exception ex) { Debug.LogWarning((object)("[HotReload] Failed to copy data via JsonUtility: " + ex.Message)); } } } public class KBGrenade : PhysicsGrenade { internal static ConfigEntry grenadeDamage = ((BaseUnityPlugin)KokiWeaponsPlugin.Instance).Config.Bind("KB Grenade", "Damage", 0, new ConfigDescription("How much damage the KB Grenade should deal on impact, range from 0-100.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100), Array.Empty())); internal void KBExplosion(Vector3 position) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.position = position; Collider[] array = Physics.OverlapSphere(position, base.explosionRadius, LayerMask.op_Implicit(base.bodyLayer)); Rigidbody rb = null; CollectionExtensions.DoIf((IEnumerable)array, (Func)((Collider c) => Object.op_Implicit((Object)(object)c) && ((Component)c).gameObject.TryGetComponent(ref rb)), (Action)delegate(Collider item) { //IL_0007: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) Vector3 val2 = ((Component)item).transform.position - ((Component)this).transform.position; val2.y = 0f; ((Vector3)(ref val2)).Normalize(); val2 *= 10f; val2.y = 2f; Transform transform = ((Component)item).transform; transform.position += new Vector3(0f, 2.5f, 0f); rb.AddForce(val2, (ForceMode)1); }); CollectionExtensions.Do(array.Select((Collider c) => ((Component)c).GetComponentInParent()).Distinct(), (Action)delegate(PlayerHealth ph) { //IL_0026: 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) //IL_003b: 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) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)ph) && !ph.sync___get_value_isKilled()) { Vector3 val2 = ((Component)ph.controller).transform.position - ((Component)this).transform.position; if (val2.y < 0f) { val2.y = 0f; } ((Vector3)(ref val2)).Normalize(); if (ph.controller.isGrounded) { Transform transform = ((Component)ph.controller).transform; transform.position += new Vector3(0f, 2.5f, 0f); } ph.controller.CustomAddForce(val2, 120f); if (base.isOwner && grenadeDamage.Value > 0) { ph.RemoveHealth((float)(grenadeDamage.Value / 25)); } } }); Object.Destroy((Object)(object)((Component)this).gameObject, 3f); ((Behaviour)this).enabled = false; ((Component)base.graph).gameObject.SetActive(false); if (!base.fragGrenade) { GameObject val = Object.Instantiate(base.explosionVfx, ((Component)this).transform.position, Quaternion.identity); if ((Object)(object)val.transform.Find("ball") != (Object)null) { val.transform.Find("ball").localScale = base.vfxScale; } } Object.Instantiate(base.explosionDecal, ((Component)this).transform.position, Quaternion.identity); base.audio.Play(); } internal void Spin() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) base.graph.Rotate(base.rotateAxis * base.rotateSpeed * Time.deltaTime); } } [HarmonyPatch(typeof(PhysicsGrenade))] internal class KBGrenadeOverrides { [HarmonyPatch("RpcLogic___HandleExplosion_4276783012")] [HarmonyPrefix] private static bool RedirectHandleExplosion(PhysicsGrenade __instance, Vector3 position) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (__instance is KBGrenade kBGrenade) { kBGrenade.KBExplosion(position); return false; } return true; } [HarmonyPatch("Update")] [HarmonyPostfix] private static void StartSpin(PhysicsGrenade __instance) { if (__instance is KBGrenade kBGrenade) { kBGrenade.Spin(); } } } public enum CarType { Boom } public class RCCar : MonoBehaviour { [SerializeField] private Transform _cameraPosition; [SerializeField] private Rigidbody _rb; public CarType carType; [Header("Bomb Car")] public GameObject explosionVFX; public AudioClip explosionSound; public GameObject explosionDecal; public GameObject bloodDecal; public float explosionRadius; private bool _exploded = false; [Header("Movement Settings")] public float accel; public float maxSpeed; public float turnSpeed; public AnimationCurve enginePowerCurve = AnimationCurve.Linear(0f, 1f, 1f, 0f); [NonSerialized] public bool driving = false; [NonSerialized] public GameObject rcCarItem; private FirstPersonController _driver; private InputAction _moveInput; private Vector3 _inputVector; private Transform _cameraTransform; private Transform _playerGraphicsTransform; private void Awake() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown PauseManager.OnBeforeSpawn += new BeforeSpawnAction(Despawn); } private void Despawn() { if (Object.op_Implicit((Object)(object)this) && Object.op_Implicit((Object)(object)((Component)this).gameObject)) { Object.Destroy((Object)(object)((Component)this).gameObject); if (InstanceFinder.IsServer && ((Component)this).gameObject.GetComponent().IsSpawned) { InstanceFinder.ServerManager.Despawn(((Component)this).gameObject, (DespawnType?)null); } } } private void OnDestroy() { if (driving) { EndDriving(); } } private void Update() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (driving) { _inputVector = Vector2.op_Implicit(_moveInput.ReadValue()); if (_inputVector.x != 0f) { float num = _inputVector.x * _inputVector.y * turnSpeed * Time.deltaTime; ((Component)this).transform.Rotate(0f, num, 0f); } } } private void FixedUpdate() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) if (driving && _inputVector.y != 0f) { Vector3 velocity = _rb.velocity; float num = Mathf.Clamp01(((Vector3)(ref velocity)).magnitude / maxSpeed); float num2 = enginePowerCurve.Evaluate(num); _rb.AddForce(((Component)this).transform.forward * accel * num2 * _inputVector.y, (ForceMode)5); } } public void BeginDriving(FirstPersonController driver) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) _moveInput = driver.move; driving = true; _driver = driver; _cameraTransform = ((Component)driver.playerCamera).transform; _cameraTransform.SetParent(_cameraPosition); _cameraTransform.localPosition = Vector3.zero; driver.playerCamera = null; _playerGraphicsTransform = ((Component)driver).transform.root.Find("Graphics").Find("PF_Aboubi_04").Find("SK_Aboubi_00"); foreach (Transform item in _playerGraphicsTransform) { Transform val = item; ((Component)val).gameObject.SetActive(true); } Transform val2 = _cameraTransform.Find("BobPosition").Find("FPArms"); ((Component)val2.Find("BothHandPositions")).gameObject.SetActive(false); ((Component)val2.Find("PF_FPArm_Container_IK_00")).gameObject.SetActive(false); PlayerActions player = InputManager.inputActions.Player; PlayerActions player2 = driver.playerControls.Player; ((PlayerActions)(ref player2)).Interact.performed -= driver.playerPickupScript.HandleInteraction; player2 = driver.playerControls.Player; ((PlayerActions)(ref player2)).Interact.performed += EndDriving; player2 = driver.playerControls.Player; ((PlayerActions)(ref player2)).FireHold.performed += TriggerWeapon; } public void TriggerWeapon(CallbackContext _) { if (carType == CarType.Boom && !_exploded) { _exploded = true; if (driving) { EndDriving(); _driver.playerPickupScript.sync___set_value_objInHand(rcCarItem, true); ((Weapon)_driver.playerPickupScript.objInHand.GetComponent()).currentAmmo = 0; } RCCarNetworking.RPC("ExplodeObservers", new object[1] { ((Component)this).gameObject.GetComponent().ObjectId }); } } public void EndDriving(CallbackContext context) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) EndDriving(); PlayerActions player = InputManager.inputActions.Player; ((PlayerActions)(ref player)).Interact.performed += _driver.playerPickupScript.HandleInteraction; ((PlayerActions)(ref player)).Interact.performed -= EndDriving; ((PlayerActions)(ref player)).FireHold.performed -= TriggerWeapon; } public void EndDriving() { //IL_00f4: 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_0033: Expected O, but got Unknown driving = false; if (Object.op_Implicit((Object)(object)_playerGraphicsTransform)) { foreach (Transform item in _playerGraphicsTransform) { Transform val = item; if (!Object.op_Implicit((Object)(object)val)) { return; } ((Component)val).gameObject.SetActive(false); } ((Component)_playerGraphicsTransform.GetChild(6)).gameObject.SetActive(true); } if (Object.op_Implicit((Object)(object)_cameraTransform) && Object.op_Implicit((Object)(object)_driver.playerCameraHolder)) { _driver.playerCamera = ((Component)_cameraTransform).GetComponent(); _cameraTransform.SetParent(_driver.playerCameraHolder.transform); _cameraTransform.localPosition = Vector3.zero; Transform val2 = _cameraTransform.Find("BobPosition").Find("FPArms"); ((Component)val2.Find("BothHandPositions")).gameObject.SetActive(true); ((Component)val2.Find("PF_FPArm_Container_IK_00")).gameObject.SetActive(true); } } public void Explode() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) CollectionExtensions.Do((from collider in Physics.OverlapSphere(((Component)this).transform.position, explosionRadius, 67584).Where(delegate(Collider collider) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (((Component)((Component)collider).transform).tag == "ShatterableGlass" && Object.op_Implicit((Object)(object)((Component)collider).gameObject.GetComponent())) { ((Component)collider).gameObject.GetComponent().Shatter3D(((Component)collider).transform.position, ((Component)collider).transform.position - ((Component)this).transform.position); } return Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent()); }) select ((Component)collider).GetComponentInParent()).Distinct(), (Action)delegate(PlayerHealth health) { //IL_002e: 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_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) if (InstanceFinder.IsServer && Object.op_Implicit((Object)(object)health) && !health.sync___get_value_isKilled()) { Object.Instantiate(bloodDecal, ((Component)health).transform.position, Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f)); health.ChangeKilledState(true); health.RemoveHealth(10f); if ((Object)(object)((Component)((Component)health).transform).gameObject == (Object)(object)((Component)((Component)_driver).transform).gameObject) { Settings.Instance.IncreaseSuicidesAmount(); health.suicide = true; } else { PauseManager.Instance.WriteLog("" + health.sync___get_value_playerValues().playerClient.PlayerNameTag + " was blown up using a RC Car by " + ClientInstance.Instance.PlayerNameTag + ""); } health.Explode(false, true, ((Object)((Component)health).gameObject).name, ((Component)health).transform.position - ((Component)this).transform.position, 60f, ((Component)this).transform.position); health.SetKiller(((Component)_driver).transform); } }); Object.Instantiate(explosionVFX, ((Component)this).transform.position, Quaternion.identity); SoundManager.Instance.PlaySound(explosionSound); Despawn(); } } public class RCCarItem : MonoBehaviour { [NonSerialized] public RCCar car; } public class RCCarNetworking : MonoBehaviour { private static readonly uint ID = 932828u; public void Awake() { MyceliumNetwork.RegisterNetworkObject((object)this, ID, 0); } public void Deregister() { MyceliumNetwork.DeregisterNetworkObject((object)this, ID, 0); } public static void RPC(string methodname, object[] parameters) { MyceliumNetwork.RPC(ID, methodname, (ReliableType)1, parameters); } public static void TargetedRPC(CSteamID steamID, string methodname, object[] parameters) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) MyceliumNetwork.RPCTarget(ID, methodname, steamID, (ReliableType)1, parameters); } [CustomRPC] public void LinkCarToCarItem(int carItemNob, int carNob) { NetworkObject value = null; NetworkObject value2 = null; Debug.LogError((object)"got rpc"); if (!InstanceFinder.IsServer) { ((ManagedObjects)InstanceFinder.ClientManager.Objects).Spawned.TryGetValue(carItemNob, out value); ((ManagedObjects)InstanceFinder.ClientManager.Objects).Spawned.TryGetValue(carNob, out value2); Debug.LogError((object)$"client nobs: {value}, {value2}"); } else { ((ManagedObjects)InstanceFinder.ServerManager.Objects).Spawned.TryGetValue(carItemNob, out value); ((ManagedObjects)InstanceFinder.ServerManager.Objects).Spawned.TryGetValue(carNob, out value2); Debug.LogError((object)$"server nobs: {value}, {value2}"); } GameObject gameObject = ((Component)value).gameObject; RCCar component = ((Component)value2).gameObject.GetComponent(); gameObject.GetComponent().car = component; component.rcCarItem = gameObject; } [CustomRPC] public void ExplodeObservers(int carNob) { NetworkObject value = null; if (!InstanceFinder.IsServer) { ((ManagedObjects)InstanceFinder.ClientManager.Objects).Spawned.TryGetValue(carNob, out value); } else { ((ManagedObjects)InstanceFinder.ServerManager.Objects).Spawned.TryGetValue(carNob, out value); } ((Component)value).gameObject.GetComponent().Explode(); } } [HarmonyPatch(typeof(WeaponHandSpawner), "Fire")] public static class FirePatch { public static bool Prefix(WeaponHandSpawner __instance) { //IL_009e: 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) if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { return true; } if (!PauseManager.Instance.pause && !((Object)(object)((Weapon)__instance).behaviour.playerPickup.currentEnvironmentInteractable != (Object)null) && ((NetworkBehaviour)((Weapon)__instance).playerController).IsOwner && ((Weapon)__instance).playerController.sync___get_value_canMove() && !(__instance.fireTimer > 0f)) { __instance.fireTimer = ((Weapon)__instance).timeBetweenFire; if (((Weapon)__instance).currentAmmo == 1 && __instance.canPlace) { __instance.SpawnObject(__instance.objToSpawn, __instance.position, __instance.rotation); ((Weapon)__instance).CameraAnimation(); ((Weapon)__instance).WeaponAnimation(); ((Weapon)__instance).currentAmmo = 2; ((Weapon)__instance).needsAmmo = false; __instance.maxInteractionDistance = 0f; } else if (((NetworkBehaviour)((Weapon)__instance).playerController).IsOwner) { RCCar car = ((Component)__instance).gameObject.GetComponent().car; if (!car.driving) { car.BeginDriving(((Weapon)__instance).playerController); } } } return false; } } public static class RCCarLink { public static void Init() { CreatePlaceItemEvent.PlaceItemEvent += LinkRCCar; } public static void LinkRCCar(object sender, CreatePlaceItemEvent.PlaceItemEventArgs eventArgs) { WeaponHandSpawner spawner = eventArgs.spawner; GameObject spawnedObj = eventArgs.spawnedObj; RCCarItem rCCarItem = default(RCCarItem); if (!((Component)spawner).gameObject.TryGetComponent(ref rCCarItem)) { eventArgs.runOriginalCode = true; return; } eventArgs.runOriginalCode = false; RCCarNetworking.RPC("LinkCarToCarItem", new object[2] { ((Component)spawner).gameObject.GetComponent().ObjectId, spawnedObj.GetComponent().ObjectId }); } } [HarmonyPatch(typeof(FirstPersonController), "HandleCameraController")] public static class HandleNullCamera { private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown FieldInfo fieldInfo = AccessTools.Field(typeof(FirstPersonController), "playerCamera"); MethodInfo methodInfo = AccessTools.Method(typeof(Object), "op_Implicit", (Type[])null, (Type[])null); Label label = generator.DefineLabel(); return new CodeMatcher(instructions, generator).Start().InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[5] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo), new CodeInstruction(OpCodes.Call, (object)methodInfo), new CodeInstruction(OpCodes.Brtrue, (object)label), new CodeInstruction(OpCodes.Ret, (object)null) }).AddLabels((IEnumerable