Decompiled source of Evolved v1.0.0

plugins/Evolved/Evolved.dll

Decompiled 9 months ago
using System;
using System.Collections.Generic;
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 HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
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: AssemblyCompany("Evolved")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+265fc12402de15e1683b92785f600f541bbc4ee0")]
[assembly: AssemblyProduct("Evolved")]
[assembly: AssemblyTitle("Evolved")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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;
		}
	}
}
namespace Evolved
{
	[BepInPlugin("Evolved", "Evolved", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin instance;

		private readonly Harmony harmony = new Harmony("Evolved");

		private Dictionary<string, int> assetDict = new Dictionary<string, int>
		{
			{ "Loafers", 40 },
			{ "LouisVuitton", 5 },
			{ "Rolex", 5 },
			{ "Pistol", 30 },
			{ "mp5", 25 },
			{ "ModelCar1", 25 },
			{ "ModelCar2", 20 },
			{ "ModelCar3", 15 },
			{ "ModelCar4", 10 },
			{ "ModelCar5", 5 },
			{ "CultMask", 10 },
			{ "shield", 8 },
			{ "ComputerKeyboard", 40 },
			{ "DinnerPlate", 50 },
			{ "Kettle", 50 },
			{ "PersonStatue", 15 },
			{ "LargeToyCar", 48 },
			{ "BeanBagChair", 37 },
			{ "BirdStatue1", 15 },
			{ "BirdStatue2", 10 },
			{ "Camera", 20 },
			{ "CoffeeMaker", 25 },
			{ "GoldenApple", 2 },
			{ "LargePottery1", 15 },
			{ "LargePottery2", 20 },
			{ "LargePottery3", 25 },
			{ "MiniFridge", 20 },
			{ "RetroTV", 15 },
			{ "Television", 30 },
			{ "DiningChair", 40 },
			{ "Dumbbell", 40 },
			{ "KetchupBottle", 45 },
			{ "Microwave", 30 },
			{ "MiniAirHockeyTable", 10 },
			{ "PastryDish", 40 },
			{ "PCMonitor", 30 },
			{ "ToiletPaper", 50 },
			{ "SniperScope", 10 },
			{ "Pottery1", 40 }
		};

		private static string ASSET_DIR = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "itemmod");

		private static string SCRAP_PATH = "Assets/scrap/";

		private static string ITEM_PATH = "Assets/Items/";

		private AssetBundle bundle = AssetBundle.LoadFromFile(ASSET_DIR);

		private void Awake()
		{
			instance = this;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"asset bundle is loaded!");
			foreach (KeyValuePair<string, int> item in assetDict)
			{
				string text = SCRAP_PATH + item.Key + "/" + item.Key + ".asset";
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Loading: " + text));
				Item val = bundle.LoadAsset<Item>(text);
				if (!val.twoHanded)
				{
					val.allowDroppingAheadOfPlayer = true;
				}
				if (val.minValue > val.maxValue)
				{
					((BaseUnityPlugin)this).Logger.LogInfo((object)("Asset $" + ((Object)val).name + " has improper min/max values"));
				}
				((BaseUnityPlugin)this).Logger.LogInfo((object)"asset loaded");
				NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
				((BaseUnityPlugin)this).Logger.LogInfo((object)"prefab network loaded");
				Utilities.FixMixerGroups(val.spawnPrefab);
				((BaseUnityPlugin)this).Logger.LogInfo((object)"prefab mixer groups loaded");
				Items.RegisterScrap(val, item.Value, (LevelTypes)(-1));
				((BaseUnityPlugin)this).Logger.LogInfo((object)"scrap registered");
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"All assets are loaded and registered!");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Evolved is loaded!");
			Item val2 = bundle.LoadAsset<Item>(ITEM_PATH + "Speaker/Speaker.asset");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading speaker");
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Utilities.FixMixerGroups(val2.spawnPrefab);
			TerminalNode val3 = ScriptableObject.CreateInstance<TerminalNode>();
			val3.clearPreviousText = true;
			val3.displayText = "This is a speaker";
			Items.RegisterShopItem(val2, (TerminalNode)null, (TerminalNode)null, val3, 0);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Evolved";

		public const string PLUGIN_NAME = "Evolved";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}