Decompiled source of Cyber Truck v1.0.5

Cybertruck.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Cybertruck.NetcodePatcher;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLib.Modules;
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: AssemblyCompany("bcs4313")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Adds a nuke as a rare scrap that may or may not be extremely dangerous.")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+cd9e2c801759e115bb3ab98ef537ed8ed3634744")]
[assembly: AssemblyProduct("Lethal_Nuke")]
[assembly: AssemblyTitle("Lethal_Nuke")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
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;
		}
	}
}
public class VehicleSelfCollisionFilter : MonoBehaviour
{
	[Header("Assign the SOLID non-trigger floor collider here")]
	[SerializeField]
	private Collider itemFloor;

	[Header("Assign all body/wheel colliders that should NOT hit the floor")]
	[SerializeField]
	private Collider[] vehicleColliders;

	private void Awake()
	{
		if ((Object)(object)itemFloor == (Object)null)
		{
			Debug.LogError((object)"VehicleSelfCollisionFilter: itemFloor not assigned");
			return;
		}
		if (vehicleColliders == null || vehicleColliders.Length == 0)
		{
			vehicleColliders = ((Component)this).GetComponentsInChildren<Collider>(true);
		}
		Collider[] array = vehicleColliders;
		foreach (Collider val in array)
		{
			if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)itemFloor))
			{
				Physics.IgnoreCollision(val, itemFloor, true);
			}
		}
	}
}
namespace ExampleEnemy
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ExampleEnemy";

		public const string PLUGIN_NAME = "MoaiEnemy";

		public const string PLUGIN_VERSION = "1.1.4";
	}
}
namespace MoaiEnemy
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "MoaiEnemy";

		public const string PLUGIN_NAME = "EasterIsland";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace CyberTruck
{
	public class MuskiteEgg : MonoBehaviour
	{
		private bool spawnedTwuck = false;

		private StunGrenadeItem eggLink;

		public void Start()
		{
			eggLink = ((Component)this).gameObject.GetComponent<StunGrenadeItem>();
		}

		public void Update()
		{
			//IL_0039: 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)
			try
			{
				if (eggLink.hasExploded && !spawnedTwuck && ((NetworkBehaviour)RoundManager.Instance).IsHost)
				{
					Plugin.spawnCyberTruck(((Component)eggLink).gameObject.transform.position, ((Component)eggLink).gameObject.transform.rotation);
					spawnedTwuck = true;
				}
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("CYBERTRUCK SPAWNING ERROR!: " + ex.ToString()));
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Cyber_Truck", "Cyber_Truck", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static Harmony _harmony;

		public static ManualLogSource Logger;

		public static AssetBundle cyberBundle;

		public static GameObject cyberPrefab;

		public static GameObject eggPrefab;

		public static Item eggItem;

		public static TerminalNode cyberNodeBuy;

		public static TerminalNode cyberNodeBought;

		public static TerminalNode cyberNodeInfo;

		public static ConfigEntry<int> cyberPrice;

		public void LogIfDebugBuild(string text)
		{
			Logger.LogInfo((object)text);
		}

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			PopulateAssets();
			bindVars();
			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);
					}
				}
			}
			cyberNodeBuy = cyberBundle.LoadAsset<TerminalNode>("buyCyberTruck");
			cyberNodeBought = cyberBundle.LoadAsset<TerminalNode>("buyCyberTruck2");
			cyberNodeInfo = cyberBundle.LoadAsset<TerminalNode>("CyberTruckInfo");
			eggPrefab = cyberBundle.LoadAsset<GameObject>("cyberEgg");
			cyberPrefab = cyberBundle.LoadAsset<GameObject>("CYBERTRUCK");
			eggItem = cyberBundle.LoadAsset<Item>("cyberEgg");
			Debug.Log((object)("egg: " + (object)eggPrefab));
			Debug.Log((object)("truckPrefab: " + (object)cyberPrefab));
			NetworkPrefabs.RegisterNetworkPrefab(cyberPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(eggPrefab);
			Items.RegisterShopItem(eggItem, cyberNodeBuy, cyberNodeBought, cyberNodeInfo, cyberPrice.Value);
		}

		public void bindVars()
		{
			//IL_002a: 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)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0050: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			cyberPrice = ((BaseUnityPlugin)this).Config.Bind<int>("Global", "Cyber Truck Price", 200, "How much the cyber truck costs.");
			ConfigEntry<int> obj = cyberPrice;
			IntInputFieldOptions val = new IntInputFieldOptions
			{
				RequiresRestart = true
			};
			((BaseRangeOptions<int>)val).Min = 0;
			((BaseRangeOptions<int>)val).Max = 100000000;
			IntInputFieldConfigItem val2 = new IntInputFieldConfigItem(obj, val);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
		}

		public static void spawnCyberTruck(Vector3 position, Quaternion rotation)
		{
			//IL_0033: 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_003e: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager singleton = NetworkManager.Singleton;
			if ((Object)(object)singleton == (Object)null || !singleton.IsServer)
			{
				Debug.LogError((object)"SpawnTruck: not server");
			}
			else
			{
				((MonoBehaviour)StartOfRound.Instance).StartCoroutine(SpawnWhenVehiclesContainerReady(position + Vector3.up * 8f, rotation));
			}
		}

		private static IEnumerator SpawnWhenVehiclesContainerReady(Vector3 pos, Quaternion rot)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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)
			while ((Object)(object)RoundManager.Instance == (Object)null || (Object)(object)RoundManager.Instance.VehiclesContainer == (Object)null)
			{
				yield return null;
			}
			GameObject go = Object.Instantiate<GameObject>(cyberPrefab, pos, rot, (Transform)null);
			NetworkObject no = go.GetComponent<NetworkObject>();
			if ((Object)(object)no == (Object)null)
			{
				Debug.LogError((object)"Truck prefab missing NetworkObject");
				Object.Destroy((Object)(object)go);
			}
			else
			{
				no.SpawnWithOwnership(NetworkManager.Singleton.LocalClientId, true);
			}
		}

		public static void PopulateAssets()
		{
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			cyberBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "epic_cybertruck"));
			Debug.Log((object)("Cybertruck Bundle::: " + (object)cyberBundle));
		}
	}
}
namespace EasterIsland
{
	internal class ConfigModel
	{
		public static ConfigEntry<float> moaiGlobalSize;

