Decompiled source of PhaseConnectCoffeeScrap v1.0.6

PhaseConnect.Coffee.dll

Decompiled 10 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
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("PhaseConnect.Coffee")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PhaseConnect.Coffee")]
[assembly: AssemblyTitle("PhaseConnect.Coffee")]
[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 LethalCompanyTemplate
{
	[BepInPlugin("PhaseConnect.Coffee", "PhaseConnect.Coffee", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private enum CoffeeTalents
		{
			Airi,
			Erina,
			Iori,
			Lia,
			Lumi,
			Meemaw,
			Michiru,
			Nasa,
			Panko,
			Pippa,
			Rie,
			Tenma,
			Uruka,
			Wemi
		}

		private const int CoffeeCount = 14;

		private const string DefaultRarities = "DefaultRarity";

		private string[] ConfigRarities = new string[14]
		{
			"airirarity", "erinararity", "iorirarity", "liararity", "lumirarity", "meemawrarity", "michirurarity", "nasararity", "pankorarity", "pippararity",
			"rierarity", "tenmararity", "urukararity", "wemirarity"
		};

		private void Awake()
		{
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(directoryName, "phaseconnect.coffee"));
			if ((Object)(object)val == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Failed to load custom assets.");
				return;
			}
			int[] array = new int[14];
			for (int i = 0; i < 14; i++)
			{
				array[i] = 0;
			}
			try
			{
				StreamReader streamReader = new StreamReader(Path.Combine(directoryName, "CoffeeRarities.cfg"));
				bool flag = false;
				while (!flag)
				{
					string text = streamReader.ReadLine();
					if (text == null)
					{
						flag = true;
					}
					else
					{
						if (text.Length < 3 || text[0] == '#')
						{
							continue;
						}
						string[] array2 = text.Split();
						if (array2.Length != 3 || !(array2[1] == "="))
						{
							continue;
						}
						int result2;
						if (array2[0].ToLower() == "DefaultRarity".ToLower())
						{
							if (int.TryParse(array2[2], out var result))
							{
								for (int j = 0; j < 14; j++)
								{
									array[j] = result;
								}
							}
						}
						else if (ConfigRarities.Contains(array2[0].ToLower()) && int.TryParse(array2[2], out result2))
						{
							int num = Array.IndexOf(ConfigRarities, array2[0].ToLower());
							array[num] = result2;
						}
					}
				}
				streamReader.Close();
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Coffee config file successfully loaded!");
			}
			catch (Exception)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Error loading coffee config file");
			}
			int num2 = 100;
			Item val2 = val.LoadAsset<Item>("Assets/NewContent/Coffee/PhaseCoffeeAiri.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterScrap(val2, array[0], (LevelTypes)(-1));
			val2 = val.LoadAsset<Item>("Assets/NewContent/Coffee/PhaseCoffeeErina.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterScrap(val2, array[1], (LevelTypes)(-1));
			val2 = val.LoadAsset<Item>("Assets/NewContent/Coffee/PhaseCoffeeIori.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterScrap(val2, array[2], (LevelTypes)(-1));
			val2 = val.LoadAsset<Item>("Assets/NewContent/Coffee/PhaseCoffeeLia.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterScrap(val2, array[3], (LevelTypes)(-1));
			val2 = val.LoadAsset<Item>("Assets/NewContent/Coffee/PhaseCoffeeLumi.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterScrap(val2, array[4], (LevelTypes)(-1));
			val2 = val.LoadAsset<Item>("Assets/NewContent/Coffee/PhaseCoffeeMichiru.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterScrap(val2, array[6], (LevelTypes)(-1));
			val2 = val.LoadAsset<Item>("Assets/NewContent/Coffee/PhaseCoffeeNasa.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterScrap(val2, array[7], (LevelTypes)(-1));
			val2 = val.LoadAsset<Item>("Assets/NewContent/Coffee/PhaseCoffeePanko.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterScrap(val2, array[8], (LevelTypes)(-1));
			val2 = val.LoadAsset<Item>("Assets/NewContent/Coffee/PhaseCoffeePippa.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterScrap(val2, array[9], (LevelTypes)(-1));
			val2 = val.LoadAsset<Item>("Assets/NewContent/Coffee/PhaseCoffeeRemi.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterScrap(val2, array[10], (LevelTypes)(-1));
			val2 = val.LoadAsset<Item>("Assets/NewContent/Coffee/PhaseCoffeeRie.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterScrap(val2, array[11], (LevelTypes)(-1));
			val2 = val.LoadAsset<Item>("Assets/NewContent/Coffee/PhaseCoffeeShiina.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterScrap(val2, array[5], (LevelTypes)(-1));
			val2 = val.LoadAsset<Item>("Assets/NewContent/Coffee/PhaseCoffeeTenma.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterScrap(val2, array[12], (LevelTypes)(-1));
			val2 = val.LoadAsset<Item>("Assets/NewContent/Coffee/PhaseCoffeeUruka.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterScrap(val2, array[13], (LevelTypes)(-1));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin PhaseConnect.Coffee is loaded!");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "PhaseConnect.Coffee";

		public const string PLUGIN_NAME = "PhaseConnect.Coffee";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}