Decompiled source of NefariousWuckleMod v1.1.0

NefariousWuckleMod/NefariousWuckleMod.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using NefariousWuckleMod.Perks;
using NefariousWuckleMod.Perks.Bindings;
using NefariousWuckleMod.Perks.Experimentals;
using TrinketAndBindingFramework;
using UnityEngine;
using UnityEngine.SceneManagement;

[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("NefariousWuckleMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NefariousWuckleMod")]
[assembly: AssemblyTitle("NefariousWuckleMod")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 NefariousWuckleMod
{
	public static class BindingLoader
	{
		public static readonly List<BindingDefinition> Bindings = new List<BindingDefinition>
		{
			Fragility.Create(),
			Comboed.Create()
		};

		public static void RegisterBindings()
		{
			foreach (BindingDefinition binding in Bindings)
			{
				Perk perk = binding.Perk;
				TrinketRegistry.RegisterBinding(perk.id, perk.title, perk.description, perk.flavorText, perk.cost, binding.ScoreMultiplierBonus, binding.ScoreBonus, perk.icon, (Func<List<Item_Object>>)null, (Func<List<Perk>>)(() => new List<Perk> { perk }), 0);
			}
		}
	}
	public static class Loader
	{
		[HarmonyPatch(typeof(CL_AssetManager), "Initialize")]
		public static class AssetRegistration
		{
			[HarmonyPostfix]
			public static void Postfix()
			{
				if (registered)
				{
					return;
				}
				WKAssetDatabase val = ScriptableObject.CreateInstance<WKAssetDatabase>();
				val.id = "nefariousWuckleModPerks";
				List<BindingDefinition> bindings = BindingLoader.Bindings;
				List<ExperimentalDefinition> list = new List<ExperimentalDefinition>
				{
					BleedingEdge.Create(),
					FalseMemory.Create()
				};
				List<PerkDefinition> list2 = new List<PerkDefinition> { Dividends.Create() };
				foreach (BindingDefinition item in bindings)
				{
					item.Perk.tags = new List<string> { "nefariouswucklemod" };
					val.perkAssets.Add(item.Perk);
					Debug.Log((object)("[NefariousWuckleMod] Registered Binding " + item.Perk.title));
				}
				foreach (ExperimentalDefinition item2 in list)
				{
					item2.Perk.tags = new List<string> { "nefariouswucklemod" };
					val.perkAssets.Add(item2.Perk);
					Debug.Log((object)("[NefariousWuckleMod] Registered Experimental Perk " + item2.Perk.title));
				}
				foreach (PerkDefinition item3 in list2)
				{
					item3.Perk.tags = new List<string> { "nefariouswucklemod" };
					val.perkAssets.Add(item3.Perk);
					Debug.Log((object)("[NefariousWuckleMod] Registered Perk " + item3.Perk.title));
				}
				CL_AssetManager.AddNewDatabase(val.id, val);
				BindingLoader.RegisterBindings();
				registered = true;
				Debug.Log((object)"[NefariousWuckleMod] Registration finished");
			}
		}

		private static bool registered;

		public static void Initialize()
		{
			Debug.Log((object)"[NefariousWuckleMod] Initializing...");
		}
	}
	[BepInPlugin("com.NefariousWuckleMod", "Nefarious Wuckle Mod", "1.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class NefariousPlugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("com.NefariousWuckleMod");
			val.PatchAll();
			MethodInfo methodInfo = AccessTools.Method(typeof(Hand), "DamageGripStrength", (Type[])null, (Type[])null);
			Patches patchInfo = Harmony.GetPatchInfo((MethodBase)methodInfo);
			((BaseUnityPlugin)this).Logger.LogInfo((object)((patchInfo == null) ? "DamageGripStrength: NO PATCHES" : $"DamageGripStrength: {patchInfo.Prefixes.Count} PREFIXES"));
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"Bleeding Edge patches: {patchInfo?.Prefixes.Count ?? 0}");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"engaging nefarious wuckle deeds");
			Loader.Initialize();
		}

		private void OnSceneLoad(Scene scene, LoadSceneMode mode)
		{
			if (!(((Scene)(ref scene)).name != "Game-Main"))
			{
				CommandConsole.hasCheated = true;
			}
		}
	}
}
namespace NefariousWuckleMod.Perks
{
	public class PerkDefinition
	{
		public Perk Perk { get; set; }

