Decompiled source of GereSkinPack v1.0.1

GereSkinPack.dll

Decompiled 20 hours ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using Microsoft.CodeAnalysis;
using ModelReplacement;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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 GereSkinPack
{
	[BepInPlugin("com.gere.lethalcompany.gereskinpack", "GereSkinPack", "1.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string GUID = "com.gere.lethalcompany.gereskinpack";

		public const string NAME = "GereSkinPack";

		public const string VERSION = "1.0.1";

		public static AssetBundle GereAssetBundle;

		public static ConfigEntry<string> suitNamesToEnableModel { get; private set; }

		public static ConfigEntry<bool> enableModelAsDefault { get; private set; }

		private void Awake()
		{
			suitNamesToEnableModel = ((BaseUnityPlugin)this).Config.Bind<string>("Gere Skin Settings", "Suits to enable Gere model for", "Gere,Default,Orange suit", "Vesszővel elválasztott lista azokról a ruhákról, amelyeknél a Gere 3D modell jelenjen meg.");
			enableModelAsDefault = ((BaseUnityPlugin)this).Config.Bind<bool>("Gere Skin Settings", "Enable Model as Default", true, "Ha igaz, a Gere modell lesz az alapértelmezett modell, ha nincs más modell regisztrálva a ruhára.");
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			string text = Path.Combine(directoryName, "gereskinpack");
			if (!File.Exists(text))
			{
				text = Path.Combine(directoryName, "build", "gereskinpack");
			}
			if (File.Exists(text))
			{
				GereAssetBundle = AssetBundle.LoadFromFile(text);
			}
			if ((Object)(object)GereAssetBundle == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("[GereSkinPack] Nem sikerült betölteni a 'gereskinpack' AssetBundle-t innen: " + text));
				return;
			}
			if (enableModelAsDefault.Value)
			{
				ModelReplacementAPI.RegisterModelReplacementDefault(typeof(GereBodyReplacement));
			}
			string[] array = suitNamesToEnableModel.Value.Split(',');
			string[] array2 = array;
			foreach (string text2 in array2)
			{
				string text3 = text2.Trim();
				if (!string.IsNullOrEmpty(text3))
				{
					ModelReplacementAPI.RegisterSuitModelReplacement(text3, typeof(GereBodyReplacement));
					((BaseUnityPlugin)this).Logger.LogInfo((object)("[GereSkinPack] Gere modell regisztrálva a következő ruhához: '" + text3 + "'"));
				}
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"GereSkinPack v1.0.1 sikeresen betöltve és kész a játékra!");
		}
	}
	public class GereBodyReplacement : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "model";
			GameObject val = Plugin.GereAssetBundle.LoadAsset<GameObject>(text);
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)("[GereSkinPack] Nem található a '" + text + "' az AssetBundle-ben!"));
			}
			return val;
		}
	}
}