Decompiled source of LethalDrones v1.0.5212

BepInEx/plugins/LethalDrones.dll

Decompiled a month ago
using System;
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 AbelMuak.Libs.LethalHelper;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using ModelReplacement;
using Newtonsoft.Json;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("Abel")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+decdfb13641eeca3b9bae7fdfec95cae5df50011")]
[assembly: AssemblyProduct("LethalDrones")]
[assembly: AssemblyTitle("LethalDrones")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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]
	[Microsoft.CodeAnalysis.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;
		}
	}
}
namespace AbelMuak.Mods.LC.LethalDrones
{
	public static class Assets
	{
		public static string charAssetBundleName = "lethaldrones_chars";

		public static string scrapsAssetBundleName = "lethaldrones_scrap";

		public static AssetBundle CharAssetBundle = null;

		public static AssetBundle ScrapAssetBundle = null;

		private static string GetAssemblyLocation()
		{
			return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
		}

		public static void PopulateAssets()
		{
			if ((Object)(object)CharAssetBundle == (Object)null)
			{
				Console.WriteLine("AbelMuak.LethalDrones: Loading Characters at " + charAssetBundleName);
				CharAssetBundle = AssetBundle.LoadFromFile(Path.Combine(GetAssemblyLocation(), charAssetBundleName));
			}
			if ((Object)(object)ScrapAssetBundle == (Object)null)
			{
				Console.WriteLine("AbelMuak.LethalDrones: Loading Scraps at " + scrapsAssetBundleName);
				ScrapAssetBundle = AssetBundle.LoadFromFile(Path.Combine(GetAssemblyLocation(), scrapsAssetBundleName));
			}
		}
	}
	public class MRSDN : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "SDN";
			return Assets.CharAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class MRUziDoorman : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "UziDoorman";
			return Assets.CharAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	[BepInPlugin("com.abelmuak.lc.lethaldrones", "Lethal Drones", "1.0.5")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string ModGUID = "com.abelmuak.lc.lethaldrones";

		public static ManualLogSource logger;

		private void Awake()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			logger = ((BaseUnityPlugin)this).Logger;
			Assets.PopulateAssets();
			Scrap.Register();
			ModelReplacementAPI.RegisterSuitModelReplacement("Lethal Drones - N", typeof(MRSDN));
			ModelReplacementAPI.RegisterSuitModelReplacement("Lethal Drones - Uzi", typeof(MRUziDoorman));
			Harmony val = new Harmony("com.abelmuak.lc.lethaldrones");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin com.abelmuak.lc.lethaldrones is loaded!");
		}
	}
	public static class Scrap
	{
		public static Item[] GetItems()
		{
			return (Item[])(object)new Item[8]
			{
				Assets.ScrapAssetBundle.LoadAsset<Item>("Assets/Projects/LethalDrones/Scrap/Scrap_JCPen.asset"),
				Assets.ScrapAssetBundle.LoadAsset<Item>("Assets/Projects/LethalDrones/Scrap/Scrap_Nanite.asset"),
				Assets.ScrapAssetBundle.LoadAsset<Item>("Assets/Projects/LethalDrones/Scrap/Scrap_UziNeck.asset"),
				Assets.ScrapAssetBundle.LoadAsset<Item>("Assets/Projects/LethalDrones/Scrap/Scrap_WDHead.asset"),
				Assets.ScrapAssetBundle.LoadAsset<Item>("Assets/Projects/LethalDrones/Scrap/Scrap_JPlush.asset"),
				Assets.ScrapAssetBundle.LoadAsset<Item>("Assets/Projects/LethalDrones/Scrap/Scrap_VPlush.asset"),
				Assets.ScrapAssetBundle.LoadAsset<Item>("Assets/Projects/LethalDrones/Scrap/Scrap_NPlush.asset"),
				Assets.ScrapAssetBundle.LoadAsset<Item>("Assets/Projects/LethalDrones/Scrap/Scrap_UziPlush.asset")
			};
		}

		public static int[] GetRarities()
		{
			return new int[8] { 30, 45, 50, 70, 69, 69, 69, 69 };
		}

		public static void Register()
		{
			Plugin.logger.LogInfo((object)"Loading Scrap list");
			TextAsset val = Assets.ScrapAssetBundle.LoadAsset<TextAsset>("Assets/Projects/LethalDrones/ScrapList.json");
			ScrapInfoJSON[] array = (ScrapInfoJSON[])(((object)JsonConvert.DeserializeObject<ScrapInfoJSON[]>(val.text)) ?? ((object)new ScrapInfoJSON[0]));
			Plugin.logger.LogInfo((object)"Scrap list loaded, info:");
			Plugin.logger.LogInfo((object)("Scrap count:" + array.Length));
			ScrapInfoJSON[] array2 = array;
			foreach (ScrapInfoJSON val2 in array2)
			{
				Item val3 = Assets.ScrapAssetBundle.LoadAsset<Item>(val2.ItemDef);
				NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab);
				Items.RegisterScrap(val3, val2.Rarity, (LevelTypes)val2.LevelType);
				Plugin.logger.LogInfo((object)("Registered " + val3.itemName + " (scrap)"));
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}