Decompiled source of RailgunnerTinker v1.3.0

NewGenSkillSwapper.dll

Decompiled 2 weeks 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.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Drifter;
using HG.Reflection;
using Microsoft.CodeAnalysis;
using On.EntityStates.Drifter;
using On.RoR2;
using On.RoR2.Skills;
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+d03435cb4cbe9b8e2b17f13a231269223c272f0c")]
[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]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace NewGenSkillSwapper
{
	public class ExtraSkillSlotsCompat
	{
		public static bool IsEnabled()
		{
			return false;
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInPlugin("acanthi.RailgunnerTinker", "RailgunnerTinker", "1.0.0")]
	public class NewGenSkillSwapper : BaseUnityPlugin
	{
		public class SkillSwapConfig
		{
			public string skillName;

			public string survivorName;

			public string family;
		}

		public class AKBankConfig
		{
			public string survivorOrigin;

			public string survivorTarget;
		}

		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 List<AKBankConfig> akbankConfig = new List<AKBankConfig>();

		public static ConfigEntry<string> skillsToSwap;

		public static ConfigEntry<string> akBankToTransfer;

		public static ConfigEntry<bool> debugMode;

		public void ParseConfig()
		{
			skillsToSwap = ((BaseUnityPlugin)this).Config.Bind<string>("RailgunnerTinker", "skillsToSwap", "(Tinker,Railgunner,special),(PassiveStatsFromScrap,Railgunner,passive),(Tinker,Swarmling,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)");
			akBankToTransfer = ((BaseUnityPlugin)this).Config.Bind<string>("RailgunnerTinker", "akBankToTransfer", "", "This should NOT be touched if you don't know what you're doing. Should be formatted like this (origin -> target): (survivorDefName,survivorDefName)");
			debugMode = ((BaseUnityPlugin)this).Config.Bind<bool>("RailgunnerTinker", "debugMode", false, "Prints all names for skills and survivors.");
			Log.Debug("Parsing Config...");
			string[] array = skillsToSwap.Value.Trim().Split("),(");
			string[] array2 = array;
			string[] array3 = array2;
			foreach (string text in array3)
			{
				if (!string.IsNullOrEmpty(text))
				{
					string text2 = text.Trim('(', ')');
					string[] array4 = text2.Split(',');
					skillSwapConfig.Add(new SkillSwapConfig
					{
						skillName = array4[0],
						survivorName = array4[1],
						family = array4[2]
					});
				}
			}
			string[] array5 = akBankToTransfer.Value.Trim().Split("),(");
			string[] array6 = array5;
			string[] array7 = array6;
			foreach (string text3 in array7)
			{
				if (!string.IsNullOrEmpty(text3))
				{
					string text4 = text3.Trim('(', ')');
					string[] array8 = text4.Split(',');
					akbankConfig.Add(new AKBankConfig
					{
						survivorOrigin = array8[0],
						survivorTarget = array8[1]
					});
				}
			}
		}

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

		public static void MatchConfig()
		{
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Expected O, but got Unknown
			foreach (AKBankConfig item in akbankConfig)
			{
				SurvivorDef val = SurvivorCatalog.FindSurvivorDef(item.survivorOrigin);
				SurvivorDef val2 = SurvivorCatalog.FindSurvivorDef(item.survivorTarget);
				if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2))
				{
					Log.Debug("Couldn't transfer AKBank. Skipping...");
				}
				else
				{
					AddSoundbank(val, val2);
				}
			}
			foreach (SkillSwapConfig item2 in skillSwapConfig)
			{
				int num = SkillCatalog.FindSkillIndexByName(item2.skillName);
				if (num == -1)
				{
					foreach (SkillDef allSkillDef in SkillCatalog.allSkillDefs)
					{
						if (item2.skillName == allSkillDef.skillNameToken)
						{
							num = allSkillDef.skillIndex;
						}
					}
				}
				if (num == -1)
				{
					Log.Debug("Couldn't find skill. Skipping...");
					continue;
				}
				SkillDef skillDef = SkillCatalog.GetSkillDef(num);
				SurvivorDef val3 = SurvivorCatalog.FindSurvivorDef(item2.survivorName);
				if (!Object.op_Implicit((Object)(object)skillDef) || !Object.op_Implicit((Object)(object)val3))
				{
					Log.Debug("Couldn't add skill. Skipping...");
					continue;
				}
				SkillLocator component = val3.bodyPrefab.GetComponent<SkillLocator>();
				if (!Object.op_Implicit((Object)component))
				{
					Log.Debug("No SkillLocator on " + val3.cachedName + "!");
					continue;
				}
				switch (item2.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 = val3.bodyPrefab.GetComponentsInChildren<GenericSkill>();
					foreach (GenericSkill val4 in componentsInChildren)
					{
						if (((Object)val4._skillFamily).name.Contains(val3.cachedName + "Passive") || ((Object)val4._skillFamily).name.Contains(val3.cachedName + "BodyPassive"))
						{
							SkillFamily skillFamily2 = val4._skillFamily;
							ApplySkillFamilyResize(skillFamily2, skillDef);
						}
					}
					break;
				}
				case "extrafirst":
					if (!ExtraSkillSlotsCompat.IsEnabled())
					{
						Log.Debug("ExtraSkillSlots entry detected, but EntrySkillSlots not installed or unsupported?");
					}
					break;
				case "extrasecond":
					if (!ExtraSkillSlotsCompat.IsEnabled())
					{
						Log.Debug("ExtraSkillSlots entry detected, but EntrySkillSlots not installed or unsupported?");
					}
					break;
				case "extrathird":
					if (!ExtraSkillSlotsCompat.IsEnabled())
					{
						Log.Debug("ExtraSkillSlots entry detected, but EntrySkillSlots not installed or unsupported?");
					}
					break;
				case "extrafourth":
					if (!ExtraSkillSlotsCompat.IsEnabled())
					{
						Log.Debug("ExtraSkillSlots entry detected, but EntrySkillSlots not installed or unsupported?");
					}
					break;
				default:
					Log.Error("Family is not set for " + item2.skillName + ", " + item2.survivorName + "!");
					break;
				}
				DrifterSkills.MatchConfig_DrifterExtension(val3.bodyPrefab, num);
			}
		}

		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()
		{
			Log.Init(((BaseUnityPlugin)this).Logger);
			DrifterSkills.Awake();
			ParseConfig();
		}

		[SystemInitializer(new Type[]
		{
			typeof(SkillCatalog),
			typeof(SurvivorCatalog)
		})]
		public static void Init()
		{
			DrifterSkills.Init();
			MatchConfig();
			PrintDebug();
		}

		public static void AddSoundbank(SurvivorDef survivorOrigin, SurvivorDef survivorTarget)
		{
			try
			{
				GameObject bodyPrefab = survivorOrigin.bodyPrefab;
				GameObject bodyPrefab2 = survivorTarget.bodyPrefab;
				AkBank component = bodyPrefab.GetComponent<AkBank>();
				CopyAkBank(component, bodyPrefab2);
			}
			catch
			{
				Log.Debug("NewGenSkillSwapper - Failed to copy AKBank from " + survivorOrigin.cachedName + " to " + survivorTarget.cachedName);
			}
		}

		public static void CopyAkBank(AkBank original, GameObject destination)
		{
			Type type = ((object)original).GetType();
			Component obj = destination.AddComponent(type);
			FieldInfo[] fields = type.GetFields();
			FieldInfo[] array = fields;
			foreach (FieldInfo fieldInfo in array)
			{
				fieldInfo.SetValue(obj, fieldInfo.GetValue(original));
			}
		}
	}
	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_Start <6>__DrifterTrashToTreasureController_Start;
		}

		public static EntitlementDef dlc3EntitlementDef;

		public static SkillDef tinkerSkillDef;

		public static SkillDef passiveStatsFromScrapSkillDef;

		public static GameObject rerollTrackingPrefab;

		public static GameObject breakTrackingPrefab;

		public static GameObject invalidTrackingPrefab;

		public static Dictionary<PlayerCharacterMasterController, bool> cachedDlc3EntitlementResult = new Dictionary<PlayerCharacterMasterController, bool>();

		private static bool configInitialized = false;

		public static void Awake()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0032: 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_003d: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			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_Start;
			if (obj7 == null)
			{
				hook_Start val7 = DrifterTrashToTreasureController_Start;
				<>O.<6>__DrifterTrashToTreasureController_Start = val7;
				obj7 = (object)val7;
			}
			DrifterTrashToTreasureController.Start += (hook_Start)obj7;
		}

		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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			dlc3EntitlementDef = Addressables.LoadAssetAsync<EntitlementDef>((object)"RoR2/DLC3/entitlementDLC3.asset").WaitForCompletion();
			tinkerSkillDef = SkillCatalog.GetSkillDef(SkillCatalog.FindSkillIndexByName("Tinker"));
			passiveStatsFromScrapSkillDef = SkillCatalog.GetSkillDef(SkillCatalog.FindSkillIndexByName("PassiveStatsFromScrap"));
			rerollTrackingPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/Drifter/TinkerIndicatorReroll.prefab").WaitForCompletion();
			breakTrackingPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/Drifter/TinkerIndicatorBreak.prefab").WaitForCompletion();
			invalidTrackingPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/Drifter/TinkerIndicatorBad.prefab").WaitForCompletion();
		}

		public static bool IsDLC3Entitled(CharacterMaster master)
		{
			PlayerCharacterMasterController pcmc = default(PlayerCharacterMasterController);
			if (((Component)master).TryGetComponent<PlayerCharacterMasterController>(ref pcmc))
			{
				return IsDLC3Entitled(pcmc);
			}
			return false;
		}

		public static bool IsDLC3Entitled(PlayerCharacterMasterController pcmc)
		{
			if (cachedDlc3EntitlementResult.ContainsKey(pcmc))
			{
				return cachedDlc3EntitlementResult[pcmc];
			}
			bool flag = false;
			PlayerCharacterMasterControllerEntitlementTracker val = default(PlayerCharacterMasterControllerEntitlementTracker);
			if (((Component)pcmc).TryGetComponent<PlayerCharacterMasterControllerEntitlementTracker>(ref val) && (Object)(object)val != (Object)null && val.HasEntitlement(dlc3EntitlementDef))
			{
				flag = true;
			}
			cachedDlc3EntitlementResult[pcmc] = flag;
			return flag;
		}

		private static void DrifterTrashToTreasureController_Start(orig_Start orig, DrifterTrashToTreasureController self)
		{
			CharacterBody val = default(CharacterBody);
			if (!((Component)self).TryGetComponent<CharacterBody>(ref val))
			{
				return;
			}
			bool flag = false;
			GenericSkill[] components = ((Component)val).GetComponents<GenericSkill>();
			foreach (GenericSkill val2 in components)
			{
				if ((Object)(object)passiveStatsFromScrapSkillDef == (Object)null)
				{
					passiveStatsFromScrapSkillDef = SkillCatalog.GetSkillDef(SkillCatalog.FindSkillIndexByName("PassiveStatsFromScrap"));
				}
				if ((Object)(object)val2.skillDef == (Object)(object)passiveStatsFromScrapSkillDef)
				{
					flag = true;
				}
			}
			if (!flag || !IsDLC3Entitled(val.master))
			{
				Log.Debug("SkillDef either doesn't match or didn't pass entitlement! DrifterTrashToTreasureController_Start disabling and returning.");
				((Behaviour)self).enabled = false;
			}
			else
			{
				orig.Invoke(self);
			}
		}

		private static void DrifterTracker_Awake(orig_Awake orig, DrifterTracker self)
		{
			DrifterTracker val = self;
			if (val.rerollTrackingPrefab == null)
			{
				val.rerollTrackingPrefab = rerollTrackingPrefab;
			}
			val = self;
			if (val.breakTrackingPrefab == null)
			{
				val.breakTrackingPrefab = breakTrackingPrefab;
			}
			val = self;
			if (val.invalidTrackingPrefab == null)
			{
				val.invalidTrackingPrefab = invalidTrackingPrefab;
			}
			orig.Invoke(self);
		}

		public static void MatchConfig_DrifterExtension(GameObject bodyPrefab, int skillIdx)
		{
			if (skillIdx == passiveStatsFromScrapSkillDef.skillIndex)
			{
				TryAddTrashToTreasureController(bodyPrefab);
			}
			if (skillIdx == tinkerSkillDef.skillIndex)
			{
				TryAddDrifterTracker(bodyPrefab);
			}
		}

		public static void TryAddDrifterTracker(GameObject bodyPrefab)
		{
			if (!Object.op_Implicit((Object)(object)bodyPrefab.gameObject.GetComponent<DrifterTracker>()))
			{
				DrifterTracker val = bodyPrefab.gameObject.AddComponent<DrifterTracker>();
			}
			else
			{
				DrifterTracker val = bodyPrefab.gameObject.GetComponent<DrifterTracker>();
			}
		}

		public static void TryAddTrashToTreasureController(GameObject bodyPrefab)
		{
			if (!Object.op_Implicit((Object)(object)bodyPrefab.GetComponent<DrifterTrashToTreasureController>()))
			{
				bodyPrefab.AddComponent<DrifterTrashToTreasureController>();
			}
		}

		private static void CastTinker_OnEnter(orig_OnEnter orig, CastTinker self)
		{
			orig.Invoke(self);
			if ((Object)(object)((EntityState)self).characterBody != (Object)(object)Survivors.Drifter.bodyPrefab && IsDLC3Entitled(((EntityState)self).characterBody.master))
			{
				((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);
		}
	}
}