		public PerkDefinition(Perk perk)
		{
			Perk = perk;
		}
	}
	public static class Dividends
	{
		private class ItemSnapshot
		{
			public string prefabName;

			public int worth;

			public ItemSnapshot(Item item)
			{
				prefabName = item.prefabName;
				worth = item.worth;
			}
		}

		[HarmonyPatch(typeof(SaveState), "LoadSave")]
		private static class LoadSavePatch
		{
			private static void Postfix(SaveState __instance, object[] __args, ref IEnumerator __result)
			{
				if (__result == null || (Object)(object)CL_GameManager.gMan == (Object)null || !CL_GameManager.gMan.IsReviving() || (__args.Length != 0 && __args[0] != null))
				{
					return;
				}
				FieldInfo fieldInfo = AccessTools.Field(typeof(SaveState), "type");
				if (fieldInfo == null)
				{
					return;
				}
				object value = fieldInfo.GetValue(__instance);
				if (value == null || value.ToString() != "disk")
				{
					return;
				}
				FieldInfo fieldInfo2 = AccessTools.Field(typeof(SaveState), "playerData");
				if (fieldInfo2 == null)
				{
					return;
				}
				object? value2 = fieldInfo2.GetValue(__instance);
				SaveData val = (SaveData)((value2 is SaveData) ? value2 : null);
				if (val == null || !val.HasPerk("nefariouswucklemod_dividends_perk"))
				{
					return;
				}
				List<ItemSnapshot> before = SnapshotSaveData(val);
				ENT_Player player = ENT_Player.GetPlayer();
				if (!((Object)(object)player == (Object)null))
				{
					Perk perk = player.GetPerk("nefariouswucklemod_dividends_perk");
					if (!((Object)(object)perk == (Object)null))
					{
						int stackAmount = perk.GetStackAmount();
						__result = AwardAfterLoad(__result, before, stackAmount);
					}
				}
			}
		}

		private static PerkDefinition? instance;

		public static PerkDefinition Create()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			if (instance != null)
			{
				return instance;
			}
			Perk val = ScriptableObject.CreateInstance<Perk>();
			val.title = "Dividends";
			val.id = "nefariouswucklemod_dividends_perk";
			val.description = "+Upon revival by disk, gain roaches equal to a proportion of the value of lost items.\r\n+Additional stacks increase the proportion of value refunded.";
			val.flavorText = "Company insurance policies are pricey, but worth it.";
			val.perkType = (PerkType)0;
			val.canStack = true;
			val.stackMax = 5;
			val.useBuff = false;
			val.modules = new List<PerkModule>();
			WKAssetDatabase fullCombinedAssetDatabase = CL_AssetManager.GetFullCombinedAssetDatabase();
			if ((Object)(object)fullCombinedAssetDatabase != (Object)null && fullCombinedAssetDatabase.perkAssets != null)
			{
				Perk val2 = ((IEnumerable<Perk>)fullCombinedAssetDatabase.perkAssets).FirstOrDefault((Func<Perk, bool>)((Perk p) => (Object)(object)p != (Object)null && p.id == "Perk_DeepPockets"));
				if ((Object)(object)val2 != (Object)null)
				{
					val.icon = val2.icon;
				}
			}
			instance = new PerkDefinition(val);
			return instance;
		}

		private static void AddSnapshot(List<ItemSnapshot> result, Item item)
		{
			if (item != null)
			{
				result.Add(new ItemSnapshot(item));
			}
		}

		private static List<ItemSnapshot> SnapshotSaveData(SaveData data)
		{
			List<ItemSnapshot> result = new List<ItemSnapshot>();
			if (data == null)
			{
				return result;
			}
			if (data.inventory != null)
			{
				Item[] inventory = data.inventory;
				foreach (Item item in inventory)
				{
					AddSnapshot(result, item);
				}
			}
			if (data.handInventory != null)
			{
				Item[] handInventory = data.handInventory;
				foreach (Item item2 in handInventory)
				{
					AddSnapshot(result, item2);
				}
			}
			AddPouchSnapshots(result, data.pouchInventory);
			AddPouchSnapshots(result, data.pocketInventory);
			return result;
		}

