Decompiled source of WolfoAlternateSkins v2.2.6

WolfoSkinsMod.dll

Decompiled 3 weeks 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 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 On.RoR2.UI.MainMenu;
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 RoR2.UI.MainMenu;
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+ff8f1f1cfbed3766496e49e8c9dcd67940603df8")]
[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 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 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> cfgSort;

		public static ConfigEntry<bool> cfgLegacySkins;

		public static ConfigEntry<bool> cfgSilentRelockReunlock;

		public static ConfigEntry<bool> cfgClearAchievementView;

		public static ConfigEntry<bool> cfgDump;

		public static ConfigEntry<bool> RemoveAllTrackers;

		public static ConfigEntry<bool> cfgTest;

		public static void InitConfig()
		{
			cfgTest = ConfigFileUNSORTED.Bind<bool>("Test", "cfgTest", false, "Don't");
			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.");
			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.");
			cfgSort = ConfigFileUNSORTED.Bind<bool>("Main", "Sort Skins", false, "Sort skins at the end of the skin list. This is mostly here in case it causes issues.");
			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
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			ModSettingsManager.SetModIcon(Assets.Bundle.LoadAsset<Sprite>("Assets/Skins/icon.png"));
			ModSettingsManager.SetModDescription("Too many skins");
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(cfgUnlockAll, false));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(cfgSort, 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));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(cfgTest, true));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(cfgDump, false));
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Wolfo.WolfoSkins", "WolfoSkins", "2.2.4")]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class WolfoSkins : BaseUnityPlugin
	{
		public void Awake()
		{
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Expected O, but got Unknown
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Expected O, but got Unknown
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Expected O, but got Unknown
			WConfig.InitConfig();
			if (WConfig.cfgTest.Value)
			{
				WConfig.cfgTest.Value = false;
				Object.Destroy((Object)(object)this);
				return;
			}
			Assets.Init(((BaseUnityPlugin)this).Info);
			Unlocks.Hooks();
			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();
			((ResourceAvailability)(ref RuleCatalog.availability)).CallWhenAvailable((Action)ModSupport);
			((ResourceAvailability)(ref GameModeCatalog.availability)).CallWhenAvailable((Action)SortSkinsLate);
			SkinDef.ApplyAsync += new hook_ApplyAsync(SkinDef_ApplyAsync);
			TemporaryOverlay.AddToCharacerModel += new hook_AddToCharacerModel(ReplaceTemporaryOverlayMaterial);
			SkinDef.BakeAsync += new hook_BakeAsync(SkinDef_BakeAsync);
		}

		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)
			IEnumerator temp = orig.Invoke(self, modelObject, loadedMaterials, loadedMeshes, unloadType);
			while (temp.MoveNext())
			{
				yield return temp.Current;
			}
			if (Object.op_Implicit((Object)(object)modelObject.GetComponent<SkinDefWolfoTracker>()))
			{
				modelObject.GetComponent<SkinDefWolfoTracker>().UndoWolfoSkin();
			}
			if (self is SkinDefWolfo)
			{
				(self as SkinDefWolfo).ApplyExtras(modelObject);
			}
		}

		private IEnumerator SkinDef_BakeAsync(orig_BakeAsync orig, SkinDef self)
		{
			if (self.runtimeSkin == null && self is SkinDefPrioritizeDirect)
			{
				for (int i = 0; self.skinDefParams.rendererInfos.Length > i; i++)
				{
					if ((Object)(object)self.skinDefParams.rendererInfos[i].defaultMaterial != (Object)null)
					{
						self.skinDefParams.rendererInfos[i].defaultMaterialAddress = null;
					}
				}
			}
			return orig.Invoke(self);
		}

		private void SkinDef_Apply(orig_Apply orig, SkinDef self, GameObject model)
		{
			orig.Invoke(self, model);
			if (Object.op_Implicit((Object)(object)model.GetComponent<SkinDefWolfoTracker>()))
			{
				model.GetComponent<SkinDefWolfoTracker>().UndoWolfoSkin();
			}
			if (self is SkinDefWolfo)
			{
				(self as SkinDefWolfo).ApplyExtras(model);
			}
		}

		internal static void SortSkinsLate()
		{
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			if (!WConfig.cfgSort.Value)
			{
				return;
			}
			List<string> list = new List<string> { "Enforcer", "HANDOverclocked", "Miner", "GnomeChefBody", "RobPaladin" };
			for (int i = 0; i < SurvivorCatalog.survivorDefs.Length; i++)
			{
				if (list.Contains(SurvivorCatalog.survivorDefs[i].cachedName))
				{
					continue;
				}
				GameObject bodyPrefab = SurvivorCatalog.survivorDefs[i].bodyPrefab;
				ModelSkinController componentInChildren = bodyPrefab.GetComponentInChildren<ModelSkinController>();
				if (!Object.op_Implicit((Object)(object)componentInChildren))
				{
					Debug.LogWarning((object)(((object)SurvivorCatalog.survivorDefs[i])?.ToString() + " has no ModelSkinController"));
				}
				else
				{
					if (componentInChildren.skins.Length <= 4)
					{
						continue;
					}
					BodyIndex bodyIndex = bodyPrefab.GetComponent<CharacterBody>().bodyIndex;
					List<SkinDef> list2 = new List<SkinDef>();
					List<SkinDef> list3 = new List<SkinDef>();
					for (int j = 0; j < componentInChildren.skins.Length; j++)
					{
						if (((Object)componentInChildren.skins[j]).name.Contains("Wolfo"))
						{
							list3.Add(componentInChildren.skins[j]);
						}
						else
						{
							list2.Add(componentInChildren.skins[j]);
						}
					}
					if (list3.Count > 0)
					{
						list2.AddRange(list3);
						SkinDef[] array = (componentInChildren.skins = list2.ToArray());
						SkinCatalog.skinsByBody[bodyIndex] = array;
						SkinCatalog.skinsByBody[bodyIndex] = array;
					}
				}
			}
			GC.Collect();
		}

		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("Executioner2Body");
			if ((Object)(object)val != (Object)null)
			{
				SkinsExecutioner.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("MoffeinPilotBody");
			if ((Object)(object)val != (Object)null)
			{
				SkinsPilot.ModdedSkin(val);
			}
			val = BodyCatalog.FindBodyPrefab("MinerBody");
			if ((Object)(object)val != (Object)null)
			{
				SkinsMiner.ModdedSkin(val);
			}
			val = BodyCatalog.FindBodyPrefab("ChirrBody");
			if ((Object)(object)val != (Object)null)
			{
				SkinsChirr.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);
			}
			val = BodyCatalog.FindBodyPrefab("NemesisEnforcerBody");
			if ((Object)(object)val != (Object)null)
			{
				SkinsNemEnforcer.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 SkinDefPrioritizeDirect : SkinDef
	{
	}
	public class SkinDefWolfo : SkinDefPrioritizeDirect
	{
		[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 Transform disableThis;

		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>();
			SkinDefWolfoTracker skinDefWolfoTracker = default(SkinDefWolfoTracker);
			if (!modelObject.TryGetComponent<SkinDefWolfoTracker>(ref skinDefWolfoTracker))
			{
				skinDefWolfoTracker = modelObject.AddComponent<SkinDefWolfoTracker>();
			}
			if (Object.op_Implicit((Object)(object)changeMaterial.targetMaterial))
			{
				OverlayMaterialReplacer overlayMaterialReplacer = modelObject.AddComponent<OverlayMaterialReplacer>();
				overlayMaterialReplacer.targetMaterial = changeMaterial.targetMaterial;
				overlayMaterialReplacer.replacementMaterial = changeMaterial.replacementMaterial;
			}
			skinDefWolfoTracker.model = component;
			skinDefWolfoTracker.changedLights = new SkinDefWolfoTracker.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))
					{
						skinDefWolfoTracker.changedLights[i] = new SkinDefWolfoTracker.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))
					{
						skinDefWolfoTracker.changedLights[i] = new SkinDefWolfoTracker.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"));
				}
			}
			skinDefWolfoTracker.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;
					skinDefWolfoTracker.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, skinDefWolfoTracker);
			}
			if (Object.op_Implicit((Object)(object)disableThis))
			{
				((Component)disableThis).gameObject.SetActive(false);
				skinDefWolfoTracker.disabledTransform = disableThis;
			}
		}

		public void EngiDisplay(GameObject modelObject, SkinDefWolfoTracker tracker)
		{
			//IL_009e: 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");
			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 };
			((Component)val.GetChild(0).GetChild(1)).gameObject.SetActive(false);
			((Component)val.GetChild(0).GetChild(2)).gameObject.SetActive(false);
			((Component)val.GetChild(1).GetChild(1)).gameObject.SetActive(false);
			((Component)val.GetChild(1).GetChild(0)).gameObject.SetActive(false);
			((Renderer)((Component)modelObject.transform.parent.GetChild(0).GetChild(1)).GetComponent<SkinnedMeshRenderer>()).material = defaultMaterial;
		}
	}
	public class SkinDefWolfoTracker : 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 _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_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: 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.survivorIndexToBodyIndex.Length; i++)
			{
				if ((int)SurvivorCatalog.survivorIndexToBodyIndex[i] == -1)
				{
					continue;
				}
				string cachedName = SurvivorCatalog.survivorDefs[i].cachedName;
				SkinDef[] array = SkinCatalog.skinsByBody[(int)SurvivorCatalog.survivorIndexToBodyIndex[i]];
				for (int j = 0; j < array.Length; j++)
				{
					if (!(array[j] is SkinDefPrioritizeDirect))
					{
						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 Sprite icon;

		public string nameToken;

		public string name;

		public bool cloneMesh;

		public bool unsetMat;

		public bool w;

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

		public static SkinDefPrioritizeDirect CreateNewSkin(SkinInfo skinInfo)
		{
			if (!Object.op_Implicit((Object)(object)skinInfo.original))
			{
				Debug.LogWarning((object)("Forgot to set original SkinDef for " + skinInfo.name));
			}
			SkinDefPrioritizeDirect skinDefPrioritizeDirect = CloneSkinDefReal(skinInfo.original, skinInfo.w, skinInfo.cloneMesh, skinInfo.extraRenders);
			((Object)skinDefPrioritizeDirect).name = skinInfo.name;
			((SkinDef)skinDefPrioritizeDirect).nameToken = skinInfo.nameToken;
			((SkinDef)skinDefPrioritizeDirect).icon = skinInfo.icon;
			if (skinInfo.unsetMat)
			{
			}
			return skinDefPrioritizeDirect;
		}

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

		public static RendererInfo[] CreateNewSkinR(SkinInfo skinInfo)
		{
			return ((SkinDef)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 void UnsetAllMat(RendererInfo[] rendererInfos)
		{
			for (int i = 0; i < rendererInfos.Length; i++)
			{
			}
		}

		public static Material CloneMat(RendererInfo[] rendererInfos, int num, bool checkDuplicates)
		{
			//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_002f: Unknown result type (might be due to invalid IL or missing references)
			Material val = null;
			AssetReferenceT<Material> defaultMaterialAddress = rendererInfos[num].defaultMaterialAddress;
			if (defaultMaterialAddress != null)
			{
				val = Object.Instantiate<Material>(AssetAsyncReferenceManager<Material>.LoadAsset(rendererInfos[num].defaultMaterialAddress, unloadType).WaitForCompletion());
				for (int i = 0; i < rendererInfos.Length; i++)
				{
					if (rendererInfos[i].defaultMaterialAddress == defaultMaterialAddress)
					{
						rendererInfos[i].defaultMaterialAddress = null;
					}
				}
			}
			return null;
		}

		public static Material CloneMat(RendererInfo[] rendererInfos, int num)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//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)
			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);
			}
			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 SkinDefPrioritizeDirect CloneSkinDefReal(SkinDef original, bool W, 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)
			{
				Debug.LogWarning((object)("Cannot find SkinDefParams for " + (object)original));
			}
			SkinDefPrioritizeDirect skinDefPrioritizeDirect = null;
			skinDefPrioritizeDirect = ((!W) ? ScriptableObject.CreateInstance<SkinDefPrioritizeDirect>() : ScriptableObject.CreateInstance<SkinDefWolfo>());
			SkinDefParams val2 = (((SkinDef)skinDefPrioritizeDirect).skinDefParams = Object.Instantiate<SkinDefParams>(val));
			((SkinDef)skinDefPrioritizeDirect).skinDefParamsAddress = new AssetReferenceT<SkinDefParams>("");
			if (((SkinDef)skinDefPrioritizeDirect).baseSkins != null && ((SkinDef)skinDefPrioritizeDirect).baseSkins.Length != 0)
			{
				((SkinDef)skinDefPrioritizeDirect).baseSkins = (SkinDef[])(object)new SkinDef[2]
				{
					((SkinDef)skinDefPrioritizeDirect).baseSkins[0],
					original
				};
			}
			else
			{
				((SkinDef)skinDefPrioritizeDirect).baseSkins = (SkinDef[])(object)new SkinDef[1] { original };
			}
			((SkinDef)skinDefPrioritizeDirect).rootObject = original.rootObject;
			AddSkinToCharacter((SkinDef)(object)skinDefPrioritizeDirect);
			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 skinDefPrioritizeDirect;
		}

		public static void DumpInfo()
		{
			//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)
			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";
					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;
								TextureWrapMode wrapMode = defaultMaterial.mainTexture.wrapMode;
								text2 = text3 + name + " | " + ((object)(TextureWrapMode)(ref wrapMode)).ToString();
							}
							text2 += "\n";
						}
					}
					Debug.Log((object)text);
					Debug.Log((object)text2);
				}
			}
		}

		public static SkinDefParams ReturnParams(this SkinDef skinDef)
		{
			//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)
			if (Object.op_Implicit((Object)(object)skinDef.skinDefParams))
			{
				return skinDef.skinDefParams;
			}
			return AssetAsyncReferenceManager<SkinDefParams>.LoadAsset(skinDef.skinDefParamsAddress, unloadType).WaitForCompletion();
		}
	}
}
namespace WolfoSkinsMod.Mod
{
	public class SkinsEnforcer
	{
		[RegisterAchievement("CLEAR_ANY_ENFORCER", "Skins.Enforcer.Wolfo.First", null, 5u, 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)
			//IL_00e7: 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 skinEnforcer = component.skins[0];
			SkinDef skinN4CR = component.skins[3];
			SkinDef val = SkinYELLOW(skinEnforcer);
			SkinDef val2 = SkinRED_ALT(skinN4CR);
			SkinDef val3 = SkinRED(skinEnforcer);
			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] = val3;
			array[5] = val2;
			array[6] = val;
			for (int i = 7; i < component.skins.Length; i++)
			{
				array[i] = component.skins[i - 3];
			}
			component.skins = array;
			SkinCatalog.skinsByBody[bodyIndex] = array;
		}

