Decompiled source of PS1Shot v2.0.0

PS1Shot.dll

Decompiled 2 weeks 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 BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("PS1Shot")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PS1Shot")]
[assembly: AssemblyTitle("PS1Shot")]
[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 ModelReplacement
{
	public class MRPS1PROTOMODEL : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "PS1 ProtoModel";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class MRPS1WORLDMACHINEMODEL : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "PS1 WorldMachineModel";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class MRRUEMODEL : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "RueModel";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class MRPS1CEDRICMODEL : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "CedricModel";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class MRPS1NIKOGASMODEL : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "PS1 NikoGasModel1";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class MRPS1NIKOMODEL : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "PS1 NikoModel";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class MRPS1ROBOTMODEL : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "PS1 BarrensRobot";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class MRPS1ROWBOTMODEL : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "PS1 Rowbot";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	[BepInPlugin(".com.Ghost.PS1Shot", "PS1Shot", "0.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static ConfigFile config;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		private static void InitConfig()
		{
			enableNikoModelForAllSuits = config.Bind<bool>("Suits to Replace Settings", "Enable PS1 Niko Model for all Suits", false, "Enable to model replace every suit. Set to false to specify suits");
			enableNikoModelAsDefault = config.Bind<bool>("Suits to Replace Settings", "Enable PS1 Niko Model as default", false, "Enable to model replace every suit that hasn't been otherwise registered.");
			suitNamesToEnableNikoModel = config.Bind<string>("Suits to Replace Settings", "Suits to enable PS1 Niko Model for", "Niko PS1", "Enter a comma separated list of suit names.(Additionally, [Green suit,Pajama suit,Hazard suit])");
			enableGMNikoModelForAllSuits = config.Bind<bool>("Suits to Replace Settings", "Enable PS1 Gas Mask Niko Model for all Suits", false, "Enable to model replace every suit. Set to false to specify suits");
			enableGMNikoModelAsDefault = config.Bind<bool>("Suits to Replace Settings", "Enable PS1 Gas Mask Niko Model as default", false, "Enable to model replace every suit that hasn't been otherwise registered.");
			suitNamesToEnableGMNikoModel = config.Bind<string>("Suits to Replace Settings", "Suits to enable PS1 Gas Mask Niko Model for", "Gas Mask Niko PS1", "Enter a comma separated list of suit names.(Additionally, [Green suit,Pajama suit,Hazard suit])");
			enableWorldMachineModelForAllSuits = config.Bind<bool>("Suits to Replace Settings", "Enable PS1 World Machine Model for all Suits", false, "Enable to model replace every suit. Set to false to specify suits");
			enableWorldMachineModelAsDefault = config.Bind<bool>("Suits to Replace Settings", "Enable PS1 World Machine Model as default", false, "Enable to model replace every suit that hasn't been otherwise registered.");
			suitNamesToEnableWorldMachineModel = config.Bind<string>("Suits to Replace Settings", "Suits to enable PS1 World Machine Model for", "World Machine PS1", "Enter a comma separated list of suit names.(Additionally, [Green suit,Pajama suit,Hazard suit])");
			enableCedricModelForAllSuits = config.Bind<bool>("Suits to Replace Settings", "Enable Model for all Suits", false, "Enable to model replace every suit. Set to false to specify suits");
			enableCedricModelAsDefault = config.Bind<bool>("Suits to Replace Settings", "Enable Model as default", false, "Enable to model replace every suit that hasn't been otherwise registered.");
			suitNamesToEnableCedricModel = config.Bind<string>("Suits to Replace Settings", "Suits to enable Model for", "Cedric PS1", "Enter a comma separated list of suit names.(Additionally, [Green suit,Pajama suit,Hazard suit])");
			enableRueModelForAllSuits = config.Bind<bool>("Suits to Replace Settings", "Enable PS1 Rue Model for all Suits", false, "Enable to model replace every suit. Set to false to specify suits");
			enableRueModelAsDefault = config.Bind<bool>("Suits to Replace Settings", "Enable PS1 Rue Model as default", false, "Enable to model replace every suit that hasn't been otherwise registered.");
			suitNamesToEnableRueModel = config.Bind<string>("Suits to Replace Settings", "Suits to enable PS1 Rue Model for", "Rue PS1", "Enter a comma separated list of suit names.(Additionally, [Green suit,Pajama suit,Hazard suit])");
			enableProtoModelForAllSuits = config.Bind<bool>("Suits to Replace Settings", "Enable PS1 Proto Model for all Suits", false, "Enable to model replace every suit. Set to false to specify suits");
			enableProtoModelAsDefault = config.Bind<bool>("Suits to Replace Settings", "Enable PS1 Proto Model as default", false, "Enable to model replace every suit that hasn't been otherwise registered.");
			suitNamesToEnableProtoModel = config.Bind<string>("Suits to Replace Settings", "Suits to enable PS1 Proto Model for", "Proto PS1", "Enter a comma separated list of suit names.(Additionally, [Green suit,Pajama suit,Hazard suit])");
			enableRobotModelForAllSuits = config.Bind<bool>("Suits to Replace Settings", "Enable PS1 Barrens Robot Model for all Suits", false, "Enable to model replace every suit. Set to false to specify suits");
			enableRobotModelAsDefault = config.Bind<bool>("Suits to Replace Settings", "Enable PS1 Barrens Robot Model as default", false, "Enable to model replace every suit that hasn't been otherwise registered.");
			suitNamesToEnableRobotModel = config.Bind<string>("Suits to Replace Settings", "Suits to enable PS1 Barrens Robot for", "Robot PS1", "Enter a comma separated list of suit names.(Additionally, [Green suit,Pajama suit,Hazard suit])");
			enableRowbotModelForAllSuits = config.Bind<bool>("Suits to Replace Settings", "Enable PS1 Rowbot Model for all Suits", false, "Enable to model replace every suit. Set to false to specify suits");
			enableRowbotModelAsDefault = config.Bind<bool>("Suits to Replace Settings", "Enable PS1 Rowbot Model as default", false, "Enable to model replace every suit that hasn't been otherwise registered.");
			suitNamesToEnableRowbotModel = config.Bind<string>("Suits to Replace Settings", "Suits to enable PS1 Rowbot for", "Rowbot PS1", "Enter a comma separated list of suit names.(Additionally, [Green suit,Pajama suit,Hazard suit])");
		}

		private void Awake()
		{
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0474: Expected O, but got Unknown
			config = ((BaseUnityPlugin)this).Config;
			InitConfig();
			Assets.PopulateAssets();
			if (enableNikoModelForAllSuits.Value)
			{
				ModelReplacementAPI.RegisterModelReplacementOverride(typeof(MRPS1NIKOMODEL));
			}
			if (enableNikoModelAsDefault.Value)
			{
				ModelReplacementAPI.RegisterModelReplacementDefault(typeof(MRPS1NIKOMODEL));
			}
			string[] array = suitNamesToEnableNikoModel.Value.Split(',');
			string[] array2 = array;
			foreach (string text in array2)
			{
				ModelReplacementAPI.RegisterSuitModelReplacement(text, typeof(MRPS1NIKOMODEL));
			}
			if (enableGMNikoModelForAllSuits.Value)
			{
				ModelReplacementAPI.RegisterModelReplacementOverride(typeof(MRPS1NIKOGASMODEL));
			}
			if (enableGMNikoModelAsDefault.Value)
			{
				ModelReplacementAPI.RegisterModelReplacementDefault(typeof(MRPS1NIKOGASMODEL));
			}
			string[] array3 = suitNamesToEnableGMNikoModel.Value.Split(',');
			string[] array4 = array3;
			foreach (string text2 in array4)
			{
				ModelReplacementAPI.RegisterSuitModelReplacement(text2, typeof(MRPS1NIKOGASMODEL));
			}
			if (enableWorldMachineModelForAllSuits.Value)
			{
				ModelReplacementAPI.RegisterModelReplacementOverride(typeof(MRPS1WORLDMACHINEMODEL));
			}
			if (enableWorldMachineModelAsDefault.Value)
			{
				ModelReplacementAPI.RegisterModelReplacementDefault(typeof(MRPS1WORLDMACHINEMODEL));
			}
			string[] array5 = suitNamesToEnableWorldMachineModel.Value.Split(',');
			string[] array6 = array5;
			foreach (string text3 in array6)
			{
				ModelReplacementAPI.RegisterSuitModelReplacement(text3, typeof(MRPS1WORLDMACHINEMODEL));
			}
			if (enableCedricModelForAllSuits.Value)
			{
				ModelReplacementAPI.RegisterModelReplacementOverride(typeof(MRPS1CEDRICMODEL));
			}
			if (enableCedricModelAsDefault.Value)
			{
				ModelReplacementAPI.RegisterModelReplacementDefault(typeof(MRPS1CEDRICMODEL));
			}
			string[] array7 = suitNamesToEnableCedricModel.Value.Split(',');
			string[] array8 = array7;
			foreach (string text4 in array8)
			{
				ModelReplacementAPI.RegisterSuitModelReplacement(text4, typeof(MRPS1CEDRICMODEL));
			}
			if (enableRueModelForAllSuits.Value)
			{
				ModelReplacementAPI.RegisterModelReplacementOverride(typeof(MRRUEMODEL));
			}
			if (enableRueModelAsDefault.Value)
			{
				ModelReplacementAPI.RegisterModelReplacementDefault(typeof(MRRUEMODEL));
			}
			string[] array9 = suitNamesToEnableRueModel.Value.Split(',');
			string[] array10 = array9;
			foreach (string text5 in array10)
			{
				ModelReplacementAPI.RegisterSuitModelReplacement(text5, typeof(MRRUEMODEL));
			}
			if (enableProtoModelForAllSuits.Value)
			{
				ModelReplacementAPI.RegisterModelReplacementOverride(typeof(MRPS1PROTOMODEL));
			}
			if (enableProtoModelAsDefault.Value)
			{
				ModelReplacementAPI.RegisterModelReplacementDefault(typeof(MRPS1PROTOMODEL));
			}
			string[] array11 = suitNamesToEnableProtoModel.Value.Split(',');
			string[] array12 = array11;
			foreach (string text6 in array12)
			{
				ModelReplacementAPI.RegisterSuitModelReplacement(text6, typeof(MRPS1PROTOMODEL));
			}
			if (enableRobotModelForAllSuits.Value)
			{
				ModelReplacementAPI.RegisterModelReplacementOverride(typeof(MRPS1ROBOTMODEL));
			}
			if (enableRobotModelAsDefault.Value)
			{
				ModelReplacementAPI.RegisterModelReplacementDefault(typeof(MRPS1ROBOTMODEL));
			}
			string[] array13 = suitNamesToEnableRobotModel.Value.Split(',');
			string[] array14 = array13;
			foreach (string text7 in array14)
			{
				ModelReplacementAPI.RegisterSuitModelReplacement(text7, typeof(MRPS1ROBOTMODEL));
			}
			if (enableRowbotModelForAllSuits.Value)
			{
				ModelReplacementAPI.RegisterModelReplacementOverride(typeof(MRPS1ROWBOTMODEL));
			}
			if (enableRowbotModelAsDefault.Value)
			{
				ModelReplacementAPI.RegisterModelReplacementDefault(typeof(MRPS1ROWBOTMODEL));
			}
			string[] array15 = suitNamesToEnableRowbotModel.Value.Split(',');
			string[] array16 = array15;
			foreach (string text8 in array16)
			{
				ModelReplacementAPI.RegisterSuitModelReplacement(text8, typeof(MRPS1ROWBOTMODEL));
			}
			Harmony val = new Harmony(".com.Ghost.PS1Shot");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin .com.Ghost.PS1Shot is loaded!");
		}
	}
	public static class Assets
	{
		public static string mainAssetBundleName = "PSOneshot";

		public static AssetBundle MainAssetBundle = null;

		private static string GetAssemblyName()
		{
			return Assembly.GetExecutingAssembly().GetName().Name.Replace(" ", "_");
		}

		public static void PopulateAssets()
		{
			if ((Object)(object)MainAssetBundle == (Object)null)
			{
				Console.WriteLine(GetAssemblyName() + "." + mainAssetBundleName);
				using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + mainAssetBundleName);
				MainAssetBundle = AssetBundle.LoadFromStream(stream);
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}