		private static void AddPouchSnapshots(List<ItemSnapshot> result, PouchSaveData[] pouches)
		{
			if (pouches == null)
			{
				return;
			}
			foreach (PouchSaveData val in pouches)
			{
				if (val.items == null)
				{
					continue;
				}
				foreach (Item item in val.items)
				{
					AddSnapshot(result, item);
				}
			}
		}

		private static List<ItemSnapshot> SnapshotCurrentInventory(ENT_Player player)
		{
			List<ItemSnapshot> result = new List<ItemSnapshot>();
			if ((Object)(object)player == (Object)null || (Object)(object)Inventory.instance == (Object)null)
			{
				return result;
			}
			Inventory val = Inventory.instance;
			if (val.bagItems != null)
			{
				foreach (Item bagItem in val.bagItems)
				{
					if (bagItem == null)
					{
						continue;
					}
					bool flag = false;
					foreach (Pouch allPouch in val.GetAllPouches())
					{
						if (allPouch.pouchItems.Contains(bagItem))
						{
							flag = true;
							break;
						}
					}
					if (!flag)
					{
						AddSnapshot(result, bagItem);
					}
				}
			}
			ItemHand[] itemHands = val.itemHands;
			foreach (ItemHand val2 in itemHands)
			{
				if (val2 != null)
				{
					AddSnapshot(result, val2.currentItem);
				}
			}
			foreach (Pouch allPouch2 in val.GetAllPouches())
			{
				if (allPouch2.pouchItems == null)
				{
					continue;
				}
				foreach (Item pouchItem in allPouch2.pouchItems)
				{
					AddSnapshot(result, pouchItem);
				}
			}
			return result;
		}

		private static int CalculateCompensation(List<ItemSnapshot> before, List<ItemSnapshot> after, int stacks)
		{
			float num = (float)Mathf.Clamp(stacks, 0, 5) * 0.2f;
			bool[] array = new bool[after.Count];
			int num2 = 0;
			foreach (ItemSnapshot item in before)
			{
				bool flag = false;
				for (int i = 0; i < after.Count; i++)
				{
					if (!array[i] && after[i].prefabName == item.prefabName)
					{
						array[i] = true;
						flag = true;
						break;
					}
				}
				if (!flag)
				{
					int num3 = Mathf.FloorToInt((float)item.worth * num);
					num2 += Mathf.Max(0, num3);
				}
			}
			return num2;
		}

		private static void AwardCompensation(List<ItemSnapshot> before, int stacks)
		{
			ENT_Player player = ENT_Player.GetPlayer();
			if (!((Object)(object)player == (Object)null))
			{
				List<ItemSnapshot> after = SnapshotCurrentInventory(player);
				int num = CalculateCompensation(before, after, stacks);
				if (num > 0)
				{
					CL_GameManager.AddRoaches(num, false);
					Debug.Log((object)("[Dividends] Awarded " + num + " compensation roaches."));
				}
			}
		}

		private static IEnumerator AwardAfterLoad(IEnumerator original, List<ItemSnapshot> before, int stacks)
		{
			try
			{
				while (original.MoveNext())
				{
					yield return original.Current;
				}
			}
			finally
			{
				(original as IDisposable)?.Dispose();
			}
			AwardCompensation(before, stacks);
		}
	}
}
namespace NefariousWuckleMod.Perks.Experimentals
{
	public class ExperimentalDefinition : PerkDefinition
	{
		public ExperimentalDefinition(Perk perk)
			: base(perk)
		{
		}
	}
	public static class BleedingEdge
	{
		[HarmonyPatch(typeof(ENT_Player), "Update")]
		public static class BleedingEdgePatch
		{
			private static float damage;