		internal static SkinDef SkinRED_ALT(SkinDef skinN4CR)
		{
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			SkinInfo skinInfo = default(SkinInfo);
			skinInfo.name = "skinEnforcerBot_1";
			skinInfo.nameToken = "SIMU_SKIN_ENFORCER_RED_ALT";
			skinInfo.icon = H.GetIcon("mod/ror1/enforcer_redBot");
			skinInfo.original = skinN4CR;
			SkinDef val = (SkinDef)(object)H.CreateNewSkin(skinInfo);
			RendererInfo[] rendererInfos = val.skinDefParams.rendererInfos;
			Material val2 = H.CloneMat(rendererInfos, 0);
			Material val3 = H.CloneMat(rendererInfos, 0);
			Material val4 = H.CloneMat(rendererInfos, 0);
			Material val5 = H.CloneMat(rendererInfos, 1);
			Material defaultMaterial = H.CloneMat(rendererInfos, 6);
			Texture2D val6 = Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/RedBot/texN4CREmission.png");
			Texture2D val7 = 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);
			val2.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/RedBot/texN4CR.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_Weapon.png");
			val3.SetTexture("_EmTex", (Texture)(object)val7);
			val3.SetTexture("_EmissionMap", (Texture)(object)val7);
			val3.color = color;
			val4.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/RedBot/texN4CR_Shield.png");
			val4.SetTexture("_EmTex", (Texture)(object)val7);
			val4.SetTexture("_EmissionMap", (Texture)(object)val7);
			val4.color = color;
			val5.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Red/texSexforcerShieldGlass.png");
			rendererInfos[0].defaultMaterial = val3;
			rendererInfos[1].defaultMaterial = val5;
			rendererInfos[2].defaultMaterial = val2;
			rendererInfos[3].defaultMaterial = val3;
			rendererInfos[4].defaultMaterial = val3;
			rendererInfos[5].defaultMaterial = val3;
			rendererInfos[6].defaultMaterial = defaultMaterial;
			rendererInfos[7].defaultMaterial = val2;
			rendererInfos[8].defaultMaterial = val2;
			return val;
		}

		internal static SkinDef SkinRED(SkinDef skinEnforcer)
		{
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			SkinInfo skinInfo = default(SkinInfo);
			skinInfo.name = "skinEnforcer_1";
			skinInfo.nameToken = "SIMU_SKIN_ENFORCER_RED";
			skinInfo.icon = H.GetIcon("mod/ror1/enforcer_red");
			skinInfo.original = skinEnforcer;
			SkinDef val = (SkinDef)(object)H.CreateNewSkin(skinInfo);
			RendererInfo[] rendererInfos = val.skinDefParams.rendererInfos;
			Material val2 = H.CloneMat(rendererInfos, 0);
			Material val3 = H.CloneMat(rendererInfos, 1);
			Material defaultMaterial = H.CloneMat(rendererInfos, 2);
			Material val4 = H.CloneMat(rendererInfos, 3);
			Material val5 = H.CloneMat(rendererInfos, 4);
			Material val6 = H.CloneMat(rendererInfos, 5);
			Material val7 = H.CloneMat(rendererInfos, 6);
			Material val8 = H.CloneMat(rendererInfos, 7);
			Texture2D val9 = 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);
			val2.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Red/texEnforcerShield.png");
			val2.color = color;
			val3.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Red/texSexforcerShieldGlass.png");
			val4.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Red/texEnforcerGun.png");
			val4.color = new Color(1f, 1f, 0.85f);
			val4.SetTexture("_EmTex", (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Red/texEnforcerGun_Emission.png"));
			val4.SetTexture("_EmissionMap", (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Red/texEnforcerGun_Emission.png"));
			val5.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Red/texClassicGunSuper.png");
			val6.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Red/texClassicGunHMG.png");
			val7.color = new Color(0.5f, 0.4f, 0.2f);
			val8.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Red/texEnforcer.png");
			val8.SetTexture("_EmTex", (Texture)(object)val9);
			val8.SetTexture("_EmissionMap", (Texture)(object)val9);
			val8.color = color;
			rendererInfos[0].defaultMaterial = val2;
			rendererInfos[1].defaultMaterial = val3;
			rendererInfos[2].defaultMaterial = defaultMaterial;
			rendererInfos[3].defaultMaterial = val4;
			rendererInfos[4].defaultMaterial = val5;
			rendererInfos[5].defaultMaterial = val6;
			rendererInfos[6].defaultMaterial = val7;
			rendererInfos[7].defaultMaterial = val8;
			rendererInfos[8].defaultMaterial = val8;
			return val;
		}

		internal static SkinDef SkinYELLOW(SkinDef skinEnforcer)
		{
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			SkinInfo skinInfo = default(SkinInfo);
			skinInfo.name = "skinEnforcer_Safety_1";
			skinInfo.nameToken = "SIMU_SKIN_ENFORCER_YELLOW";
			skinInfo.icon = H.GetIcon("mod/ror1/enforcer_yellow");
			skinInfo.original = skinEnforcer;
			SkinDef val = (SkinDef)(object)H.CreateNewSkin(skinInfo);
			RendererInfo[] rendererInfos = val.skinDefParams.rendererInfos;
			Material val2 = H.CloneMat(rendererInfos, 0);
			Material val3 = H.CloneMat(rendererInfos, 1);
			Material defaultMaterial = H.CloneMat(rendererInfos, 2);
			Material val4 = H.CloneMat(rendererInfos, 3);
			Material val5 = H.CloneMat(rendererInfos, 4);
			Material val6 = H.CloneMat(rendererInfos, 5);
			Material val7 = H.CloneMat(rendererInfos, 6);
			Material val8 = H.CloneMat(rendererInfos, 7);
			Texture2D val9 = Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Yellow/texEnforcerGun_EmissionSAFETY.png");
			Texture2D val10 = 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);
			val2.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Yellow/texEnforcerShieldSAFETY.png");
			val2.color = color;
			val3.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Yellow/texSexforcerShieldGlassSAFETY.png");
			val4.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Yellow/texEnforcerGunSAFETY.png");
			val4.color = new Color(1f, 1f, 1f);
			val4.SetTexture("_EmTex", (Texture)(object)val9);
			val4.SetTexture("_EmissionMap", (Texture)(object)val9);
			val5.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Yellow/texClassicGunSuperSAFETY.png");
			val6.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Yellow/texClassicGunHMGSAFETY.png");
			val7.color = new Color(0.5f, 0.3f, 0.5f);
			val8.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Enforcer/Yellow/texEnforcerSAFETY.png");
			val8.SetTexture("_EmTex", (Texture)(object)val10);
			val8.SetTexture("_EmissionMap", (Texture)(object)val10);
			val8.color = color;
			rendererInfos[0].defaultMaterial = val2;
			rendererInfos[1].defaultMaterial = val3;
			rendererInfos[2].defaultMaterial = defaultMaterial;
			rendererInfos[3].defaultMaterial = val4;
			rendererInfos[4].defaultMaterial = val5;
			rendererInfos[5].defaultMaterial = val6;
			rendererInfos[6].defaultMaterial = val7;
			rendererInfos[7].defaultMaterial = val8;
			rendererInfos[8].defaultMaterial = val8;
			return val;
		}
	}
	public class SkinsHand
	{
		[RegisterAchievement("CLEAR_ANY_HANDOVERCLOCKED", "Skins.HANDOverclocked.Wolfo.First", null, 5u, 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)
			//IL_00fb: 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;
			SkinCatalog.skinsByBody[bodyIndex] = array;
		}

		internal static SkinDef Hand_Gold(SkinDef skinHandDefault)
		{
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: 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_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			SkinInfo skinInfo = default(SkinInfo);
			skinInfo.name = "skinHandGold_1";
			skinInfo.nameToken = "SIMU_SKIN_HAND";
			skinInfo.icon = H.GetIcon("mod/ror1/hand_gold");
			skinInfo.original = skinHandDefault;
			SkinDefWolfo skinDefWolfo = H.CreateNewSkinW(skinInfo);
			RendererInfo[] rendererInfos = ((SkinDef)skinDefWolfo).skinDefParams.rendererInfos;
			Material val = H.CloneMat(rendererInfos, 0);
			Material val2 = H.CloneMat(rendererInfos, 1);
			Material val3 = H.CloneMat(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);
			skinDefWolfo.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)skinDefWolfo;
		}

		internal static SkinDef Hand_Rusty(SkinDef skinHandDefault)
		{
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: 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_0112: Unknown result type (might be due to invalid IL or missing references)
			SkinInfo skinInfo = default(SkinInfo);
			skinInfo.name = "skinHandRusted_1";
			skinInfo.nameToken = "SIMU_SKIN_HAND_ORANGE";
			skinInfo.icon = H.GetIcon("mod/ror1/hand_orange");
			skinInfo.original = skinHandDefault;
			SkinDef val = (SkinDef)(object)H.CreateNewSkin(skinInfo);
			RendererInfo[] rendererInfos = val.skinDefParams.rendererInfos;
			Material val2 = H.CloneMat(rendererInfos, 0);
			Material val3 = H.CloneMat(rendererInfos, 1);
			Material val4 = H.CloneMat(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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			SkinInfo skinInfo = default(SkinInfo);
			skinInfo.name = "skinHandOxidized_1";
			skinInfo.nameToken = "SIMU_SKIN_HAND_GREEN";
			skinInfo.icon = H.GetIcon("mod/ror1/hand_green");
			skinInfo.original = skinHandDefault;
			SkinDef val = (SkinDef)(object)H.CreateNewSkin(skinInfo);
			RendererInfo[] rendererInfos = val.skinDefParams.rendererInfos;
			Material val2 = H.CloneMat(rendererInfos, 0);
			Material val3 = H.CloneMat(rendererInfos, 1);
			Material val4 = H.CloneMat(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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: 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)
			SkinInfo skinInfo = default(SkinInfo);
			skinInfo.name = "skinHandGold_RETURN_1";
			skinInfo.nameToken = "SIMU_SKIN_HAND2";
			skinInfo.icon = H.GetIcon("mod/ror1/hand_goldGM");
			skinInfo.original = skinHandReturns;
			SkinDefWolfo skinDefWolfo = H.CreateNewSkinW(skinInfo);
			RendererInfo[] rendererInfos = ((SkinDef)skinDefWolfo).skinDefParams.rendererInfos;
			Material val = H.CloneMat(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;
			skinDefWolfo.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)skinDefWolfo;
		}

		internal static SkinDef Hand_Rusty_RETURNS(SkinDef skinHandReturns)
		{
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			SkinInfo skinInfo = default(SkinInfo);
			skinInfo.name = "skinHandOxidized_RETURN_1";
			skinInfo.nameToken = "SIMU_SKIN_HAND2_ORANGE";
			skinInfo.icon = H.GetIcon("mod/ror1/hand_orangeGM");
			skinInfo.original = skinHandReturns;
			SkinDef val = (SkinDef)(object)H.CreateNewSkin(skinInfo);
			RendererInfo[] rendererInfos = val.skinDefParams.rendererInfos;
			Material val2 = H.CloneMat(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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			SkinInfo skinInfo = default(SkinInfo);
			skinInfo.name = "skinHandOxidized_RETURN_1";
			skinInfo.nameToken = "SIMU_SKIN_HAND2_GREEN";
			skinInfo.icon = H.GetIcon("mod/ror1/hand_greenGM");
			skinInfo.original = skinHandReturns;
			SkinDef val = (SkinDef)(object)H.CreateNewSkin(skinInfo);
			RendererInfo[] rendererInfos = val.skinDefParams.rendererInfos;
			Material val2 = H.CloneMat(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, 5u, 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)
			//IL_011a: 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 skinMinerDefault = componentInChildren.skins[0];
			SkinDef skinMinerMolten = componentInChildren.skins[1];
			SkinDef skinMinerBlacksmith = componentInChildren.skins[5];
			SkinDef item = SkinsBlack(skinMinerMolten);
			SkinDef item2 = SkinsGold(skinMinerBlacksmith);
			SkinDef item3 = SkinsEmerald(skinMinerDefault);
			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[] array = (componentInChildren.skins = list.ToArray());
			SkinCatalog.skinsByBody[bodyIndex] = array;
		}

		internal static SkinDef SkinsBlack(SkinDef skinMinerMolten)
		{
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			SkinInfo skinInfo = default(SkinInfo);
			skinInfo.name = "skinMiner_Black_1";
			skinInfo.nameToken = "SIMU_SKIN_MINER";
			skinInfo.icon = H.GetIcon("mod/ror1/miner_black");
			skinInfo.original = skinMinerMolten;
			SkinDef val = (SkinDef)(object)H.CreateNewSkin(skinInfo);
			RendererInfo[] rendererInfos = val.skinDefParams.rendererInfos;
			Material val2 = H.CloneMat(rendererInfos, 0);
			((Object)val2).name = "MatMinerBody";
			val2.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Miner/texMinerMolten.png");
			val2.SetTexture("_EmTex", (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Miner/texMinerMoltenEmission.png"));
			val2.SetColor("_EmColor", new Color(1f, 1f, 0f, 1f));
			val2.SetFloat("_EmPower", 4f);
			return val;
		}

		internal static SkinDef SkinsEmerald(SkinDef skinMinerDefault)
		{
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			SkinInfo skinInfo = default(SkinInfo);
			skinInfo.name = "skinMiner_Emerald_1";
			skinInfo.nameToken = "SIMU_SKIN_MINER_EMERALD";
			skinInfo.icon = H.GetIcon("mod/ror1/miner_green");
			skinInfo.original = skinMinerDefault;
			SkinDef val = (SkinDef)(object)H.CreateNewSkin(skinInfo);
			RendererInfo[] rendererInfos = val.skinDefParams.rendererInfos;
			Material val2 = H.CloneMat(rendererInfos, 0);
			val2.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Miner/texMinerDiamond.png");
			val2.SetTexture("_EmTex", (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Miner/texMinerDiamondEmission.png"));
			val2.SetFloat("_EmPower", 0.75f);
			val2.color = new Color(0.6f, 1f, 0.6f);
			return val;
		}

		internal static SkinDef SkinsGold(SkinDef skinMinerBlacksmith)
		{
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			SkinInfo skinInfo = default(SkinInfo);
			skinInfo.name = "skinMiner_1";
			skinInfo.nameToken = "SIMU_SKIN_MINER_ORANGE";
			skinInfo.icon = H.GetIcon("mod/ror1/miner_orange");
			skinInfo.original = skinMinerBlacksmith;
			SkinDef val = (SkinDef)(object)H.CreateNewSkin(skinInfo);
			RendererInfo[] rendererInfos = val.skinDefParams.rendererInfos;
			Material val2 = H.CloneMat(rendererInfos, 0);
			val2.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Miner/texMinerGold.png");
			val2.SetTexture("_EmTex", (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Miner/texMinerGoldEmission.png"));
			val2.SetFloat("_EmPower", 1f);
			val2.color = new Color(1f, 0.6f, 0.6f);
			val2.SetColor("_EmColor", new Color(0.9569f, 0.7176f, 0.7176f, 1f));
			return val;
		}
	}
	public class SkinsSniper
	{
		[RegisterAchievement("CLEAR_ANY_SNIPERCLASSIC", "Skins.SniperClassic.Wolfo.First", null, 5u, null)]
		public class ClearSimulacrumSniperClassic : 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("SniperClassicBody");
			}
		}

		internal static void ModdedSkin(GameObject SniperBody)
		{
			//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)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Sniper Skins");
			BodyIndex bodyIndex = SniperBody.GetComponent<CharacterBody>().bodyIndex;
			ModelSkinController component = ((Component)SniperBody.transform.GetChild(0).GetChild(2)).GetComponent<ModelSkinController>();
			SkinDef skinSniper = component.skins[0];
			SkinDef skinDef = component.skins[1];
			SkinDef val = ModdedSkin_Orange(skinSniper, skinDef.ReturnParams());
			SkinDef val2 = ModdedSkinGRAY(skinSniper, skinDef.ReturnParams());
			SkinCatalog.skinsByBody[bodyIndex] = component.skins;
		}

		internal static SkinDef ModdedSkin_Orange(SkinDef skinSniper, SkinDefParams skinSniperMASTERY)
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			SkinInfo skinInfo = default(SkinInfo);
			skinInfo.name = "skinSniperMix_1";
			skinInfo.nameToken = "SIMU_SKIN_SNIPER";
			skinInfo.icon = H.GetIcon("mod/ror1/sniper_orange");
			skinInfo.original = skinSniper;
			SkinDef val = (SkinDef)(object)H.CreateNewSkin(skinInfo);
			RendererInfo[] rendererInfos = val.skinDefParams.rendererInfos;
			Material val2 = H.CloneFromOriginal(skinSniperMASTERY, 0);
			val2.mainTexture = (Texture)(object)Assets.Bundle.LoadAsset<Texture2D>("Assets/Skins/mod/Sniper/texSniperDefault.png");
			val2.SetColor("_EmColor", new Color(1f, 1f, 1f));
			rendererInfos[0].defaultMaterial = val2;
			rendererInfos[1].defaultMaterial = val2;
			rendererInfos[2].defaultMaterial = val2;
			rendererInfos[3].defaultMaterial = val2;
			rendererInfos[4].defaultMaterial = val2;
			val.skinDefParams.gameObjectActivations = skinSniperMASTERY.gameObjectActivations;
			return val;
		}

		internal static SkinDef ModdedSkinGRAY(SkinDef skinSniper, SkinDefParams skinSniperMASTERY)
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			SkinInfo skinInfo = default(SkinInfo);
			skinInfo.name = "skinSniperMixGray_1";
			skinInfo.nameToken = "SIMU_SKIN