		public static ConfigEntry<float> moaiGlobalMusicVol;

		public static ConfigEntry<float> moaiGlobalRarity;

		public static ConfigEntry<float> moaiGlobalSpeed;

		public static void setupConfig()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0028: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0050: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//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)
			//IL_0066: Expected O, but got Unknown
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_0078: Expected O, but got Unknown
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_00a0: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			ConfigEntry<float> obj = moaiGlobalSize;
			FloatSliderOptions val = new FloatSliderOptions();
			((BaseRangeOptions<float>)val).Min = 0.05f;
			((BaseRangeOptions<float>)val).Max = 5f;
			FloatSliderConfigItem val2 = new FloatSliderConfigItem(obj, val);
			ConfigEntry<float> obj2 = moaiGlobalMusicVol;
			FloatSliderOptions val3 = new FloatSliderOptions();
			((BaseRangeOptions<float>)val3).Min = 0f;
			((BaseRangeOptions<float>)val3).Max = 2f;
			FloatSliderConfigItem val4 = new FloatSliderConfigItem(obj2, val3);
			ConfigEntry<float> obj3 = moaiGlobalRarity;
			FloatSliderOptions val5 = new FloatSliderOptions();
			((BaseRangeOptions<float>)val5).Min = 0f;
			((BaseRangeOptions<float>)val5).Max = 10f;
			FloatSliderConfigItem val6 = new FloatSliderConfigItem(obj3, val5);
			ConfigEntry<float> obj4 = moaiGlobalSpeed;
			FloatSliderOptions val7 = new FloatSliderOptions();
			((BaseRangeOptions<float>)val7).Min = 0f;
			((BaseRangeOptions<float>)val7).Max = 5f;
			FloatSliderConfigItem val8 = new FloatSliderConfigItem(obj4, val7);
		}
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
		}
	}
}
namespace Cybertruck.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}