			[HarmonyPostfix]
			public static void Postfix(ENT_Player __instance)
			{
				if (!__instance.HasPerk("nefariouswucklemod_bleedingedge_experimental"))
				{
					return;
				}
				float currentGripStrengthTimer = __instance.GetCurrentGripStrengthTimer(0);
				float currentGripStrengthTimer2 = __instance.GetCurrentGripStrengthTimer(1);
				bool flag = __instance.hands[0].gripStrength < currentGripStrengthTimer * 0.5f;
				bool flag2 = __instance.hands[1].gripStrength < currentGripStrengthTimer2 * 0.5f;
				if ((flag || flag2) && !(((GameEntity)__instance).health <= 1f))
				{
					float num = 1f * Time.deltaTime;
					damage += num;
					if (damage >= 1f)
					{
						((GameEntity)__instance).Damage(DamageInfo.CreateDamageInfo(damage, "bleeding_edge", new List<string> { "dontkill" }, (GameEntity)null));
						damage = 0f;
					}
					if (flag)
					{
						__instance.hands[0].AddGripStrength(1.5f * num);
					}
					if (flag2)
					{
						__instance.hands[1].AddGripStrength(1.5f * num);
					}
				}
			}
		}

		private static ExperimentalDefinition? instance;

		public static ExperimentalDefinition Create()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Expected O, but got Unknown
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Expected O, but got Unknown
			//IL_01b1: Expected O, but got Unknown
			if (instance != null)
			{
				return instance;
			}
			Perk val = ScriptableObject.CreateInstance<Perk>();
			val.title = "Bleeding Edge";
			val.id = "nefariouswucklemod_bleedingedge_experimental";
			val.description = "+Increased walking and jumping speed.\r\n+Increased stamina regeneration below 50% health.\r\n-Drains health to restore your stamina.";
			val.flavorText = "Progress, at any cost.";
			val.perkType = (PerkType)3;
			val.canStack = true;
			val.stackMax = 5;
			val.useBuff = true;
			val.buffMultiplier = 1f;
			val.multiplierCurve = AnimationCurve.Linear(0f, 1f, 1f, 1f);
			val.modules = new List<PerkModule>();
			WKAssetDatabase fullCombinedAssetDatabase = CL_AssetManager.GetFullCombinedAssetDatabase();
			if ((Object)(object)fullCombinedAssetDatabase != (Object)null && fullCombinedAssetDatabase.perkAssets != null)
			{
				Perk val2 = ((IEnumerable<Perk>)fullCombinedAssetDatabase.perkAssets).FirstOrDefault((Func<Perk, bool>)((Perk p) => (Object)(object)p != (Object)null && p.id == "Perk_U_T1_EmployeeMotivator"));
				if ((Object)(object)val2 != (Object)null)
				{
					val.icon = val2.icon;
				}
			}
			val.buff = new BuffContainer
			{
				id = "nefariouswucklemod_bleedingedge_experimental_buff",
				loseOverTime = false,
				loseRate = 0f,
				buffTime = 1f,
				multiplier = 1f,
				loseRateEffectedByPerks = false,
				buffs = new List<Buff>
				{
					new Buff
					{
						id = "addSpeed",
						maxAmount = 0.1f,
						amount = 0.1f
					},
					new Buff
					{
						id = "addJump",
						maxAmount = 0.1f,
						amount = 0.1f
					}
				}
			};
			instance = new ExperimentalDefinition(val);
			return instance;
		}
	}
	public static class FalseMemory
	{
		[HarmonyPatch(typeof(HandItem_Food), "Eat")]
		public class FalseMemoryFoodPatch
		{
			[HarmonyPrefix]
			public static void Prefix(HandItem_Food __instance, out (Item? clone, bool active) __state)
			{
				ENT_Player player = ((Hand_Base)__instance).hand.GetPlayer();
				bool flag = player.HasPerk("nefariouswucklemod_falsememory_experimental");
				__state = (clone: flag ? ((HandItem)__instance).item.GetClone((Item)null, false) : null, active: flag);
			}

			[HarmonyPostfix]
			public static void Postfix(HandItem_Food __instance, (Item? clone, bool active) __state)
			{
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				if (__state.active && __state.clone != null)
				{
					ENT_Player player = ((Hand_Base)__instance).hand.GetPlayer();
					Inventory.instance.AddItemToInventoryScreen(new Vector3(0f, 0f, 1f), __state.clone, true, false, true);
					player.RemovePerk("nefariouswucklemod_falsememory_experimental", false);
				}
			}
		}

		[HarmonyPatch(typeof(HandItem_Buff), "StartBuff")]
		public class FalseMemoryBuffPatch
		{
			[HarmonyPrefix]
			public static void Prefix(HandItem_Buff __instance, out (Item? clone, bool active) __state)
			{
				if (__instance is HandItem_Buff_Grub)
				{
					__state = (clone: null, active: false);
					return;
				}
				ENT_Player player = ((Hand_Base)__instance).hand.GetPlayer();
				bool flag = player.HasPerk("nefariouswucklemod_falsememory_experimental");
				__state = (clone: flag ? ((HandItem)__instance).item.GetClone((Item)null, false) : null, active: flag);
			}

			[HarmonyPostfix]
			public static void Postfix(HandItem_Buff __instance, (Item? clone, bool active) __state)
			{
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				if (__state.active && __state.clone != null)
				{
					ENT_Player player = ((Hand_Base)__instance).hand.GetPlayer();
					Inventory.instance.AddItemToInventoryScreen(new Vector3(0f, 0f, 1f), __state.clone, true, false, true);
					player.RemovePerk("nefariouswucklemod_falsememory_experimental", false);
				}
			}
		}

		[HarmonyPatch(typeof(HandItem_BlinkEye), "StopUse")]
		public class FalseMemoryEyePatch
		{
			private static readonly FieldInfo HoldTimeField = AccessTools.Field(typeof(HandItem_BlinkEye), "holdTime");

			private static readonly FieldInfo QuickTimeField = AccessTools.Field(typeof(HandItem_BlinkEye), "quickTime");

			[HarmonyPrefix]
			public static void Prefix(HandItem_BlinkEye __instance, out (Item? clone, int uses, bool active, bool wasUsed, float holdTime, float quickTime) __state)
			{
				ENT_Player player = ((Hand_Base)__instance).hand.GetPlayer();
				bool flag = player.HasPerk("nefariouswucklemod_falsememory_experimental");
				__state = (clone: flag ? ((HandItem)__instance).item.GetClone((Item)null, false) : null, uses: int.TryParse(((HandItem)__instance).item.GetFirstDataStringByType("uses", false), out var result) ? result : 0, active: flag, wasUsed: ((HandItem)__instance).used, holdTime: (float)HoldTimeField.GetValue(__instance), quickTime: (float)QuickTimeField.GetValue(__instance));
			}

			[HarmonyPostfix]
			public static void Postfix(HandItem_BlinkEye __instance, (Item? clone, int uses, bool active, bool wasUsed, float holdTime, float quickTime) __state)
			{
				//IL_009e: Unknown result type (might be due to invalid IL or missing references)
				if (__state.active && __state.wasUsed && (!(__state.holdTime < 0.2f) || !(__state.quickTime <= 0f)))
				{
					ENT_Player player = ((Hand_Base)__instance).hand.GetPlayer();
					if (__state.uses == 1 && __instance.crushOnLastUse && !player.HasInfiniteAmmo())
					{
						var (val, _, _, _, _, _) = __state;
						val.SetFirstDataStringsofType("uses", "3");
						Inventory.instance.AddItemToInventoryScreen(new Vector3(0f, 0f, 1f), val, true, false, true);
						player.RemovePerk("nefariouswucklemod_falsememory_experimental", false);
					}
				}
			}
		}

		private static ExperimentalDefinition? instance;

		public static ExperimentalDefinition Create()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Expected O, but got Unknown
			if (instance != null)
			{
				return instance;
			}
			Perk val = ScriptableObject.CreateInstance<Perk>();
			val.title = "Déjà Vu";
			val.id = "nefariouswucklemod_falsememory_experimental";
			val.description = "    When consuming some items, this perk will be consumed to add a copy into your inventory.\r\n    Does not work on Grubs. You monster.";
			val.flavorText = "Overcome by memories that do not exist.";
			val.perkType = (PerkType)3;
			val.canStack = true;
			val.stackMax = 99;
			val.useBuff = false;
			val.buffMultiplier = 1f;
			val.multiplierCurve = AnimationCurve.Linear(0f, 1f, 1f, 1f);
			val.modules = new List<PerkModule>();
			WKAssetDatabase fullCombinedAssetDatabase = CL_AssetManager.GetFullCombinedAssetDatabase();
			if ((Object)(object)fullCombinedAssetDatabase != (Object)null && fullCombinedAssetDatabase.perkAssets != null)
			{
				Perk val2 = ((IEnumerable<Perk>)fullCombinedAssetDatabase.perkAssets).FirstOrDefault((Func<Perk, bool>)((Perk p) => (Object)(object)p != (Object)null && p.id == "Perk_U_T1_EmployeeRetention"));
				if ((Object)(object)val2 != (Object)null)
				{
					val.icon = val2.icon;
				}
			}
			val.buff = new BuffContainer
			{
				id = "nefariouswucklemod_bleedingedge_experimental_buff",
				loseOverTime = false,
				loseRate = 0f,
				buffTime = 1f,
				multiplier = 1f,
				loseRateEffectedByPerks = false
			};
			instance = new ExperimentalDefinition(val);
			return instance;
		}
	}
}
namespace NefariousWuckleMod.Perks.Bindings
{
	public class BindingDefinition : PerkDefinition
	{
		public float ScoreMultiplierBonus { get; set; }

