Decompiled source of MinerSkillReturns v1.0.1

MinerSkillReturns.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DiggerPlugin;
using EntityStates;
using EntityStates.Bandit2;
using EntityStates.Digger;
using HG;
using IL.RoR2.UI;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using On.EntityStates;
using On.RoR2;
using On.RoR2.UI;
using PassiveAgression.ModCompat;
using R2API;
using RoR2;
using RoR2.Skills;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.UI;

[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("MinerSkillReturns")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ea7a57ac5190360172084d86053441cddf8f29a2")]
[assembly: AssemblyProduct("MinerSkillReturns")]
[assembly: AssemblyTitle("MinerSkillReturns")]
[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 MinerSkillReturns
{
	public class AddContent
	{
		public static void Init()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Expected O, but got Unknown
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Expected O, but got Unknown
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			BlazingHeart.HeatActive = ScriptableObject.CreateInstance<BuffDef>();
			BlazingHeart.HeatActive.canStack = false;
			((Object)BlazingHeart.HeatActive).name = Language.GetString("MinerSkillReturns_HEATACTIVE".ToUpper());
			BlazingHeart.HeatActive.iconSprite = Main.AssetBundle.LoadAsset<Sprite>("Assets/minerbuffiicon.png");
			BlazingHeart.HeatActive.buffColor = Color.white;
			ContentAddition.AddBuffDef(BlazingHeart.HeatActive);
			Sprite sprite = Addressables.LoadAssetAsync<Sprite>((object)"Assets/RoR2/Base/UI/Generic UI/Textures/texUIMainHealthbar.png").WaitForCompletion();
			BlazingHeart.Crosshair = new GameObject("Blazing Heart Crosshair");
			RectTransform val = BlazingHeart.Crosshair.AddComponent<RectTransform>();
			((Transform)val).position = new Vector3(32f, 0f, 0f);
			val.pivot = Vector2.oneVector * 0.5f;
			BlazingHeart.BlazingHeartUI blazingHeartUI = BlazingHeart.Crosshair.AddComponent<BlazingHeart.BlazingHeartUI>();
			GameObject val2 = new GameObject("Backdrop");
			RectTransform val3 = val2.AddComponent<RectTransform>();
			((Transform)val3).position = new Vector3(32f, 0f, 0f);
			((Transform)val3).SetParent((Transform)(object)val);
			val3.pivot = Vector2.oneVector * 0.5f;
			val3.sizeDelta = new Vector2(12f, 32f);
			CanvasRenderer val4 = val2.AddComponent<CanvasRenderer>();
			Image val5 = val2.AddComponent<Image>();
			val5.sprite = sprite;
			val5.fillAmount = 1f;
			val5.fillCenter = true;
			((Graphic)val5).color = new Color(0.1321f, 0.043f, 0.0705f, 0.7725f);
			GameObject val6 = new GameObject("Heat");
			RectTransform val7 = val6.AddComponent<RectTransform>();
			((Transform)val7).position = new Vector3(32f, 0f, 0f);
			((Transform)val7).SetParent((Transform)(object)val);
			val7.pivot = Vector2.oneVector * 0.5f;
			val7.sizeDelta = new Vector2(12f, 0f);
			CanvasRenderer val8 = val6.AddComponent<CanvasRenderer>();
			Image val9 = val6.AddComponent<Image>();
			val9.sprite = sprite;
			val9.fillAmount = 1f;
			val9.fillCenter = true;
			((Graphic)val9).color = new Color(1f, 0.4f, 0f, 1f);
			Object.DontDestroyOnLoad((Object)(object)BlazingHeart.Crosshair);
			GameObject val10 = new GameObject("HeatText");
			RectTransform val11 = val10.AddComponent<RectTransform>();
			((Transform)val11).position = new Vector3(32f, -24f, 0f);
			((Transform)val11).SetParent((Transform)(object)val);
			HGTextMeshProUGUI val12 = val10.AddComponent<HGTextMeshProUGUI>();
			((TMP_Text)val12).fontSize = 16f;
			((TMP_Text)val12).alignment = (TextAlignmentOptions)4098;
			((Graphic)val12).color = new Color(1f, 0.4f, 0f, 1f);
			Burnout.BurnoutState.effect = LegacyResourcesAPI.LoadAsync<GameObject>("Prefabs/Effects/OmniEffect/OmniExplosionVFXCommandoGrenade").WaitForCompletion();
		}
	}
	public class BlazingHeart : Skill
	{
		public class BlazingHeartUI : MonoBehaviour
		{
			public Image img;

			public HGTextMeshProUGUI text;

			public float blink = 0f;

			public void Start()
			{
				img = ((Component)((Component)this).gameObject.transform.Find("Heat")).GetComponent<Image>();
				text = ((Component)((Component)this).gameObject.transform.Find("HeatText")).GetComponent<HGTextMeshProUGUI>();
				UpdateHeat(0f);
			}

			public void Update()
			{
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				if (!(blink <= 0f))
				{
					blink -= Time.deltaTime;
					if (blink <= 0f)
					{
						((Graphic)img).color = new Color(1f, 0.4f, 0f, 1f);
						((Graphic)text).color = new Color(1f, 0.4f, 0f, 1f);
					}
				}
			}

			public void UpdateHeat(float heat)
			{
				//IL_0029: 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_0056: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
				((Component)img).transform.localPosition = new Vector3(0f, 16f * heat / 100f - 16f, 0f);
				((RectTransform)((Component)img).transform).sizeDelta = new Vector2(12f, 32f * heat / 100f);
				if (Main.DisplayPercentage.Value)
				{
					((TMP_Text)text).text = Mathf.Floor(heat) + "%";
				}
				blink = 0.15f;
				((Graphic)img).color = new Color(1f, 0.8f, 0.5f, 1f);
				((Graphic)text).color = new Color(1f, 0.8f, 0.5f, 1f);
			}
		}

		public class BlazingHeartManager : MonoBehaviour
		{
			[SyncVar]
			public float heat = 0f;

			public float time = 0f;

			public float time2 = 0f;

			public BlazingHeartUI ui;

			public void Update()
			{
				//IL_00da: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)((Component)this).gameObject) || !Object.op_Implicit((Object)(object)((Component)this).gameObject.GetComponent<CharacterBody>()))
				{
					return;
				}
				CharacterBody component = ((Component)this).gameObject.GetComponent<CharacterBody>();
				if (!component.HasBuff(HeatActive))
				{
					return;
				}
				time += Time.deltaTime;
				time2 += Time.deltaTime;
				if (time2 > 0.3f)
				{
					time2 %= 0.3f;
					if (Object.op_Implicit((Object)(object)ui))
					{
						ui.blink = 0.15f;
						((Graphic)((Component)ui.img).GetComponent<Image>()).color = new Color(1f, 0.8f, 0.5f, 1f);
					}
				}
				while (time > 1f)
				{
					time -= 1f;
					Decrement(100f / Main.PassiveDrain.Value);
					if (heat <= 0f)
					{
						time = 0f;
						time2 = 0f;
						break;
					}
				}
			}

			public void Increment(float amount)
			{
				//IL_0089: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b9: Expected O, but got Unknown
				if (!Object.op_Implicit((Object)(object)((Component)this).gameObject) || !Object.op_Implicit((Object)(object)((Component)this).gameObject.GetComponent<CharacterBody>()))
				{
					return;
				}
				CharacterBody component = ((Component)this).gameObject.GetComponent<CharacterBody>();
				float num = heat + amount;
				if (num >= 100f)
				{
					heat = 100f;
					if (!component.HasBuff(HeatActive))
					{
						component.AddBuff(HeatActive);
						EffectManager.SpawnEffect(StealthMode.smokeBombEffectPrefab, new EffectData
						{
							rootObject = ((Component)this).gameObject,
							scale = 1.5f,
							origin = component.footPosition
						}, false);
						Util.PlaySound("Play_mage_m1_shoot", ((Component)this).gameObject);
						Util.PlaySound("Play_mage_m1_impact", ((Component)this).gameObject);
						Util.PlaySound("Play_teamWarCry_activate", ((Component)this).gameObject);
						BurnEffectController val = ((Component)this).gameObject.AddComponent<BurnEffectController>();
						val.effectType = BurnEffectController.normalEffect;
						val.target = ((Component)component.modelLocator.modelTransform).gameObject;
					}
				}
				else
				{
					heat = num;
				}
				if (Object.op_Implicit((Object)(object)ui))
				{
					ui.UpdateHeat(heat);
				}
			}

			public void Decrement(float amount)
			{
				if (Object.op_Implicit((Object)(object)((Component)this).gameObject) && Object.op_Implicit((Object)(object)((Component)this).gameObject.GetComponent<CharacterBody>()))
				{
					CharacterBody component = ((Component)this).gameObject.GetComponent<CharacterBody>();
					float num = heat - amount;
					if (num <= 0f)
					{
						component.RemoveBuff(HeatActive);
						heat = 0f;
						Util.PlaySound("Play_UI_chest_unlock", ((Component)component).gameObject);
						Util.PlaySound("Play_bandit_shift_jump", ((Component)component).gameObject);
						Object.Destroy((Object)(object)((Component)this).gameObject.GetComponent<BurnEffectController>());
					}
					else
					{
						heat = num;
					}
					if (Object.op_Implicit((Object)(object)ui))
					{
						ui.UpdateHeat(heat);
					}
				}
			}
		}

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

			public static hook_RecalculateStats <>9__3_0;

			internal void <Init>b__3_0(orig_RecalculateStats orig, CharacterBody self)
			{
				orig.Invoke(self);
				if (Object.op_Implicit((Object)(object)self) && self.HasBuff(HeatActive))
				{
					self.skillLocator.secondary.cooldownScale = 0f;
					if ((Object)(object)self.skillLocator.utility.skillDef != (Object)(object)Burnout.Instance)
					{
						self.skillLocator.utility.cooldownScale = 0f;
					}
					self.skillLocator.special.cooldownScale = 0f;
				}
			}
		}

		public static BuffDef HeatActive;

		public static GameObject Crosshair;

		public static BlazingHeart Instance;

		public Action<Run> unhook;

		public Hook _Hook4;

		public static List<CharacterBody> eligibleM1 = new List<CharacterBody>();

		public override void Init()
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			Instance = this;
			Main.StringFormats.Add("MINERSKILLRETURNS_BLAZINGHEART_KEYWORD", new object[1] { Main.M1Multiplier.Value });
			((SkillDef)this).icon = Main.AssetBundle.LoadAsset<Sprite>("Assets/Blazing_Heart.png");
			((SkillDef)this).keywordTokens = new string[1] { "MINERSKILLRETURNS_BLAZINGHEART_KEYWORD" };
			((SkillDef)this).baseRechargeInterval = 0f;
			((SkillDef)this).activationStateMachineName = "Body";
			((SkillDef)this).activationState = EntityStateMachine.FindByCustomName(Main.Miner, "Body").mainStateType;
			((SkillDef)this).canceledFromSprinting = false;
			((SkillDef)this).cancelSprintingOnActivation = false;
			object obj = <>c.<>9__3_0;
			if (obj == null)
			{
				hook_RecalculateStats val = delegate(orig_RecalculateStats orig, CharacterBody self)
				{
					orig.Invoke(self);
					if (Object.op_Implicit((Object)(object)self) && self.HasBuff(HeatActive))
					{
						self.skillLocator.secondary.cooldownScale = 0f;
						if ((Object)(object)self.skillLocator.utility.skillDef != (Object)(object)Burnout.Instance)
						{
							self.skillLocator.utility.cooldownScale = 0f;
						}
						self.skillLocator.special.cooldownScale = 0f;
					}
				};
				<>c.<>9__3_0 = val;
				obj = (object)val;
			}
			CharacterBody.RecalculateStats += (hook_RecalculateStats)obj;
		}

		public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot)
		{
			OnHook();
			unhook = delegate
			{
				OnUnhook();
				Run.onRunDestroyGlobal -= unhook;
			};
			Run.onRunDestroyGlobal += unhook;
			return null;
		}

		public override void OnUnassigned([NotNull] GenericSkill skillSlot)
		{
			((SkillDef)this).OnUnassigned(skillSlot);
			EntityState state = skillSlot.stateMachine.state;
			if (state != null && state is DiggerMain)
			{
				state.OnEnter();
			}
		}

		public void OnHook()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			eligibleM1.Clear();
			BaseState.OnEnter += new hook_OnEnter(Hook);
			GlobalEventManager.onServerDamageDealt += Hook2;
			GlobalEventManager.onClientDamageNotified += Hook22;
			CrosshairManager.UpdateCrosshair += new hook_UpdateCrosshair(Hook3);
			_Hook4 = new Hook((MethodBase)typeof(DiggerMain).GetMethod("OnEnter"), (Delegate)new Action<Action<DiggerMain>, DiggerMain>(Hook4));
		}

		public void OnUnhook()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			BaseState.OnEnter -= new hook_OnEnter(Hook);
			GlobalEventManager.onServerDamageDealt -= Hook2;
			GlobalEventManager.onClientDamageNotified -= Hook22;
			CrosshairManager.UpdateCrosshair -= new hook_UpdateCrosshair(Hook3);
			_Hook4.Free();
		}

		public void Hook(orig_OnEnter orig, BaseState self)
		{
			orig.Invoke(self);
			if (!PassiveEnabled((EntityState)(object)self))
			{
				return;
			}
			BlazingHeartManager blazingHeartManager = default(BlazingHeartManager);
			if (!((Component)((EntityState)self).characterBody).gameObject.TryGetComponent<BlazingHeartManager>(ref blazingHeartManager))
			{
				((Component)((EntityState)self).characterBody).gameObject.AddComponent<BlazingHeartManager>();
			}
			Type type = ((object)self).GetType();
			if (((SerializableEntityStateType)(ref ((EntityState)self).characterBody.skillLocator.primary.skillDef.activationState)).stateType == type)
			{
				if (((EntityState)self).characterBody.HasBuff(HeatActive))
				{
					self.damageStat *= Main.M1Multiplier.Value / 100f;
				}
				OnM1(((EntityState)self).characterBody);
			}
			if (((SerializableEntityStateType)(ref ((EntityState)self).characterBody.skillLocator.secondary.skillDef.activationState)).stateType == type)
			{
				OnM2(((EntityState)self).characterBody);
			}
			if (((SerializableEntityStateType)(ref ((EntityState)self).characterBody.skillLocator.utility.skillDef.activationState)).stateType == type)
			{
				OnUtil(((EntityState)self).characterBody);
			}
			if (((SerializableEntityStateType)(ref ((EntityState)self).characterBody.skillLocator.special.skillDef.activationState)).stateType == type)
			{
				OnSpecial(((EntityState)self).characterBody);
			}
		}

		public void Hook2(DamageReport report)
		{
			BlazingHeartManager blazingHeartManager = default(BlazingHeartManager);
			if (report != null && Object.op_Implicit((Object)(object)report.attackerBody) && Object.op_Implicit((Object)(object)((Component)report.attackerBody).gameObject) && ((Component)report.attackerBody).gameObject.TryGetComponent<BlazingHeartManager>(ref blazingHeartManager) && eligibleM1.Contains(report.attackerBody))
			{
				eligibleM1.Remove(report.attackerBody);
				((Component)report.attackerBody).gameObject.GetComponent<BlazingHeartManager>().Increment(Main.M1Gain.Value);
			}
		}

		public void Hook22(DamageDealtMessage report)
		{
			BlazingHeartManager blazingHeartManager = default(BlazingHeartManager);
			if (report != null && Object.op_Implicit((Object)(object)report.attacker) && Object.op_Implicit((Object)(object)report.attacker.GetComponent<CharacterBody>()) && Object.op_Implicit((Object)(object)((Component)report.attacker.GetComponent<CharacterBody>()).gameObject) && ((Component)report.attacker.GetComponent<CharacterBody>()).gameObject.TryGetComponent<BlazingHeartManager>(ref blazingHeartManager) && eligibleM1.Contains(report.attacker.GetComponent<CharacterBody>()))
			{
				eligibleM1.Remove(report.attacker.GetComponent<CharacterBody>());
				report.attacker.GetComponent<BlazingHeartManager>().Increment(Main.M1Gain.Value);
			}
		}

		public void Hook3(orig_UpdateCrosshair orig, CrosshairManager self, CharacterBody targetBody, Vector3 crosshairWorldPosition, Camera uiCamera)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, targetBody, crosshairWorldPosition, uiCamera);
			BlazingHeartManager blazingHeartManager = default(BlazingHeartManager);
			if (Object.op_Implicit((Object)(object)targetBody) && NetworkUser.localPlayers.Any((NetworkUser x) => (Object)(object)x.GetCurrentBody() == (Object)(object)targetBody) && Object.op_Implicit((Object)(object)((Component)targetBody).gameObject) && ((Component)targetBody).gameObject.TryGetComponent<BlazingHeartManager>(ref blazingHeartManager) && !Object.op_Implicit((Object)(object)((Component)targetBody).gameObject.GetComponent<BlazingHeartManager>().ui))
			{
				GameObject val = PrefabAPI.InstantiateClone(Crosshair, "Blazing Heart Crosshair(Clone)", false);
				val.transform.SetParent(((Component)self).gameObject.transform.Find("MainContainer/MainUIArea/CrosshairCanvas/CrosshairExtras"));
				val.transform.localPosition = new Vector3(32f, 0f, 0f);
				val.transform.localScale = new Vector3(1f, 1f, 1f);
				((Component)targetBody).gameObject.GetComponent<BlazingHeartManager>().ui = val.GetComponent<BlazingHeartUI>();
			}
		}

		public void Hook4(Action<DiggerMain> orig, DiggerMain self)
		{
			orig(self);
			BlazingHeartManager blazingHeartManager = default(BlazingHeartManager);
			if (Object.op_Implicit((Object)(object)((EntityState)self).gameObject) && ((EntityState)self).gameObject.TryGetComponent<BlazingHeartManager>(ref blazingHeartManager))
			{
				self.gotJunkie = true;
				self.adrenalineCap = -1f;
			}
		}

		public bool PassiveEnabled(EntityState self)
		{
			//IL_0024: 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)
			return Object.op_Implicit((Object)(object)self.characterBody) && Object.op_Implicit((Object)(object)Main.Miner.GetComponent<CharacterBody>()) && self.characterBody.bodyIndex == Main.Miner.GetComponent<CharacterBody>().bodyIndex && Object.op_Implicit((Object)(object)self.characterBody.skillLocator) && self.characterBody.skillLocator.allSkills.Any((GenericSkill x) => (Object)(object)x.skillDef == (Object)(object)this);
		}

		public static void OnM1(CharacterBody characterBody)
		{
			if (!eligibleM1.Contains(characterBody))
			{
				eligibleM1.Add(characterBody);
			}
		}

		public static bool IsHeat(CharacterBody body, out BlazingHeartManager manager)
		{
			manager = null;
			if (!Object.op_Implicit((Object)(object)body) || !body.HasBuff(HeatActive) || !Object.op_Implicit((Object)(object)((Component)body).gameObject) || !Object.op_Implicit((Object)(object)((Component)body).gameObject.GetComponent<BlazingHeartManager>()))
			{
				return false;
			}
			manager = ((Component)body).gameObject.GetComponent<BlazingHeartManager>();
			return true;
		}

		public static void OnM2(CharacterBody characterBody)
		{
			eligibleM1.Remove(characterBody);
			if (IsHeat(characterBody, out var manager) && manager.heat >= Main.M2Cost.Value)
			{
				manager.Decrement(Main.M2Cost.Value);
			}
		}

		public static void OnUtil(CharacterBody characterBody)
		{
			eligibleM1.Remove(characterBody);
			if (IsHeat(characterBody, out var manager) && manager.heat >= Main.UtilCost.Value)
			{
				manager.Decrement(Main.UtilCost.Value);
			}
		}

		public static void OnSpecial(CharacterBody characterBody)
		{
			eligibleM1.Remove(characterBody);
			if (IsHeat(characterBody, out var manager) && manager.heat >= Main.SpecialCost.Value)
			{
				manager.Decrement(Main.SpecialCost.Value);
			}
		}
	}
	public class Burnout : Skill
	{
		public class BurnoutState : BaseSkillState
		{
			public static GameObject effect;

			public float baseDuration = 0.35f;

			private float duration;

			public override void OnEnter()
			{
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: 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_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Expected O, but got Unknown
				//IL_009a: Unknown result type (might be due to invalid IL or missing references)
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ce: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f3: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_0104: Unknown result type (might be due to invalid IL or missing references)
				//IL_0110: Unknown result type (might be due to invalid IL or missing references)
				//IL_012c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0149: Unknown result type (might be due to invalid IL or missing references)
				//IL_014b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0150: Unknown result type (might be due to invalid IL or missing references)
				//IL_015b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0162: Unknown result type (might be due to invalid IL or missing references)
				//IL_0167: Unknown result type (might be due to invalid IL or missing references)
				//IL_016c: Unknown result type (might be due to invalid IL or missing references)
				//IL_016f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0174: Unknown result type (might be due to invalid IL or missing references)
				//IL_0179: Unknown result type (might be due to invalid IL or missing references)
				//IL_017b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0181: Expected O, but got Unknown
				//IL_0182: Unknown result type (might be due to invalid IL or missing references)
				//IL_0188: Unknown result type (might be due to invalid IL or missing references)
				//IL_018d: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d9: 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_01e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0203: Unknown result type (might be due to invalid IL or missing references)
				//IL_020a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0215: Unknown result type (might be due to invalid IL or missing references)
				//IL_021b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0221: Unknown result type (might be due to invalid IL or missing references)
				//IL_0223: Unknown result type (might be due to invalid IL or missing references)
				//IL_0228: Unknown result type (might be due to invalid IL or missing references)
				//IL_022e: Expected O, but got Unknown
				//IL_023e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0244: 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_024e: Unknown result type (might be due to invalid IL or missing references)
				((BaseState)this).OnEnter();
				duration = baseDuration;
				((EntityState)this).PlayAnimation("FullBody, Override", "Flip", "Flip.playbackRate", 1f, 0f);
				EffectManager.SpawnEffect(effect, new EffectData
				{
					origin = ((EntityState)this).characterBody.corePosition,
					scale = 1.5f
				}, false);
				Util.PlaySound("Play_captain_shift_impact", ((EntityState)this).gameObject);
				Util.PlaySound("Play_commando_shift", ((EntityState)this).gameObject);
				((EntityState)this).characterBody.characterMotor.velocity = Vector3.ProjectOnPlane(((EntityState)this).characterBody.characterMotor.velocity, ((EntityState)this).gameObject.transform.up) + ((EntityState)this).gameObject.transform.up * 10f;
				BlastAttack val = new BlastAttack
				{
					radius = 14f,
					procCoefficient = 1f,
					position = ((EntityState)this).characterBody.corePosition,
					attacker = ((EntityState)this).gameObject,
					crit = Util.CheckRoll(((BaseState)this).critStat, ((EntityState)this).characterBody.master),
					baseDamage = ((BaseState)this).damageStat * Main.BurnoutDamage.Value / 100f,
					falloffModel = (FalloffModel)0,
					baseForce = 500f,
					teamIndex = TeamComponent.GetObjectTeam(((EntityState)this).gameObject),
					damageType = DamageTypeCombo.op_Implicit((DamageType)32),
					attackerFiltering = (AttackerFiltering)2
				};
				val.Fire();
				DamageInfo val2 = new DamageInfo
				{
					damage = (Main.BurnoutMaxHP.Value ? ((EntityState)this).characterBody.healthComponent.fullHealth : ((EntityState)this).characterBody.healthComponent.health) * Main.BurnoutSelfDamage.Value / 100f,
					position = ((EntityState)this).characterBody.corePosition,
					force = Vector3.zero,
					damageColorIndex = (DamageColorIndex)0,
					attacker = null,
					inflictor = null,
					crit = false,
					procCoefficient = 0f,
					procChainMask = default(ProcChainMask),
					damageType = DamageTypeCombo.op_Implicit((DamageType)2)
				};
				if (Main.BurnoutPreventSuicide.Value)
				{
					val2.damageType |= DamageTypeCombo.op_Implicit((DamageType)1);
				}
				((EntityState)this).characterBody.healthComponent.TakeDamage(val2);
				BlazingHeart.BlazingHeartManager blazingHeartManager = default(BlazingHeart.BlazingHeartManager);
				if (((EntityState)this).gameObject.TryGetComponent<BlazingHeart.BlazingHeartManager>(ref blazingHeartManager))
				{
					blazingHeartManager.Increment(Main.BurnoutGain.Value);
				}
			}

			public override void FixedUpdate()
			{
				((EntityState)this).FixedUpdate();
				if ((((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority) || !((BaseSkillState)this).IsKeyDownAuthority())
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}

			public override InterruptPriority GetMinimumInterruptPriority()
			{
				return (InterruptPriority)2;
			}
		}

		public static Burnout Instance;

		public override void Init()
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			Main.StringFormats.Add("MINERSKILLRETURNS_BURNOUT_DESC", new object[4]
			{
				Main.BurnoutDamage.Value,
				Main.BurnoutSelfDamage.Value,
				Main.BurnoutGain.Value,
				Main.BurnoutPreventSuicide.Value ? "Cannot die from self-damage." : ""
			});
			bool flag = default(bool);
			ContentAddition.AddEntityState<BurnoutState>(ref flag);
			((SkillDef)this).icon = Main.AssetBundle.LoadAsset<Sprite>("Assets/Burnout.png");
			((SkillDef)this).activationState = new SerializableEntityStateType(typeof(BurnoutState));
			((SkillDef)this).activationStateMachineName = "Weapon";
			((SkillDef)this).baseMaxStock = 1;
			((SkillDef)this).isCombatSkill = true;
			((SkillDef)this).baseRechargeInterval = 5f;
			((SkillDef)this).interruptPriority = (InterruptPriority)1;
		}
	}
	public class HookPassive
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_FromSkillSlot <>9__2_0;

			public static Func<Instruction, bool> <>9__2_4;

			public static Func<Instruction, bool> <>9__2_5;

			public static Func<Instruction, bool> <>9__2_6;

			public static Action<List<StripDisplayData>, StripDisplayData, GenericSkill> <>9__2_7;

			public static Manipulator <>9__2_1;

			public static Func<Instruction, bool> <>9__2_8;

			public static Func<Row, Row> <>9__2_9;

			public static Manipulator <>9__2_2;

			internal object <HookOurself>b__2_0(orig_FromSkillSlot orig, LoadoutPanelController owner, BodyIndex bodyIndex, int skillSlotIndex, GenericSkill skillSlot)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Expected O, but got Unknown
				Row val = (Row)orig.Invoke(owner, bodyIndex, skillSlotIndex, skillSlot);
				if (((Object)skillSlot.skillFamily).name.Contains("Passive"))
				{
					Transform val2 = ((Transform)val.rowPanelTransform).Find("SlotLabel") ?? ((Transform)val.rowPanelTransform).Find("LabelContainer").Find("SlotLabel");
					if (Object.op_Implicit((Object)(object)val2))
					{
						((Component)val2).GetComponent<LanguageTextMeshController>().token = "Passive";
					}
				}
				return val;
			}

			internal void <HookOurself>b__2_1(ILContext il)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Expected O, but got Unknown
				//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
				<>c__DisplayClass2_0 CS$<>8__locals0 = new <>c__DisplayClass2_0();
				ILCursor val = new ILCursor(il);
				CS$<>8__locals0.skillIndex = -1;
				ILLabel val2 = default(ILLabel);
				val.GotoNext(new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref CS$<>8__locals0.skillIndex),
					(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(GenericSkill).GetField("hideInCharacterSelect")),
					(Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref val2)
				});
				val.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(List<StripDisplayData>).GetMethod("Add"))
				});
				val.Remove();
				val.Emit(OpCodes.Ldloc, CS$<>8__locals0.skillIndex);
				val.EmitDelegate<Action<List<StripDisplayData>, StripDisplayData, GenericSkill>>((Action<List<StripDisplayData>, StripDisplayData, GenericSkill>)delegate(List<StripDisplayData> list, StripDisplayData disp, GenericSkill ski)
				{
					//IL_0026: 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)
					if (((Object)ski.skillFamily).name.Contains("Passive"))
					{
						list.Insert(0, disp);
					}
					else
					{
						list.Add(disp);
					}
				});
			}

			internal bool <HookOurself>b__2_4(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdfld(x, typeof(GenericSkill).GetField("hideInCharacterSelect"));
			}

			internal bool <HookOurself>b__2_5(Instruction x)
			{
				ILLabel val = default(ILLabel);
				return ILPatternMatchingExt.MatchBrtrue(x, ref val);
			}

			internal bool <HookOurself>b__2_6(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(List<StripDisplayData>).GetMethod("Add"));
			}

			internal void <HookOurself>b__2_7(List<StripDisplayData> list, StripDisplayData disp, GenericSkill ski)
			{
				//IL_0026: 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)
				if (((Object)ski.skillFamily).name.Contains("Passive"))
				{
					list.Insert(0, disp);
				}
				else
				{
					list.Add(disp);
				}
			}

			internal void <HookOurself>b__2_2(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				ILCursor val = new ILCursor(il);
				val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(Row).GetMethod("FromSkillSlot"))
				});
				val.EmitDelegate<Func<Row, Row>>((Func<Row, Row>)delegate(Row orig)
				{
					Transform val2 = ((Transform)orig.rowPanelTransform).Find("SlotLabel") ?? ((Transform)orig.rowPanelTransform).Find("LabelContainer").Find("SlotLabel");
					if (Object.op_Implicit((Object)(object)val2) && ((Component)val2).GetComponent<LanguageTextMeshController>().token == "Passive")
					{
						((Transform)orig.rowPanelTransform).SetSiblingIndex(0);
					}
					return orig;
				});
			}

			internal bool <HookOurself>b__2_8(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(Row).GetMethod("FromSkillSlot"));
			}

			internal Row <HookOurself>b__2_9(Row orig)
			{
				Transform val = ((Transform)orig.rowPanelTransform).Find("SlotLabel") ?? ((Transform)orig.rowPanelTransform).Find("LabelContainer").Find("SlotLabel");
				if (Object.op_Implicit((Object)(object)val) && ((Component)val).GetComponent<LanguageTextMeshController>().token == "Passive")
				{
					((Transform)orig.rowPanelTransform).SetSiblingIndex(0);
				}
				return orig;
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass2_0
		{
			public int skillIndex;

			internal bool <HookOurself>b__3(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdloc(x, ref skillIndex);
			}
		}

		public static SkillFamily MinerPassive;

		public static void ReusePassiveAgression()
		{
			MinerPassive = DiggerBlacksmithPassive.slot.family;
		}

		public static void HookOurself()
		{
			//IL_00de: 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)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Expected O, but got Unknown
			//IL_0132: 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_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Expected O, but got Unknown
			//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_018c: Expected O, but got Unknown
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Expected O, but got Unknown
			GenericSkill val = Main.Miner.AddComponent<GenericSkill>();
			SkillLocator component = Main.Miner.GetComponent<SkillLocator>();
			component.passiveSkill.enabled = false;
			val._skillFamily = ScriptableObject.CreateInstance<SkillFamily>();
			MinerPassive = val.skillFamily;
			((Object)MinerPassive).name = ((Object)Main.Miner).name + "Passive";
			SkillDef val2 = ScriptableObject.CreateInstance<SkillDef>();
			val2.skillNameToken = component.passiveSkill.skillNameToken;
			val2.skillDescriptionToken = component.passiveSkill.skillDescriptionToken;
			val2.keywordTokens = ((component.passiveSkill.keywordToken.Length <= 0) ? null : new string[1] { component.passiveSkill.keywordToken });
			((Object)val2).name = val2.skillNameToken;
			val2.baseRechargeInterval = 0f;
			val2.activationStateMachineName = "Body";
			val2.activationState = new SerializableEntityStateType(typeof(DiggerMain));
			val2.icon = component.passiveSkill.icon;
			ContentAddition.AddSkillDef(val2);
			SkillFamily minerPassive = MinerPassive;
			Variant[] array = new Variant[1];
			Variant val3 = new Variant
			{
				skillDef = val2
			};
			((Variant)(ref val3)).viewableNode = new Node(val2.skillNameToken, false, (Node)null);
			array[0] = val3;
			minerPassive.variants = (Variant[])(object)array;
			ContentAddition.AddSkillFamily(MinerPassive);
			object obj = <>c.<>9__2_0;
			if (obj == null)
			{
				hook_FromSkillSlot val4 = delegate(orig_FromSkillSlot orig, LoadoutPanelController owner, BodyIndex bodyIndex, int skillSlotIndex, GenericSkill skillSlot)
				{
					//IL_0003: Unknown result type (might be due to invalid IL or missing references)
					//IL_000d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0013: Expected O, but got Unknown
					Row val11 = (Row)orig.Invoke(owner, bodyIndex, skillSlotIndex, skillSlot);
					if (((Object)skillSlot.skillFamily).name.Contains("Passive"))
					{
						Transform val12 = ((Transform)val11.rowPanelTransform).Find("SlotLabel") ?? ((Transform)val11.rowPanelTransform).Find("LabelContainer").Find("SlotLabel");
						if (Object.op_Implicit((Object)(object)val12))
						{
							((Component)val12).GetComponent<LanguageTextMeshController>().token = "Passive";
						}
					}
					return val11;
				};
				<>c.<>9__2_0 = val4;
				obj = (object)val4;
			}
			Row.FromSkillSlot += (hook_FromSkillSlot)obj;
			object obj2 = <>c.<>9__2_1;
			if (obj2 == null)
			{
				Manipulator val5 = delegate(ILContext il)
				{
					//IL_0008: Unknown result type (might be due to invalid IL or missing references)
					//IL_000e: Expected O, but got Unknown
					//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
					ILCursor val9 = new ILCursor(il);
					int skillIndex = -1;
					ILLabel val10 = default(ILLabel);
					val9.GotoNext(new Func<Instruction, bool>[3]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref skillIndex),
						(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(GenericSkill).GetField("hideInCharacterSelect")),
						(Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref val10)
					});
					val9.GotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(List<StripDisplayData>).GetMethod("Add"))
					});
					val9.Remove();
					val9.Emit(OpCodes.Ldloc, skillIndex);
					val9.EmitDelegate<Action<List<StripDisplayData>, StripDisplayData, GenericSkill>>((Action<List<StripDisplayData>, StripDisplayData, GenericSkill>)delegate(List<StripDisplayData> list, StripDisplayData disp, GenericSkill ski)
					{
						//IL_0026: 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)
						if (((Object)ski.skillFamily).name.Contains("Passive"))
						{
							list.Insert(0, disp);
						}
						else
						{
							list.Add(disp);
						}
					});
				};
				<>c.<>9__2_1 = val5;
				obj2 = (object)val5;
			}
			CharacterSelectController.BuildSkillStripDisplayData += (Manipulator)obj2;
			object obj3 = <>c.<>9__2_2;
			if (obj3 == null)
			{
				Manipulator val6 = delegate(ILContext il)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Expected O, but got Unknown
					ILCursor val7 = new ILCursor(il);
					val7.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(Row).GetMethod("FromSkillSlot"))
					});
					val7.EmitDelegate<Func<Row, Row>>((Func<Row, Row>)delegate(Row orig)
					{
						Transform val8 = ((Transform)orig.rowPanelTransform).Find("SlotLabel") ?? ((Transform)orig.rowPanelTransform).Find("LabelContainer").Find("SlotLabel");
						if (Object.op_Implicit((Object)(object)val8) && ((Component)val8).GetComponent<LanguageTextMeshController>().token == "Passive")
						{
							((Transform)orig.rowPanelTransform).SetSiblingIndex(0);
						}
						return orig;
					});
				};
				<>c.<>9__2_2 = val6;
				obj3 = (object)val6;
			}
			LoadoutPanelController.Rebuild += (Manipulator)obj3;
		}
	}
	[BepInPlugin("prodzpod.MinerSkillReturns", "MinerSkillReturns", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Main : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_GetLocalizedStringByToken <>9__24_0;

			internal string <Awake>b__24_0(orig_GetLocalizedStringByToken orig, Language self, string token)
			{
				if (StringFormats.TryGetValue(token, out var value))
				{
					string text = orig.Invoke(self, token);
					for (int i = 0; i < value.Length; i++)
					{
						text = text.Replace($"{{{i}}}", value[i]?.ToString() ?? "Null");
					}
					return text;
				}
				return orig.Invoke(self, token);
			}
		}

		public const string PluginGUID = "prodzpod.MinerSkillReturns";

		public const string PluginAuthor = "prodzpod";

		public const string PluginName = "MinerSkillReturns";

		public const string PluginVersion = "1.0.0";

		public static ManualLogSource Log;

		public static PluginInfo pluginInfo;

		public static ConfigFile Config;

		public static ConfigEntry<float> M1Gain;

		public static ConfigEntry<float> PassiveDrain;

		public static ConfigEntry<float> M1Multiplier;

		public static ConfigEntry<float> M2Cost;

		public static ConfigEntry<float> UtilCost;

		public static ConfigEntry<float> SpecialCost;

		public static ConfigEntry<bool> DisplayPercentage;

		public static ConfigEntry<float> BurnoutDamage;

		public static ConfigEntry<float> BurnoutSelfDamage;

		public static ConfigEntry<float> BurnoutGain;

		public static ConfigEntry<bool> BurnoutMaxHP;

		public static ConfigEntry<bool> BurnoutPreventSuicide;

		private static AssetBundle _assetBundle;

		public static Dictionary<string, object[]> StringFormats = new Dictionary<string, object[]>();

		public static GameObject Miner;

		public static AssetBundle AssetBundle
		{
			get
			{
				if ((Object)(object)_assetBundle == (Object)null)
				{
					_assetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(pluginInfo.Location), "minerskillreturns"));
				}
				return _assetBundle;
			}
		}

		public void Awake()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Expected O, but got Unknown
			pluginInfo = ((BaseUnityPlugin)this).Info;
			Log = ((BaseUnityPlugin)this).Logger;
			Config = new ConfigFile(Path.Combine(Paths.ConfigPath, "prodzpod.MinerSkillReturns.cfg"), true);
			M1Gain = Config.Bind<float>("Blazing Heart", "Heat gain per M1", 9f, "100 is max");
			PassiveDrain = Config.Bind<float>("Blazing Heart", "Passive heat loss on scorching", 20f, "in seconds");
			M1Multiplier = Config.Bind<float>("Blazing Heart", "M1 Damage Multiplier on scorching", 154f, "in % of bar, default is returns value");
			M2Cost = Config.Bind<float>("Blazing Heart", "M2 heat drain per free use", 10f, "in % of bar, made smth up");
			UtilCost = Config.Bind<float>("Blazing Heart", "Util heat drain per free use", 5f, "in % of bar, made smth up");
			SpecialCost = Config.Bind<float>("Blazing Heart", "Special heat drain per free use", 20f, "in % of bar, default is returns value");
			DisplayPercentage = Config.Bind<bool>("Blazing Heart", "Display Percentage", true, "next to hud bar");
			BurnoutDamage = Config.Bind<float>("Burnout", "Damage Coefficient", 500f, "in %, default is returns value");
			BurnoutSelfDamage = Config.Bind<float>("Burnout", "Self Damage %", 25f, "default is returns value");
			BurnoutGain = Config.Bind<float>("Burnout", "Heat gain %", 25f, "default is returns value");
			BurnoutMaxHP = Config.Bind<bool>("Burnout", "Use max HP", false, "if false, uses current remaining hp.");
			BurnoutPreventSuicide = Config.Bind<bool>("Burnout", "Prevent Suicide", true, "does not die from using burnout. default is returns value");
			AddContent.Init();
			object obj = <>c.<>9__24_0;
			if (obj == null)
			{
				hook_GetLocalizedStringByToken val = delegate(orig_GetLocalizedStringByToken orig, Language self, string token)
				{
					if (StringFormats.TryGetValue(token, out var value))
					{
						string text = orig.Invoke(self, token);
						for (int i = 0; i < value.Length; i++)
						{
							text = text.Replace($"{{{i}}}", value[i]?.ToString() ?? "Null");
						}
						return text;
					}
					return orig.Invoke(self, token);
				};
				<>c.<>9__24_0 = val;
				obj = (object)val;
			}
			Language.GetLocalizedStringByToken += (hook_GetLocalizedStringByToken)obj;
		}

		public void Start()
		{
			Miner = DiggerPlugin.characterBodyPrefab;
			if (Chainloader.PluginInfos.ContainsKey("xyz.yekoc.PassiveAgression"))
			{
				HookPassive.ReusePassiveAgression();
			}
			else
			{
				HookPassive.HookOurself();
			}
			ScriptableObject.CreateInstance<BlazingHeart>()._Init().Add(HookPassive.MinerPassive);
			ScriptableObject.CreateInstance<Burnout>()._Init().Add(Miner.GetComponent<SkillLocator>().utility.skillFamily);
		}
	}
	public abstract class Skill : SkillDef
	{
		public Skill _Init()
		{
			Init();
			base.skillNameToken = ("MinerSkillReturns_" + ((object)this).GetType().Name).ToUpper();
			base.skillDescriptionToken = base.skillNameToken + "_DESC";
			ContentAddition.AddSkillDef((SkillDef)(object)this);
			return this;
		}

		public virtual void Init()
		{
		}

		public void Add(SkillFamily family)
		{
			//IL_0009: 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_002b: Expected O, but got Unknown
			ref Variant[] variants = ref family.variants;
			Variant val = new Variant
			{
				skillDef = (SkillDef)(object)this
			};
			((Variant)(ref val)).viewableNode = new Node(base.skillNameToken, false, (Node)null);
			ArrayUtils.ArrayAppend<Variant>(ref variants, ref val);
		}
	}
}