using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Cray.SBGItemFramework; using HarmonyLib; using Microsoft.CodeAnalysis; using Mirror; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("GolfCartLauncher")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+19753bac31a5762ac91e17fd3f080fb90c69e40b")] [assembly: AssemblyProduct("GolfCartLauncher")] [assembly: AssemblyTitle("GolfCartLauncher")] [assembly: AssemblyVersion("1.0.0.0")] [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 GolfCartLauncher { internal static class InputBridge { internal static bool WasPressedThisFrame(KeyCode keyCode) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected I4, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) switch (keyCode - 323) { case 0: if (Mouse.current != null) { return Mouse.current.leftButton.wasPressedThisFrame; } return false; case 1: if (Mouse.current != null) { return Mouse.current.rightButton.wasPressedThisFrame; } return false; case 2: if (Mouse.current != null) { return Mouse.current.middleButton.wasPressedThisFrame; } return false; case 3: if (Mouse.current != null) { return Mouse.current.backButton.wasPressedThisFrame; } return false; case 4: if (Mouse.current != null) { return Mouse.current.forwardButton.wasPressedThisFrame; } return false; default: { Key val = TranslateKey(keyCode); if ((int)val == 0 || Keyboard.current == null) { return false; } return ((ButtonControl)Keyboard.current[val]).wasPressedThisFrame; } } } internal static bool IsHeld(KeyCode keyCode) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected I4, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) switch (keyCode - 323) { case 0: if (Mouse.current != null) { return Mouse.current.leftButton.isPressed; } return false; case 1: if (Mouse.current != null) { return Mouse.current.rightButton.isPressed; } return false; case 2: if (Mouse.current != null) { return Mouse.current.middleButton.isPressed; } return false; case 3: if (Mouse.current != null) { return Mouse.current.backButton.isPressed; } return false; case 4: if (Mouse.current != null) { return Mouse.current.forwardButton.isPressed; } return false; default: { Key val = TranslateKey(keyCode); if ((int)val == 0 || Keyboard.current == null) { return false; } return ((ButtonControl)Keyboard.current[val]).isPressed; } } } private static Key TranslateKey(KeyCode keyCode) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0076: 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) //IL_00fb: Expected I4, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Expected I4, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected I4, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 if ((int)keyCode <= 27) { if ((int)keyCode <= 9) { if ((int)keyCode == 8) { return (Key)65; } if ((int)keyCode == 9) { return (Key)3; } } else { if ((int)keyCode == 13) { return (Key)2; } if ((int)keyCode == 27) { return (Key)60; } } } else if ((int)keyCode <= 57) { if ((int)keyCode == 32) { return (Key)1; } switch (keyCode - 48) { case 0: return (Key)50; case 1: return (Key)41; case 2: return (Key)42; case 3: return (Key)43; case 4: return (Key)44; case 5: return (Key)45; case 6: return (Key)46; case 7: return (Key)47; case 8: return (Key)48; case 9: return (Key)49; } } else { switch (keyCode - 97) { default: switch (keyCode - 273) { case 9: return (Key)94; case 10: return (Key)95; case 11: return (Key)96; case 12: return (Key)97; case 13: return (Key)98; case 14: return (Key)99; case 15: return (Key)100; case 16: return (Key)101; case 17: return (Key)102; case 18: return (Key)103; case 19: return (Key)104; case 20: return (Key)105; case 31: return (Key)51; case 30: return (Key)52; case 33: return (Key)55; case 32: return (Key)56; case 35: return (Key)53; case 34: return (Key)54; case 0: return (Key)63; case 1: return (Key)64; case 3: return (Key)61; case 2: return (Key)62; } break; case 0: return (Key)15; case 1: return (Key)16; case 2: return (Key)17; case 3: return (Key)18; case 4: return (Key)19; case 5: return (Key)20; case 6: return (Key)21; case 7: return (Key)22; case 8: return (Key)23; case 9: return (Key)24; case 10: return (Key)25; case 11: return (Key)26; case 12: return (Key)27; case 13: return (Key)28; case 14: return (Key)29; case 15: return (Key)30; case 16: return (Key)31; case 17: return (Key)32; case 18: return (Key)33; case 19: return (Key)34; case 20: return (Key)35; case 21: return (Key)36; case 22: return (Key)37; case 23: return (Key)38; case 24: return (Key)39; case 25: return (Key)40; case 30: return (Key)71; case 26: case 27: case 28: case 29: break; } } return (Key)0; } } [BepInPlugin("sbg.golfcartlauncher", "GolfCartLauncher", "0.4.0")] public sealed class Plugin : BaseUnityPlugin { internal sealed class CartLauncherHandler : ItemHandlerBase { public override void OnUse(PlayerInventory inventory) { bool shouldEatInput = false; TryFireCartLauncher(inventory, ref shouldEatInput); } } [HarmonyPatch(typeof(GolfCartMovement), "SetAllWheelBrakeTorque")] private static class Patch_GolfCartMovement_SetAllWheelBrakeTorque { private static void Prefix(GolfCartMovement __instance, ref float brakeTorque) { if ((Object)(object)__instance == (Object)null) { return; } uint netId = ((NetworkBehaviour)__instance).netId; if (netId != 0 && ProjectileEndTimes.TryGetValue(netId, out var value)) { if (Time.time >= value) { ProjectileEndTimes.Remove(netId); } else { brakeTorque = 0f; } } } } public const string ModGuid = "sbg.golfcartlauncher"; public const string ModName = "GolfCartLauncher"; public const string ModVersion = "0.4.0"; internal const int CustomItemTypeRaw = 1002; internal static readonly ItemType CustomItemType = (ItemType)1002; internal const string CustomItemDisplayName = "Cart Launcher"; internal static ManualLogSource Log; internal static Plugin Instance; internal ConfigEntry launchSpeedMphConfig; internal ConfigEntry upwardArcDegreesConfig; internal ConfigEntry projectileWindowSecondsConfig; internal ConfigEntry spawnHeightOffsetConfig; internal ConfigEntry debugGrantHotkeyEnabledConfig; internal ConfigEntry tintInHandConfig; internal ConfigEntry tintInHandColorHexConfig; internal static readonly Dictionary ProjectileEndTimes = new Dictionary(); internal static readonly Dictionary ProjectileWheelDisabled = new Dictionary(); private static MethodInfo getFirearmAimPointMethod; private static MethodInfo decrementUseFromSlotAtMethod; private static MethodInfo removeIfOutOfUsesMethod; private static bool serializerRegistered; private static bool serverHandlerRegistered; private static GameObject lastTintedEquipment; private static MaterialPropertyBlock tintBlock; private static readonly int TintBaseColor = Shader.PropertyToID("_BaseColor"); private static readonly int TintColor = Shader.PropertyToID("_Color"); private static List projectileExpiryReuse; private void Awake() { //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) Instance = this; Log = ((BaseUnityPlugin)this).Logger; launchSpeedMphConfig = ((BaseUnityPlugin)this).Config.Bind("Projectile", "LaunchSpeedMph", 40f, "Forward launch speed of the cart projectile in MPH. Recommended range 25 to 45."); projectileWindowSecondsConfig = ((BaseUnityPlugin)this).Config.Bind("Projectile", "ProjectileWindowSeconds", 2f, "Seconds to keep the cart in projectile mode (wheel colliders disabled, brake torque suppressed) so it follows a ballistic arc instead of being pinned to the ground by the wheel suspension and driverless brake."); upwardArcDegreesConfig = ((BaseUnityPlugin)this).Config.Bind("Projectile", "UpwardArcDegrees", 30f, "Pitch the launch direction up by this many degrees. With wheel colliders disabled the cart follows pure ballistic motion; 30° at 40 mph clears ~25 m of flat ground."); spawnHeightOffsetConfig = ((BaseUnityPlugin)this).Config.Bind("Projectile", "SpawnHeightOffsetMeters", 0.6f, "Vertical offset above the barrel at which the cart spawns, so it doesn't immediately collide with the launching player or the ground."); debugGrantHotkeyEnabledConfig = ((BaseUnityPlugin)this).Config.Bind("Debug", "EnableGrantHotkey", true, "Press F7 to grant one Cart Launcher to the local player. Off-hand fallback while spawn-pool injection is not implemented."); tintInHandConfig = ((BaseUnityPlugin)this).Config.Bind("Visuals", "TintInHand", true, "Tint the in-hand launcher model so it's visually distinct from the vanilla Rocket Launcher."); tintInHandColorHexConfig = ((BaseUnityPlugin)this).Config.Bind("Visuals", "TintInHandColorHex", "#7BD0FF", "Hex color (e.g. #7BD0FF) multiplied into the launcher's in-hand renderer materials."); CacheReflection(); RegisterSerializers(); new Harmony("sbg.golfcartlauncher").PatchAll(); Color val = ParseHexOr(tintInHandColorHexConfig.Value, new Color(0.48f, 0.81f, 1f)); ItemKit.Register(RegisteredItem.Define(CustomItemType, "Cart Launcher").WithHandler((IItemHandler)(object)new CartLauncherHandler()).WithIconFromVanillaItem((ItemType)7) .WithIconTint(val) .WithMaxUses(1) .WithMimicVanillaItem((ItemType)7) .WithTooltip("Hold-to-aim, click to launch a golf cart on a 30° arc that crashes wherever you point.") .Done()); Log.LogInfo((object)"GolfCartLauncher v0.4.0 loaded."); } private void Update() { if (debugGrantHotkeyEnabledConfig.Value && InputBridge.WasPressedThisFrame((KeyCode)288)) { TryDebugGrantItem(); } ServiceProjectileExpiries(); ServiceInHandTint(); } private static void CacheReflection() { getFirearmAimPointMethod = AccessTools.Method(typeof(PlayerInventory), "GetFirearmAimPoint", (Type[])null, (Type[])null); decrementUseFromSlotAtMethod = AccessTools.Method(typeof(PlayerInventory), "DecrementUseFromSlotAt", (Type[])null, (Type[])null); removeIfOutOfUsesMethod = AccessTools.Method(typeof(PlayerInventory), "RemoveIfOutOfUses", (Type[])null, (Type[])null); } private static void RegisterSerializers() { if (!serializerRegistered) { Writer.write = delegate(NetworkWriter w, CartLauncherFireMsg m) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) NetworkWriterExtensions.WriteVector3(w, m.position); NetworkWriterExtensions.WriteVector3(w, m.velocity); NetworkWriterExtensions.WriteQuaternion(w, m.rotation); }; Reader.read = (NetworkReader r) => new CartLauncherFireMsg { position = NetworkReaderExtensions.ReadVector3(r), velocity = NetworkReaderExtensions.ReadVector3(r), rotation = NetworkReaderExtensions.ReadQuaternion(r) }; serializerRegistered = true; } } private static void EnsureNetworkHandlerRegistered() { if (!serverHandlerRegistered || !NetworkServer.active) { if (!NetworkServer.active) { serverHandlerRegistered = false; return; } NetworkServer.ReplaceHandler((Action)OnFireRequest, true); serverHandlerRegistered = true; } } private void ServiceInHandTint() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_008c: Unknown result type (might be due to invalid IL or missing references) if (!tintInHandConfig.Value) { if ((Object)(object)lastTintedEquipment != (Object)null) { ClearTint(lastTintedEquipment); } lastTintedEquipment = null; return; } PlayerInventory localPlayerInventory = GameManager.LocalPlayerInventory; if ((Object)(object)localPlayerInventory == (Object)null) { return; } MethodInfo methodInfo = AccessTools.Method(typeof(PlayerInventory), "GetEffectiveSlot", (Type[])null, (Type[])null); if (methodInfo == null) { return; } InventorySlot val; try { val = (InventorySlot)methodInfo.Invoke(localPlayerInventory, new object[1] { localPlayerInventory.EquippedItemIndex }); } catch { return; } if (val.itemType != CustomItemType) { if ((Object)(object)lastTintedEquipment != (Object)null) { ClearTint(lastTintedEquipment); lastTintedEquipment = null; } return; } EquipmentSwitcher val2 = (((Object)(object)localPlayerInventory.PlayerInfo != (Object)null) ? localPlayerInventory.PlayerInfo.RightHandEquipmentSwitcher : null); Equipment val3 = (((Object)(object)val2 != (Object)null) ? val2.CurrentEquipment : null); if (!((Object)(object)val3 == (Object)null) && !((Object)(object)((Component)val3).gameObject == (Object)null) && !((Object)(object)lastTintedEquipment == (Object)(object)((Component)val3).gameObject)) { if ((Object)(object)lastTintedEquipment != (Object)null) { ClearTint(lastTintedEquipment); } ApplyTint(((Component)val3).gameObject); lastTintedEquipment = ((Component)val3).gameObject; } } private void ApplyTint(GameObject root) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) Color val = default(Color); if (!ColorUtility.TryParseHtmlString(tintInHandColorHexConfig.Value, ref val)) { return; } if (tintBlock == null) { tintBlock = new MaterialPropertyBlock(); } Renderer[] componentsInChildren = root.GetComponentsInChildren(true); foreach (Renderer val2 in componentsInChildren) { if (!((Object)(object)val2 == (Object)null)) { val2.GetPropertyBlock(tintBlock); if ((Object)(object)val2.sharedMaterial != (Object)null && val2.sharedMaterial.HasProperty(TintColor)) { tintBlock.SetColor(TintColor, val); } if ((Object)(object)val2.sharedMaterial != (Object)null && val2.sharedMaterial.HasProperty(TintBaseColor)) { tintBlock.SetColor(TintBaseColor, val); } val2.SetPropertyBlock(tintBlock); } } } private static void ClearTint(GameObject root) { if ((Object)(object)root == (Object)null) { return; } Renderer[] componentsInChildren = root.GetComponentsInChildren(true); foreach (Renderer val in componentsInChildren) { if ((Object)(object)val != (Object)null) { val.SetPropertyBlock((MaterialPropertyBlock)null); } } } private static void ServiceProjectileExpiries() { EnsureNetworkHandlerRegistered(); if (ProjectileWheelDisabled.Count == 0) { return; } float time = Time.time; if (projectileExpiryReuse == null) { projectileExpiryReuse = new List(); } projectileExpiryReuse.Clear(); foreach (KeyValuePair item in ProjectileWheelDisabled) { if (!ProjectileEndTimes.TryGetValue(item.Key, out var value) || time >= value) { projectileExpiryReuse.Add(item.Key); } } foreach (uint item2 in projectileExpiryReuse) { if (ProjectileWheelDisabled.TryGetValue(item2, out var value2) && value2 != null) { WheelCollider[] array = value2; foreach (WheelCollider val in array) { if ((Object)(object)val != (Object)null) { ((Collider)val).enabled = true; } } } ProjectileWheelDisabled.Remove(item2); ProjectileEndTimes.Remove(item2); } } private static bool TryFireCartLauncher(PlayerInventory inventory, ref bool shouldEatInput) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0032: 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) //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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00ce: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) shouldEatInput = true; if ((Object)(object)inventory == (Object)null || !((NetworkBehaviour)inventory).isLocalPlayer) { return false; } if (!inventory.IsAimingItem) { shouldEatInput = false; return false; } Vector3 rocketLauncherBarrelFrontEndPosition = inventory.GetRocketLauncherBarrelFrontEndPosition(); Vector3 val = ResolveAimPoint(inventory, rocketLauncherBarrelFrontEndPosition) - rocketLauncherBarrelFrontEndPosition; Vector3 val2 = ((Vector3)(ref val)).normalized; if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f) { val2 = ((Component)inventory.PlayerInfo).transform.forward; } float num = 0f - (((Object)(object)Instance != (Object)null) ? Instance.upwardArcDegreesConfig.Value : 12f); val = Vector3.Cross(val2, Vector3.up); Vector3 val3 = Quaternion.AngleAxis(num, ((Vector3)(ref val)).normalized) * val2; float num2 = (((Object)(object)Instance != (Object)null) ? Instance.launchSpeedMphConfig.Value : 22f) * 0.44704f; Vector3 velocity = val3 * num2; Quaternion rotation = Quaternion.LookRotation(new Vector3(val3.x, 0f, val3.z), Vector3.up); if (NetworkServer.active) { SpawnCartProjectile(rocketLauncherBarrelFrontEndPosition, velocity, rotation); } else if (NetworkClient.active && NetworkClient.ready) { NetworkClient.Send(new CartLauncherFireMsg { position = rocketLauncherBarrelFrontEndPosition, velocity = velocity, rotation = rotation }, 0); } decrementUseFromSlotAtMethod?.Invoke(inventory, new object[1] { inventory.EquippedItemIndex }); removeIfOutOfUsesMethod?.Invoke(inventory, new object[2] { inventory.EquippedItemIndex, true }); shouldEatInput = false; return true; } private static Vector3 ResolveAimPoint(PlayerInventory inventory, Vector3 fallback) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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) //IL_0019: 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_0028: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (getFirearmAimPointMethod == null) { return fallback + ((Component)inventory.PlayerInfo).transform.forward * 30f; } try { object[] parameters = new object[5] { inventory.GetRocketLauncherBarrelFrontEndPosition(), inventory.GetRocketLauncherBarrelForward(), 80f, GameManager.LayerSettings.RocketHittablesMask, 0f }; return (Vector3)getFirearmAimPointMethod.Invoke(inventory, parameters); } catch { return fallback + ((Component)inventory.PlayerInfo).transform.forward * 30f; } } private static void OnFireRequest(NetworkConnectionToClient conn, CartLauncherFireMsg msg) { //IL_0009: 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_0015: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { SpawnCartProjectile(msg.position, msg.velocity, msg.rotation); } } private static void SpawnCartProjectile(Vector3 position, Vector3 velocity, Quaternion rotation) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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) if ((Object)(object)GameManager.GolfCartSettings == (Object)null || (Object)(object)GameManager.GolfCartSettings.Prefab == (Object)null) { ManualLogSource log = Log; if (log != null) { log.LogWarning((object)"Cart Launcher fire request ignored: GolfCartSettings.Prefab missing."); } return; } float num = (((Object)(object)Instance != (Object)null) ? Instance.spawnHeightOffsetConfig.Value : 0.6f); Vector3 val = position + Vector3.up * num; GolfCartInfo val2 = Object.Instantiate(GameManager.GolfCartSettings.Prefab, val, rotation); if ((Object)(object)val2 == (Object)null) { ManualLogSource log2 = Log; if (log2 != null) { log2.LogWarning((object)"Cart Launcher: failed to instantiate cart projectile."); } return; } NetworkServer.Spawn(((Component)val2).gameObject, (NetworkConnectionToClient)null); WheelCollider[] componentsInChildren = ((Component)val2).GetComponentsInChildren(true); WheelCollider[] array = componentsInChildren; foreach (WheelCollider val3 in array) { if ((Object)(object)val3 != (Object)null) { ((Collider)val3).enabled = false; } } ProjectileWheelDisabled[((NetworkBehaviour)val2).netId] = componentsInChildren; Rigidbody val4 = ((Component)val2).GetComponent() ?? ((Component)val2).GetComponentInChildren(); if ((Object)(object)val4 != (Object)null) { val4.linearVelocity = velocity; } float num2 = (((Object)(object)Instance != (Object)null) ? Instance.projectileWindowSecondsConfig.Value : 2f); ProjectileEndTimes[((NetworkBehaviour)val2).netId] = Time.time + num2; } private static void TryDebugGrantItem() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) PlayerInventory localPlayerInventory = GameManager.LocalPlayerInventory; if ((Object)(object)localPlayerInventory == (Object)null) { return; } if (NetworkServer.active) { RegisteredItem obj = ItemKit.Get(CustomItemType); int num = ((obj == null) ? 1 : obj.MaxUses); localPlayerInventory.ServerTryAddItem(CustomItemType, num); ManualLogSource log = Log; if (log != null) { log.LogInfo((object)"Cart Launcher: granted via F7."); } } else { ManualLogSource log2 = Log; if (log2 != null) { log2.LogWarning((object)"Cart Launcher F7 grant requires hosting locally; cheats-gated CmdAddItem isn't being used here."); } } } private static Color ParseHexOr(string hex, Color fallback) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) Color result = default(Color); if (!ColorUtility.TryParseHtmlString(hex, ref result)) { return fallback; } return result; } } internal struct CartLauncherFireMsg : NetworkMessage { public Vector3 position; public Vector3 velocity; public Quaternion rotation; } }