Decompiled source of Armarouge Ceruledge PokeSuits v1.0.0

Armarouge_Ceruledge_PokeSuits.dll

Decompiled 43 minutes ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using ModelReplacement;
using ModelReplacement.AvatarBodyUpdater;
using ModelReplacement.Monobehaviors;
using MoreCompany;
using MoreCompany.Cosmetics;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Armarouge_Ceruledge_PokeSuits")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+8f1a626a9d4214f25a26437e9a7e332436f08cd6")]
[assembly: AssemblyProduct("Armarouge_Ceruledge_PokeSuits")]
[assembly: AssemblyTitle("Armarouge_Ceruledge_PokeSuits")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 ArmarougeMod
{
	public class MRARMAROUGE : BodyReplacementBase
	{
		protected virtual string PrefabName => "Armarouge";

		protected override GameObject LoadAssetsAndReturnModel()
		{
			GameObject obj = Assets.MainAssetBundle.LoadAsset<GameObject>(PrefabName);
			CosmeticTuning.Apply(obj, ((BaseUnityPlugin)Plugin.Instance).Config);
			return obj;
		}

		public override void LateUpdate()
		{
			((BodyReplacementBase)this).LateUpdate();
			CosmeticTuning.PlaceOnAnchors((BodyReplacementBase)(object)this);
		}

		protected override void OnDestroy()
		{
			CosmeticTuning.OnRemoved((BodyReplacementBase)(object)this);
			((BodyReplacementBase)this).OnDestroy();
		}
	}
	public class MRARMAROUGESHINY : MRARMAROUGE
	{
		protected override string PrefabName => "ArmarougeShiny";
	}
	public class MRCERULEDGE : MRARMAROUGE
	{
		protected override string PrefabName => "Ceruledge";
	}
	public class MRCERULEDGESHINY : MRARMAROUGE
	{
		protected override string PrefabName => "CeruledgeShiny";
	}
	internal static class CosmeticTuning
	{
		private class Slot
		{
			public string Name;

			public int MoreCompanyType;

			public HumanBodyBones[] Bones;

			public ConfigEntry<bool> Show;
		}

		private static readonly Quaternion BlenderToUnity = Quaternion.Euler(270f, 0f, 0f);

		private static readonly List<Slot> slots = new List<Slot>
		{
			new Slot
			{
				Name = "Hat",
				MoreCompanyType = 0,
				Bones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)10 }
			},
			new Slot
			{
				Name = "Chest",
				MoreCompanyType = 2,
				Bones = (HumanBodyBones[])(object)new HumanBodyBones[2]
				{
					(HumanBodyBones)54,
					(HumanBodyBones)8
				}
			},
			new Slot
			{
				Name = "RightForearm",
				MoreCompanyType = 3,
				Bones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)16 }
			},
			new Slot
			{
				Name = "Hip",
				MoreCompanyType = 4,
				Bones = (HumanBodyBones[])(object)new HumanBodyBones[1]
			},
			new Slot
			{
				Name = "LeftShin",
				MoreCompanyType = 5,
				Bones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)3 }
			},
			new Slot
			{
				Name = "RightShin",
				MoreCompanyType = 6,
				Bones = (HumanBodyBones[])(object)new HumanBodyBones[1] { (HumanBodyBones)4 }
			}
		};

		private static ConfigEntry<bool> useAnchors;

		internal static ConfigEntry<bool> debugLog;

		private static readonly Dictionary<int, Dictionary<int, Transform>> anchorCache = new Dictionary<int, Dictionary<int, Transform>>();

		public static void Bind(ConfigFile config)
		{
			debugLog = config.Bind<bool>("Debug", "Cosmetic diagnostics", false, "Log where each cosmetic is placed ([AnchorDiag]) and dump all cosmetics while emoting ([SceneDump]).");
			useAnchors = config.Bind<bool>("Cosmetics", "Use model anchors", true, "Place MoreCompany cosmetics on the anchors built into this model. Off = ModelReplacementAPI's default placement.");
			foreach (Slot slot in slots)
			{
				slot.Show = config.Bind<bool>("Cosmetics." + slot.Name, "Show", true, "Show " + slot.Name + " cosmetics on this model. (Wrist cosmetics are never shown on model replacements.)");
			}
		}

		public static void Apply(GameObject prefab, ConfigFile config)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			config.Reload();
			Animator componentInChildren = prefab.GetComponentInChildren<Animator>(true);
			if ((Object)(object)componentInChildren == (Object)null || (Object)(object)componentInChildren.avatar == (Object)null)
			{
				return;
			}
			Dictionary<string, string> dictionary = componentInChildren.avatar.humanDescription.human.ToDictionary((HumanBone h) => ((HumanBone)(ref h)).humanName, (HumanBone h) => ((HumanBone)(ref h)).boneName);
			Transform[] componentsInChildren = prefab.GetComponentsInChildren<Transform>(true);
			bool flag = componentsInChildren.Any((Transform t) => ((Object)t).name.StartsWith("Cosmetic_"));
			foreach (Slot slot in slots)
			{
				Transform val = null;
				HumanBodyBones[] bones = slot.Bones;
				foreach (HumanBodyBones val2 in bones)
				{
					if (dictionary.TryGetValue(HumanTrait.BoneName[val2], out var boneName) && (Object)(object)(val = ((IEnumerable<Transform>)componentsInChildren).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == boneName))) != (Object)null)
					{
						break;
					}
				}
				if (!((Object)(object)val == (Object)null))
				{
					RotationOffset val3 = ((Component)val).GetComponent<RotationOffset>();
					if ((Object)(object)val3 == (Object)null)
					{
						val3 = ((Component)val).gameObject.AddComponent<RotationOffset>();
					}
					val3.RenderMCC = slot.Show.Value;
					val3.MCCPosition = Vector3.zero;
					val3.MCCRotation = Quaternion.Inverse(val3.offset);
				}
			}
			Plugin.Log.LogInfo((object)("Cosmetics: " + ((flag && useAnchors.Value) ? "using model anchors" : "API placement (no anchors)")));
		}

		public static void PlaceOnAnchors(BodyReplacementBase br)
		{
			if (!ModelReplacementAPI.moreCompanyPresent || !useAnchors.Value || (Object)(object)br.controller == (Object)null)
			{
				return;
			}
			GameObject val = (((Object)(object)br.replacementDeadBody != (Object)null && br.replacementDeadBody.activeInHierarchy) ? br.replacementDeadBody : br.replacementModel);
			if (!((Object)(object)val == (Object)null))
			{
				Dictionary<int, Transform> dictionary = AnchorsFor(val);
				if (dictionary.Count != 0)
				{
					MoreCompanyBridge.Place(br, dictionary);
				}
			}
		}

		public static void OnRemoved(BodyReplacementBase br)
		{
			if (ModelReplacementAPI.moreCompanyPresent && (Object)(object)br.controller != (Object)null)
			{
				MoreCompanyBridge.RestoreScales(((Component)br.controller).gameObject);
			}
		}

		private static Dictionary<int, Transform> AnchorsFor(GameObject model)
		{
			int instanceID = ((Object)model).GetInstanceID();
			if (anchorCache.TryGetValue(instanceID, out var value) && value.Values.All((Transform t) => (Object)(object)t != (Object)null))
			{
				return value;
			}
			Dictionary<string, Transform> dictionary = (from t in model.GetComponentsInChildren<Transform>(true)
				where ((Object)t).name.StartsWith("Cosmetic_")
				group t by ((Object)t).name).ToDictionary((IGrouping<string, Transform> g) => g.Key, (IGrouping<string, Transform> g) => g.First());
			Dictionary<int, Transform> dictionary2 = new Dictionary<int, Transform>();
			foreach (Slot slot in slots)
			{
				if (slot.Show.Value && dictionary.TryGetValue("Cosmetic_" + slot.Name, out var value2))
				{
					dictionary2[slot.MoreCompanyType] = value2;
				}
			}
			anchorCache[instanceID] = dictionary2;
			return dictionary2;
		}

		internal static void PlaceOne(Transform cosmetic, Transform anchor, Vector3 baseScale)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			cosmetic.SetPositionAndRotation(anchor.position, anchor.rotation * BlenderToUnity);
			Vector3 localScale = anchor.localScale;
			cosmetic.localScale = Vector3.Scale(baseScale, new Vector3(localScale.x, localScale.z, localScale.y));
		}
	}
	internal static class MoreCompanyBridge
	{
		private static class Diag
		{
			private class Entry
			{
				public Transform T;

				public Transform Anchor;

				public string Name;

				public string Type;

				public Vector3 ApiPos;

				public Vector3 BaseScale;

				public int Frame;
			}

			[CompilerGenerated]
			private static class <>O
			{
				public static UnityAction <0>__Report;
			}

			private static readonly Dictionary<int, Entry> tracked = new Dictionary<int, Entry>();

			private static readonly HashSet<int> done = new HashSet<int>();

			private static bool hooked;

			public static void Track(Transform t, string name, string type, Transform anchor, Vector3 apiPos, Vector3 baseScale)
			{
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Unknown result type (might be due to invalid IL or missing references)
				//IL_008f: Expected O, but got Unknown
				int instanceID = ((Object)t).GetInstanceID();
				if (done.Contains(instanceID))
				{
					return;
				}
				if (!tracked.TryGetValue(instanceID, out var value))
				{
					Dictionary<int, Entry> dictionary = tracked;
					Entry obj = new Entry
					{
						T = t,
						Name = name,
						Type = type,
						Frame = Time.frameCount
					};
					value = obj;
					dictionary[instanceID] = obj;
				}
				value.Anchor = anchor;
				value.ApiPos = apiPos;
				value.BaseScale = baseScale;
				if (!hooked)
				{
					object obj2 = <>O.<0>__Report;
					if (obj2 == null)
					{
						UnityAction val = Report;
						<>O.<0>__Report = val;
						obj2 = (object)val;
					}
					Application.onBeforeRender += (UnityAction)obj2;
					hooked = true;
				}
			}

			private static void Report()
			{
				//IL_009d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0101: Unknown result type (might be due to invalid IL or missing references)
				//IL_010c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0117: Unknown result type (might be due to invalid IL or missing references)
				//IL_012c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0144: Unknown result type (might be due to invalid IL or missing references)
				//IL_0154: Unknown result type (might be due to invalid IL or missing references)
				//IL_0171: Unknown result type (might be due to invalid IL or missing references)
				//IL_017c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0190: Unknown result type (might be due to invalid IL or missing references)
				//IL_0195: Unknown result type (might be due to invalid IL or missing references)
				foreach (KeyValuePair<int, Entry> item in tracked.ToList())
				{
					Entry value = item.Value;
					if ((Object)(object)value.T == (Object)null || (Object)(object)value.Anchor == (Object)null)
					{
						tracked.Remove(item.Key);
					}
					else if (Time.frameCount - value.Frame >= 120)
					{
						Plugin.Log.LogInfo((object)($"[AnchorDiag] {value.Type} '{value.Name}': rendered at {value.T.position:F3}, anchor {((Object)value.Anchor).name} at " + $"{value.Anchor.position:F3} (off by {Vector3.Distance(value.T.position, value.Anchor.position):F3} m), API-only spot " + $"{value.ApiPos:F3} (anchor moved it {Vector3.Distance(value.ApiPos, value.Anchor.position):F3} m); scale {value.T.lossyScale:F3} " + $"= base {value.BaseScale:F3} x anchor local {value.Anchor.localScale:F3}; rot diff to anchor " + $"{Quaternion.Angle(value.T.rotation, value.Anchor.rotation * Quaternion.Euler(270f, 0f, 0f)):F1} deg; " + $"active={((Component)value.T).gameObject.activeInHierarchy} layer={((Component)value.T).gameObject.layer}"));
						tracked.Remove(item.Key);
						done.Add(item.Key);
					}
				}
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static UnityAction <0>__SceneDump;
		}

		private static readonly Dictionary<int, Vector3> baseScales = new Dictionary<int, Vector3>();

		private static int dumps;

		private static int lastDumpFrame = -100000;

		private static bool sceneHooked;

		public static void Place(BodyReplacementBase br, Dictionary<int, Transform> anchors)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected I4, but got Unknown
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			if (CosmeticTuning.debugLog.Value)
			{
				HookSceneDump();
			}
			ViewStateManager viewState = br.viewState;
			bool flag = (Object)(object)viewState != (Object)null && ((ManagerBase)viewState).localPlayer && (int)viewState.GetViewState() != 1;
			int num = ((!((Object)(object)viewState == (Object)null)) ? (flag ? viewState.ModelLayer : viewState.VisibleLayer) : 0);
			bool value = MainClass.cosmeticsSyncOther.Value;
			CosmeticApplication[] componentsInChildren = ((Component)br.controller).GetComponentsInChildren<CosmeticApplication>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				foreach (CosmeticInstance spawnedCosmetic in componentsInChildren[i].spawnedCosmetics)
				{
					if ((Object)(object)spawnedCosmetic == (Object)null)
					{
						continue;
					}
					if (!anchors.TryGetValue((int)spawnedCosmetic.cosmeticType, out var value2))
					{
						if (((Component)spawnedCosmetic).gameObject.activeSelf)
						{
							((Component)spawnedCosmetic).gameObject.SetActive(false);
						}
						continue;
					}
					Transform transform = ((Component)spawnedCosmetic).transform;
					if ((Object)(object)transform.parent != (Object)null)
					{
						transform.SetParent((Transform)null, true);
					}
					int instanceID = ((Object)spawnedCosmetic).GetInstanceID();
					if (!baseScales.TryGetValue(instanceID, out var value3))
					{
						value3 = (baseScales[instanceID] = transform.localScale);
					}
					if (((Component)spawnedCosmetic).gameObject.activeSelf != value)
					{
						((Component)spawnedCosmetic).gameObject.SetActive(value);
					}
					if (((Component)spawnedCosmetic).gameObject.layer != num)
					{
						SetLayer(transform, num);
					}
					Vector3 position = transform.position;
					CosmeticTuning.PlaceOne(transform, value2, value3);
					if (CosmeticTuning.debugLog.Value)
					{
						Diag.Track(transform, spawnedCosmetic.cosmeticId, ((object)Unsafe.As<CosmeticType, CosmeticType>(ref spawnedCosmetic.cosmeticType)/*cast due to .constrained prefix*/).ToString(), value2, position, value3);
					}
				}
			}
		}

		private static void SetLayer(Transform t, int layer)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			((Component)t).gameObject.layer = layer;
			foreach (Transform item in t)
			{
				SetLayer(item, layer);
			}
		}

		public static void HookSceneDump()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			if (!sceneHooked)
			{
				sceneHooked = true;
				object obj = <>O.<0>__SceneDump;
				if (obj == null)
				{
					UnityAction val = SceneDump;
					<>O.<0>__SceneDump = val;
					obj = (object)val;
				}
				Application.onBeforeRender += (UnityAction)obj;
			}
		}

		private static string PathOf(Transform t)
		{
			List<string> list = new List<string>();
			int num = 0;
			while ((Object)(object)t != (Object)null && num < 5)
			{
				list.Add(((Object)t).name);
				num++;
				t = t.parent;
			}
			return string.Join("<", list);
		}

		private static void SceneDump()
		{
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			if (dumps >= 4 || Time.frameCount - lastDumpFrame < 180)
			{
				return;
			}
			Camera[] allCameras = Camera.allCameras;
			if (!allCameras.Any((Camera c) => ((Object)c).name == "EmoteCamera"))
			{
				return;
			}
			dumps++;
			lastDumpFrame = Time.frameCount;
			ManualLogSource log = Plugin.Log;
			log.LogInfo((object)($"[SceneDump {dumps}] cameras: " + string.Join(" | ", allCameras.Select((Camera c) => $"{((Object)c).name} mask=0x{c.cullingMask:X} at {((Component)c).transform.position:F2}"))));
			CosmeticInstance[] array = Object.FindObjectsOfType<CosmeticInstance>(true);
			foreach (CosmeticInstance val in array)
			{
				Renderer[] componentsInChildren = ((Component)val).GetComponentsInChildren<Renderer>(true);
				int layer = ((Component)val).gameObject.layer;
				IEnumerable<string> values = from cam in allCameras
					where (cam.cullingMask & (1 << layer)) != 0
					select ((Object)cam).name;
				log.LogInfo((object)($"[SceneDump {dumps}] {val.cosmeticType} '{val.cosmeticId}' id={((Object)val).GetInstanceID()} active={((Component)val).gameObject.activeInHierarchy} " + $"layer={layer} renderers={componentsInChildren.Count((Renderer r) => r.enabled)}/{componentsInChildren.Length} pos={((Component)val).transform.position:F3} " + string.Format("tracked={0} path={1} seenBy=[{2}]", baseScales.ContainsKey(((Object)val).GetInstanceID()), PathOf(((Component)val).transform), string.Join(",", values))));
			}
		}

		public static void RestoreScales(GameObject player)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			CosmeticApplication[] componentsInChildren = player.GetComponentsInChildren<CosmeticApplication>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				foreach (CosmeticInstance spawnedCosmetic in componentsInChildren[i].spawnedCosmetics)
				{
					if ((Object)(object)spawnedCosmetic != (Object)null && baseScales.TryGetValue(((Object)spawnedCosmetic).GetInstanceID(), out var value) && (Object)(object)((Component)spawnedCosmetic).transform.parent == (Object)null)
					{
						((Component)spawnedCosmetic).transform.localScale = value;
					}
				}
			}
		}
	}
	[BepInPlugin("lethalvibe.pokesuits", "Armarouge_Ceruledge_PokeSuits", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string GUID = "lethalvibe.pokesuits";

		public const string NAME = "Armarouge_Ceruledge_PokeSuits";

		public const string VERSION = "1.0.0";

		internal static Plugin Instance;

		internal static ManualLogSource Log;

		public static ConfigEntry<bool> enableModelForAllSuits;

		public static ConfigEntry<bool> enableModelAsDefault;

		public static ConfigEntry<string> suitNamesToEnableModel;

		public static ConfigEntry<string> suitNamesToEnableShinyModel;

		public static ConfigEntry<string> suitNamesToEnableCeruledge;

		public static ConfigEntry<string> suitNamesToEnableCeruledgeShiny;

		private void Awake()
		{
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			enableModelForAllSuits = ((BaseUnityPlugin)this).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");
			enableModelAsDefault = ((BaseUnityPlugin)this).Config.Bind<bool>("Suits to Replace Settings", "Enable Model as default", false, "Enable to model replace every suit that hasn't been otherwise registered.");
			suitNamesToEnableModel = ((BaseUnityPlugin)this).Config.Bind<string>("Suits to Replace Settings", "Suits to enable Model for", "Armarouge", "Comma separated list of suit names.");
			suitNamesToEnableShinyModel = ((BaseUnityPlugin)this).Config.Bind<string>("Suits to Replace Settings", "Suits to enable Shiny Model for", "Armarouge Shiny", "Comma separated list of suit names that get the recoloured (shiny) Armarouge.");
			suitNamesToEnableCeruledge = ((BaseUnityPlugin)this).Config.Bind<string>("Suits to Replace Settings", "Suits to enable Ceruledge for", "Ceruledge", "Comma separated list of suit names that get the Ceruledge model.");
			suitNamesToEnableCeruledgeShiny = ((BaseUnityPlugin)this).Config.Bind<string>("Suits to Replace Settings", "Suits to enable Ceruledge Shiny for", "Ceruledge Shiny", "Comma separated list of suit names that get the recoloured (shiny) Ceruledge.");
			CosmeticTuning.Bind(((BaseUnityPlugin)this).Config);
			Assets.PopulateAssets();
			if (enableModelForAllSuits.Value)
			{
				ModelReplacementAPI.RegisterModelReplacementOverride(typeof(MRARMAROUGE));
			}
			if (enableModelAsDefault.Value)
			{
				ModelReplacementAPI.RegisterModelReplacementDefault(typeof(MRARMAROUGE));
			}
			string[] array = suitNamesToEnableModel.Value.Split(',');
			foreach (string text in array)
			{
				if (!string.IsNullOrWhiteSpace(text))
				{
					ModelReplacementAPI.RegisterSuitModelReplacement(text.Trim(), typeof(MRARMAROUGE));
				}
			}
			array = suitNamesToEnableShinyModel.Value.Split(',');
			foreach (string text2 in array)
			{
				if (!string.IsNullOrWhiteSpace(text2))
				{
					ModelReplacementAPI.RegisterSuitModelReplacement(text2.Trim(), typeof(MRARMAROUGESHINY));
				}
			}
			array = suitNamesToEnableCeruledge.Value.Split(',');
			foreach (string text3 in array)
			{
				if (!string.IsNullOrWhiteSpace(text3))
				{
					ModelReplacementAPI.RegisterSuitModelReplacement(text3.Trim(), typeof(MRCERULEDGE));
				}
			}
			array = suitNamesToEnableCeruledgeShiny.Value.Split(',');
			foreach (string text4 in array)
			{
				if (!string.IsNullOrWhiteSpace(text4))
				{
					ModelReplacementAPI.RegisterSuitModelReplacement(text4.Trim(), typeof(MRCERULEDGESHINY));
				}
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Armarouge_Ceruledge_PokeSuits 1.0.0 loaded (bundle " + (((Object)(object)Assets.MainAssetBundle != (Object)null) ? "ok" : "MISSING") + ")"));
		}
	}
	public static class Assets
	{
		public const string mainAssetBundleName = "armarougebundle";

		public static AssetBundle MainAssetBundle;

		public static void PopulateAssets()
		{
			if ((Object)(object)MainAssetBundle != (Object)null)
			{
				return;
			}
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string text = "armarougebundle";
			using Stream stream = executingAssembly.GetManifestResourceStream(text);
			if (stream == null)
			{
				Console.WriteLine("[PokeSuits] embedded resource " + text + " not found");
			}
			else
			{
				MainAssetBundle = AssetBundle.LoadFromStream(stream);
			}
		}
	}
}