		public float ScoreBonus { get; set; }

		public BindingDefinition(Perk perk, float scoreMultiplierBonus = 0f, float scoreBonus = 0f)
			: base(perk)
		{
			ScoreMultiplierBonus = scoreMultiplierBonus;
			ScoreBonus = scoreBonus;
		}
	}
	public static class Comboed
	{
		[HarmonyPatch(typeof(ENT_Player), "Damage")]
		public static class ComboDamagePatch
		{
			[HarmonyPrefix]
			public static void Prefix(ENT_Player __instance, out bool __state, DamageInfo info)
			{
				if (info != null)
				{
					__state = (double)info.amount > 0.25;
				}
				else
				{
					__state = false;
				}
			}

			[HarmonyPostfix]
			public static void Postfix(ENT_Player __instance, bool __state)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: 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_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_007c: Expected O, but got Unknown
				//IL_0087: Expected O, but got Unknown
				if (__state)
				{
					((GameEntity)__instance).AddNewBuff(new BuffContainer
					{
						id = "nefariouswucklemod_tagteam_binding_buff",
						loseOverTime = true,
						loseRate = 0.25f,
						buffTime = 1f,
						multiplier = 1f,
						loseRateEffectedByPerks = false,
						buffs = new List<Buff>
						{
							new Buff
							{
								id = "addSpeed",
								maxAmount = -0.9f,
								amount = -0.9f
							}
						}
					});
				}
			}
		}

