Decompiled source of RailgunnerTinker v1.1.0

NewGenSkillSwapper.dll

Decompiled 3 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
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.Drifter;
using ExtraSkillSlots;
using HG.Reflection;
using Microsoft.CodeAnalysis;
using On.EntityStates.Drifter;
using On.RoR2;
using On.RoR2.Skills;
using R2API;
using RoR2;
using RoR2.EntitlementManagement;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("NewGenSkillSwapper")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+520bdb6a3b54c0d5369dc0992186c0c60bc744ae")]
[assembly: AssemblyProduct("NewGenSkillSwapper")]
[assembly: AssemblyTitle("NewGenSkillSwapper")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace NewGenSkillSwapper
{
	public class ExtraSkillSlotsCompat
	{
		private static SkillDef _dummySkill;

		private static SkillDef GetDummySkill()
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)_dummySkill))
			{
				_dummySkill = ScriptableObject.CreateInstance<SkillDef>();
				_dummySkill.skillName = "ESS_Placeholder";
				((Object)_dummySkill).name = "ESS_Placeholder";
				_dummySkill.skillNameToken = "ESS_PLACEHOLDER_NAME";
				_dummySkill.skillDescriptionToken = "ESS_PLACEHOLDER_DESC";
				_dummySkill.activationStateMachineName = "Weapon";
				_dummySkill.activationState = new SerializableEntityStateType(typeof(Idle));
				_dummySkill.interruptPriority = (InterruptPriority)0;
				_dummySkill.baseRechargeInterval = 1f;
				_dummySkill.baseMaxStock = 1;
				_dummySkill.rechargeStock = 1;
				_dummySkill.beginSkillCooldownOnSkillEnd = false;
				_dummySkill.activationState = new SerializableEntityStateType(typeof(BaseState));
				ContentAddition.AddSkillDef(_dummySkill);
			}
			return _dummySkill;
		}

		public static bool IsEnabled()
		{
			return Chainloader.PluginInfos.ContainsKey("com.KingEnderBrine.ExtraSkillSlots");
		}

		internal static void CreateFirstExtraSkillFamily(GameObject targetPrefab)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Creating First Skill Family...");
			ExtraSkillLocator val = targetPrefab.GetComponent<ExtraSkillLocator>();
			if (!Object.op_Implicit((Object)(object)val))
			{
				val = targetPrefab.AddComponent<ExtraSkillLocator>();
			}
			val.extraFirst = targetPrefab.AddComponent<GenericSkill>();
			SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>();
			((Object)val2).name = ((Object)targetPrefab).name + "_FirstExtraFamily";
			val2.variants = (Variant[])(object)new Variant[1]
			{
				new Variant
				{
					skillDef = GetDummySkill()
				}
			};
			ContentAddition.AddSkillFamily(val2);
			val.extraFirst._skillFamily = val2;
		}

		internal static void CreateSecondExtraSkillFamily(GameObject targetPrefab)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Creating Second Skill Family...");
			ExtraSkillLocator val = targetPrefab.GetComponent<ExtraSkillLocator>();
			if (!Object.op_Implicit((Object)(object)val))
			{
				val = targetPrefab.AddComponent<ExtraSkillLocator>();
			}
			val.extraSecond = targetPrefab.AddComponent<GenericSkill>();
			SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>();
			((Object)val2).name = ((Object)targetPrefab).name + "_SecondExtraFamily";
			val2.variants = (Variant[])(object)new Variant[1]
			{
				new Variant
				{
					skillDef = GetDummySkill()
				}
			};
			ContentAddition.AddSkillFamily(val2);
			val.extraSecond._skillFamily = val2;
		}

		internal static void CreateThirdExtraSkillFamily(GameObject targetPrefab)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Creating Third Skill Family...");
			ExtraSkillLocator val = targetPrefab.GetComponent<ExtraSkillLocator>();
			if (!Object.op_Implicit((Object)(object)val))
			{
				val = targetPrefab.AddComponent<ExtraSkillLocator>();
			}
			val.extraThird = targetPrefab.AddComponent<GenericSkill>();
			SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>();
			((Object)val2).name = ((Object)targetPrefab).name + "_ThirdExtraFamily";
			val2.variants = (Variant[])(object)new Variant[1]
			{
				new Variant
				{
					skillDef = GetDummySkill()
				}
			};
			ContentAddition.AddSkillFamily(val2);
			val.extraThird._skillFamily = val2;
		}

		internal static void CreateFourthExtraSkillFamily(GameObject targetPrefab)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Creating Fourth Skill Family...");
			ExtraSkillLocator val = targetPrefab.GetComponent<ExtraSkillLocator>();
			if (!Object.op_Implicit((Object)(object)val))
			{
				val = targetPrefab.AddComponent<ExtraSkillLocator>();
			}
			val.extraFourth = targetPrefab.AddComponent<GenericSkill>();
			SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>();
			((Object)val2).name = ((Object)targetPrefab).name + "_FourthExtraFamily";
			val2.variants = (Variant[])(object)new Variant[1]
			{
				new Variant
				{
					skillDef = GetDummySkill()
				}
			};
			ContentAddition.AddSkillFamily(val2);
			val.extraFourth._skillFamily = val2;
		}

		internal static void AddExtraSkill(GameObject targetPrefab, SkillDef skillDef, int skillSlot)
		{
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Expected O, but got Unknown
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			ExtraSkillLocator component = targetPrefab.GetComponent<ExtraSkillLocator>();
			SkillFamily val = null;
			if (Object.op_Implicit((Object)(object)component))
			{
				switch (skillSlot)
				{
				case 0:
					val = component.extraFirst.skillFamily;
					break;
				case 1:
					val = component.extraSecond.skillFamily;
					break;
				case 2:
					val = component.extraThird.skillFamily;
					break;
				case 3:
					val = component.extraFourth.skillFamily;
					break;
				}
				Variant val2;
				if ((Object)(object)val.variants[0].skillDef == (Object)(object)GetDummySkill())
				{
					Debug.Log((object)"Filling initial skill...");
					Variant[] variants = val.variants;
					val2 = new Variant
					{
						skillDef = skillDef,
						unlockableName = ""
					};
					((Variant)(ref val2)).viewableNode = new Node(skillDef.skillNameToken, false, (Node)null);
					variants[0] = val2;
				}
				else
				{
					Array.Resize(ref val.variants, val.variants.Length + 1);
					Variant[] variants2 = val.variants;
					int num = val.variants.Length - 1;
					val2 = new Variant
					{
						skillDef = skillDef,
						unlockableName = ""
					};
					((Variant)(ref val2)).viewableNode = new Node(skillDef.skillNameToken, false, (Node)null);
					variants2[num] = val2;
				}
			}
			else
			{
				Debug.LogError((object)"AddExtraSkill called without skillLocator!");
			}
		}

		public static void MatchConfig_ESSCompat(GameObject bodyPrefab, SkillDef skillDef, int skillSlot)
		{
			switch (skillSlot)
			{
			case 0:
				AddExtraSkill(bodyPrefab, skillDef, skillSlot);
				return;
			case 1:
				AddExtraSkill(bodyPrefab, skillDef, skillSlot);
				return;
			case 2:
				AddExtraSkill(bodyPrefab, skillDef, skillSlot);
				return;
			case 3:
				AddExtraSkill(bodyPrefab, skillDef, skillSlot);
				return;
			}
			Debug.LogError((object)("Family is not properly set for " + skillDef.skillName + ", " + ((Object)bodyPrefab).name + "!"));
		}

		internal static void RegisterFamilies()
		{
			foreach (NewGenSkillSwapper.SkillSwapConfig item in NewGenSkillSwapper.skillSwapConfig)
			{
				GameObject val = BodyCatalog.FindBodyPrefab(item.survivorName + "Body");
				if (!Object.op_Implicit((Object)(object)val))
				{
					Debug.Log((object)"ESSCompat - Couldn't find SurvivorDef...");
					continue;
				}
				switch (item.family.ToLower())
				{
				case "extrafirst":
					if (!Object.op_Implicit((Object)(object)val.GetComponent<ExtraSkillLocator>()) || (Object)(object)val.GetComponent<ExtraSkillLocator>() == (Object)null)
					{
						CreateFirstExtraSkillFamily(val);
					}
					else if ((Object)(object)val.GetComponent<ExtraSkillLocator>().extraFirst.skillFamily == (Object)null)
					{
						CreateFirstExtraSkillFamily(val);
					}
					break;
				case "extrasecond":
					if (!Object.op_Implicit((Object)(object)val.GetComponent<ExtraSkillLocator>()) || (Object)(object)val.GetComponent<ExtraSkillLocator>() == (Object)null)
					{
						CreateSecondExtraSkillFamily(val);
					}
					else if ((Object)(object)val.GetComponent<ExtraSkillLocator>().extraSecond.skillFamily == (Object)null)
					{
						CreateSecondExtraSkillFamily(val);
					}
					break;
				case "extrathird":
					if (!Object.op_Implicit((Object)(object)val.GetComponent<ExtraSkillLocator>()) || (Object)(object)val.GetComponent<ExtraSkillLocator>() == (Object)null)
					{
						CreateThirdExtraSkillFamily(val);
					}
					else if ((Object)(object)val.GetComponent<ExtraSkillLocator>().extraThird.skillFamily == (Object)null)
					{
						CreateThirdExtraSkillFamily(val);
					}
					break;
				case "extrafourth":
					if (!Object.op_Implicit((Object)(object)val.GetComponent<ExtraSkillLocator>()) || (Object)(object)val.GetComponent<ExtraSkillLocator>() == (Object)null)
					{
						CreateFourthExtraSkillFamily(val);
					}
					else if ((Object)(object)val.GetComponent<ExtraSkillLocator>().extraFourth.skillFamily == (Object)null)
					{
						CreateFourthExtraSkillFamily(val);
					}
					break;
				default:
					Debug.LogError((object)"ESSCompat - Failed to register...");
					break;
				}
			}
		}
	}
	[BepInPlugin("acanthi.RailgunnerTinker", "RailgunnerTinker", "1.0.0")]
	public class NewGenSkillSwapper : BaseUnityPlugin
	{
		public class SkillSwapConfig
		{
			public string skillName;

			public string survivorName;

			public string family;
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_Init <>9__12_0;

			public static hook_Init <>9__12_1;

			internal void <Awake>b__12_0(orig_Init orig)
			{
				orig.Invoke();
				PrintDebug();
				MatchConfig();
			}

			internal void <Awake>b__12_1(orig_Init orig)
			{
				if (ExtraSkillSlotsCompat.IsEnabled())
				{
					ExtraSkillSlotsCompat.RegisterFamilies();
				}
				orig.Invoke();
			}
		}

		public const string PluginGUID = "acanthi.RailgunnerTinker";

		public const string PluginAuthor = "acanthi";

		public const string PluginName = "RailgunnerTinker";

		public const string PluginVersion = "1.0.0";

		public static List<SkillSwapConfig> skillSwapConfig = new List<SkillSwapConfig>();

		public static ConfigEntry<string> skillsToSwap;

		public static ConfigEntry<bool> debugMode;

		public void ParseConfig()
		{
			skillsToSwap = ((BaseUnityPlugin)this).Config.Bind<string>("RailgunnerTinker", "skillsToSwap", "(Tinker,Railgunner,special)", "This should NOT be touched if you don't know what you're doing. Theoretically you could use this to add Tinker to more survivors but it's not a supported feature. Here be Dragons! A list of skills to swap. Should be formatted like this: (skillDefName,survivorDefName,family),(otherSkillDefName,otherSurvivorDefName,otherFamily)");
			debugMode = ((BaseUnityPlugin)this).Config.Bind<bool>("RailgunnerTinker", "debugMode", false, "Prints all names for skills and survivors.");
			Debug.Log((object)"Parsing Config...");
			string[] array = skillsToSwap.Value.Trim().Split("),(");
			string[] array2 = array;
			string[] array3 = array2;
			foreach (string text in array3)
			{
				Debug.Log((object)text);
				string text2 = text.Trim('(', ')');
				string[] array4 = text2.Split(',');
				skillSwapConfig.Add(new SkillSwapConfig
				{
					skillName = array4[0],
					survivorName = array4[1],
					family = array4[2]
				});
			}
		}

		public static void PrintDebug()
		{
			if (debugMode.Value)
			{
				Debug.Log((object)"Printing skill names... Disable debugMode in config to disable this!");
				foreach (SkillDef allSkillDef in SkillCatalog.allSkillDefs)
				{
					Debug.Log((object)(allSkillDef.skillName + " || Token (for reference, dont use!): " + allSkillDef.skillNameToken));
				}
				Debug.Log((object)"Printing survivor names... Disable debugMode in config to disable this!");
				{
					foreach (SurvivorDef allSurvivorDef in SurvivorCatalog.allSurvivorDefs)
					{
						Debug.Log((object)allSurvivorDef.cachedName);
					}
					return;
				}
			}
			Debug.Log((object)"Skipping logs...");
		}

		public static void MatchConfig()
		{
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			foreach (SkillSwapConfig item in skillSwapConfig)
			{
				int num = SkillCatalog.FindSkillIndexByName(item.skillName);
				if (num == -1)
				{
					Debug.Log((object)"Couldn't find skill. Skipping...");
					continue;
				}
				SkillDef skillDef = SkillCatalog.GetSkillDef(num);
				SurvivorDef val = SurvivorCatalog.FindSurvivorDef(item.survivorName);
				if (!Object.op_Implicit((Object)(object)skillDef) || !Object.op_Implicit((Object)(object)val))
				{
					Debug.Log((object)"Couldn't add skill. Skipping...");
					continue;
				}
				SkillLocator component = val.bodyPrefab.GetComponent<SkillLocator>();
				if (!Object.op_Implicit((Object)component))
				{
					Debug.Log((object)("No SkillLocator on " + val.cachedName + "!"));
					continue;
				}
				switch (item.family.ToLower())
				{
				case "primary":
				{
					SkillFamily skillFamily = component.primary.skillFamily;
					ApplySkillFamilyResize(skillFamily, skillDef);
					break;
				}
				case "secondary":
				{
					SkillFamily skillFamily = component.secondary.skillFamily;
					ApplySkillFamilyResize(skillFamily, skillDef);
					break;
				}
				case "utility":
				{
					SkillFamily skillFamily = component.utility.skillFamily;
					ApplySkillFamilyResize(skillFamily, skillDef);
					break;
				}
				case "special":
				{
					SkillFamily skillFamily = component.special.skillFamily;
					ApplySkillFamilyResize(skillFamily, skillDef);
					break;
				}
				case "passive":
				{
					GenericSkill[] componentsInChildren = val.bodyPrefab.GetComponentsInChildren<GenericSkill>();
					foreach (GenericSkill val2 in componentsInChildren)
					{
						if (((Object)val2._skillFamily).name.Contains("Passive"))
						{
							SkillFamily skillFamily2 = val2._skillFamily;
							ApplySkillFamilyResize(skillFamily2, skillDef);
						}
					}
					break;
				}
				case "extrafirst":
					if (!ExtraSkillSlotsCompat.IsEnabled())
					{
						Debug.Log((object)"ExtraSkillSlots entry detected, but EntrySkillSlots not installed?");
					}
					else
					{
						ExtraSkillSlotsCompat.MatchConfig_ESSCompat(val.bodyPrefab, skillDef, 0);
					}
					break;
				case "extrasecond":
					if (!ExtraSkillSlotsCompat.IsEnabled())
					{
						Debug.Log((object)"ExtraSkillSlots entry detected, but EntrySkillSlots not installed?");
					}
					else
					{
						ExtraSkillSlotsCompat.MatchConfig_ESSCompat(val.bodyPrefab, skillDef, 1);
					}
					break;
				case "extrathird":
					if (!ExtraSkillSlotsCompat.IsEnabled())
					{
						Debug.Log((object)"ExtraSkillSlots entry detected, but EntrySkillSlots not installed?");
					}
					else
					{
						ExtraSkillSlotsCompat.MatchConfig_ESSCompat(val.bodyPrefab, skillDef, 2);
					}
					break;
				case "extrafourth":
					if (!ExtraSkillSlotsCompat.IsEnabled())
					{
						Debug.Log((object)"ExtraSkillSlots entry detected, but EntrySkillSlots not installed?");
					}
					else
					{
						ExtraSkillSlotsCompat.MatchConfig_ESSCompat(val.bodyPrefab, skillDef, 3);
					}
					break;
				default:
					Debug.LogError((object)("Family is not set for " + item.skillName + ", " + item.survivorName + "!"));
					break;
				}
				DrifterSkills.MatchConfig_DrifterExtension(val.bodyPrefab);
			}
		}

		private static void ApplySkillFamilyResize(SkillFamily skillFamily, SkillDef skillDef)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
			Variant[] variants = skillFamily.variants;
			int num = skillFamily.variants.Length - 1;
			Variant val = new Variant
			{
				skillDef = skillDef
			};
			((Variant)(ref val)).viewableNode = new Node(skillDef.skillNameToken, false, (Node)null);
			variants[num] = val;
		}

		private void Awake()
		{
			//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_002d: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			ParseConfig();
			DrifterSkills.Init();
			object obj = <>c.<>9__12_0;
			if (obj == null)
			{
				hook_Init val = delegate(orig_Init orig)
				{
					orig.Invoke();
					PrintDebug();
					MatchConfig();
				};
				<>c.<>9__12_0 = val;
				obj = (object)val;
			}
			SkillCatalog.Init += (hook_Init)obj;
			object obj2 = <>c.<>9__12_1;
			if (obj2 == null)
			{
				hook_Init val2 = delegate(orig_Init orig)
				{
					if (ExtraSkillSlotsCompat.IsEnabled())
					{
						ExtraSkillSlotsCompat.RegisterFamilies();
					}
					orig.Invoke();
				};
				<>c.<>9__12_1 = val2;
				obj2 = (object)val2;
			}
			SurvivorCatalog.Init += (hook_Init)obj2;
		}
	}
	public class DrifterSkills
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_HasRequiredJunk <0>__DrifterSkillDef_HasRequiredJunk;

			public static hook_HasRequiredJunk <1>__DrifterTrackingSkillDef_HasRequiredJunk;

			public static hook_OnExecute <2>__DrifterTrackingSkillDef_OnExecute;

			public static hook_OnExecute <3>__DrifterSkillDef_OnExecute;

			public static hook_OnEnter <4>__CastTinker_OnEnter;

			public static hook_Awake <5>__DrifterTracker_Awake;

			public static hook_OnInventoryChanged <6>__DrifterTrashToTreasureController_OnInventoryChanged;
		}

		public static EntitlementDef alloyedCollectiveEntitlement;

		public static SkillDef tinkerDef;

		public static SkillDef treasureDef;

		private static bool configInitialized;

		public static void Init()
		{
			//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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Expected O, but got Unknown
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Expected O, but got Unknown
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Expected O, but got Unknown
			alloyedCollectiveEntitlement = Addressables.LoadAssetAsync<EntitlementDef>((object)"RoR2/DLC3/entitlementDLC3.asset").WaitForCompletion();
			tinkerDef = SkillCatalog.GetSkillDef(SkillCatalog.FindSkillIndexByName("tinker"));
			treasureDef = SkillCatalog.GetSkillDef(SkillCatalog.FindSkillIndexByName("PassiveStatsFromScrap"));
			object obj = <>O.<0>__DrifterSkillDef_HasRequiredJunk;
			if (obj == null)
			{
				hook_HasRequiredJunk val = DrifterSkillDef_HasRequiredJunk;
				<>O.<0>__DrifterSkillDef_HasRequiredJunk = val;
				obj = (object)val;
			}
			DrifterSkillDef.HasRequiredJunk += (hook_HasRequiredJunk)obj;
			object obj2 = <>O.<1>__DrifterTrackingSkillDef_HasRequiredJunk;
			if (obj2 == null)
			{
				hook_HasRequiredJunk val2 = DrifterTrackingSkillDef_HasRequiredJunk;
				<>O.<1>__DrifterTrackingSkillDef_HasRequiredJunk = val2;
				obj2 = (object)val2;
			}
			DrifterTrackingSkillDef.HasRequiredJunk += (hook_HasRequiredJunk)obj2;
			object obj3 = <>O.<2>__DrifterTrackingSkillDef_OnExecute;
			if (obj3 == null)
			{
				hook_OnExecute val3 = DrifterTrackingSkillDef_OnExecute;
				<>O.<2>__DrifterTrackingSkillDef_OnExecute = val3;
				obj3 = (object)val3;
			}
			DrifterTrackingSkillDef.OnExecute += (hook_OnExecute)obj3;
			object obj4 = <>O.<3>__DrifterSkillDef_OnExecute;
			if (obj4 == null)
			{
				hook_OnExecute val4 = DrifterSkillDef_OnExecute;
				<>O.<3>__DrifterSkillDef_OnExecute = val4;
				obj4 = (object)val4;
			}
			DrifterSkillDef.OnExecute += (hook_OnExecute)obj4;
			object obj5 = <>O.<4>__CastTinker_OnEnter;
			if (obj5 == null)
			{
				hook_OnEnter val5 = CastTinker_OnEnter;
				<>O.<4>__CastTinker_OnEnter = val5;
				obj5 = (object)val5;
			}
			CastTinker.OnEnter += (hook_OnEnter)obj5;
			object obj6 = <>O.<5>__DrifterTracker_Awake;
			if (obj6 == null)
			{
				hook_Awake val6 = DrifterTracker_Awake;
				<>O.<5>__DrifterTracker_Awake = val6;
				obj6 = (object)val6;
			}
			DrifterTracker.Awake += (hook_Awake)obj6;
			object obj7 = <>O.<6>__DrifterTrashToTreasureController_OnInventoryChanged;
			if (obj7 == null)
			{
				hook_OnInventoryChanged val7 = DrifterTrashToTreasureController_OnInventoryChanged;
				<>O.<6>__DrifterTrashToTreasureController_OnInventoryChanged = val7;
				obj7 = (object)val7;
			}
			DrifterTrashToTreasureController.OnInventoryChanged += (hook_OnInventoryChanged)obj7;
		}

		private static void DrifterTrashToTreasureController_OnInventoryChanged(orig_OnInventoryChanged orig, DrifterTrashToTreasureController self)
		{
			CharacterBody val = default(CharacterBody);
			((Component)self).TryGetComponent<CharacterBody>(ref val);
			PlayerCharacterMasterController val2 = default(PlayerCharacterMasterController);
			((Component)val.master).TryGetComponent<PlayerCharacterMasterController>(ref val2);
			PlayerCharacterMasterControllerEntitlementTracker val3 = default(PlayerCharacterMasterControllerEntitlementTracker);
			((Component)val2).TryGetComponent<PlayerCharacterMasterControllerEntitlementTracker>(ref val3);
			if ((Object)(object)val3 == (Object)null)
			{
				Debug.Log((object)"RailgunnerTweaks - Exiting TrashToTreasure because entitlement couldn't be verified.");
				((Behaviour)self).enabled = false;
				return;
			}
			if (!val3.HasEntitlement(alloyedCollectiveEntitlement))
			{
				Debug.Log((object)"RailgunnerTweaks - Exiting TrashToTreasure because player did not pass entitlement.");
				((Behaviour)self).enabled = false;
				return;
			}
			treasureDef = SkillCatalog.GetSkillDef(SkillCatalog.FindSkillIndexByName("PassiveStatsFromScrap"));
			GenericSkill[] componentsInChildren = ((Component)val).GetComponentsInChildren<GenericSkill>();
			foreach (GenericSkill val4 in componentsInChildren)
			{
				if (((Object)val4._skillFamily).name.Contains("Passive"))
				{
					SkillFamily skillFamily = val4._skillFamily;
					if ((Object)(object)val4.skillDef != (Object)(object)treasureDef)
					{
						((Behaviour)self).enabled = false;
						return;
					}
				}
			}
			orig.Invoke(self);
		}

		private static void DrifterTracker_Awake(orig_Awake orig, DrifterTracker self)
		{
			//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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			self.rerollTrackingPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/Drifter/TinkerIndicatorReroll.prefab").WaitForCompletion();
			self.breakTrackingPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/Drifter/TinkerIndicatorBreak.prefab").WaitForCompletion();
			self.invalidTrackingPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/Drifter/TinkerIndicatorBad.prefab").WaitForCompletion();
			orig.Invoke(self);
		}

		public static void MatchConfig_DrifterExtension(GameObject body)
		{
			SkillLocator val = default(SkillLocator);
			if (configInitialized || !body.TryGetComponent<SkillLocator>(ref val))
			{
				return;
			}
			GenericSkill[] array = (GenericSkill[])(object)new GenericSkill[4] { val.primary, val.secondary, val.utility, val.special };
			GenericSkill val2 = null;
			GenericSkill[] array2 = array;
			foreach (GenericSkill val3 in array2)
			{
				if ((Object)(object)val3.skillDef == (Object)(object)tinkerDef)
				{
					val2 = val3;
					break;
				}
			}
			if ((Object)(object)val2 != (Object)null)
			{
				DrifterTracker val4 = body.gameObject.AddComponent<DrifterTracker>();
				val4.skillInstance = val2;
			}
			GenericSkill val5 = null;
			GenericSkill[] componentsInChildren = body.GetComponentsInChildren<GenericSkill>();
			foreach (GenericSkill val6 in componentsInChildren)
			{
				if (((Object)val6._skillFamily).name.Contains("Passive"))
				{
					SkillFamily skillFamily = val6._skillFamily;
					if ((Object)(object)val6.skillDef == (Object)(object)treasureDef)
					{
						val5 = val6;
					}
				}
			}
			if ((Object)(object)val5 != (Object)null)
			{
				DrifterTrashToTreasureController val7 = body.gameObject.AddComponent<DrifterTrashToTreasureController>();
			}
			configInitialized = true;
		}

		private static void CastTinker_OnEnter(orig_OnEnter orig, CastTinker self)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (!((Object)((Component)((EntityState)self).characterBody).gameObject).name.Contains("DrifterBody"))
			{
				PlayerCharacterMasterController val = default(PlayerCharacterMasterController);
				((Component)((EntityState)self).characterBody.master).TryGetComponent<PlayerCharacterMasterController>(ref val);
				PlayerCharacterMasterControllerEntitlementTracker val2 = default(PlayerCharacterMasterControllerEntitlementTracker);
				((Component)val).TryGetComponent<PlayerCharacterMasterControllerEntitlementTracker>(ref val2);
				if ((Object)(object)val2 == (Object)null)
				{
					Debug.Log((object)"RailgunnerTweaks - Exiting CastTinker because entitlement couldn't be verified.");
					return;
				}
				if (!val2.HasEntitlement(alloyedCollectiveEntitlement))
				{
					Debug.Log((object)"RailgunnerTweaks - Exiting CastTinker because player did not pass entitlement.");
					return;
				}
				((GenericProjectileBaseState)self).FireProjectile();
				((GenericProjectileBaseState)self).DoFireEffects();
			}
		}

		private static void DrifterTrackingSkillDef_OnExecute(orig_OnExecute orig, DrifterTrackingSkillDef self, GenericSkill skillSlot)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			InstanceData val = (InstanceData)skillSlot.skillInstanceData;
			skillSlot.stateMachine.SetInterruptState(((SkillDef)self).InstantiateNextState(skillSlot), ((SkillDef)self).interruptPriority);
			if (!Object.op_Implicit((Object)val.junkController))
			{
				skillSlot.stock -= ((SkillDef)self).stockToConsume;
				if (((SkillDef)self).cancelSprintingOnActivation)
				{
					skillSlot.characterBody.isSprinting = false;
				}
				if (((SkillDef)self).resetCooldownTimerOnUse)
				{
					skillSlot.rechargeStopwatch = 0f;
				}
				if (Object.op_Implicit((Object)skillSlot.characterBody))
				{
					skillSlot.characterBody.OnSkillActivated(skillSlot);
				}
			}
			else
			{
				orig.Invoke(self, skillSlot);
			}
		}

		private static void DrifterSkillDef_OnExecute(orig_OnExecute orig, DrifterSkillDef self, GenericSkill skillSlot)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			InstanceData val = (InstanceData)skillSlot.skillInstanceData;
			skillSlot.stateMachine.SetInterruptState(((SkillDef)self).InstantiateNextState(skillSlot), ((SkillDef)self).interruptPriority);
			if (!Object.op_Implicit((Object)val.junkController))
			{
				skillSlot.stock -= ((SkillDef)self).stockToConsume;
				if (((SkillDef)self).cancelSprintingOnActivation)
				{
					skillSlot.characterBody.isSprinting = false;
				}
				if (((SkillDef)self).resetCooldownTimerOnUse)
				{
					skillSlot.rechargeStopwatch = 0f;
				}
				if (Object.op_Implicit((Object)skillSlot.characterBody))
				{
					skillSlot.characterBody.OnSkillActivated(skillSlot);
				}
			}
			else
			{
				orig.Invoke(self, skillSlot);
			}
		}

		private static bool DrifterSkillDef_HasRequiredJunk(orig_HasRequiredJunk orig, DrifterSkillDef self, GenericSkill skillSlot)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			InstanceData val = (InstanceData)skillSlot.skillInstanceData;
			if (!Object.op_Implicit((Object)val.junkController))
			{
				return true;
			}
			return orig.Invoke(self, skillSlot);
		}

		private static bool DrifterTrackingSkillDef_HasRequiredJunk(orig_HasRequiredJunk orig, DrifterTrackingSkillDef self, GenericSkill skillSlot)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)((Component)skillSlot.characterBody).gameObject.GetComponent<DrifterTracker>()))
			{
				((Component)skillSlot.characterBody).gameObject.AddComponent<DrifterTracker>();
			}
			InstanceData val = (InstanceData)skillSlot.skillInstanceData;
			if (!Object.op_Implicit((Object)val.junkController))
			{
				return true;
			}
			return orig.Invoke(self, skillSlot);
		}
	}
}