Decompiled source of WolfoAlternateSkins v3.0.1

WolfoSkinsMod.dll

Decompiled a month ago
using System;
using System.Collections;
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 System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.BrotherMonster;
using EntityStates.Commando;
using EntityStates.FalseSon;
using EntityStates.Missions.LunarScavengerEncounter;
using EntityStates.VoidRaidCrab;
using HG;
using Microsoft.CodeAnalysis;
using On.EntityStates.BrotherMonster;
using On.EntityStates.Commando;
using On.EntityStates.FalseSon;
using On.EntityStates.Missions.LunarScavengerEncounter;
using On.EntityStates.VoidRaidCrab;
using On.RoR2;
using On.RoR2.UI.LogBook;
using R2API;
using R2API.Utils;
using RA2Mod.General.Components;
using Rewired;
using RiskOfOptions;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Achievements;
using RoR2.ContentManagement;
using RoR2.ExpansionManagement;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.Stats;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Rendering;
using WolfoSkinsMod.Base;
using WolfoSkinsMod.DLC1;
using WolfoSkinsMod.DLC2;
using WolfoSkinsMod.Mod;

[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("WolfoSkinsMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+387772b1b487d7e7a47349679a5baa3096129403")]
[assembly: AssemblyProduct("WolfoSkinsMod")]
[assembly: AssemblyTitle("WolfoSkinsMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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;
		}
	}
}
namespace WolfoSkinsMod
{
	public class Achievements
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_PlayAllEnemiesDefeatedSound <>9__9_0;

			public static hook_OnEnter <>9__9_1;

			internal void <Hooks>b__9_0(orig_PlayAllEnemiesDefeatedSound orig, InfiniteTowerWaveController self)
			{
				orig.Invoke(self);
				if (self.waveIndex == 50 || self.waveIndex == 51)
				{
					GrantUnlockAndAchievement("CLEAR_SIMU_");
				}
			}