		private static BindingDefinition? instance;

		public static BindingDefinition Create()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Expected O, but got Unknown
			if (instance != null)
			{
				return instance;
			}
			Perk val = ScriptableObject.CreateInstance<Perk>();
			val.title = "Comboed";
			val.id = "nefariouswucklemod_tagteam_binding";
			val.description = "Taking heavy damage drastically slows you.";
			val.flavorText = "Why'd you waste evasive on THAT?";
			val.perkType = (PerkType)9;
			val.cost = 1;
			val.canStack = true;
			val.stackMax = 10;
			val.useBuff = true;
			val.buffMultiplier = 1f;
			val.multiplierCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[6]
			{
				new Keyframe(0f, 0.2235f),
				new Keyframe(0.1f, 0.149f),
				new Keyframe(0.2f, 0.0894f),
				new Keyframe(0.3f, 0.0447f),
				new Keyframe(0.4f, 0.0298f),
				new Keyframe(1f, 0.0149f)
			});
			WKAssetDatabase fullCombinedAssetDatabase = CL_AssetManager.GetFullCombinedAssetDatabase();
			if ((Object)(object)fullCombinedAssetDatabase != (Object)null && fullCombinedAssetDatabase.perkAssets != null)
			{
				Perk val2 = ((IEnumerable<Perk>)fullCombinedAssetDatabase.perkAssets).FirstOrDefault((Func<Perk, bool>)((Perk p) => (Object)(object)p != (Object)null && p.id == "Perk_U_T2_PulseBladder"));
				if ((Object)(object)val2 != (Object)null)
				{
					val.icon = val2.icon;
				}
			}
			instance = new BindingDefinition(val, 0.5f);
			return instance;
		}
	}
	public static class Fragility
	{
		[HarmonyPatch(typeof(ENT_Player), "AddGripStrength")]
		public static class FragilityGripPatch
		{
			[HarmonyPrefix]
			public static void Prefix(ENT_Player __instance, ref float amount)
			{
				if (!((Object)(object)__instance == (Object)null) && __instance.HasPerk("nefariouswucklemod_fragility_binding"))
				{
					amount *= 0.25f * (1f / __instance.GetPerk("nefariouswucklemod_fragility_binding").GetStackEvaluationMultiplier());
				}
			}
		}

		[HarmonyPatch(typeof(ENT_Player), "HandStamina")]
		public static class FragilitySprintPatch
		{
			[HarmonyPostfix]
			public static void Postfix(ENT_Player __instance, int hand)
			{
				if (__instance.HasPerk("nefariouswucklemod_fragility_binding") && __instance.IsSprinting())
				{
					__instance.hands[hand].DamageGripStrength(Time.deltaTime * 1f);
				}
			}
		}

		private static BindingDefinition? instance;

		public static BindingDefinition Create()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Expected O, but got Unknown
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Expected O, but got Unknown
			//IL_01fe: 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_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Expected O, but got Unknown
			//IL_0234: Expected O, but got Unknown
			if (instance != null)
			{
				return instance;
			}
			Perk val = ScriptableObject.CreateInstance<Perk>();
			val.title = "Osteoporosis";
			val.id = "nefariouswucklemod_fragility_binding";
			val.description = "Maximum stamina reduced. All sources of stamina gain and regeneration are heavily reduced. Sprinting consumes stamina.";
			val.flavorText = "Get a grip.";
			val.perkType = (PerkType)9;
			val.cost = 1;
			val.canStack = true;
			val.stackMax = 10;
			val.useBuff = true;
			val.buffMultiplier = 1f;
			val.multiplierCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[6]
			{
				new Keyframe(0f, 0.2235f),
				new Keyframe(0.1f, 0.149f),
				new Keyframe(0.2f, 0.0894f),
				new Keyframe(0.3f, 0.0447f),
				new Keyframe(0.4f, 0.0298f),
				new Keyframe(1f, 0.0149f)
			});
			val.modules = new List<PerkModule>();
			WKAssetDatabase fullCombinedAssetDatabase = CL_AssetManager.GetFullCombinedAssetDatabase();
			if ((Object)(object)fullCombinedAssetDatabase != (Object)null && fullCombinedAssetDatabase.perkAssets != null)
			{
				Perk val2 = ((IEnumerable<Perk>)fullCombinedAssetDatabase.perkAssets).FirstOrDefault((Func<Perk, bool>)((Perk p) => (Object)(object)p != (Object)null && p.id == "Perk_U_T3_Bulletproof"));
				if ((Object)(object)val2 != (Object)null)
				{
					val.icon = val2.icon;
				}
			}
			val.buff = new BuffContainer
			{
				id = "nefariouswucklemod_fragility_binding_buff",
				loseOverTime = false,
				loseRate = 0f,
				buffTime = 1f,
				multiplier = 1f,
				loseRateEffectedByPerks = false,
				buffs = new List<Buff>
				{
					new Buff
					{
						id = "addStamina",
						maxAmount = -0.25f,
						amount = -0.25f
					},
					new Buff
					{
						id = "addStaminaRegen",
						maxAmount = -0.75f,
						amount = -0.75f
					}
				}
			};
			instance = new BindingDefinition(val, 0.5f);
			return instance;
		}
	}
}