			internal void <Hooks>b__9_1(orig_OnEnter orig, FadeOut self)
			{
				orig.Invoke(self);
				GrantUnlockAndAchievement("CLEAR_LUNARSCAV_");
			}
		}

		public static event Action unlockSkins_One;

		public static event Action unlockSkins_Two;

		public static event Action unlockSkins_Three;

		internal static void Hooks()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			object obj = <>c.<>9__9_0;
			if (obj == null)
			{
				hook_PlayAllEnemiesDefeatedSound val = delegate(orig_PlayAllEnemiesDefeatedSound orig, InfiniteTowerWaveController self)
				{
					orig.Invoke(self);
					if (self.waveIndex == 50 || self.waveIndex == 51)
					{
						GrantUnlockAndAchievement("CLEAR_SIMU_");
					}
				};
				<>c.<>9__9_0 = val;
				obj = (object)val;
			}
			InfiniteTowerWaveController.PlayAllEnemiesDefeatedSound += (hook_PlayAllEnemiesDefeatedSound)obj;
			object obj2 = <>c.<>9__9_1;
			if (obj2 == null)
			{
				hook_OnEnter val2 = delegate(orig_OnEnter orig, FadeOut self)
				{
					orig.Invoke(self);
					GrantUnlockAndAchievement("CLEAR_LUNARSCAV_");
				};
				<>c.<>9__9_1 = val2;
				obj2 = (object)val2;
			}
			FadeOut.OnEnter += (hook_OnEnter)obj2;
			DeathState.OnEnter += new hook_OnEnter(Voidling_Unlock);
			TrueDeathState.OnEnter += new hook_OnEnter(Eclipse_Unlock);
			Run.onClientGameOverGlobal += BackupInCaseMainFailed;
		}

		public static void BackupInCaseMainFailed(Run run, RunReport runReport)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Invalid comparison between Unknown and I4
			if (Object.op_Implicit((Object)(object)runReport.gameEnding) && runReport.gameEnding.isWin)
			{
				if (runReport.gameEnding.cachedName.Equals("InfiniteTowerEnding"))
				{
					GrantUnlockAndAchievement("CLEAR_SIMU_");
				}
				else if ((Object)(object)runReport.gameEnding == (Object)(object)GameEndings.MainEnding && (int)run.selectedDifficulty >= 6)
				{
					GrantUnlockAndAchievement("CLEAR_LUNARSCAV_");
				}
				else if ((Object)(object)runReport.gameEnding == (Object)(object)GameEndings.LimboEnding)
				{
					GrantUnlockAndAchievement("CLEAR_ECLIPSE_");
				}
				else if ((Object)(object)runReport.gameEnding == (Object)(object)GameEndings.VoidEnding)
				{
					GrantUnlockAndAchievement("CLEAR_VOIDLING_");
				}
			}
		}

		public static void GrantUnlockAndAchievement(string achievement)
		{
			if (LocalUserManager.readOnlyLocalUsersList.Count == 0)
			{
				return;
			}
			UserProfile userProfile = LocalUserManager.readOnlyLocalUsersList[0].userProfile;
			SurvivorDef survivorPreference = userProfile.GetSurvivorPreference();
			if (Object.op_Implicit((Object)(object)survivorPreference))
			{
				string text = survivorPreference.cachedName.ToUpperInvariant();
				if (!userProfile.HasAchievement(achievement + text))
				{
					userProfile.AddAchievement(achievement + text, false);
				}
				int num = 0;
				int token = 0;
				if (userProfile.HasAchievement("CLEAR_LUNARSCAV_" + text))
				{
					num++;
					token = 1;
				}
				if (userProfile.HasAchievement("CLEAR_VOIDLING_" + text))
				{
					num++;
					token = 2;
				}
				if (userProfile.HasAchievement("CLEAR_SIMU_" + text))
				{
					num++;
					token = 3;
				}
				if (userProfile.HasAchievement("CLEAR_ECLIPSE_" + text))
				{
					num++;
					token = 4;
				}
				Achievements.unlockSkins_One?.Invoke();
				if (num >= 2)
				{
					Achievements.unlockSkins_Two?.Invoke();
					Unlocks.UpdateTier2Objective_Specific(userProfile, survivorPreference, 0);
				}
				else
				{
					Unlocks.UpdateTier2Objective_Specific(userProfile, survivorPreference, token);
				}
			}
		}

		private static void Voidling_Unlock(orig_OnEnter orig, DeathState self)
		{
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)SceneInfo.instance) && SceneInfo.instance.sceneDef.cachedName.Equals("voidraid"))
			{
				GrantUnlockAndAchievement("CLEAR_VOIDLING_");
			}
		}

		private static void Eclipse_Unlock(orig_OnEnter orig, TrueDeathState self)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Invalid comparison between Unknown and I4
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)SceneInfo.instance) && SceneInfo.instance.sceneDef.cachedName == "moon2" && (int)Run.instance.selectedDifficulty >= 6)
			{
				GrantUnlockAndAchievement("CLEAR_ECLIPSE_");
			}
		}
	}
	public class ACHIEVEMENT_BASE : BaseAchievement
	{
		public void Unlock()
		{
			base.achievementDef.nameToken = Language.GetString(base.achievementDef.nameToken);
			((BaseAchievement)this).Grant();
		}
	}
	public class Achievement_TWO_THINGS : ACHIEVEMENT_BASE
	{
		public override void OnBodyRequirementMet()
		{
			if (HasBaseAchievement())
			{
				((BaseAchievement)this).OnBodyRequirementMet();
				Achievements.unlockSkins_Two += base.Unlock;
			}
		}

		public override void OnBodyRequirementBroken()
		{
			if (HasBaseAchievement())
			{
				((BaseAchievement)this).OnBodyRequirementBroken();
				Achievements.unlockSkins_Two -= base.Unlock;
			}
		}

		public bool HasBaseAchievement()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_001f: Invalid comparison between Unknown and I4
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			if (((BaseAchievement)this).owner == null)
			{
				return false;
			}
			BodyIndex val = ((BaseAchievement)this).LookUpRequiredBodyIndex();
			if ((int)val == -1)
			{
				return false;
			}
			SurvivorIndex survivorIndexFromBodyIndex = SurvivorCatalog.GetSurvivorIndexFromBodyIndex(val);
			SurvivorDef survivorDef = SurvivorCatalog.GetSurvivorDef(survivorIndexFromBodyIndex);
			string text = "CLEAR_ANY_" + survivorDef.cachedName.ToUpperInvariant();
			AchievementDef achievementDef = AchievementManager.GetAchievementDef(text);
			if (achievementDef == null)
			{
				return false;
			}
			return ((BaseAchievement)this).owner.userProfile.HasAchievement(text);
		}
	}
	public class Achievement_ONE_THINGS : ACHIEVEMENT_BASE
	{
		public override void OnBodyRequirementMet()
		{
			Achievements.unlockSkins_One += base.Unlock;
			((BaseAchievement)this).OnBodyRequirementMet();
		}

		public override void OnBodyRequirementBroken()
		{
			Achievements.unlockSkins_One -= base.Unlock;
			((BaseAchievement)this).OnBodyRequirementBroken();
		}
	}
	internal static class Assets
	{
		public static AssetBundle Bundle;

		public static AssetBundle BundleDLC;

		public static AssetBundle BundleMod;

		public static PluginInfo PluginInfo;

		public static string Folder = "Skins";

		internal static string assemblyDir => Path.GetDirectoryName(PluginInfo.Location);

		internal static void Init(PluginInfo info)
		{
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			PluginInfo = info;
			if (!Directory.Exists(GetPathToFile(Folder)))
			{
				Debug.LogWarning((object)(Folder + " | Folder does not exist"));
				Folder = "plugins\\" + Folder;
				if (!Directory.Exists(GetPathToFile(Folder)))
				{
					Debug.LogWarning((object)(Folder + " | Folder does not exist"));
				}
			}
			if (Directory.Exists(GetPathToFile(Folder + "\\Languages")))
			{
				Language.SetFolders += new hook_SetFolders(SetFolders);
			}
			else
			{
				Debug.LogWarning((object)(Folder + "\\Languages | Folder does not exist"));
			}
			if (Directory.Exists(GetPathToFile(Folder + "\\AssetBundles")))
			{
				Bundle = AssetBundle.LoadFromFile(GetPathToFile(Folder + "\\AssetBundles", "altskins"));
			}
			else
			{
				Debug.LogWarning((object)(Folder + "\\AssetBundles | Folder does not exist"));
			}
		}

		private static void SetFolders(orig_SetFolders orig, Language self, IEnumerable<string> newFolders)
		{
			IEnumerable<string> second = Directory.EnumerateDirectories(Path.Combine(GetPathToFile(Folder + "\\Languages")), self.name);
			orig.Invoke(self, newFolders.Union(second));
		}

		internal static string GetPathToFile(string folderName)
		{
			return Path.Combine(assemblyDir, folderName);
		}

		internal static string GetPathToFile(string folderName, string fileName)
		{
			return Path.Combine(assemblyDir, folderName, fileName);
		}
	}
	public class WConfig
	{
		public static ConfigFile ConfigFileUNSORTED = new ConfigFile(Paths.ConfigPath + "\\Wolfo.Wolfo_Skins.cfg", true);

		public static ConfigEntry<bool> cfgUnlockAll;

		public static ConfigEntry<bool> cfgRunAutoUnlocker;

		public static ConfigEntry<bool> RemoveSkinUnlocks;

		public static ConfigEntry<bool> cfgClientHost;

		public static ConfigEntry<bool> cfgLegacySkins;

		public static ConfigEntry<bool> cfgSilentRelockReunlock;

		public static ConfigEntry<bool> cfgClearAchievementView;

		public static ConfigEntry<bool> cfgDump;

		public static ConfigEntry<bool> cfgSortLate;

		public static ConfigEntry<bool> RemoveAllTrackers;

		public static void InitConfig()
		{
			RemoveAllTrackers = ConfigFileUNSORTED.Bind<bool>("Test", "Remove all unlock trackers", false, "Testing ");
			cfgUnlockAll = ConfigFileUNSORTED.Bind<bool>("Main", "Unlock all skins", false, "Makes skins not require unlocks.\n\nUnlocks and Achievements remain to be collected.");
			cfgSortLate = ConfigFileUNSORTED.Bind<bool>("Main", "Sort Skins to end of list", true, "Whether or not skins added by this mod should be after vanilla skins, or after all modded skins.\n\nThis is done by 'making' the mod sooner or later.");
			cfgRunAutoUnlocker = ConfigFileUNSORTED.Bind<bool>("Main", "Check for missing unlocks", true, "Checks for Eclipse 4+ and Simu Wave 50 completion.");
			RemoveSkinUnlocks = ConfigFileUNSORTED.Bind<bool>("Main", "Re-lock Everything", false, "Revoke all achievements related to this mod that you have.\n\nRemoves AltBoss/Simu tracker unlock so you need to reearn them or have the auto unlocker give them to you.\n\nDoes Not remove LunarScav/Voidling Tracker unlock.");
			cfgSilentRelockReunlock = ConfigFileUNSORTED.Bind<bool>("Other", "Silently ReLockReUnlock v3", true, "For whenever an update adds, changes or breaks something.");
			cfgClearAchievementView = ConfigFileUNSORTED.Bind<bool>("Main", "Clear Achievement Notifs", false, "Clears any remaining notifiations if pressed in game.");
			cfgDump = ConfigFileUNSORTED.Bind<bool>("Test", "cfgDump", false, "cfgDump");
			cfgRunAutoUnlocker.SettingChanged += CfgRunAutoUnlocker_SettingChanged;
			cfgClearAchievementView.SettingChanged += CfgClearAchievementView_SettingChanged;
			RemoveAllTrackers.SettingChanged += RemoveAllIdentifiers_SettingChanged;
			RemoveSkinUnlocks.SettingChanged += RemoveAllIdentifiers_SettingChanged;
			cfgUnlockAll.SettingChanged += CfgUnlockAll_SettingChanged;
			cfgDump.SettingChanged += CfgDump_SettingChanged;
		}

		private static void CfgDump_SettingChanged(object sender, EventArgs e)
		{
			if (cfgDump.Value)
			{
				H.DumpInfo();
			}
			cfgDump.Value = false;
		}

		private static void CfgUnlockAll_SettingChanged(object sender, EventArgs e)
		{
			Unlocks.AssignUnlockables();
		}

		private static void RemoveAllIdentifiers_SettingChanged(object sender, EventArgs e)
		{
			if (RemoveSkinUnlocks.Value || RemoveAllTrackers.Value)
			{
				Unlocks.LockEverything(null, RemoveAllTrackers.Value);
				Unlocks.UpdateTier2_ForAll(null);
			}
		}

		private static void CfgClearAchievementView_SettingChanged(object sender, EventArgs e)
		{
			LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
			if (firstLocalUser == null)
			{
				Debug.LogError((object)"NO LOCAL USER");
				return;
			}
			UserProfile userProfile = firstLocalUser.userProfile;
			if (userProfile == null)
			{
				Debug.LogError((object)"NO LOCAL USER");
				return;
			}
			userProfile.ClearAllAchievementNotifications();
			cfgClearAchievementView.Value = false;
		}

		private static void CfgRunAutoUnlocker_SettingChanged(object sender, EventArgs e)
		{
			if (cfgRunAutoUnlocker.Value)
			{
				Unlocks.CheckForPreviouslyEarned(null, clearView: false);
				Unlocks.UpdateTier2_ForAll(null);
			}
		}

		internal static void RiskConfig()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			ModSettingsManager.SetModIcon(Assets.Bundle.LoadAsset<Sprite>("Assets/Skins/icon.png"));
			ModSettingsManager.SetModDescription("A lot of manually created recolors of skins for vanilla and modded survivors");
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(cfgUnlockAll, false));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(cfgRunAutoUnlocker, false));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(RemoveSkinUnlocks, false));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(cfgClearAchievementView, false));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(RemoveAllTrackers, false));
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Wolfo.WolfoSkins", "WolfoSkins", "2.3.0")]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class WolfoSkins : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <DoNotBakeUntilCreated>d__4 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public orig_BakeAsync orig;

			public SkinDef self;

			public WolfoSkins <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DoNotBakeUntilCreated>d__4(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (self is SkinDefMakeOnApply && !(self as SkinDefMakeOnApply).created)
					{
						return false;
					}
					<>2__current = orig.Invoke(self);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <SkinDef_ApplyAsync>d__5 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public orig_ApplyAsync orig;

			public SkinDef self;

			public GameObject modelObject;

			public List<AssetReferenceT<Material>> loadedMaterials;

			public List<AssetReferenceT<Mesh>> loadedMeshes;

			public AsyncReferenceHandleUnloadType unloadType;

			public WolfoSkins <>4__this;

			private IEnumerator <temp>5__1;

			private object <obj2>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <SkinDef_ApplyAsync>d__5(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<temp>5__1 = null;
				<obj2>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (self is SkinDefMakeOnApply)
					{
						(self as SkinDefMakeOnApply).Override();
					}
					<temp>5__1 = orig.Invoke(self, modelObject, loadedMaterials, loadedMeshes, unloadType);
					break;
				case 1:
					<>1__state = -1;
					<obj2>5__2 = null;
					break;
				}
				if (<temp>5__1.MoveNext())
				{
					<obj2>5__2 = <temp>5__1.Current;
					<>2__current = <obj2>5__2;
					<>1__state = 1;
					return true;
				}
				if (Object.op_Implicit((Object)(object)modelObject.GetComponent<SkinDefAltColorTracker>()))
				{
					modelObject.GetComponent<SkinDefAltColorTracker>().UndoWolfoSkin();
				}
				if (self is SkinDefEnhanced)
				{
					(self as SkinDefEnhanced).ApplyExtras(modelObject);
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public void Awake()
		{
			WConfig.InitConfig();
			Assets.Init(((BaseUnityPlugin)this).Info);
			Unlocks.Hooks();
			if (!WConfig.cfgSortLate.Value)
			{
				Make();
				((ResourceAvailability)(ref BodyCatalog.availability)).CallWhenAvailable((Action)ModSupport);
			}
		}

		public void Start()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			if (WConfig.cfgSortLate.Value)
			{
				((ResourceAvailability)(ref BodyCatalog.availability)).CallWhenAvailable((Action)Make);
				((ResourceAvailability)(ref BodyCatalog.availability)).CallWhenAvailable((Action)ModSupport);
			}
			SkinDef.ApplyAsync += new hook_ApplyAsync(SkinDef_ApplyAsync);
		}

		public void Make()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			SkinsCommando.Start();
			SkinsHuntress.Start();
			SkinsBandit2.Start();
			SkinsToolbot_MULT.Start();
			SkinsEngineer.Start();
			SkinsMage_Artificer.Start();
			SkinsMerc.Start();
			SkinsTreebot_REX.Start();
			SkinsLoader.Start();
			SkinsCroco_Acrid.Start();
			SkinsCaptain.Start();
			SkinsRailGunner.Start();
			SkinsVoidFiend.Start();
			SkinsSeeker.Start();
			SkinsChef.Start();
			SkinsFalseSon.Start();
			SkinsOperator.Start();
			SkinsDrifter.Start();
			TemporaryOverlay.AddToCharacerModel += new hook_AddToCharacerModel(ReplaceTemporaryOverlayMaterial);
		}

		private void SkinCatalog_ValidateParams(orig_ValidateParams orig, SkinDef skinDef)
		{
			if (!(skinDef is SkinDefMakeOnApply))
			{
				orig.Invoke(skinDef);
			}
		}

		[IteratorStateMachine(typeof(<DoNotBakeUntilCreated>d__4))]
		private IEnumerator DoNotBakeUntilCreated(orig_BakeAsync orig, SkinDef self)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DoNotBakeUntilCreated>d__4(0)
			{
				<>4__this = this,
				orig = orig,
				self = self
			};
		}

		[IteratorStateMachine(typeof(<SkinDef_ApplyAsync>d__5))]
		private IEnumerator SkinDef_ApplyAsync(orig_ApplyAsync orig, SkinDef self, GameObject modelObject, List<AssetReferenceT<Material>> loadedMaterials, List<AssetReferenceT<Mesh>> loadedMeshes, AsyncReferenceHandleUnloadType unloadType)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <SkinDef_ApplyAsync>d__5(0)
			{
				<>4__this = this,
				orig = orig,
				self = self,
				modelObject = modelObject,
				loadedMaterials = loadedMaterials,
				loadedMeshes = loadedMeshes,
				unloadType = unloadType
			};
		}

		internal static void ModSupport()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			WConfig.RiskConfig();
			SkinsFalseSon.falseSonBodyIndex = Survivors.FalseSon.bodyPrefab.GetComponent<CharacterBody>().bodyIndex;
			GameObject val = BodyCatalog.FindBodyPrefab("HANDOverclockedBody");
			if ((Object)(object)val != (Object)null)
			{
				SkinsHand.ModdedSkin(val);
			}
			if (Chainloader.PluginInfos.ContainsKey("com.EnforcerGang.Enforcer"))
			{
				val = BodyCatalog.FindBodyPrefab("EnforcerBody");
				if ((Object)(object)val != (Object)null)
				{
					SkinsEnforcer.ModdedSkin(val);
				}
			}
			val = BodyCatalog.FindBodyPrefab("ChirrBody");
			if ((Object)(object)val != (Object)null)
			{
				SkinsChirr.ModdedSkin(val);
			}
			val = BodyCatalog.FindBodyPrefab("SniperClassicBody");
			if ((Object)(object)val != (Object)null)
			{
				SkinsSniper.ModdedSkin(val);
			}
			val = BodyCatalog.FindBodyPrefab("RobRavagerBody");
			if ((Object)(object)val != (Object)null)
			{
				SkinsRavager.ModdedSkin(val);
			}
			val = BodyCatalog.FindBodyPrefab("RocketSurvivorBody");
			if ((Object)(object)val != (Object)null)
			{
				SkinsRocket.ModdedSkin(val);
			}
			val = BodyCatalog.FindBodyPrefab("MinerBody");
			if ((Object)(object)val != (Object)null)
			{
				SkinsMiner.ModdedSkin(val);
			}
			val = BodyCatalog.FindBodyPrefab("ArsonistBody");
			if ((Object)(object)val != (Object)null)
			{
				SkinsArsonist.ModdedSkin(val);
			}
			val = BodyCatalog.FindBodyPrefab("TeslaTrooperBody");
			if ((Object)(object)val != (Object)null)
			{
				TeslaDesolatorColors.AddToTeslaTrooper(val);
			}
			val = BodyCatalog.FindBodyPrefab("TeslaTowerBody");
			if ((Object)(object)val != (Object)null)
			{
				TeslaDesolatorColors.AddToTeslaTower(val);
			}
			val = BodyCatalog.FindBodyPrefab("DesolatorBody");
			if ((Object)(object)val != (Object)null)
			{
				TeslaDesolatorColors.AddToDesolator(val);
			}
			val = BodyCatalog.FindBodyPrefab("RobPaladinBody");
			if ((Object)(object)val != (Object)null)
			{
				SkinsPaladin.ModdedSkin(val);
			}
		}

		private void ReplaceTemporaryOverlayMaterial(orig_AddToCharacerModel orig, TemporaryOverlay self, CharacterModel characterModel)
		{
			if (Object.op_Implicit((Object)(object)characterModel))
			{
				OverlayMaterialReplacer component = ((Component)characterModel).GetComponent<OverlayMaterialReplacer>();
				if (Object.op_Implicit((Object)(object)component) && (Object)(object)self.originalMaterial == (Object)(object)component.targetMaterial)
				{
					self.originalMaterial = component.replacementMaterial;
				}
			}
			orig.Invoke(self, characterModel);
		}
	}
	public class SkinDefEnhanced : SkinDefMakeOnApply
	{
		[Serializable]
		public struct MaterialChanger
		{
			public Material targetMaterial;

			public Material replacementMaterial;
		}

		[Serializable]
		public struct LightColorChanges
		{
			public string lightPath;

			public Color color;

			public Color color2;
		}

		public LightColorChanges[] lightColorsChanges = Array.Empty<LightColorChanges>();

		public ItemDisplayRule[] addGameObjects = Array.Empty<ItemDisplayRule>();

		public MaterialChanger changeMaterial;

		public string? disableThis = null;

		public void ApplyExtras(GameObject modelObject)
		{
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: 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_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			CharacterModel component = modelObject.GetComponent<CharacterModel>();
			SkinDefAltColorTracker skinDefAltColorTracker = default(SkinDefAltColorTracker);
			if (!modelObject.TryGetComponent<SkinDefAltColorTracker>(ref skinDefAltColorTracker))
			{
				skinDefAltColorTracker = modelObject.AddComponent<SkinDefAltColorTracker>();
			}
			if (Object.op_Implicit((Object)(object)changeMaterial.targetMaterial))
			{
				OverlayMaterialReplacer overlayMaterialReplacer = modelObject.AddComponent<OverlayMaterialReplacer>();
				overlayMaterialReplacer.targetMaterial = changeMaterial.targetMaterial;
				overlayMaterialReplacer.replacementMaterial = changeMaterial.replacementMaterial;
			}
			skinDefAltColorTracker.model = component;
			skinDefAltColorTracker.changedLights = new SkinDefAltColorTracker.ChangedLightColors[lightColorsChanges.Length];
			for (int i = 0; lightColorsChanges.Length > i; i++)
			{
				Transform val = modelObject.transform.Find(lightColorsChanges[i].lightPath);
				if (Object.op_Implicit((Object)(object)val))
				{
					Light component2 = ((Component)val).GetComponent<Light>();
					if (Object.op_Implicit((Object)(object)component2))
					{
						skinDefAltColorTracker.changedLights[i] = new SkinDefAltColorTracker.ChangedLightColors
						{
							light = component2,
							originalColor = component2.color
						};
						component2.color = lightColorsChanges[i].color;
						for (int j = 0; component.baseLightInfos.Length > j; j++)
						{
							if ((Object)(object)component.baseLightInfos[j].light == (Object)(object)component2)
							{
								component.baseLightInfos[j].defaultColor = lightColorsChanges[i].color;
							}
						}
					}
					TrailRenderer component3 = ((Component)val).GetComponent<TrailRenderer>();
					if (Object.op_Implicit((Object)(object)component3))
					{
						skinDefAltColorTracker.changedLights[i] = new SkinDefAltColorTracker.ChangedLightColors
						{
							trail = component3,
							originalColor = component3.startColor,
							trailEndColor = component3.endColor
						};
						component3.startColor = lightColorsChanges[i].color;
						component3.endColor = lightColorsChanges[i].color2;
					}
					if (!Object.op_Implicit((Object)(object)component2) && !Object.op_Implicit((Object)(object)component3))
					{
						Debug.LogWarning((object)(lightColorsChanges[i].lightPath + " : Not Light or Trail attached"));
					}
				}
				else
				{
					Debug.LogWarning((object)(lightColorsChanges[i].lightPath + " : Not Found"));
				}
			}
			skinDefAltColorTracker.addedObjects = (GameObject[])(object)new GameObject[addGameObjects.Length];
			for (int k = 0; addGameObjects.Length > k; k++)
			{
				Transform val2 = component.childLocator.FindChild(addGameObjects[k].childName);
				if (Object.op_Implicit((Object)(object)val2))
				{
					GameObject val3 = Object.Instantiate<GameObject>(addGameObjects[k].followerPrefab, val2);
					val3.transform.localPosition = addGameObjects[k].localPos;
					val3.transform.localEulerAngles = addGameObjects[k].localAngles;
					val3.transform.localScale = addGameObjects[k].localScale;
					skinDefAltColorTracker.addedObjects[k] = val3;
					ItemDisplay component4 = val3.GetComponent<ItemDisplay>();
					if (Object.op_Implicit((Object)(object)component4))
					{
						component.baseRendererInfos = ArrayUtils.Join<RendererInfo>(component.baseRendererInfos, component4.rendererInfos);
						component4.RefreshRenderers();
					}
				}
			}
			if (!Object.op_Implicit((Object)(object)Run.instance) && Object.op_Implicit((Object)(object)modelObject.transform.parent) && ((Object)modelObject).name.EndsWith("Engi"))
			{
				EngiDisplay(modelObject, skinDefAltColorTracker);
			}
			if (disableThis != null)
			{
				Transform val4 = modelObject.transform.Find(disableThis);
				if (Object.op_Implicit((Object)(object)val4))
				{
					((Component)val4).gameObject.SetActive(false);
					skinDefAltColorTracker.disabledTransform = val4;
				}
			}
		}

		public void EngiDisplay(GameObject modelObject, SkinDefAltColorTracker tracker)
		{
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			Transform val = modelObject.transform.parent.Find("mdlEngi/EngiArmature/ROOT/base/stomach/chest/upper_arm.l/lower_arm.l/hand.l/IKBoneStart/IKBoneMid/MineHolder");
			for (int i = 0; i < val.childCount; i++)
			{
				for (int j = 0; j < val.GetChild(i).childCount; j++)
				{
					((Component)val.GetChild(i).GetChild(j)).gameObject.SetActive(false);
				}
			}
			Material defaultMaterial = ((SkinDef)this).skinDefParams.minionSkinReplacements[0].minionSkin.skinDefParams.rendererInfos[0].defaultMaterial;
			GameObject val2 = Object.Instantiate<GameObject>(((SkinDef)this).skinDefParams.projectileGhostReplacements[1].projectileGhostReplacementPrefab, val.GetChild(0));
			GameObject val3 = Object.Instantiate<GameObject>(((SkinDef)this).skinDefParams.projectileGhostReplacements[2].projectileGhostReplacementPrefab, val.GetChild(1));
			val3.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
			tracker.addedObjects = (GameObject[])(object)new GameObject[2] { val2, val3 };
			((Renderer)((Component)modelObject.transform.parent.GetChild(0).GetChild(1)).GetComponent<SkinnedMeshRenderer>()).material = defaultMaterial;
		}
	}
	public class SkinDefAltColorTracker : MonoBehaviour
	{
		[Serializable]
		public struct ChangedLightColors
		{
			public Light light;

			public TrailRenderer trail;

			public Color originalColor;

			public Color trailEndColor;
		}

		public GameObject[] addedObjects;

		public ChangedLightColors[] changedLights;

		public CharacterModel model;

		public Transform disabledTransform;

		public void UndoWolfoSkin()
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)disabledTransform))
			{
				((Component)disabledTransform).gameObject.SetActive(true);
			}
			if (changedLights != null)
			{
				for (int i = 0; changedLights.Length > i; i++)
				{
					if (Object.op_Implicit((Object)(object)changedLights[i].light))
					{
						changedLights[i].light.color = changedLights[i].originalColor;
						for (int j = 0; model.baseLightInfos.Length > j; j++)
						{
							if ((Object)(object)model.baseLightInfos[j].light == (Object)(object)changedLights[i].light)
							{
								model.baseLightInfos[j].defaultColor = changedLights[i].originalColor;
							}
						}
					}
					if (Object.op_Implicit((Object)(object)changedLights[i].trail))
					{
						changedLights[i].trail.startColor = changedLights[i].originalColor;
						changedLights[i].trail.endColor = changedLights[i].trailEndColor;
					}
				}
			}
			if (addedObjects != null)
			{
				for (int k = 0; addedObjects.Length > k; k++)
				{
					Object.Destroy((Object)(object)addedObjects[k]);
				}
			}
			Object.DestroyImmediate((Object)(object)this);
		}
	}
	public class OverlayMaterialReplacer : MonoBehaviour
	{
		public Material targetMaterial;

		public Material replacementMaterial;
	}
	public class SkinDefMakeOnApply : SkinDef
	{
		public SkinDef baseSkin;

		public SkinDef[] minionSkins;

		public Action<SkinDefMakeOnApply> creationMethod;

		public int extraRenders;

		public bool cloneMesh;

		public bool created = false;

		public void Override()
		{
			if (created)
			{
				return;
			}
			if (creationMethod != null)
			{
				Object.Destroy((Object)(object)base.skinDefParams);
				H.CloneSkinDefReal((SkinDef)(object)this, baseSkin, cloneMesh, extraRenders);
				creationMethod(this);
				creationMethod = null;
			}
			base._runtimeSkin = null;
			for (int i = 0; base.skinDefParams.rendererInfos.Length > i; i++)
			{
				if ((Object)(object)base.skinDefParams.rendererInfos[i].defaultMaterial != (Object)null)
				{
					base.skinDefParams.rendererInfos[i].defaultMaterialAddress = null;
				}
			}
			created = true;
		}
	}
	public class _Skins
	{
	}
	public class Unlocks
	{
		internal static void Hooks()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			Achievements.Hooks();
			LogBookController.CanSelectAchievementEntry += new hook_CanSelectAchievementEntry(HideUnimplementedUnlocks);
			RoR2Content.CreateEclipseUnlockablesForSurvivor += new hook_CreateEclipseUnlockablesForSurvivor(AutogenerateUnlockableDefs);
			LocalUserManager.AddUser += new hook_AddUser(LocalUserManager_AddUser);
			UnlockableCatalog.GenerateUnlockableMetaData += new hook_GenerateUnlockableMetaData(UnlockableCatalog_GenerateUnlockableMetaData);
			((ResourceAvailability)(ref GameModeCatalog.availability)).CallWhenAvailable((Action)AutogenerateTokens);
			UserProfile.RevokeUnlockable += new hook_RevokeUnlockable(RevokeUnlock_ActualSafteyCheck);
		}

		private static void LocalUserManager_AddUser(orig_AddUser orig, Player inputPlayer, UserProfile userProfile)
		{
			orig.Invoke(inputPlayer, userProfile);
			if (WConfig.cfgSilentRelockReunlock.Value)
			{
				LockEverything(userProfile, trueAll: false);
				CheckForPreviouslyEarned(userProfile, clearView: true);
			}
			else if (WConfig.RemoveSkinUnlocks.Value)
			{
				LockEverything(userProfile, trueAll: false);
			}
			else if (WConfig.cfgRunAutoUnlocker.Value)
			{
				CheckForPreviouslyEarned(userProfile, clearView: true);
			}
			UpdateTier2_ForAll(userProfile);
		}

		private static void RevokeUnlock_ActualSafteyCheck(orig_RevokeUnlockable orig, UserProfile self, UnlockableDef unlockableDef)
		{
			if (Object.op_Implicit((Object)(object)unlockableDef))
			{
				orig.Invoke(self, unlockableDef);
			}
		}

		private static void UnlockableCatalog_GenerateUnlockableMetaData(orig_GenerateUnlockableMetaData orig, UnlockableDef[] unlockableDefs)
		{
			try
			{
				AssignUnlockables();
			}
			catch (Exception ex)
			{
				Debug.LogError((object)ex);
			}
			orig.Invoke(unlockableDefs);
		}

		public static void CheckForPreviouslyEarned(UserProfile userProfile, bool clearView)
		{
			if (userProfile == null)
			{
				LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
				userProfile = firstLocalUser.userProfile;
			}
			if (userProfile == null)
			{
				Debug.LogWarning((object)"NO USER PROFILE");
				return;
			}
			WConfig.cfgRunAutoUnlocker.Value = false;
			Debug.LogWarning((object)("Checking for previously earned achievements " + userProfile.name));
			StatSheet statSheet = userProfile.statSheet;
			CheckOld(userProfile);
			SurvivorDef[] survivorDefs = SurvivorCatalog.survivorDefs;
			foreach (SurvivorDef val in survivorDefs)
			{
				string text = val.cachedName.ToUpperInvariant();
				int num = 0;
				if (userProfile.HasAchievement("CLEAR_SIMU_" + text))
				{
					num++;
				}
				else
				{
					string name = ((Object)val.bodyPrefab).name;
					ulong statValueULong = statSheet.GetStatValueULong(PerBodyStatDef.highestInfiniteTowerWaveReachedHard, name);
					ulong statValueULong2 = statSheet.GetStatValueULong(PerBodyStatDef.highestInfiniteTowerWaveReachedNormal, name);
					ulong statValueULong3 = statSheet.GetStatValueULong(PerBodyStatDef.highestInfiniteTowerWaveReachedEasy, name);
					if (statValueULong >= 50 || statValueULong2 >= 50 || statValueULong3 >= 50)
					{
						num++;
						userProfile.AddAchievement("CLEAR_SIMU_" + text, false);
					}
				}
				if (userProfile.HasAchievement("CLEAR_ECLIPSE_" + text))
				{
					num++;
				}
				else if (userProfile.HasUnlockable("Eclipse." + val.cachedName + ".5"))
				{
					num++;
					userProfile.AddAchievement("CLEAR_ECLIPSE_" + text, false);
				}
				if (userProfile.HasAchievement("CLEAR_LUNARSCAV_" + text))
				{
					num++;
				}
				else if (userProfile.HasUnlockable("Skins." + val.cachedName + ".Wolfo.LunarScav"))
				{
					num++;
					userProfile.AddAchievement("CLEAR_LUNARSCAV_" + text, false);
				}
				if (userProfile.HasAchievement("CLEAR_VOIDLING_" + text))
				{
					num++;
				}
				else if (userProfile.HasUnlockable("Skins." + val.cachedName + ".Wolfo.Voidling"))
				{
					num++;
					userProfile.AddAchievement("CLEAR_VOIDLING_" + text, false);
				}
				if (num > 0)
				{
					UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef("Skins." + val.cachedName + ".Wolfo.First");
					if (Object.op_Implicit((Object)(object)unlockableDef))
					{
						userProfile.GrantUnlockable(unlockableDef);
					}
					if (!userProfile.HasAchievement("CLEAR_ANY_" + text))
					{
						userProfile.AddAchievement("CLEAR_ANY_" + text, true);
					}
				}
				if (num > 1)
				{
					UnlockableDef unlockableDef2 = UnlockableCatalog.GetUnlockableDef("Skins." + val.cachedName + ".Wolfo.Both");
					if (Object.op_Implicit((Object)(object)unlockableDef2))
					{
						userProfile.GrantUnlockable(unlockableDef2);
					}
					if (!userProfile.HasAchievement("CLEAR_BOTH_" + text))
					{
						userProfile.AddAchievement("CLEAR_BOTH_" + text, true);
					}
				}
				if (!clearView)
				{
					Debug.Log((object)(val.cachedName + "\n hasSimulacrum | " + userProfile.HasAchievement("CLEAR_SIMU_" + text) + "\n has Eclipse 4 | " + userProfile.HasAchievement("CLEAR_ECLIPSE_" + text) + "\n has LunarScav | " + userProfile.HasAchievement("CLEAR_LUNARSCAV_" + text) + "\n has  Voidling | " + userProfile.HasAchievement("CLEAR_VOIDLING_" + text)));
				}
			}
			if (clearView)
			{
				userProfile.ClearAllAchievementNotifications();
			}
			WConfig.RemoveSkinUnlocks.Value = false;
			WConfig.RemoveAllTrackers.Value = false;
			WConfig.cfgSilentRelockReunlock.Value = false;
			userProfile.RequestEventualSave();
		}

		public static void LockEverything(UserProfile userProfile, bool trueAll)
		{
			if (userProfile == null)
			{
				LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
				userProfile = firstLocalUser.userProfile;
			}
			Debug.Log((object)userProfile);
			if (userProfile == null)
			{
				Debug.LogWarning((object)"NO USER PROFILE");
				return;
			}
			Debug.LogWarning((object)("Removing all skin achievements and main unlockables " + userProfile.name));
			SurvivorDef[] survivorDefs = SurvivorCatalog.survivorDefs;
			foreach (SurvivorDef val in survivorDefs)
			{
				string text = val.cachedName.ToUpperInvariant();
				UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef("Skins." + val.cachedName + ".Wolfo.First");
				UnlockableDef unlockableDef2 = UnlockableCatalog.GetUnlockableDef("Skins." + val.cachedName + ".Wolfo.Both");
				userProfile.RevokeUnlockable(unlockableDef);
				userProfile.RevokeUnlockable(unlockableDef2);
				userProfile.RevokeAchievement("CLEAR_ANY_" + text);
				userProfile.RevokeAchievement("CLEAR_BOTH_" + text);
				if (trueAll)
				{
					Debug.Log((object)(val.cachedName + "\n hadSimulacrum | " + userProfile.HasAchievement("CLEAR_SIMU_" + text) + "\n had Eclipse 4 | " + userProfile.HasAchievement("CLEAR_ECLIPSE_" + text) + "\n had LunarScav | " + userProfile.HasAchievement("CLEAR_LUNARSCAV_" + text) + "\n had  Voidling | " + userProfile.HasAchievement("CLEAR_VOIDLING_" + text)));
					userProfile.RevokeAchievement("CLEAR_SIMU_" + text);
					userProfile.RevokeAchievement("CLEAR_ECLIPSE_" + text);
					userProfile.RevokeAchievement("CLEAR_VOIDLING_" + text);
					userProfile.RevokeAchievement("CLEAR_LUNARSCAV_" + text);
				}
			}
			WConfig.RemoveSkinUnlocks.Value = false;
			WConfig.RemoveAllTrackers.Value = false;
			WConfig.cfgSilentRelockReunlock.Value = false;
			userProfile.RequestEventualSave();
		}

		public static void CheckOld(UserProfile userProfile)
		{
			if (userProfile.HasAchievement("SIMU_SKIN_BANDIT") && !userProfile.HasAchievement("CLEAR_SIMU_BANDIT2"))
			{
				Debug.Log((object)"Has manual Legacy : SIMU_SKIN_BANDIT2");
				if (!userProfile.HasAchievement("CLEAR_ALTBOSS_BANDIT2"))
				{
					userProfile.AddAchievement("CLEAR_ALTBOSS_BANDIT2", false);
				}
			}
			if (userProfile.HasAchievement("SIMU_SKIN_ENGINEER") && !userProfile.HasAchievement("CLEAR_SIMU_ENGI"))
			{
				Debug.Log((object)"Has manual Legacy : SIMU_SKIN_ENGINEER");
				if (!userProfile.HasAchievement("CLEAR_ALTBOSS_ENGI"))
				{
					userProfile.AddAchievement("CLEAR_ALTBOSS_ENGI", false);
				}
			}
			if (userProfile.HasAchievement("SIMU_SKIN_Captain") && !userProfile.HasAchievement("CLEAR_SIMU_CAPTAIN"))
			{
				Debug.Log((object)"Has manual Legacy : SIMU_SKIN_Captain");
				if (!userProfile.HasAchievement("CLEAR_ALTBOSS_CAPTAIN"))
				{
					userProfile.AddAchievement("CLEAR_ALTBOSS_CAPTAIN", false);
				}
			}
			if (userProfile.HasAchievement("SIMU_SKIN_HAND") && !userProfile.HasAchievement("CLEAR_SIMU_HANDOVERCLOCKED"))
			{
				Debug.Log((object)"Has manual Legacy : SIMU_SKIN_HAND");
				if (!userProfile.HasAchievement("CLEAR_ALTBOSS_HANDOVERCLOCKED"))
				{
					userProfile.AddAchievement("CLEAR_ALTBOSS_HANDOVERCLOCKED", false);
				}
			}
			if (userProfile.HasAchievement("SIMU_SKIN_SNIPER") && !userProfile.HasAchievement("CLEAR_SIMU_SNIPERCLASSIC"))
			{
				Debug.Log((object)"Has manual Legacy : SIMU_SKIN_SNIPER");
				if (!userProfile.HasAchievement("CLEAR_ALTBOSS_SNIPERCLASSIC"))
				{
					userProfile.AddAchievement("CLEAR_ALTBOSS_SNIPERCLASSIC", false);
				}
			}
			if (userProfile.HasAchievement("SIMU_SKIN_ROCKET") && !userProfile.HasAchievement("CLEAR_SIMU_ROCKETSURVIVOR"))
			{
				Debug.Log((object)"Has manual Legacy : SIMU_SKIN_ROCKET");
				if (!userProfile.HasAchievement("CLEAR_ALTBOSS_ROCKETSURVIVOR"))
				{
					userProfile.AddAchievement("CLEAR_ALTBOSS_ROCKETSURVIVOR", false);
				}
			}
			if (userProfile.HasAchievement("SIMU_SKIN_PALADIN") && !userProfile.HasAchievement("CLEAR_SIMU_ROBPALADIN"))
			{
				Debug.Log((object)"Has manual Legacy : SIMU_SKIN_PALADIN");
				if (!userProfile.HasAchievement("CLEAR_ALTBOSS_ROBPALADIN"))
				{
					userProfile.AddAchievement("CLEAR_ALTBOSS_ROBPALADIN", false);
				}
			}
			if (userProfile.HasAchievement("SIMU_SKIN_RAVAGER") && !userProfile.HasAchievement("CLEAR_SIMU_ROB_RAVAGER_BODY_NAME"))
			{
				Debug.Log((object)"Has manual Legacy : SIMU_SKIN_RAVAGER");
				if (!userProfile.HasAchievement("CLEAR_ALTBOSS_ROB_RAVAGER_BODY_NAME"))
				{
					userProfile.AddAchievement("CLEAR_ALTBOSS_ROB_RAVAGER_BODY_NAME", false);
				}
			}
			if (userProfile.HasAchievement("SIMU_SKIN_ARSONIST") && !userProfile.HasAchievement("CLEAR_SIMU_POPCORN_ARSONIST_BODY_"))
			{
				Debug.Log((object)"Has manual Legacy : SIMU_SKIN_ARSONIST");
				if (!userProfile.HasAchievement("CLEAR_ALTBOSS_POPCORN_ARSONIST_BODY_"))
				{
					userProfile.AddAchievement("CLEAR_ALTBOSS_POPCORN_ARSONIST_BODY_", false);
				}
			}
			if (userProfile.HasAchievement("SIMU_SKIN_EXECUTIONER") && !userProfile.HasAchievement("CLEAR_SIMU_SURVIVOREXECUTIONER2"))
			{
				Debug.Log((object)"Has manual Legacy : SIMU_SKIN_EXECUTIONER");
				if (!userProfile.HasAchievement("CLEAR_ALTBOSS_SURVIVOREXECUTIONER2"))
				{
					userProfile.AddAchievement("CLEAR_ALTBOSS_SURVIVOREXECUTIONER2", false);
				}
			}
			if (userProfile.HasAchievement("SIMU_SKIN_CHEF") && !userProfile.HasAchievement("CLEAR_SIMU_GNOMECHEF"))
			{
				Debug.Log((object)"Has manual Legacy : SIMU_SKIN_CHEF");
				if (!userProfile.HasAchievement("CLEAR_ALTBOSS_GNOMECHEF"))
				{
					userProfile.AddAchievement("CLEAR_ALTBOSS_GNOMECHEF", false);
				}
			}
			if (userProfile.HasAchievement("SIMU_SKIN_NEM_ENFORCER") && !userProfile.HasAchievement("CLEAR_SIMU_NEMESISENFORCER"))
			{
				Debug.Log((object)"Has manual Legacy : SIMU_SKIN_NEM_ENFORCER");
				if (!userProfile.HasAchievement("CLEAR_ALTBOSS_NEMESISENFORCER"))
				{
					userProfile.AddAchievement("CLEAR_ALTBOSS_NEMESISENFORCER", false);
				}
			}
			if (userProfile.HasAchievement("SIMU_SKIN_PILOT") && !userProfile.HasAchievement("CLEAR_SIMU_MOFFEINPILOT"))
			{
				Debug.Log((object)"Has manual Legacy : SIMU_SKIN_PILOT");
				if (!userProfile.HasAchievement("CLEAR_ALTBOSS_MOFFEINPILOT"))
				{
					userProfile.AddAchievement("CLEAR_ALTBOSS_MOFFEINPILOT", false);
				}
			}
		}

		public static void UpdateTier2Objective_Specific(UserProfile userProfile, SurvivorDef survivorDef, int token)
		{
			string text = survivorDef.cachedName.ToUpperInvariant();
			AchievementDef achievementDef = AchievementManager.GetAchievementDef("CLEAR_BOTH_" + text);
			if (achievementDef != null)
			{
				achievementDef.descriptionToken = string.Format(Language.GetString("ACHIEVEMENT_CLEAR_TIER2_" + token), Language.GetString(survivorDef.displayNameToken));
			}
		}

		public static void UpdateTier2_ForAll(UserProfile userProfile)
		{
			Debug.Log((object)"UpdateTier2_ForAll");
			if (userProfile == null)
			{
				LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
				userProfile = firstLocalUser.userProfile;
			}
			if (userProfile == null)
			{
				Debug.LogError((object)"NO LOCAL USER");
				return;
			}
			SurvivorDef[] survivorDefs = SurvivorCatalog.survivorDefs;
			foreach (SurvivorDef val in survivorDefs)
			{
				string text = val.cachedName.ToUpperInvariant();
				string @string = Language.GetString(val.displayNameToken);
				AchievementDef achievementDef = AchievementManager.GetAchievementDef("CLEAR_BOTH_" + text);
				if (achievementDef == null)
				{
					continue;
				}
				if (userProfile.HasAchievement(achievementDef.identifier))
				{
					achievementDef.descriptionToken = string.Format(Language.GetString("ACHIEVEMENT_CLEAR_TIER2_0"), @string);
					continue;
				}
				int num = 0;
				int num2 = 0;
				if (userProfile.HasAchievement("CLEAR_LUNARSCAV_" + text))
				{
					num2++;
					num = 1;
				}
				if (userProfile.HasAchievement("CLEAR_VOIDLING_" + text))
				{
					num2++;
					num = 2;
				}
				if (userProfile.HasAchievement("CLEAR_SIMU_" + text))
				{
					num2++;
					num = 3;
				}
				if (userProfile.HasAchievement("CLEAR_ECLIPSE_" + text))
				{
					num2++;
					num = 4;
				}
				if (num2 >= 2)
				{
					achievementDef.descriptionToken = string.Format(Language.GetString("ACHIEVEMENT_CLEAR_TIER2_0"), @string);
				}
				else
				{
					achievementDef.descriptionToken = string.Format(Language.GetString("ACHIEVEMENT_CLEAR_TIER2_" + num), @string);
				}
			}
		}

		public static void AutogenerateTokens()
		{
			Debug.Log((object)"AutogenerateTokens");
			SurvivorDef[] survivorDefs = SurvivorCatalog.survivorDefs;
			foreach (SurvivorDef val in survivorDefs)
			{
				string arg = val.cachedName.ToUpperInvariant();
				string text = $"ACHIEVEMENT_CLEAR_ANY_{arg}_NAME";
				string text2 = $"ACHIEVEMENT_CLEAR_BOTH_{arg}_NAME";
				string text3 = $"ACHIEVEMENT_CLEAR_ANY_{arg}_DESCRIPTION";
				string @string = Language.GetString(val.displayNameToken);
				string text4 = string.Format(Language.GetString("ACHIEVEMENT_CLEAR_ANY_NAME"), @string);
				string text5 = string.Format(Language.GetString("ACHIEVEMENT_CLEAR_BOTH_NAME"), @string);
				string text6 = string.Format(Language.GetString("ACHIEVEMENT_CLEAR_TIER1"), @string);
				LanguageAPI.Add(text, text4);
				LanguageAPI.Add(text2, text5);
				LanguageAPI.Add(text3, text6);
			}
		}

		public static UnlockableDef[] AutogenerateUnlockableDefs(orig_CreateEclipseUnlockablesForSurvivor orig, SurvivorDef survivorDef, int minEclipseLevel, int maxEclipseLevel)
		{
			UnlockableDef[] array = orig.Invoke(survivorDef, minEclipseLevel, maxEclipseLevel);
			string arg = survivorDef.cachedName.ToUpperInvariant();
			string nameToken = $"ACHIEVEMENT_CLEAR_ANY_{arg}_NAME";
			string nameToken2 = $"ACHIEVEMENT_CLEAR_BOTH_{arg}_NAME";
			UnlockableDef val = ScriptableObject.CreateInstance<UnlockableDef>();
			val.cachedName = "Skins." + survivorDef.cachedName + ".Wolfo.First";
			val.hidden = false;
			val.nameToken = nameToken;
			UnlockableDef val2 = ScriptableObject.CreateInstance<UnlockableDef>();
			val2.cachedName = "Skins." + survivorDef.cachedName + ".Wolfo.Both";
			val2.hidden = false;
			val2.nameToken = nameToken2;
			UnlockableDef val3 = ScriptableObject.CreateInstance<UnlockableDef>();
			val3.cachedName = "Skins." + survivorDef.cachedName + ".Wolfo.Simu";
			val3.hidden = true;
			UnlockableDef val4 = ScriptableObject.CreateInstance<UnlockableDef>();
			val4.cachedName = "Skins." + survivorDef.cachedName + ".Wolfo.LunarScav";
			val4.hidden = true;
			UnlockableDef val5 = ScriptableObject.CreateInstance<UnlockableDef>();
			val5.cachedName = "Skins." + survivorDef.cachedName + ".Wolfo.Voidling";
			val5.hidden = true;
			UnlockableDef[] array2 = (UnlockableDef[])(object)new UnlockableDef[5] { val, val2, val3, val4, val5 };
			return ArrayUtils.Join<UnlockableDef>(array, array2);
		}

		public static void AssignUnlockables()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Invalid comparison between Unknown and I4
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			if (SkinCatalog.skinsByBody.Length == 0)
			{
				return;
			}
			ExpansionDef requiredExpansion = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC2/Common/DLC2.asset").WaitForCompletion();
			Debug.Log((object)"AssignUnlockables");
			bool value = WConfig.cfgUnlockAll.Value;
			for (int i = 0; i < SurvivorCatalog.survivorDefs.Length; i++)
			{
				BodyIndex bodyIndexFromSurvivorIndex = SurvivorCatalog.GetBodyIndexFromSurvivorIndex(SurvivorCatalog.survivorDefs[i].survivorIndex);
				if ((int)bodyIndexFromSurvivorIndex == -1)
				{
					continue;
				}
				string cachedName = SurvivorCatalog.survivorDefs[i].cachedName;
				SkinDef[] array = SkinCatalog.skinsByBody[bodyIndexFromSurvivorIndex];
				for (int j = 2; j < array.Length; j++)
				{
					if (!(array[j] is SkinDefMakeOnApply))
					{
						continue;
					}
					UnlockableDef val = null;
					if (((Object)array[j]).name.EndsWith("_1"))
					{
						val = UnlockableCatalog.GetUnlockableDef("Skins." + cachedName + ".Wolfo.First");
					}
					else if (((Object)array[j]).name.EndsWith("_DLC2"))
					{
						val = UnlockableCatalog.GetUnlockableDef("Skins." + cachedName + ".Wolfo.Both");
						if (Object.op_Implicit((Object)(object)val))
						{
							val.requiredExpansion = requiredExpansion;
						}
					}
					if (Object.op_Implicit((Object)(object)val))
					{
						if (!Object.op_Implicit((Object)(object)val.achievementIcon))
						{
							val.achievementIcon = array[j].icon;
						}
						if (value)
						{
							array[j].unlockableDef = null;
						}
						else
						{
							array[j].unlockableDef = val;
						}
					}
				}
			}
			UnlockableDef val2 = UnlockableCatalog.GetUnlockableDef("Skins.Merc.Wolfo.First");
			UnlockableDef val3 = UnlockableCatalog.GetUnlockableDef("Skins.Merc.Wolfo.Both");
			UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef("Skins.Commando.Wolfo.First");
			UnlockableDef val4 = UnlockableCatalog.GetUnlockableDef("Skins.TeslaTrooper.Wolfo.First");
			UnlockableDef val5 = UnlockableCatalog.GetUnlockableDef("Skins.Desolator.Wolfo.First");
			if (!Object.op_Implicit((Object)(object)val2))
			{
				Debug.Log((object)"Failed to generate Merc Unlock, How?");
				return;
			}
			val3.achievementIcon = SkinsMerc.green_SKIN.icon;
			if (Object.op_Implicit((Object)(object)val4))
			{
				val4.achievementIcon = H.GetIcon("mod/Tesla/colorsTesla");
			}
			if (Object.op_Implicit((Object)(object)val5))
			{
				val5.achievementIcon = H.GetIcon("mod/Tesla/colorsDesolator");
			}
			if (value)
			{
				val2 = null;
				val3 = null;
				unlockableDef = null;
				val4 = null;
				val5 = null;
			}
			SkinsMerc.red_SKIN.unlockableDef = val2;
			SkinsMerc.green_SKIN.unlockableDef = val3;
			Addressables.LoadAssetAsync<SkinDef>((object)"RoR2/DLC1/skinCommandoMarine.asset").WaitForCompletion().unlockableDef = unlockableDef;
			if (Object.op_Implicit((Object)(object)val4))
			{
				for (int k = 8; k < TeslaDesolatorColors.teslaColors.variants.Length; k++)
				{
					TeslaDesolatorColors.teslaColors.variants[k].unlockableDef = val4;
				}
			}
			if (Object.op_Implicit((Object)(object)val5))
			{
				for (int l = 8; l < TeslaDesolatorColors.desolatorColors.variants.Length; l++)
				{
					TeslaDesolatorColors.desolatorColors.variants[l].unlockableDef = val5;
				}
			}
			GC.Collect();
		}

		public static bool HideUnimplementedUnlocks(orig_CanSelectAchievementEntry orig, AchievementDef achievementDef, Dictionary<ExpansionDef, bool> expansionAvailability)
		{
			UnlockableDef unlockableDef = UnlockableCatalog.GetUnlockableDef(achievementDef.unlockableRewardIdentifier);
			if (Object.op_Implicit((Object)(object)unlockableDef) && unlockableDef.hidden)
			{
				Debug.Log((object)("Hiding : " + achievementDef.identifier));
				return false;
			}
			if (!Object.op_Implicit((Object)(object)unlockableDef))
			{
				Debug.Log((object)("Hiding : " + achievementDef.identifier));
				return false;
			}
			return orig.Invoke(achievementDef, expansionAvailability);
		}
	}
	public struct SkinInfo
	{
		public SkinDef original;

		public SkinDef[] minionSkins;

		public Sprite icon;

		public string nameToken;

		public string name;

		public bool enhancedSkin;

		public bool cloneMesh;

		public int extraRenders;
	}
	internal static class H
	{
		public static AsyncReferenceHandleUnloadType unloadType = (AsyncReferenceHandleUnloadType)3;

		public static SkinDefMakeOnApply CreateEmptySkinForLaterCreation(SkinInfo skinInfo, Action<SkinDefMakeOnApply> method)
		{
			SkinDefMakeOnApply skinDefMakeOnApply = null;
			skinDefMakeOnApply = ((!skinInfo.enhancedSkin) ? ScriptableObject.CreateInstance<SkinDefMakeOnApply>() : ScriptableObject.CreateInstance<SkinDefEnhanced>());
			((Object)skinDefMakeOnApply).name = skinInfo.name;
			((SkinDef)skinDefMakeOnApply).nameToken = skinInfo.nameToken;
			((SkinDef)skinDefMakeOnApply).icon = skinInfo.icon;
			skinDefMakeOnApply.cloneMesh = skinInfo.cloneMesh;
			skinDefMakeOnApply.extraRenders = skinInfo.extraRenders;
			skinDefMakeOnApply.creationMethod = method;
			skinDefMakeOnApply.baseSkin = skinInfo.original;
			skinDefMakeOnApply.minionSkins = skinInfo.minionSkins;
			((SkinDef)skinDefMakeOnApply).rootObject = skinInfo.original.rootObject;
			((SkinDef)skinDefMakeOnApply).skinDefParams = ScriptableObject.CreateInstance<SkinDefParams>();
			AddSkinToCharacter((SkinDef)(object)skinDefMakeOnApply);
			return skinDefMakeOnApply;
		}

		public static SkinDef CreateNewSkin(SkinInfo skinInfo)
		{
			if (!Object.op_Implicit((Object)(object)skinInfo.original))
			{
				Debug.LogWarning((object)("Forgot to set original SkinDef for " + skinInfo.name));
			}
			SkinDef val = null;
			val = (SkinDef)(object)((!skinInfo.enhancedSkin) ? ScriptableObject.CreateInstance<SkinDefMakeOnApply>() : ScriptableObject.CreateInstance<SkinDefEnhanced>());
			CloneSkinDefReal(val, skinInfo.original, skinInfo.cloneMesh, skinInfo.extraRenders);
			AddSkinToCharacter(val);
			((Object)val).name = skinInfo.name;
			val.nameToken = skinInfo.nameToken;
			val.icon = skinInfo.icon;
			return val;
		}

		public static SkinDefEnhanced CreateNewSkinW(SkinInfo skinInfo)
		{
			skinInfo.enhancedSkin = true;
			return CreateNewSkin(skinInfo) as SkinDefEnhanced;
		}

		public static RendererInfo[] CreateNewSkinR(SkinInfo skinInfo)
		{
			return CreateNewSkin(skinInfo).skinDefParams.rendererInfos;
		}

		private static void AddSkinToCharacter(SkinDef skin)
		{
			ModelSkinController component = skin.rootObject.GetComponent<ModelSkinController>();
			ArrayUtils.ArrayAppend<SkinDef>(ref component.skins, ref skin);
		}

		public static void AddSkinToObject(GameObject body, SkinDef skin)
		{
			ModelSkinController component = ((Component)body.transform.GetChild(0).GetChild(0)).GetComponent<ModelSkinController>();
			ArrayUtils.ArrayAppend<SkinDef>(ref component.skins, ref skin);
		}

		public static void AddSkinToCharacterPublic(SkinDef skin)
		{
			ModelSkinController component = skin.rootObject.GetComponent<ModelSkinController>();
			ArrayUtils.ArrayAppend<SkinDef>(ref component.skins, ref skin);
		}

		public static Material CloneMat(ref RendererInfo[] rendererInfos, int num, bool unset = false)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			Material val = null;
			AssetReferenceT<Material> defaultMaterialAddress = rendererInfos[num].defaultMaterialAddress;
			if (defaultMaterialAddress != null && ((AssetReference)defaultMaterialAddress).RuntimeKeyIsValid())
			{
				val = Object.Instantiate<Material>(AssetAsyncReferenceManager<Material>.LoadAsset(defaultMaterialAddress, unloadType).WaitForCompletion());
			}
			else if ((Object)(object)rendererInfos[num].defaultMaterial != (Object)null)
			{
				val = Object.Instantiate<Material>(rendererInfos[num].defaultMaterial);
			}
			if (unset)
			{
				rendererInfos[num].defaultMaterialAddress = null;
			}
			rendererInfos[num].defaultMaterial = val;
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogWarning((object)("Could not find Material " + ((object)rendererInfos[num].renderer)?.ToString() + "|" + num));
			}
			return val;
		}

		public static Material CloneFromOriginal(SkinDefParams skinDefParams, int num)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			Material result = null;
			RendererInfo val = skinDefParams.rendererInfos[num];
			if ((Object)(object)val.defaultMaterial != (Object)null)
			{
				result = Object.Instantiate<Material>(val.defaultMaterial);
			}
			else if (val.defaultMaterialAddress != null && ((AssetReference)val.defaultMaterialAddress).RuntimeKeyIsValid())
			{
				result = Object.Instantiate<Material>(AssetAsyncReferenceManager<Material>.LoadAsset(val.defaultMaterialAddress, unloadType).WaitForCompletion());
			}
			return result;
		}

		public static Sprite GetIcon(string name)
		{
			return Assets.Bundle.LoadAsset<Sprite>("Assets/Skins/Icons/" + name + ".png");
		}

		public static MeshReplacement[] CloneMesh(SkinDefParams original)
		{
			return ArrayUtils.Clone<MeshReplacement>(original.meshReplacements);
		}

		public static MinionSkinReplacement[] CloneMinion(SkinDefParams original)
		{
			return ArrayUtils.Clone<MinionSkinReplacement>(original.minionSkinReplacements);
		}

		public static SkinDef CloneSkinDefReal(SkinDef newSkinDef, SkinDef original, bool newMesh, int extraRenderers)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//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)
			SkinDefParams val = null;
			if (((AssetReference)original.skinDefParamsAddress).RuntimeKeyIsValid())
			{
				val = AssetAsyncReferenceManager<SkinDefParams>.LoadAsset(original.skinDefParamsAddress, unloadType).WaitForCompletion();
			}
			else if (Object.op_Implicit((Object)(object)original.skinDefParams))
			{
				val = original.skinDefParams;
			}
			if ((Object)(object)val == (Object)null)
			{
				SkinCatalog.ValidateParams(original);
				val = original.skinDefParams;
			}
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogWarning((object)("Cannot find SkinDefParams for " + (object)original));
			}
			SkinDefParams val2 = (newSkinDef.skinDefParams = Object.Instantiate<SkinDefParams>(val));
			newSkinDef.skinDefParamsAddress = new AssetReferenceT<SkinDefParams>("");
			if (newSkinDef.baseSkins != null && newSkinDef.baseSkins.Length != 0)
			{
				newSkinDef.baseSkins = (SkinDef[])(object)new SkinDef[2]
				{
					newSkinDef.baseSkins[0],
					original
				};
			}
			else
			{
				newSkinDef.baseSkins = (SkinDef[])(object)new SkinDef[1] { original };
			}
			newSkinDef.rootObject = original.rootObject;
			val2.rendererInfos = ArrayUtils.Clone<RendererInfo>(val.rendererInfos);
			if (extraRenderers != 0)
			{
				Array.Resize(ref val2.rendererInfos, val2.rendererInfos.Length + extraRenderers);
			}
			if (newMesh)
			{
				val2.meshReplacements = ArrayUtils.Clone<MeshReplacement>(val.meshReplacements);
			}
			else
			{
				val2.meshReplacements = val.meshReplacements;
			}
			val2.projectileGhostReplacements = val.projectileGhostReplacements;
			val2.gameObjectActivations = val.gameObjectActivations;
			return newSkinDef;
		}

		public static void DumpInfo()
		{
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < SurvivorCatalog.survivorIndexToBodyIndex.Length; i++)
			{
				SkinDef[] array = SkinCatalog.skinsByBody[(int)SurvivorCatalog.survivorIndexToBodyIndex[i]];
				Debug.Log((object)BodyCatalog.GetBodyPrefab(SurvivorCatalog.survivorIndexToBodyIndex[i]));
				foreach (SkinDef val in array)
				{
					Debug.Log((object)val);
					List<Material> list = new List<Material>();
					string text = "____________________\n" + ((Object)val).name;
					string text2 = "____________________\n";
					TextureWrapMode wrapMode;
					for (int k = 0; k < val.rendererInfos.Length; k++)
					{
						Material defaultMaterial = val.rendererInfos[k].defaultMaterial;
						if ((Object)(object)defaultMaterial == (Object)null)
						{
							continue;
						}
						text = text + "\n[" + k + "] " + ((Object)defaultMaterial).name + " | " + ((Object)val.rendererInfos[k].renderer).name;
						if (!list.Contains(defaultMaterial))
						{
							list.Add(defaultMaterial);
							if ((Object)(object)defaultMaterial.mainTexture != (Object)null)
							{
								string text3 = text2;
								string name = ((Object)defaultMaterial.mainTexture).name;
								wrapMode = defaultMaterial.mainTexture.wrapMode;
								text2 = text3 + name + " | " + ((object)(TextureWrapMode)(ref wrapMode)).ToString();
							}
							text2 += "\n";
						}
					}
					SkinDefParams val2 = val.ReturnParams();
					for (int l = 0; l < val2.rendererInfos.Length; l++)
					{
						Material val3 = val2.rendererInfos[l].ReturnMaterial();
						if ((Object)(object)val3 == (Object)null)
						{
							continue;
						}
						text = text + "\n[" + l + "] " + ((Object)val3).name + " | " + ((Object)val2.rendererInfos[l].renderer).name;
						if (!list.Contains(val3))
						{
							list.Add(val3);
							if ((Object)(object)val3.mainTexture != (Object)null)
							{
								string text4 = text2;
								string name2 = ((Object)val3.mainTexture).name;
								wrapMode = val3.mainTexture.wrapMode;
								text2 = text4 + name2 + " | " + ((object)(TextureWrapMode)(ref wrapMode)).ToString();
							}
							text2 += "\n";
						}
					}
					Debug.Log((object)text);
					Debug.Log((object)text2);
				}
			}
		}

		public static SkinDefParams ReturnParams(this SkinDef skinDef)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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)
			SkinCatalog.ValidateParams(skinDef);
			if (Object.op_Implicit((Object)(object)skinDef.skinDefParams))
			{
				return skinDef.skinDefParams;
			}
			return AssetAsyncReferenceManager<SkinDefParams>.LoadAsset(skinDef.skinDefParamsAddress, unloadType).WaitForCompletion();
		}

		public static Material ReturnMaterial(this RendererInfo render)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)render.defaultMaterial))
			{
				return render.defaultMaterial;
			}
			return AssetAsyncReferenceManager<Material>.LoadAsset(render.defaultMaterialAddress, unloadType).WaitForCompletion();
		}
	}
}
namespace WolfoSkinsMod.Mod
{
	public class SkinsEnforcer
	{
		[RegisterAchievement("CLEAR_ANY_ENFORCER", "Skins.Enforcer.Wolfo.First", null, 3u, null)]
		public class ClearSimulacrumENFORCER : Achievement_ONE_THINGS
		{
			public override BodyIndex LookUpRequiredBodyIndex()
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				return BodyCatalog.FindBodyIndex("EnforcerBody");
			}
		}

		internal static void ModdedSkin(GameObject EnforcerBody)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Enforcer Skins");
			BodyIndex bodyIndex = EnforcerBody.GetComponent<CharacterBody>().bodyIndex;
			ModelSkinController component = ((Component)EnforcerBody.transform.GetChild(0).GetChild(0)).GetComponent<ModelSkinController>();
			SkinDef original = component.skins[0];
			SkinDef original2 = component.skins[3];
			SkinInfo skinInfo = default(SkinInfo);
			skinInfo.name = "skinEnforcer_1";
			skinInfo.nameToken = "SIMU_SKIN_ENFORCER_RED";
			skinInfo.icon = H.GetIcon("mod/ror1/enforcer_red");
			skinInfo.original = original;
			SkinDef val = (SkinDef)(object)H.CreateEmptySkinForLaterCreation(skinInfo, DefaultRed);
			skinInfo = default(SkinInfo);
			skinInfo.name = "skinEnforcerBot_1";
			skinInfo.nameToken = "SIMU_SKIN_ENFORCER_RED_ALT";
			skinInfo.icon = H.GetIcon("mod/ror1/enforcer_redBot");
			skinInfo.original = original2;
			SkinDef val2 = (SkinDef)(object)H.CreateEmptySkinForLaterCreation(skinInfo, Robot_Red);
			skinInfo = default(SkinInfo);
			skinInfo.name = "skinEnforcer_Safety_1";
			skinInfo.nameToken = "SIMU_SKIN_ENFORCER_YELLOW";
			skinInfo.icon = H.GetIcon("mod/ror1/enforcer_yellow");
			skinInfo.original = original;
			SkinDef val3 = (SkinDef)(object)H.CreateEmptySkinForLaterCreation(skinInfo, DefaultYellow);
			SkinDef[] array = (SkinDef[])(object)new SkinDef[component.skins.Length];
			array[0] = component.skins[0];
			array[1] = component.skins[1];
			array[2] = component.skins[2];
			array[3] = component.skins[3];
			array[4] = val;
			array[5] = val2;
			array[6] = val3;
			for (int i = 7; i < component.skins.Length; i++)
			{
				array[i] = component.skins[i - 3];
			}
			component.skins = array;
		}

		internal static void Robot_Red(SkinDefMakeOnApply newSkinDef)
		{
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			RendererInfo[] rendererInfos = ((SkinDef)newSkinDef).skinDefParams.rendererInfos;
			Material val = H.CloneMat(ref rendererInfos, 0);
			Material val2 = H.CloneMat(ref rendererInfos, 0);
			Material val3 = H.CloneMat(ref rendererInfos, 0);
			Material val4 = H.CloneMat(ref rendererInfos, 1);
			Material defaultMaterial = H.CloneMat(ref rendererInfos, 6);
			Texture2D val5 = Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/RedBot/texN4CREmission.png");
			Texture2D val6 = Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/RedBot/texN4CREmission_Weapon.png");
			Color color = default(Color);
			((Color)(ref color))..ctor(1f, 0.9f, 0.9f, 1f);
			val.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/RedBot/texN4CR.png");
			val.SetTexture("_EmTex", (Texture)(object)val5);
			val.SetTexture("_EmissionMap", (Texture)(object)val5);
			val.color = color;
			val2.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/RedBot/texN4CR_Weapon.png");
			val2.SetTexture("_EmTex", (Texture)(object)val6);
			val2.SetTexture("_EmissionMap", (Texture)(object)val6);
			val2.color = color;
			val3.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/RedBot/texN4CR_Shield.png");
			val3.SetTexture("_EmTex", (Texture)(object)val6);
			val3.SetTexture("_EmissionMap", (Texture)(object)val6);
			val3.color = color;
			val4.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Red/texSexforcerShieldGlass.png");
			rendererInfos[0].defaultMaterial = val2;
			rendererInfos[1].defaultMaterial = val4;
			rendererInfos[2].defaultMaterial = val;
			rendererInfos[3].defaultMaterial = val2;
			rendererInfos[4].defaultMaterial = val2;
			rendererInfos[5].defaultMaterial = val2;
			rendererInfos[6].defaultMaterial = defaultMaterial;
			rendererInfos[7].defaultMaterial = val;
			rendererInfos[8].defaultMaterial = val;
		}

		internal static void DefaultRed(SkinDefMakeOnApply newSkinDef)
		{
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: 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_01b3: Unknown result type (might be due to invalid IL or missing references)
			RendererInfo[] rendererInfos = ((SkinDef)newSkinDef).skinDefParams.rendererInfos;
			Material val = H.CloneMat(ref rendererInfos, 0);
			Material val2 = H.CloneMat(ref rendererInfos, 1);
			Material defaultMaterial = H.CloneMat(ref rendererInfos, 2);
			Material val3 = H.CloneMat(ref rendererInfos, 3);
			Material val4 = H.CloneMat(ref rendererInfos, 4);
			Material val5 = H.CloneMat(ref rendererInfos, 5);
			Material val6 = H.CloneMat(ref rendererInfos, 6);
			Material val7 = H.CloneMat(ref rendererInfos, 7);
			Texture2D val8 = Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Red/texEnforcer_Emission.png");
			Color color = default(Color);
			((Color)(ref color))..ctor(1f, 0.7f, 0.7f, 1f);
			val.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Red/texEnforcerShield.png");
			val.color = color;
			val2.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Red/texSexforcerShieldGlass.png");
			val3.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Red/texEnforcerGun.png");
			val3.color = new Color(1f, 1f, 0.85f);
			val3.SetTexture("_EmTex", (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Red/texEnforcerGun_Emission.png"));
			val3.SetTexture("_EmissionMap", (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Red/texEnforcerGun_Emission.png"));
			val4.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Red/texClassicGunSuper.png");
			val5.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Red/texClassicGunHMG.png");
			val6.color = new Color(0.5f, 0.4f, 0.2f);
			val7.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Red/texEnforcer.png");
			val7.SetTexture("_EmTex", (Texture)(object)val8);
			val7.SetTexture("_EmissionMap", (Texture)(object)val8);
			val7.color = color;
			rendererInfos[0].defaultMaterial = val;
			rendererInfos[1].defaultMaterial = val2;
			rendererInfos[2].defaultMaterial = defaultMaterial;
			rendererInfos[3].defaultMaterial = val3;
			rendererInfos[4].defaultMaterial = val4;
			rendererInfos[5].defaultMaterial = val5;
			rendererInfos[6].defaultMaterial = val6;
			rendererInfos[7].defaultMaterial = val7;
			rendererInfos[8].defaultMaterial = val7;
		}

		internal static void DefaultYellow(SkinDefMakeOnApply newSkinDef)
		{
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_01a6: Unknown result type (might be due to invalid IL or missing references)
			RendererInfo[] rendererInfos = ((SkinDef)newSkinDef).skinDefParams.rendererInfos;
			Material val = H.CloneMat(ref rendererInfos, 0);
			Material val2 = H.CloneMat(ref rendererInfos, 1);
			Material defaultMaterial = H.CloneMat(ref rendererInfos, 2);
			Material val3 = H.CloneMat(ref rendererInfos, 3);
			Material val4 = H.CloneMat(ref rendererInfos, 4);
			Material val5 = H.CloneMat(ref rendererInfos, 5);
			Material val6 = H.CloneMat(ref rendererInfos, 6);
			Material val7 = H.CloneMat(ref rendererInfos, 7);
			Texture2D val8 = Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Yellow/texEnforcerGun_EmissionSAFETY.png");
			Texture2D val9 = Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Yellow/texEnforcer_EmissionSAFETY.png");
			Color color = default(Color);
			((Color)(ref color))..ctor(1f, 1f, 0.9f, 1f);
			val.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Yellow/texEnforcerShieldSAFETY.png");
			val.color = color;
			val2.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Yellow/texSexforcerShieldGlassSAFETY.png");
			val3.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Yellow/texEnforcerGunSAFETY.png");
			val3.color = new Color(1f, 1f, 1f);
			val3.SetTexture("_EmTex", (Texture)(object)val8);
			val3.SetTexture("_EmissionMap", (Texture)(object)val8);
			val4.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Yellow/texClassicGunSuperSAFETY.png");
			val5.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Yellow/texClassicGunHMGSAFETY.png");
			val6.color = new Color(0.5f, 0.3f, 0.5f);
			val7.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Yellow/texEnforcerSAFETY.png");
			val7.SetTexture("_EmTex", (Texture)(object)val9);
			val7.SetTexture("_EmissionMap", (Texture)(object)val9);
			val7.color = color;
			rendererInfos[0].defaultMaterial = val;
			rendererInfos[1].defaultMaterial = val2;
			rendererInfos[2].defaultMaterial = defaultMaterial;
			rendererInfos[3].defaultMaterial = val3;
			rendererInfos[4].defaultMaterial = val4;
			rendererInfos[5].defaultMaterial = val5;
			rendererInfos[6].defaultMaterial = val6;
			rendererInfos[7].defaultMaterial = val7;
			rendererInfos[8].defaultMaterial = val7;
		}
	}
	public class SkinsHand
	{
		[RegisterAchievement("CLEAR_ANY_HANDOVERCLOCKED", "Skins.HANDOverclocked.Wolfo.First", null, 3u, null)]
		public class ClearSimulacrumHANDOverclockedBody : Achievement_ONE_THINGS
		{
			public override BodyIndex LookUpRequiredBodyIndex()
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				return BodyCatalog.FindBodyIndex("HANDOverclockedBody");
			}
		}

		public static GameObject GoldAffixEffectNew;

		internal static void ModdedSkin(GameObject HandBody)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			BodyIndex bodyIndex = HandBody.GetComponent<CharacterBody>().bodyIndex;
			ModelSkinController component = ((Component)HandBody.transform.GetChild(0).GetChild(0)).GetComponent<ModelSkinController>();
			SkinDef skinHandDefault = component.skins[0];
			SkinDef skinHandReturns = component.skins[2];
			SkinDef val = Hand_Gold(skinHandDefault);
			SkinDef val2 = Hand_Rusty(skinHandDefault);
			SkinDef val3 = Hand_Green(skinHandDefault);
			SkinDef val4 = Hand_Gold_RETURNS(skinHandReturns);
			SkinDef val5 = Hand_Rusty_RETURNS(skinHandReturns);
			SkinDef val6 = Hand_Green_RETURNS(skinHandReturns);
			SkinDef[] array = (SkinDef[])(object)new SkinDef[component.skins.Length];
			array[0] = component.skins[0];
			array[1] = component.skins[1];
			array[2] = component.skins[2];
			array[3] = val;
			array[4] = val2;
			array[5] = val3;
			array[6] = val4;
			array[7] = val5;
			array[8] = val6;
			for (int i = 9; i < component.skins.Length; i++)
			{
				array[i] = component.skins[i - 6];
			}
			component.skins = array;
		}

		internal static SkinDef Hand_Gold(SkinDef skinHandDefault)
		{
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			SkinInfo skinInfo = default(SkinInfo);
			skinInfo.name = "skinHANDOverclockedGold_1";
			skinInfo.nameToken = "SIMU_SKIN_HAND";
			skinInfo.icon = H.GetIcon("mod/ror1/hand_gold");
			skinInfo.original = skinHandDefault;
			SkinDefEnhanced skinDefEnhanced = H.CreateNewSkinW(skinInfo);
			RendererInfo[] rendererInfos = ((SkinDef)skinDefEnhanced).skinDefParams.rendererInfos;
			Material val = H.CloneMat(ref rendererInfos, 0);
			Material val2 = H.CloneMat(ref rendererInfos, 1);
			Material val3 = H.CloneMat(ref rendererInfos, 2);
			Color color = default(Color);
			((Color)(ref color))..ctor(1.2f, 1.1f, 1f);
			val.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/HanD/Gold/HanD_Diffuse.png");
			val.color = color;
			val.SetTexture("_EmTex", (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/HanD/Gold/HanD_Emission.png"));
			val.SetColor("_EmColor", new Color(1f, 1f, 1.8f));
			val2.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/HanD/Gold/HanDWeapon_Diffuse.png");
			val2.color = color;
			val3.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/HanD/Gold/texDroneBody.png");
			val3.color = color;
			val3.SetTexture("_EmTex", (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/HanD/Gold/texDroneBodyEmission.png"));
			val3.SetColor("_EmColor", new Color(1f, 1f, 1.5f));
			rendererInfos[0].defaultMaterial = val;
			rendererInfos[1].defaultMaterial = val2;
			rendererInfos[2].defaultMaterial = val3;
			GameObject val4 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Junk/EliteGold/GoldAffixEffect.prefab").WaitForCompletion();
			GoldAffixEffectNew = PrefabAPI.InstantiateClone(val4, "HANDGoldSparkles", false);
			((Component)GoldAffixEffectNew.transform.GetChild(0)).gameObject.SetActive(false);
			GoldAffixEffectNew.transform.GetChild(0).localPosition = new Vector3(0f, 4f, 0f);
			((Component)GoldAffixEffectNew.transform.GetChild(0)).GetComponent<Light>().intensity = 1f;
			ParticleSystem component = GoldAffixEffectNew.GetComponent<ParticleSystem>();
			component.playbackSpeed = 0.5f;
			component.emissionRate = 6f;
			component.simulationSpace = (ParticleSystemSimulationSpace)1;
			component.startColor = new Color(0f, 0.6f, 1f);
			MainModule main = component.main;
			((MainModule)(ref main)).cullingMode = (ParticleSystemCullingMode)3;
			ShapeModule shape = component.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0;
			((ShapeModule)(ref shape)).scale = new Vector3(1.8f, 2.4f, 1.5f);
			skinDefEnhanced.addGameObjects = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					ruleType = (ItemDisplayRuleType)0,
					followerPrefab = GoldAffixEffectNew,
					childName = "Base",
					localPos = new Vector3(0f, 4.6f, 0f),
					localAngles = new Vector3(0f, 0f, 0f),
					localScale = new Vector3(0.6f, 0.6f, 0.6f),
					limbMask = (LimbFlags)0
				}
			};
			return (SkinDef)(object)skinDefEnhanced;
		}

		internal static SkinDef Hand_Rusty(SkinDef skinHandDefault)
		{
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			SkinInfo skinInfo = default(SkinInfo);
			skinInfo.name = "skinHANDOverclockedRusted_1";
			skinInfo.nameToken = "SIMU_SKIN_HAND_ORANGE";
			skinInfo.icon = H.GetIcon("mod/ror1/hand_orange");
			skinInfo.original = skinHandDefault;
			SkinDef val = H.CreateNewSkin(skinInfo);
			RendererInfo[] rendererInfos = val.skinDefParams.rendererInfos;
			Material val2 = H.CloneMat(ref rendererInfos, 0);
			Material val3 = H.CloneMat(ref rendererInfos, 1);
			Material val4 = H.CloneMat(ref rendererInfos, 2);
			Color color = default(Color);
			((Color)(ref color))..ctor(1f, 1f, 1f);
			val2.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/HanD/ORANGE/HanD_DiffuseORANGE.png");
			val2.color = color;
			val2.SetColor("_EmColor", new Color(1.6f, 1f, 1f));
			val3.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/HanD/ORANGE/HanDWeapon_DiffuseORANGE.png");
			val3.color = color;
			val4.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/HanD/ORANGE/texDroneBodyORANGE.png");
			val4.color = color;
			val4.SetColor("_EmColor", new Color(1.4f, 1f, 1f));
			rendererInfos[0].defaultMaterial = val2;
			rendererInfos[1].defaultMaterial = val3;
			rendererInfos[2].defaultMaterial = val4;
			return val;
		}

		internal static SkinDef Hand_Green(SkinDef skinHandDefault)
		{
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			SkinInfo skinInfo = default(SkinInfo);
			skinInfo.name = "skinHANDOverclockedOxidized_1";
			skinInfo.nameToken = "SIMU_SKIN_HAND_GREEN";
			skinInfo.icon = H.GetIcon("mod/ror1/hand_green");
			skinInfo.original = skinHandDefault;
			SkinDef val = H.CreateNewSkin(skinInfo);
			RendererInfo[] rendererInfos = val.skinDefParams.rendererInfos;
			Material val2 = H.CloneMat(ref rendererInfos, 0);
			Material val3 = H.CloneMat(ref rendererInfos, 1);
			Material val4 = H.CloneMat(ref rendererInfos, 2);
			Color color = default(Color);
			((Color)(ref color))..ctor(1f, 1f, 1f);
			val2.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/HanD/GREEN/HanD_DiffuseGREEN.png");
			val2.color = color;
			val2.SetTexture("_EmTex", (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/HanD/GREEN/HanD_EmissionGREEN.png"));
			val2.SetColor("_EmColor", new Color(1.44f, 1.6f, 0.6f));
			val3.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/HanD/GREEN/HanDWeapon_DiffuseGREEN.png");
			val3.color = color;
			val4.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/HanD/GREEN/texDroneBodyGREEN.png");
			val4.color = color;
			val4.SetTexture("_EmTex", (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/HanD/GREEN/texDroneBodyEmissionGREEN.png"));
			val4.SetColor("_EmColor", new Color(1.26f, 1.4f, 0.6f));
			rendererInfos[0].defaultMaterial = val2;
			rendererInfos[1].defaultMaterial = val3;
			rendererInfos[2].defaultMaterial = val4;
			return val;
		}

		internal static SkinDef Hand_Gold_RETURNS(SkinDef skinHandReturns)
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			SkinInfo skinInfo = default(SkinInfo);
			skinInfo.name = "skinHANDOverclockedGold_RETURN_1";
			skinInfo.nameToken = "SIMU_SKIN_HAND2";
			skinInfo.icon = H.GetIcon("mod/ror1/hand_goldGM");
			skinInfo.original = skinHandReturns;
			SkinDefEnhanced skinDefEnhanced = H.CreateNewSkinW(skinInfo);
			RendererInfo[] rendererInfos = ((SkinDef)skinDefEnhanced).skinDefParams.rendererInfos;
			Material val = H.CloneMat(ref rendererInfos, 0);
			Color color = default(Color);
			((Color)(ref color))..ctor(1.2f, 1.1f, 1f);
			val.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/HanD/Gold/textrimsheetjanitortransparent.png");
			val.color = color;
			val.SetTexture("_EmTex", (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/HanD/Gold/textrimsheetconstructionemission.png"));
			val.SetColor("_EmColor", new Color(1f, 1f, 1.1f));
			rendererInfos[0].defaultMaterial = val;
			rendererInfos[1].defaultMaterial = val;
			rendererInfos[2].defaultMaterial = val;
			skinDefEnhanced.addGameObjects = (ItemDisplayRule[])(object)new ItemDisplayRule[1]
			{
				new ItemDisplayRule
				{
					ruleType = (ItemDisplayRuleType)0,
					followerPrefab = GoldAffixEffectNew,
					childName = "Base",
					localPos = new Vector3(0f, 4.6f, 0f),
					localAngles = new Vector3(0f, 0f, 0f),
					localScale = new Vector3(0.6f, 0.6f, 0.6f),
					limbMask = (LimbFlags)0
				}
			};
			return (SkinDef)(object)skinDefEnhanced;
		}

		internal static SkinDef Hand_Rusty_RETURNS(SkinDef skinHandReturns)
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			SkinInfo skinInfo = default(SkinInfo);
			skinInfo.name = "skinHANDOverclockedOxidized_RETURN_1";
			skinInfo.nameToken = "SIMU_SKIN_HAND2_ORANGE";
			skinInfo.icon = H.GetIcon("mod/ror1/hand_orangeGM");
			skinInfo.original = skinHandReturns;
			SkinDef val = H.CreateNewSkin(skinInfo);
			RendererInfo[] rendererInfos = val.skinDefParams.rendererInfos;
			Material val2 = H.CloneMat(ref rendererInfos, 0);
			Color color = default(Color);
			((Color)(ref color))..ctor(1f, 1f, 1f);
			val2.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/HanD/ORANGE/textrimsheetjanitortransparent.png");
			val2.color = color;
			val2.SetTexture("_EmTex", (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/HanD/ORANGE/textrimsheetconstructionemission.png"));
			val2.SetColor("_EmColor", new Color(1.1f, 1f, 1f));
			rendererInfos[0].defaultMaterial = val2;
			rendererInfos[1].defaultMaterial = val2;
			rendererInfos[2].defaultMaterial = val2;
			return val;
		}

		internal static SkinDef Hand_Green_RETURNS(SkinDef skinHandReturns)
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			SkinInfo skinInfo = default(SkinInfo);
			skinInfo.name = "skinHANDOverclockedOxidized_RETURN_1";
			skinInfo.nameToken = "SIMU_SKIN_HAND2_GREEN";
			skinInfo.icon = H.GetIcon("mod/ror1/hand_greenGM");
			skinInfo.original = skinHandReturns;
			SkinDef val = H.CreateNewSkin(skinInfo);
			RendererInfo[] rendererInfos = val.skinDefParams.rendererInfos;
			Material val2 = H.CloneMat(ref rendererInfos, 0);
			Color color = default(Color);
			((Color)(ref color))..ctor(1f, 1f, 1f);
			val2.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/HanD/GREEN/textrimsheetjanitortransparent.png");
			val2.color = color;
			val2.SetTexture("_EmTex", (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/HanD/GREEN/textrimsheetconstructionemission.png"));
			val2.SetColor("_EmColor", new Color(1f, 1.1f, 0.6f));
			rendererInfos[0].defaultMaterial = val2;
			rendererInfos[1].defaultMaterial = val2;
			rendererInfos[2].defaultMaterial = val2;
			return val;
		}
	}
	public class SkinsMiner
	{
		[RegisterAchievement("CLEAR_ANY_MINER", "Skins.Miner.Wolfo.First", null, 3u, null)]
		public class ClearSimulacrumMiner : Achievement_ONE_THINGS
		{
			public override BodyIndex LookUpRequiredBodyIndex()
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				return BodyCatalog.FindBodyIndex("MinerBody");
			}
		}

		internal static void ModdedSkin(GameObject MinerBody)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Miner Skins");
			ModelSkinController componentInChildren = MinerBody.GetComponentInChildren<ModelSkinController>();
			BodyIndex bodyIndex = MinerBody.GetComponent<CharacterBody>().bodyIndex;
			SkinDef original = componentInChildren.skins[0];
			SkinDef original2 = componentInChildren.skins[1];
			SkinDef original3 = componentInChildren.skins[5];
			SkinInfo skinInfo = default(SkinInfo);
			skinInfo.name = "skinMiner_Black_1";
			skinInfo.nameToken = "SIMU_SKIN_MINER";
			skinInfo.icon = H.GetIcon("mod/ror1/miner_black");
			skinInfo.original = original2;
			SkinDef item = (SkinDef)(object)H.CreateEmptySkinForLaterCreation(skinInfo, Mastery_BlackGlow);
			skinInfo = default(SkinInfo);
			skinInfo.name = "skinMiner_1";
			skinInfo.nameToken = "SIMU_SKIN_MINER_ORANGE";
			skinInfo.icon = H.GetIcon("mod/ror1/miner_orange");
			skinInfo.original = original3;
			SkinDef item2 = (SkinDef)(object)H.CreateEmptySkinForLaterCreation(skinInfo, Blacksmith_Orange);
			skinInfo = default(SkinInfo);
			skinInfo.name = "skinMiner_Emerald_1";
			skinInfo.nameToken = "SIMU_SKIN_MINER_EMERALD";
			skinInfo.icon = H.GetIcon("mod/ror1/miner_green");
			skinInfo.original = original;
			SkinDef item3 = (SkinDef)(object)H.CreateEmptySkinForLaterCreation(skinInfo, Default_Emerald);
			List<SkinDef> list = new List<SkinDef>();
			list.Add(componentInChildren.skins[0]);
			list.Add(componentInChildren.skins[1]);
			list.Add(componentInChildren.skins[2]);
			list.Add(componentInChildren.skins[5]);
			list.Add(item);
			list.Add(item2);
			list.Add(item3);
			for (int i = 3; i < componentInChildren.skins.Length; i++)
			{
				if (!list.Contains(componentInChildren.skins[i]))
				{
					list.Add(componentInChildren.skins[i]);
				}
			}
			SkinDef[] skins = list.ToArray();
			componentInChildren.skins = skins;
		}

		internal static void Mastery_BlackGlow(SkinDefMakeOnApply newSkinDef)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			RendererInfo[] rendererInfos = ((SkinDef)newSkinDef).skinDefParams.rendererInfos;
			Material val = H.CloneMat(ref rendererInfos, 0);
			((Object)val).name = "MatMinerBody";
			val.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Miner/texMinerMolten.png");
			val.SetTexture("_EmTex", (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Miner/texMinerMoltenEmission.png"));
			val.SetColor("_EmColor", new Color(1f, 1f, 0f, 1f));
			val.SetFloat("_EmPower", 4f);
		}

		internal static void Default_Emerald(SkinDefMakeOnApply newSkinDef)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			RendererInfo[] rendererInfos = ((SkinDef)newSkinDef).skinDefParams.rendererInfos;
			Material val = H.CloneMat(ref rendererInfos, 0);
			val.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Miner/texMinerDiamond.png");