Decompiled source of CustomMovesetPack v4.0.3

plugins/CustomMovesetPack.dll

Decompiled 6 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using SideLoader;
using SideLoader.Model;
using TinyHelper;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace CustomMovesetPack;

[BepInPlugin("com.ehaugw.custommovesetpack", "Custom Moveset Pack", "4.0.3")]
[BepInDependency("com.ehaugw.tinyhelper", "4.3.4")]
[BepInDependency("com.ehaugw.customweaponbehaviour", "3.1.3")]
public class CustomMovesetPack : BaseUnityPlugin
{
	public const string GUID = "com.ehaugw.custommovesetpack";

	public const string VERSION = "4.0.3";

	public const string NAME = "Custom Moveset Pack";

	public static string ModFolderName = Directory.GetParent(typeof(CustomMovesetPack).Assembly.Location).Name.ToString();

	internal void Awake()
	{
		SL.OnPacksLoaded += OnPackLoaded;
	}

	private void OnPackLoaded()
	{
		IronSword.MakeItem();
		Tuple<int, string[]>[] array = new Tuple<int, string[]>[29]
		{
			new Tuple<int, string[]>(2000010, new string[1] { "Bastard" }),
			new Tuple<int, string[]>(2000021, new string[1] { "Finesse" }),
			new Tuple<int, string[]>(2000020, new string[1] { "Finesse" }),
			new Tuple<int, string[]>(2000060, new string[1] { "Finesse" }),
			new Tuple<int, string[]>(2000061, new string[1] { "Finesse" }),
			new Tuple<int, string[]>(2000070, new string[2] { "Bastard", "MaulShoveTag" }),
			new Tuple<int, string[]>(2010060, new string[1] { "Bastard" }),
			new Tuple<int, string[]>(2000090, new string[1] { "Finesse" }),
			new Tuple<int, string[]>(2000110, new string[1] { "Finesse" }),
			new Tuple<int, string[]>(2000120, new string[1] { "Finesse" }),
			new Tuple<int, string[]>(2000160, new string[1] { "Bastard" }),
			new Tuple<int, string[]>(2000030, new string[2] { "Bastard", "Holy" }),
			new Tuple<int, string[]>(2020020, new string[1] { "Bastard" }),
			new Tuple<int, string[]>(2000260, new string[1] { "Bastard" }),
			new Tuple<int, string[]>(2010030, new string[1] { "Bastard" }),
			new Tuple<int, string[]>(2100000, new string[2] { "Holy", "MaulShoveTag" }),
			new Tuple<int, string[]>(2010190, new string[1] { "Holy" }),
			new Tuple<int, string[]>(2000080, new string[1] { "Bastard" }),
			new Tuple<int, string[]>(2000050, new string[1] { "Finesse" }),
			new Tuple<int, string[]>(2010110, new string[2] { "Bastard", "Holy" }),
			new Tuple<int, string[]>(2100120, new string[2] { "Holy", "MaulShoveTag" }),
			new Tuple<int, string[]>(2110080, new string[1] { "Holy" }),
			new Tuple<int, string[]>(2120110, new string[1] { "Holy" }),
			new Tuple<int, string[]>(2140100, new string[1] { "Holy" }),
			new Tuple<int, string[]>(2160080, new string[1] { "Holy" }),
			new Tuple<int, string[]>(2020100, new string[2] { "Bastard", "Holy" }),
			new Tuple<int, string[]>(2300170, new string[1] { "Holy" }),
			new Tuple<int, string[]>(2130140, new string[1] { "Holy" }),
			new Tuple<int, string[]>(2000140, new string[3] { "Bastard", "Holy", "MaulShoveTag" })
		};
		foreach (Tuple<int, string[]> tuple in array)
		{
			Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(tuple.Item1);
			if (itemPrefab != null)
			{
				CustomItems.SetItemTags(itemPrefab, TinyTagManager.GetSafeTags(tuple.Item2), false);
			}
		}
	}
}
public class IronSword
{
	public const string SubfolderName = "IronSword";

	public static Item MakeItem()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Expected O, but got Unknown
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Expected O, but got Unknown
		SL_Weapon val = new SL_Weapon
		{
			Target_ItemID = 2000010,
			New_ItemID = -1,
			ItemVisuals = new SL_ItemVisual
			{
				Prefab_Name = "iron_sword_Prefab",
				Prefab_AssetBundle = "iron_sword",
				Prefab_SLPack = CustomMovesetPack.ModFolderName
			},
			SLPackName = CustomMovesetPack.ModFolderName,
			SubfolderName = "IronSword"
		};
		((ContentTemplate)val).ApplyTemplate();
		return ResourcesPrefabManager.Instance.GetItemPrefab(((SL_Item)val).New_ItemID);
	}
}

plugins/CustomWeaponBehaviour.dll

Decompiled 6 months ago
using System;
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 HolyDamageManager;
using Photon;
using SideLoader;
using TinyHelper;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace CustomWeaponBehaviour;

public class MaulShoveBehaviour
{
	public virtual bool Eligible(Weapon weapon)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		return ((Item)weapon).HasTag(CustomWeaponBehaviour.MaulShoveTag);
	}

	public virtual bool IsActive(Weapon weapon)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Invalid comparison between Unknown and I4
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Invalid comparison between Unknown and I4
		return (int)weapon.Type != 53 && (int)BehaviourManager.GetCurrentAnimationType(weapon) == 53;
	}

	public bool IsMaulShoveMode(Weapon weapon)
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		int result;
		if (Eligible(weapon) && ((Item)weapon).IsEquipped)
		{
			Character ownerCharacter = ((EffectSynchronizer)weapon).OwnerCharacter;
			if (!((Object)(object)((ownerCharacter != null) ? ownerCharacter.LeftHandEquipment : null) == (Object)null))
			{
				Character ownerCharacter2 = ((EffectSynchronizer)weapon).OwnerCharacter;
				Equipment val = ((ownerCharacter2 != null) ? ownerCharacter2.LeftHandEquipment : null);
				if (val == null || !((Item)val).HasTag(CustomWeaponBehaviour.HandsFreeTag))
				{
					result = (((Equipment)weapon).TwoHanded ? 1 : 0);
					goto IL_005b;
				}
			}
			result = 1;
		}
		else
		{
			result = 0;
		}
		goto IL_005b;
		IL_005b:
		return (byte)result != 0;
	}

	public void PostAffectDamage(ref Weapon weapon, DamageList original, ref DamageList result)
	{
		if (!IsMaulShoveMode(weapon))
		{
			return;
		}
		foreach (IBastardModifier iBastardModifier in CustomWeaponBehaviour.IBastardModifiers)
		{
			iBastardModifier.ApplyDamageModifier(weapon, original, ref result);
		}
	}

	public void PostAffectImpact(ref Weapon weapon, float original, ref float result)
	{
		if (!IsMaulShoveMode(weapon))
		{
			return;
		}
		foreach (IBastardModifier iBastardModifier in CustomWeaponBehaviour.IBastardModifiers)
		{
			iBastardModifier.ApplyImpactModifier(weapon, original, ref result);
		}
	}

	public void PostAffectSpeed(ref Weapon weapon, float original, ref float result)
	{
		if (!IsMaulShoveMode(weapon))
		{
			return;
		}
		foreach (IBastardModifier iBastardModifier in CustomWeaponBehaviour.IBastardModifiers)
		{
			iBastardModifier.ApplySpeedModifier(weapon, original, ref result);
		}
	}

	public void PostAffectStaminaCost(ref Weapon weapon, float original, ref float result)
	{
		if (!IsMaulShoveMode(weapon))
		{
			return;
		}
		foreach (IBastardModifier iBastardModifier in CustomWeaponBehaviour.IBastardModifiers)
		{
			iBastardModifier.ApplyStaminaModifier(weapon, original, ref result);
		}
	}
}
public class BastardBehaviour
{
	public static WeaponType? GetBastardType(WeaponType type)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected I4, but got Unknown
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		return (int)type switch
		{
			1 => (WeaponType)52, 
			0 => (WeaponType)51, 
			2 => (WeaponType)53, 
			_ => type, 
		};
	}

	public virtual bool Eligible(Weapon weapon)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		return ((Item)weapon).HasTag(CustomWeaponBehaviour.BastardTag) && !((Equipment)weapon).TwoHanded;
	}

	public bool IsBastardMode(Weapon weapon)
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		if (!Eligible(weapon) || !((Item)weapon).IsEquipped)
		{
			goto IL_0064;
		}
		Character ownerCharacter = ((EffectSynchronizer)weapon).OwnerCharacter;
		if (!((Object)(object)((ownerCharacter != null) ? ownerCharacter.LeftHandEquipment : null) == (Object)null))
		{
			Character ownerCharacter2 = ((EffectSynchronizer)weapon).OwnerCharacter;
			Equipment val = ((ownerCharacter2 != null) ? ownerCharacter2.LeftHandEquipment : null);
			if (val == null || !((Item)val).HasTag(CustomWeaponBehaviour.HandsFreeTag))
			{
				goto IL_0064;
			}
		}
		int result = ((!CustomWeaponBehaviour.Instance.maulShoveBehaviour.IsActive(weapon)) ? 1 : 0);
		goto IL_0065;
		IL_0065:
		return (byte)result != 0;
		IL_0064:
		result = 0;
		goto IL_0065;
	}

	public void PostAffectDamage(ref Weapon weapon, DamageList original, ref DamageList result)
	{
		if (!IsBastardMode(weapon))
		{
			return;
		}
		foreach (IBastardModifier iBastardModifier in CustomWeaponBehaviour.IBastardModifiers)
		{
			iBastardModifier.ApplyDamageModifier(weapon, original, ref result);
		}
	}

	public void PostAffectImpact(ref Weapon weapon, float original, ref float result)
	{
		if (!IsBastardMode(weapon))
		{
			return;
		}
		foreach (IBastardModifier iBastardModifier in CustomWeaponBehaviour.IBastardModifiers)
		{
			iBastardModifier.ApplyImpactModifier(weapon, original, ref result);
		}
	}

	public void PostAffectSpeed(ref Weapon weapon, float original, ref float result)
	{
		if (!IsBastardMode(weapon))
		{
			return;
		}
		foreach (IBastardModifier iBastardModifier in CustomWeaponBehaviour.IBastardModifiers)
		{
			iBastardModifier.ApplySpeedModifier(weapon, original, ref result);
		}
	}

	public void PostAffectStaminaCost(ref Weapon weapon, float original, ref float result)
	{
		if (!IsBastardMode(weapon))
		{
			return;
		}
		foreach (IBastardModifier iBastardModifier in CustomWeaponBehaviour.IBastardModifiers)
		{
			iBastardModifier.ApplyStaminaModifier(weapon, original, ref result);
		}
	}
}
public class AttackCancelByBlockBehaviour
{
	public bool IsBlockMode(Character character)
	{
		return Eligible(character);
	}

	public virtual bool Eligible(Character character)
	{
		return false;
	}
}
public class AttackCancelBySkillBehaviour
{
	public bool IsAttackCancelBySkillMode(Character character)
	{
		return Eligible(character);
	}

	public virtual bool Eligible(Character character)
	{
		return false;
	}
}
public class SpecialLeapBehaviour
{
	public virtual bool IsSpecialLeapMode(Weapon weapon)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		return ((Item)weapon).IsEquipped && ((Item)weapon).HasTag(CustomWeaponBehaviour.SpecialLeapTag);
	}
}
public class HalfHandedBehaviour
{
	public bool IsHalfHandedMode(Weapon weapon)
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		if (!Eligible(weapon) || !((Item)weapon).IsEquipped)
		{
			goto IL_005a;
		}
		Character ownerCharacter = ((EffectSynchronizer)weapon).OwnerCharacter;
		if (!((Object)(object)((ownerCharacter != null) ? ownerCharacter.LeftHandEquipment : null) == (Object)null))
		{
			Character ownerCharacter2 = ((EffectSynchronizer)weapon).OwnerCharacter;
			Equipment val = ((ownerCharacter2 != null) ? ownerCharacter2.LeftHandEquipment : null);
			if (val == null || !((Item)val).HasTag(CustomWeaponBehaviour.HandsFreeTag))
			{
				goto IL_005a;
			}
		}
		int result = ((!((Equipment)weapon).TwoHanded) ? 1 : 0);
		goto IL_005b;
		IL_005b:
		return (byte)result != 0;
		IL_005a:
		result = 0;
		goto IL_005b;
	}

	public virtual bool Eligible(Weapon weapon)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		return ((Item)weapon).HasTag(CustomWeaponBehaviour.HalfHandedTag);
	}
}
public class ParryBehaviour
{
	public virtual float GetParryWindow(Weapon weapon)
	{
		return 0.3f;
	}

	public virtual float GetParryWindUp(Weapon weapon)
	{
		return 0.1f;
	}

	public bool IsParryMode(Weapon weapon)
	{
		int result;
		if (((Item)weapon).IsEquipped && Eligible(weapon))
		{
			Character ownerCharacter = ((EffectSynchronizer)weapon).OwnerCharacter;
			result = (((Object)(object)((ownerCharacter != null) ? ownerCharacter.LeftHandEquipment : null) == (Object)null || OffhandEligible((weapon != null) ? ((EffectSynchronizer)weapon).OwnerCharacter : null)) ? 1 : 0);
		}
		else
		{
			result = 0;
		}
		return (byte)result != 0;
	}

	public virtual bool OffhandEligible(Character character)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Invalid comparison between Unknown and I4
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		Equipment obj = ((character != null) ? character.LeftHandEquipment : null);
		Weapon val = (Weapon)(object)((obj is Weapon) ? obj : null);
		return val != null && ((int)val.Type != 100 || ((Item)val).HasTag(CustomWeaponBehaviour.BucklerTag));
	}

	public virtual bool Eligible(Weapon weapon)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		return ((Item)weapon).HasTag(CustomWeaponBehaviour.ParryTag);
	}

	public virtual bool DidSuccessfulParry(Weapon weapon)
	{
		int result;
		if (IsParryMode(weapon))
		{
			Character ownerCharacter = ((EffectSynchronizer)weapon).OwnerCharacter;
			if (ownerCharacter != null && ownerCharacter.Blocking && Time.time - (float)At.GetField<Character>(ownerCharacter, "m_blockTime") < GetParryWindow(weapon) && ownerCharacter.Blocking)
			{
				result = ((Time.time - (float)At.GetField<Character>(ownerCharacter, "m_blockTime") > GetParryWindUp(weapon)) ? 1 : 0);
				goto IL_0065;
			}
		}
		result = 0;
		goto IL_0065;
		IL_0065:
		return (byte)result != 0;
	}

	public virtual void DeliverParry(Character blocker, Character striker, Vector3 _hitDir, float impactDamage)
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		At.Invoke<Character>(striker, "StabilityHit", new object[4]
		{
			impactDamage / 2f,
			Vector3.Angle(((Component)striker).transform.forward, -_hitDir),
			false,
			blocker
		});
		CasualStagger.Stagger(striker);
	}
}
public class HolyBehaviour
{
	public virtual Types GetHolyDamageType()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		return HolyDamageManager.GetDamageType();
	}

	public virtual float GetHolyWeaponConvertionRate(Weapon weapon)
	{
		return 0.2f;
	}

	public bool IsHolyWeaponMode(Weapon weapon)
	{
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		if (((Item)weapon).IsEquipped && Eligible(weapon) && weapon.Imbued)
		{
			Effect[] imbuedEffects = weapon.FirstImbue.ImbuedEffects;
			foreach (Effect val in imbuedEffects)
			{
				WeaponDamage val2 = (WeaponDamage)(object)((val is WeaponDamage) ? val : null);
				if (val2 != null && ((PunctualDamage)val2).Damages.Length != 0 && ((PunctualDamage)val2).Damages[0].Type == GetHolyDamageType())
				{
					return true;
				}
			}
		}
		return false;
	}

	public virtual bool Eligible(Weapon weapon)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		return ((Item)weapon).HasTag(CustomWeaponBehaviour.HolyWeaponTag);
	}

	public void PostAffectDamage(ref Weapon _weapon, DamageList original, ref DamageList _damageList)
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Expected O, but got Unknown
		if (IsHolyWeaponMode(_weapon))
		{
			float totalDamage = _damageList.TotalDamage;
			float holyWeaponConvertionRate = GetHolyWeaponConvertionRate(_weapon);
			_damageList *= 1f - holyWeaponConvertionRate;
			_damageList.Add(new DamageType(GetHolyDamageType(), totalDamage * holyWeaponConvertionRate));
		}
	}
}
public class FinesseBehaviour
{
	public bool IsFinesseMode(Weapon weapon)
	{
		return ((Item)weapon).IsEquipped && Eligible(weapon);
	}

	public virtual bool Eligible(Weapon weapon)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		return ((Item)weapon).HasTag(CustomWeaponBehaviour.FinesseTag);
	}
}
public class BehaviourManager
{
	public static WeaponType GetCurrentAnimationType(Weapon weapon)
	{
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: 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)
		if (((Item)weapon).IsEquipped)
		{
			Character ownerCharacter = ((EffectSynchronizer)weapon).OwnerCharacter;
			Animator val = ((ownerCharacter != null) ? ownerCharacter.Animator : null);
			if (val != null)
			{
				return (WeaponType)val.GetInteger("WeaponType");
			}
		}
		return weapon.Type;
	}

	public static bool IsComboAttack(Character __instance, int _type, int _id)
	{
		return _type switch
		{
			0 => true, 
			1 => __instance.NextAtkAllowed == 2, 
			_ => false, 
		};
	}

	public static bool AdaptGrip(Character __instance, ref int _type, ref int _id)
	{
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Invalid comparison between Unknown and I4
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Invalid comparison between Unknown and I4
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ba: 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_0204: Unknown result type (might be due to invalid IL or missing references)
		//IL_0212: Unknown result type (might be due to invalid IL or missing references)
		//IL_0234: Unknown result type (might be due to invalid IL or missing references)
		//IL_0220: Unknown result type (might be due to invalid IL or missing references)
		//IL_0226: Invalid comparison between Unknown and I4
		Weapon val = ((__instance != null) ? __instance.CurrentWeapon : null);
		if ((Object)(object)val == (Object)null)
		{
			return false;
		}
		if (_type == 2502 || _type == 2511)
		{
			object field = At.GetField<Character>(__instance, "m_lastUsedSkill");
			MeleeSkill val2 = (MeleeSkill)((field is MeleeSkill) ? field : null);
			if (val2 != null && ((int)((Item)val2).ActivateEffectAnimType == 502 || (int)((Item)val2).ActivateEffectAnimType == 511) && ((AttackSkill)val2).RequiredWeaponTypes[0] != val.Type)
			{
				CustomWeaponBehaviour.ChangeGrip(__instance, ((AttackSkill)val2).RequiredWeaponTypes[0]);
				return true;
			}
		}
		if (CustomWeaponBehaviour.Instance.finesseBehaviour.IsFinesseMode(val) && _type == 1 && !IsComboAttack(__instance, _type, _id))
		{
			CustomWeaponBehaviour.ChangeGrip(__instance, (WeaponType)1);
			return true;
		}
		if (CustomWeaponBehaviour.Instance.halfHandedBehaviour.IsHalfHandedMode(val) && _type == 1 && !IsComboAttack(__instance, _type, _id))
		{
			_type = 0;
			CustomWeaponBehaviour.ChangeGrip(__instance, (WeaponType)54);
			return true;
		}
		if (CustomWeaponBehaviour.Instance.maulShoveBehaviour.IsMaulShoveMode(val) && _type == 1 && !IsComboAttack(__instance, _type, _id))
		{
			CustomWeaponBehaviour.ChangeGrip(__instance, (WeaponType)53);
			return true;
		}
		if (CustomWeaponBehaviour.Instance.bastardBehaviour.IsBastardMode(val))
		{
			WeaponType? bastardType = BastardBehaviour.GetBastardType(val.Type);
			if (bastardType.HasValue)
			{
				WeaponType valueOrDefault = bastardType.GetValueOrDefault();
				if (true && Extensions.Contains(new int[3] { 0, 1, 2500 }, _type))
				{
					CustomWeaponBehaviour.ChangeGrip(__instance, valueOrDefault);
					Equipment val3 = ((__instance != null) ? __instance.LeftHandEquipment : null);
					if (val3 != null && ((Item)val3).HasTag(CustomWeaponBehaviour.HandsFreeTag) && ((Item)val3).HasTag(CustomWeaponBehaviour.LanternTag) && (int)val3.IKType == 1)
					{
						val3.IKType = (IKMode)0;
					}
					return true;
				}
			}
		}
		return false;
	}

	public static bool SpellHasAttackAnimation(Character character)
	{
		if (character.IsCasting && character.Animator.GetInteger("AttackID") < 2)
		{
			return true;
		}
		return false;
	}

	public static bool AttackHasSpellAnimation(Character character)
	{
		if (!character.IsCasting && character.Animator.GetInteger("AttackID") >= 2)
		{
			return true;
		}
		return false;
	}
}
public interface IBaseDamageModifier
{
	bool Eligible(Weapon weapon);

	void Apply(Weapon weapon, DamageList original, ref DamageList result);
}
public interface IBastardModifier
{
	void ApplyDamageModifier(Weapon weapon, DamageList original, ref DamageList modifier);

	void ApplyImpactModifier(Weapon weapon, float original, ref float modifier);

	void ApplySpeedModifier(Weapon weapon, float original, ref float result);

	void ApplyStaminaModifier(Weapon weapon, float original, ref float result);
}
public interface IMaulShoveModifier
{
	void ApplyDamageModifier(Weapon weapon, DamageList original, ref DamageList result);

	void ApplyImpactModifier(Weapon weapon, float original, ref float result);

	void ApplySpeedModifier(Weapon weapon, float original, ref float result);
}
public class CustomBehaviourFormulas
{
	public static void PostAffectSpeed(Weapon weapon, ref float result)
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)weapon == (Object)null))
		{
			float original = result;
			CustomWeaponBehaviour.Instance.bastardBehaviour.PostAffectSpeed(ref weapon, original, ref result);
			CustomWeaponBehaviour.Instance.maulShoveBehaviour.PostAffectSpeed(ref weapon, original, ref result);
			if (WeaponManager.Speeds.ContainsKey(weapon.Type) && WeaponManager.Speeds.ContainsKey(BehaviourManager.GetCurrentAnimationType(weapon)))
			{
				result *= WeaponManager.Speeds[BehaviourManager.GetCurrentAnimationType(weapon)] / WeaponManager.Speeds[weapon.Type];
			}
			if (result < 0f)
			{
				result = 0f;
			}
		}
	}

	public static void PostAffectDamage(ref Weapon _weapon, ref DamageList result)
	{
		DamageList original = result.Clone();
		foreach (IBaseDamageModifier iBaseDamageModifier in CustomWeaponBehaviour.IBaseDamageModifiers)
		{
			if (iBaseDamageModifier.Eligible(_weapon))
			{
				iBaseDamageModifier.Apply(_weapon, original, ref result);
			}
		}
		CustomWeaponBehaviour.Instance.maulShoveBehaviour.PostAffectDamage(ref _weapon, original, ref result);
		CustomWeaponBehaviour.Instance.bastardBehaviour.PostAffectDamage(ref _weapon, original, ref result);
		CustomWeaponBehaviour.Instance.holyBehaviour.PostAffectDamage(ref _weapon, original, ref result);
	}

	public static void PostAffectImpact(ref Weapon _weapon, ref float _impactDamage)
	{
		float original = _impactDamage;
		CustomWeaponBehaviour.Instance.maulShoveBehaviour.PostAffectImpact(ref _weapon, original, ref _impactDamage);
		CustomWeaponBehaviour.Instance.bastardBehaviour.PostAffectImpact(ref _weapon, original, ref _impactDamage);
		if (_impactDamage < 0f)
		{
			_impactDamage = 0f;
		}
	}

	public static void PostAffectStaminaCost(Weapon _weapon, ref float _staminaCost)
	{
		float original = _staminaCost;
		CustomWeaponBehaviour.Instance.bastardBehaviour.PostAffectStaminaCost(ref _weapon, original, ref _staminaCost);
		if (_staminaCost < 0f)
		{
			_staminaCost = 0f;
		}
	}
}
public class EnableHitDetection : Effect
{
	protected override void ActivateLocally(Character _affectedCharacter, object[] _infos)
	{
		Item parentItem = ((Effect)this).ParentItem;
		MeleeSkill val = (MeleeSkill)(object)((parentItem is MeleeSkill) ? parentItem : null);
		if (val != null && (Object)(object)val.MeleeHitDetector != (Object)null)
		{
			MeleeHitDetector val2 = ((_affectedCharacter != null) ? _affectedCharacter.SkillMeleeDetector : null);
			if (val2 != null)
			{
				val2.HitStarted(-1);
				return;
			}
		}
		Weapon obj = ((_affectedCharacter != null) ? _affectedCharacter.CurrentWeapon : null);
		MeleeWeapon val3 = (MeleeWeapon)(object)((obj is MeleeWeapon) ? obj : null);
		if (val3 != null)
		{
			((Weapon)val3).HitStarted(-1);
		}
	}
}
public class WeaponSkillAnimationSelector : Effect
{
	public WeaponType WeaponType;

	protected override void ActivateLocally(Character character, object[] _infos)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		CustomWeaponBehaviour.ChangeGrip(character, WeaponType);
	}

	public static void SetCustomAttackAnimation(Skill skill, WeaponType weaponType)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		Transform transform = TinyGameObjectManager.MakeFreshObject("ActivationEffects", true, true, ((Component)skill).transform).transform;
		((Component)transform).gameObject.AddComponent<WeaponSkillAnimationSelector>().WeaponType = weaponType;
	}
}
[HarmonyPatch(typeof(Skill), "HasAllRequirements")]
public class Skill_HasAllRequirements
{
	[HarmonyPrefix]
	public static void Prefix(Skill __instance, bool _tryingToActivate)
	{
		if (_tryingToActivate)
		{
			MeleeSkill val = (MeleeSkill)(object)((__instance is MeleeSkill) ? __instance : null);
			if (val != null && ((EffectSynchronizer)__instance).OwnerCharacter.NextAtkAllowed == 2 && CustomWeaponBehaviour.Instance.attackCancelBySkillBehaviour.IsAttackCancelBySkillMode(((EffectSynchronizer)__instance).OwnerCharacter) && ((Skill)val).HasAllRequirements(false))
			{
				((EffectSynchronizer)__instance).OwnerCharacter.ForceCancel(true, true);
				At.SetValue<bool>(true, typeof(Character), (object)((EffectSynchronizer)__instance).OwnerCharacter, "m_inLocomotion");
				At.SetValue<bool>(true, typeof(Character), (object)((EffectSynchronizer)__instance).OwnerCharacter, "m_nextIsLocomotion");
			}
		}
	}
}
[HarmonyPatch(typeof(Character), "BlockInput")]
public class Character_BlockInput
{
	[HarmonyPrefix]
	public static bool Prefix(Character __instance, ref bool _active)
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Invalid comparison between Unknown and I4
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Invalid comparison between Unknown and I4
		if (__instance.IsAI)
		{
			return true;
		}
		if (!__instance.IsPhotonPlayerLocal || __instance.Sheathing || __instance.PreparingToSleep || __instance.Dodging || (int)__instance.CurrentSpellCast == 35 || (int)__instance.CurrentSpellCast == 900)
		{
			return true;
		}
		if (!_active || (__instance.InLocomotion && __instance.NextIsLocomotion))
		{
			return true;
		}
		if (__instance.ShieldEquipped || (Object)(object)__instance.CurrentWeapon == (Object)null || !CustomWeaponBehaviour.Instance.attackCancelByBlockBehaviour.IsBlockMode(__instance))
		{
			return true;
		}
		int num = (int)At.GetValue(typeof(Character), (object)__instance, "m_dodgeAllowedInAction");
		if (num > 0 && __instance.NextAtkAllowed > 0)
		{
			((MonoBehaviour)__instance).photonView.RPC("SendBlockStateTrivial", (PhotonTargets)0, new object[1] { true });
			__instance.StealthInput(false);
			return false;
		}
		return true;
	}
}
[HarmonyPatch(typeof(Character), "SendPerformAttackTrivial", new Type[]
{
	typeof(int),
	typeof(int)
})]
public class Character_SendPerformAttackTrivial
{
	[HarmonyPrefix]
	public static void Prefix(Character __instance, ref int _type, ref int _id)
	{
		BehaviourManager.AdaptGrip(__instance, ref _type, ref _id);
	}
}
[HarmonyPatch(typeof(Character), "HitEnded")]
public class Character_HitEnded
{
	[HarmonyPrefix]
	public static void Prefix(Character __instance, ref int _attackID)
	{
		if (_attackID != -2 && !__instance.IsCasting)
		{
			CustomWeaponBehaviour.ResetGrip(__instance);
		}
	}
}
[HarmonyPatch(typeof(Character), "StopLocomotionAction")]
public class Character_StopLocomotionAction
{
	[HarmonyPrefix]
	public static void Prefix(Character __instance)
	{
		CustomWeaponBehaviour.ResetGrip(__instance);
	}
}
[HarmonyPatch(typeof(Character), "ReceiveBlock", new Type[]
{
	typeof(MonoBehaviour),
	typeof(float),
	typeof(Vector3),
	typeof(float),
	typeof(float),
	typeof(Character),
	typeof(float)
})]
public class Character_ReceiveBlock
{
	[HarmonyPrefix]
	public static void Prefix(Character __instance, Character _dealerChar, Vector3 _hitDir, ref float _knockBack)
	{
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		if (CustomWeaponBehaviour.Instance.parryBehaviour.DidSuccessfulParry(__instance.CurrentWeapon))
		{
			float num = _knockBack;
			float? obj;
			if (__instance == null)
			{
				obj = null;
			}
			else
			{
				Weapon currentWeapon = __instance.CurrentWeapon;
				obj = ((currentWeapon != null) ? new float?(currentWeapon.Impact) : null);
			}
			float? num2 = obj;
			_knockBack = num - num2.GetValueOrDefault();
			if (_knockBack < 0f)
			{
				_knockBack = 0f;
			}
			ParryBehaviour parryBehaviour = CustomWeaponBehaviour.Instance.parryBehaviour;
			float? obj2;
			if (__instance == null)
			{
				obj2 = null;
			}
			else
			{
				Weapon currentWeapon2 = __instance.CurrentWeapon;
				obj2 = ((currentWeapon2 != null) ? new float?(currentWeapon2.Impact) : null);
			}
			num2 = obj2;
			parryBehaviour.DeliverParry(__instance, _dealerChar, _hitDir, num2.GetValueOrDefault());
		}
	}
}
[HarmonyPatch(typeof(AttackSkill), "OwnerHasAllRequiredItems")]
public class AttackSkill_OwnerHasAllRequiredItemsMainHand
{
	[HarmonyPrefix]
	public static void Prefix(AttackSkill __instance, out List<WeaponType> __state)
	{
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: 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_00af: Unknown result type (might be due to invalid IL or missing references)
		__state = null;
		object obj;
		if (__instance == null)
		{
			obj = null;
		}
		else
		{
			Character ownerCharacter = ((EffectSynchronizer)__instance).OwnerCharacter;
			obj = ((ownerCharacter != null) ? ownerCharacter.CurrentWeapon : null);
		}
		Weapon val = (Weapon)obj;
		if (val == null || __instance.RequiredWeaponTypes == null)
		{
			return;
		}
		WeaponType? bastardType = BastardBehaviour.GetBastardType(val.Type);
		if (bastardType.HasValue)
		{
			WeaponType valueOrDefault = bastardType.GetValueOrDefault();
			if (__instance.RequiredWeaponTypes.Contains(valueOrDefault) && !__instance.RequiredWeaponTypes.Contains(val.Type) && CustomWeaponBehaviour.Instance.bastardBehaviour.IsBastardMode(val))
			{
				__state = __instance.RequiredWeaponTypes;
				__instance.RequiredWeaponTypes = new List<WeaponType>(__state);
				__instance.RequiredWeaponTypes.Add(val.Type);
			}
		}
	}

	public static void Postfix(AttackSkill __instance, List<WeaponType> __state)
	{
		if (__state != null)
		{
			__instance.RequiredWeaponTypes = __state;
		}
	}
}
[HarmonyPatch(typeof(AttackSkill), "OwnerHasAllRequiredItems")]
public class AttackSkill_OwnerHasAllRequiredItemsOffHand
{
	[HarmonyPrefix]
	public static void Prefix(AttackSkill __instance, out Tuple<List<WeaponType>, Equipment> __state)
	{
		//IL_0048: 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)
		__state = null;
		Character val = ((__instance != null) ? ((EffectSynchronizer)__instance).OwnerCharacter : null);
		if (val != null)
		{
			Weapon leftHandWeapon = val.LeftHandWeapon;
			if (leftHandWeapon != null && __instance.RequiredOffHandTypes != null && __instance.RequiredOffHandTypes.Contains((WeaponType)30) && ((Item)leftHandWeapon).HasTag(CustomWeaponBehaviour.PointyTag))
			{
				__state = new Tuple<List<WeaponType>, Equipment>(__instance.RequiredOffHandTypes, (Equipment)(object)(val.LeftHandWeapon ?? null));
				__instance.RequiredOffHandTypes = new List<WeaponType>(__state.Item1);
				__instance.RequiredOffHandTypes.Add(leftHandWeapon.Type);
				At.SetValue<Weapon>(leftHandWeapon, typeof(Character), (object)val, "m_leftHandEquipment");
			}
		}
	}

	public static void Postfix(AttackSkill __instance, Tuple<List<WeaponType>, Equipment> __state)
	{
		if (__state != null)
		{
			__instance.RequiredOffHandTypes = __state.Item1;
			At.SetValue<Equipment>(__state.Item2, typeof(Character), (object)((__instance != null) ? ((EffectSynchronizer)__instance).OwnerCharacter : null), "m_leftHandEquipment");
		}
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class WeaponDamage_BuildDamage
{
	[HarmonyPrefix]
	public static void Prefix(WeaponDamage __instance, ref AttackSkill ___m_attackSkill, out List<WeaponType> __state)
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: 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)
		__state = null;
		AttackSkill obj = ___m_attackSkill;
		object obj2;
		if (obj == null)
		{
			obj2 = null;
		}
		else
		{
			Character ownerCharacter = ((EffectSynchronizer)obj).OwnerCharacter;
			obj2 = ((ownerCharacter != null) ? ownerCharacter.CurrentWeapon : null);
		}
		Weapon val = (Weapon)obj2;
		if (val == null || ___m_attackSkill.RequiredWeaponTypes == null)
		{
			return;
		}
		WeaponType? bastardType = BastardBehaviour.GetBastardType(val.Type);
		if (bastardType.HasValue)
		{
			WeaponType valueOrDefault = bastardType.GetValueOrDefault();
			if (true && ___m_attackSkill.RequiredWeaponTypes.Contains(valueOrDefault) && !___m_attackSkill.RequiredWeaponTypes.Contains(val.Type) && CustomWeaponBehaviour.Instance.bastardBehaviour.IsBastardMode(val))
			{
				__state = ___m_attackSkill.RequiredWeaponTypes;
				___m_attackSkill.RequiredWeaponTypes = new List<WeaponType>(__state) { val.Type };
			}
		}
	}

	public static void Postfix(AttackSkill ___m_attackSkill, List<WeaponType> __state)
	{
		if (__state != null && (Object)(object)___m_attackSkill != (Object)null)
		{
			___m_attackSkill.RequiredWeaponTypes = __state;
		}
	}
}
[HarmonyPatch(typeof(AttackSkill), "OwnerHasAllRequiredItems")]
public class AttackSkill_OwnerHasAllRequiredItemsFist
{
	[HarmonyPrefix]
	public static void Prefix(AttackSkill __instance, out Tuple<List<WeaponType>, Equipment> __state)
	{
		//IL_0048: 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)
		__state = null;
		Character val = ((__instance != null) ? ((EffectSynchronizer)__instance).OwnerCharacter : null);
		if (val != null)
		{
			Weapon currentWeapon = val.CurrentWeapon;
			if (currentWeapon != null && __instance.RequiredOffHandTypes != null && __instance.RequiredOffHandTypes.Contains((WeaponType)30) && ((Item)currentWeapon).HasTag(CustomWeaponBehaviour.PointyTag))
			{
				__state = new Tuple<List<WeaponType>, Equipment>(__instance.RequiredOffHandTypes, (Equipment)(object)(val.LeftHandWeapon ?? null));
				__instance.RequiredOffHandTypes = new List<WeaponType>(__state.Item1);
				__instance.RequiredOffHandTypes.Add(currentWeapon.Type);
				At.SetValue<Weapon>(currentWeapon, typeof(Character), (object)val, "m_leftHandEquipment");
			}
		}
	}

	public static void Postfix(AttackSkill __instance, Tuple<List<WeaponType>, Equipment> __state)
	{
		if (__state != null)
		{
			__instance.RequiredOffHandTypes = __state.Item1;
			At.SetValue<Equipment>(__state.Item2, typeof(Character), (object)((__instance != null) ? ((EffectSynchronizer)__instance).OwnerCharacter : null), "m_leftHandEquipment");
		}
	}
}
[HarmonyPatch(typeof(CharacterStats), "GetAmplifiedAttackSpeed")]
public class CharacterStats_GetAmplifiedAttackSpeed
{
	[HarmonyPostfix]
	public static void Postfix(CharacterStats __instance, ref float __result, ref Character ___m_character)
	{
		Character obj = ___m_character;
		Weapon val = ((obj != null) ? obj.CurrentWeapon : null);
		if (!((Object)(object)val == (Object)null))
		{
			CustomBehaviourFormulas.PostAffectSpeed(val, ref __result);
		}
	}
}
[HarmonyPatch(typeof(WeaponStats), "GetAttackStamCost")]
public class WeaponStats_GetAttackStamCost
{
	[HarmonyPostfix]
	public static void Postfix(WeaponStats __instance, Item ___m_item, ref float __result)
	{
		Weapon val = (Weapon)(object)((___m_item is Weapon) ? ___m_item : null);
		if (val != null)
		{
			CustomBehaviourFormulas.PostAffectStaminaCost(val, ref __result);
		}
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Weapon_BaseImpact
{
	[HarmonyPostfix]
	public static void Postfix(Weapon __instance, ref float __result)
	{
		CustomBehaviourFormulas.PostAffectImpact(ref __instance, ref __result);
	}
}
[HarmonyPatch(typeof(WeaponStats), "GetAttackImpact")]
public class WeaponStats_GetAttackImpact
{
	[HarmonyPostfix]
	public static void Postfix(WeaponStats __instance, int _attackID, ref float __result, Item ___m_item)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Expected O, but got Unknown
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		Weapon val = (Weapon)___m_item;
		WeaponType val2 = val.Type;
		object obj;
		if (val == null)
		{
			obj = null;
		}
		else
		{
			Character ownerCharacter = ((EffectSynchronizer)val).OwnerCharacter;
			obj = ((ownerCharacter != null) ? ownerCharacter.Animator : null);
		}
		Animator val3 = (Animator)obj;
		if (val3 != null && UnityEngineExtensions.HasParameter(val3, "WeaponType"))
		{
			val2 = (WeaponType)val3.GetInteger("WeaponType");
		}
		float num = 1f;
		if (WeaponStatData.WeaponBaseDataDict.Keys.Contains(val2))
		{
			num = WeaponStatData.WeaponBaseDataDict[val2].ImpactMult[_attackID];
		}
		__result = val.Impact * num;
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
public class Weapon_Damage
{
	[HarmonyPostfix]
	public static void Postfix(Weapon __instance, ref DamageList __result)
	{
		__result = __result.Clone();
		CustomBehaviourFormulas.PostAffectDamage(ref __instance, ref __result);
	}
}
[HarmonyPatch(typeof(WeaponStats), "GetAttackDamage")]
public class WeaponStats_GetAttackDamage
{
	[HarmonyPostfix]
	public static void Postfix(WeaponStats __instance, int _attackID, ref IList<float> __result, Item ___m_item)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Expected O, but got Unknown
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		Weapon val = (Weapon)___m_item;
		WeaponType val2 = val.Type;
		object obj;
		if (val == null)
		{
			obj = null;
		}
		else
		{
			Character ownerCharacter = ((EffectSynchronizer)val).OwnerCharacter;
			obj = ((ownerCharacter != null) ? ownerCharacter.Animator : null);
		}
		Animator val3 = (Animator)obj;
		if (val3 != null && UnityEngineExtensions.HasParameter(val3, "WeaponType"))
		{
			val2 = (WeaponType)val3.GetInteger("WeaponType");
		}
		float[] array = new float[5] { 1f, 1f, 1f, 1f, 1f };
		if (WeaponStatData.WeaponBaseDataDict.Keys.Contains(val2))
		{
			array = WeaponStatData.WeaponBaseDataDict[val2].DamageMult;
		}
		if (_attackID < 0 || _attackID >= array.Length)
		{
			_attackID = 0;
		}
		DamageList damage = val.Damage;
		for (int i = 0; i < damage.Count && i < __result.Count; i++)
		{
			__result[i] = damage[i].Damage * array[_attackID];
		}
	}
}
public class WeaponStatData
{
	public static Dictionary<WeaponType, WeaponStatData> WeaponBaseDataDict = new Dictionary<WeaponType, WeaponStatData>
	{
		{
			(WeaponType)0,
			new WeaponStatData
			{
				DamageMult = new float[5] { 1f, 1f, 1.495f, 1.265f, 1.265f },
				ImpactMult = new float[5] { 1f, 1f, 1.3f, 1.1f, 1.1f },
				StamMult = new float[5] { 1f, 1f, 1.2f, 1.1f, 1.1f }
			}
		},
		{
			(WeaponType)51,
			new WeaponStatData
			{
				DamageMult = new float[5] { 1f, 1f, 1.5f, 1.265f, 1.265f },
				ImpactMult = new float[5] { 1f, 1f, 1.5f, 1.1f, 1.1f },
				StamMult = new float[5] { 1f, 1f, 1.3f, 1.1f, 1.1f }
			}
		},
		{
			(WeaponType)1,
			new WeaponStatData
			{
				DamageMult = new float[5] { 1f, 1f, 1.3f, 1.3f, 1.3f },
				ImpactMult = new float[5] { 1f, 1f, 1.3f, 1.3f, 1.3f },
				StamMult = new float[5] { 1f, 1f, 1.2f, 1.2f, 1.2f }
			}
		},
		{
			(WeaponType)52,
			new WeaponStatData
			{
				DamageMult = new float[5] { 1f, 1f, 1.3f, 1.3f, 1.3f },
				ImpactMult = new float[5] { 1f, 1f, 1.3f, 1.3f, 1.3f },
				StamMult = new float[5] { 1f, 1f, 1.375f, 1.375f, 1.35f }
			}
		},
		{
			(WeaponType)2,
			new WeaponStatData
			{
				DamageMult = new float[5] { 1f, 1f, 1.3f, 1.3f, 1.3f },
				ImpactMult = new float[5] { 1f, 1f, 2.5f, 1.3f, 1.3f },
				StamMult = new float[5] { 1f, 1f, 1.3f, 1.3f, 1.3f }
			}
		},
		{
			(WeaponType)53,
			new WeaponStatData
			{
				DamageMult = new float[5] { 1f, 1f, 0.75f, 1.4f, 1.4f },
				ImpactMult = new float[5] { 1f, 1f, 2f, 1.4f, 1.4f },
				StamMult = new float[5] { 1f, 1f, 1.2f, 1.2f, 1.2f }
			}
		},
		{
			(WeaponType)50,
			new WeaponStatData
			{
				DamageMult = new float[5] { 1f, 1f, 1.3f, 1.3f, 1.7f },
				ImpactMult = new float[5] { 1f, 1f, 1.3f, 1.3f, 1.7f },
				StamMult = new float[5] { 1f, 1f, 1.25f, 1.25f, 1.75f }
			}
		},
		{
			(WeaponType)54,
			new WeaponStatData
			{
				DamageMult = new float[5] { 1f, 1f, 1.4f, 1.3f, 1.2f },
				ImpactMult = new float[5] { 1f, 1f, 1.2f, 1.2f, 1.1f },
				StamMult = new float[5] { 1f, 1f, 1.25f, 1.25f, 1.25f }
			}
		},
		{
			(WeaponType)55,
			new WeaponStatData
			{
				DamageMult = new float[5] { 1f, 1f, 1.3f, 1.3f, 1.3f },
				ImpactMult = new float[5] { 1f, 1f, 1.3f, 1.3f, 1.3f },
				StamMult = new float[5] { 1f, 1f, 1.3f, 1.2f, 1.2f }
			}
		}
	};

	public float[] DamageMult;

	public float[] ImpactMult;

	public float[] StamMult;
}
[BepInPlugin("com.ehaugw.customweaponbehaviour", "Custom Weapon Behaviour", "3.1.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency("com.ehaugw.holydamagemanager", "1.0.0")]
[BepInDependency("com.ehaugw.tinyhelper", "4.3.4")]
public class CustomWeaponBehaviour : BaseUnityPlugin
{
	public const string GUID = "com.ehaugw.customweaponbehaviour";

	public const string VERSION = "3.1.3";

	public const string NAME = "Custom Weapon Behaviour";

	public static CustomWeaponBehaviour Instance;

	public static Tag BastardTag;

	public static Tag FinesseTag;

	public static Tag HolyWeaponTag;

	public static Tag HalfHandedTag;

	public static Tag SpecialLeapTag;

	public static Tag ParryTag;

	public static Tag BucklerTag;

	public static Tag WandTag;

	public static Tag HandsFreeTag;

	public static Tag LanternTag;

	public static Tag MaulShoveTag;

	public static Tag PointyTag;

	public BastardBehaviour bastardBehaviour = new BastardBehaviour();

	public MaulShoveBehaviour maulShoveBehaviour = new MaulShoveBehaviour();

	public FinesseBehaviour finesseBehaviour = new FinesseBehaviour();

	public HalfHandedBehaviour halfHandedBehaviour = new HalfHandedBehaviour();

	public HolyBehaviour holyBehaviour = new HolyBehaviour();

	public ParryBehaviour parryBehaviour = new ParryBehaviour();

	public AttackCancelByBlockBehaviour attackCancelByBlockBehaviour = new AttackCancelByBlockBehaviour();

	public AttackCancelBySkillBehaviour attackCancelBySkillBehaviour = new AttackCancelBySkillBehaviour();

	public static List<IBastardModifier> IBastardModifiers = new List<IBastardModifier>();

	public static List<IMaulShoveModifier> IMaulShoveModifiers = new List<IMaulShoveModifier>();

	public static List<IBaseDamageModifier> IBaseDamageModifiers = new List<IBaseDamageModifier>();

	internal void Awake()
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Expected O, but got Unknown
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Expected O, but got Unknown
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Expected O, but got Unknown
		IBastardModifiers.Add(new BastardModifier());
		IMaulShoveModifiers.Add(new MaulShoveModifier());
		Instance = this;
		Harmony val = new Harmony("com.ehaugw.customweaponbehaviour");
		val.PatchAll();
		SL.BeforePacksLoaded += BeforePacksLoaded;
		SL.OnPacksLoaded += OnPacksLoaded;
		TinyHelper.OnDescriptionModified = (DescriptionModifier)Delegate.Combine((Delegate?)(object)TinyHelper.OnDescriptionModified, (Delegate?)new DescriptionModifier(CustomTagDescriptionModifier));
	}

	private void CustomTagDescriptionModifier(Item item, ref string description)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: 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_0066: 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)
		string text = "";
		foreach (Tuple<Tag, string> item2 in new List<Tuple<Tag, string>>
		{
			new Tuple<Tag, string>(PointyTag, "Pointy"),
			new Tuple<Tag, string>(BastardTag, "Bastard"),
			new Tuple<Tag, string>(FinesseTag, "Finesse"),
			new Tuple<Tag, string>(HolyWeaponTag, "Holy"),
			new Tuple<Tag, string>(WandTag, "Wand")
		})
		{
			if (item.HasTag(item2.Item1))
			{
				text = text + ((text.Length > 0) ? ", " : "") + item2.Item2;
			}
		}
		if (text.Length > 0)
		{
			description = text + "\n\n" + description;
		}
	}

	private void BeforePacksLoaded()
	{
		//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_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: 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_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//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_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_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		PointyTag = TinyTagManager.GetOrMakeTag("Pointy");
		BastardTag = TinyTagManager.GetOrMakeTag("Bastard");
		FinesseTag = TinyTagManager.GetOrMakeTag("Finesse");
		HolyWeaponTag = TinyTagManager.GetOrMakeTag("Holy");
		ParryTag = TinyTagManager.GetOrMakeTag("Parry");
		BucklerTag = TinyTagManager.GetOrMakeTag("Buckler");
		HalfHandedTag = TinyTagManager.GetOrMakeTag("HalfHanded");
		SpecialLeapTag = TinyTagManager.GetOrMakeTag("SpecialLeap");
		WandTag = TinyTagManager.GetOrMakeTag("Wand");
		HandsFreeTag = TinyTagManager.GetOrMakeTag("HandsFreeTag");
		LanternTag = TinyTagManager.GetOrMakeTag("Lantern");
		MaulShoveTag = TinyTagManager.GetOrMakeTag("MaulShoveTag");
	}

	private void OnPacksLoaded()
	{
	}

	public static void ChangeGrip(Character character, WeaponType toMoveset)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Expected O, but got Unknown
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Expected I4, but got Unknown
		((CharacterKnowledge)character.Inventory.SkillKnowledge).AddItem(new Item());
		if (character != null)
		{
			Animator animator = character.Animator;
			if (animator != null)
			{
				animator.SetInteger("WeaponType", (int)toMoveset);
			}
		}
	}

	public static void ResetGrip(Character character)
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Expected I4, but got Unknown
		//IL_0049: 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_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Invalid comparison between Unknown and I4
		Weapon val = ((character != null) ? character.CurrentWeapon : null);
		if (val != null && character != null)
		{
			Animator animator = character.Animator;
			if (animator != null)
			{
				animator.SetInteger("WeaponType", (int)val.Type);
			}
		}
		Equipment val2 = ((character != null) ? character.LeftHandEquipment : null);
		if (val2 != null && ((Item)val2).HasTag(HandsFreeTag) && ((Item)val2).HasTag(LanternTag) && (int)val2.IKType == 0)
		{
			val2.IKType = (IKMode)1;
		}
	}
}
public class MaulShoveModifier : IMaulShoveModifier
{
	public void ApplyDamageModifier(Weapon weapon, DamageList original, ref DamageList result)
	{
		result += original * -0.25f;
	}

	public void ApplyImpactModifier(Weapon weapon, float original, ref float result)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Invalid comparison between Unknown and I4
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Invalid comparison between Unknown and I4
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Invalid comparison between Unknown and I4
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Invalid comparison between Unknown and I4
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Invalid comparison between Unknown and I4
		WeaponType type = weapon.Type;
		WeaponType val = type;
		if ((int)val <= 2)
		{
			if ((int)val <= 1)
			{
				goto IL_002a;
			}
			if ((int)val != 2)
			{
				return;
			}
		}
		else
		{
			if (val - 51 <= 1)
			{
				goto IL_002a;
			}
			if ((int)val != 53)
			{
				return;
			}
		}
		result += original * 0.5f;
		return;
		IL_002a:
		result += original * 2f;
	}

	public void ApplySpeedModifier(Weapon weapon, float original, ref float result)
	{
		result += original * -0.2f;
	}
}
public class BastardModifier : IBastardModifier
{
	public void ApplyDamageModifier(Weapon weapon, DamageList original, ref DamageList result)
	{
		result += original * 0.1f;
	}

	public void ApplyImpactModifier(Weapon weapon, float original, ref float result)
	{
		result += original * 0.1f;
	}

	public void ApplySpeedModifier(Weapon weapon, float original, ref float result)
	{
		result += 0.1f;
	}

	public void ApplyStaminaModifier(Weapon weapon, float original, ref float stamina)
	{
		stamina += original * -0.4f;
	}
}

plugins/HolyDamageManager.dll

Decompiled 6 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace HolyDamageManager;

[BepInPlugin("com.ehaugw.holydamagemanager", "Holy Damage Manager", "1.0.0")]
public class HolyDamageManager : BaseUnityPlugin
{
	public const string GUID = "com.ehaugw.holydamagemanager";

	public const string VERSION = "1.0.0";

	public const string NAME = "Holy Damage Manager";

	private static Types m_holyDamageType;

	private static Tag m_holyDamageTag;

	internal void Awake()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		SetHolyType((Types)3);
		SetHolyTag(Tag.None);
	}

	public static void SetHolyType(Types type)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		m_holyDamageType = type;
	}

	public static void SetHolyTag(Tag tag)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		m_holyDamageTag = tag;
	}

	public static float BuffHolyDamageOrHealing(Character character, float value)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//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_0020: Unknown result type (might be due to invalid IL or missing references)
		DamageList val = new DamageList(GetDamageType(), value);
		character.Stats.GetAmplifiedDamage((IList<Tag>)(object)new Tag[1] { GetDamageTag() }, ref val);
		return val.TotalDamage;
	}

	public static Tag GetDamageTag()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		return m_holyDamageTag;
	}

	public static Types GetDamageType()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		return m_holyDamageType;
	}

	public static int GetHolyIndex()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected I4, but got Unknown
		return (int)GetDamageType();
	}

	public static float[] GetHolyDamageBonusArray(float damageBonus)
	{
		float[] array = new float[9];
		array[GetHolyIndex()] = damageBonus;
		return array;
	}
}

plugins/TinyHelper.dll

Decompiled 6 months ago
#define DEBUG
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.Threading;
using System.Threading.Tasks;
using BepInEx;
using HarmonyLib;
using Localizer;
using NodeCanvas.DialogueTrees;
using NodeCanvas.Framework;
using NodeCanvas.Tasks.Actions;
using NodeCanvas.Tasks.Conditions;
using Photon;
using TinyHelper.Effects;
using TinyHelper.Interfaces;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
public static class TinyHelpers
{
	public static void Shuffle<T>(this IList<T> list)
	{
		Random random = new Random();
		int count = list.Count;
		for (int num = list.Count - 1; num > 1; num--)
		{
			int index = random.Next(num + 1);
			T value = list[index];
			list[index] = list[num];
			list[num] = value;
		}
	}
}
namespace TinyHelper
{
	public static class At
	{
		public static BindingFlags flags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;

		public static object Call(object obj, string method, params object[] args)
		{
			MethodInfo method2 = obj.GetType().GetMethod(method, flags);
			if (method2 != null)
			{
				return method2.Invoke(obj, args);
			}
			return null;
		}

		public static void SetValue<T>(T value, Type type, object obj, string field)
		{
			FieldInfo field2 = type.GetField(field, flags);
			if (field2 != null)
			{
				field2.SetValue(obj, value);
			}
		}

		public static object GetValue(Type type, object obj, string value)
		{
			FieldInfo field = type.GetField(value, flags);
			if (field != null)
			{
				return field.GetValue(obj);
			}
			return null;
		}

		public static void InheritBaseValues(object _derived, object _base)
		{
			FieldInfo[] fields = _base.GetType().GetFields(flags);
			foreach (FieldInfo fieldInfo in fields)
			{
				try
				{
					_derived.GetType().GetField(fieldInfo.Name).SetValue(_derived, fieldInfo.GetValue(_base));
				}
				catch
				{
				}
			}
		}
	}
	public class QuestKnowledgeCondition : EffectCondition
	{
		public int[] Quests;

		public LogicType Logic = LogicType.Any;

		protected override bool CheckIsValid(Character _affectedCharacter)
		{
			return QuestRequirements.HasQuestKnowledge(_affectedCharacter, Quests, Logic);
		}
	}
	public class StatusEffectsCondition : EffectCondition
	{
		public enum LogicType
		{
			Any,
			All
		}

		public string[] StatusEffectNames;

		public LogicType Logic = LogicType.Any;

		protected override bool CheckIsValid(Character _affectedCharacter)
		{
			StatusEffectManager statusEffectManager = ((_affectedCharacter != null) ? _affectedCharacter.StatusEffectMngr : null);
			if (statusEffectManager != null)
			{
				IEnumerable<bool> source = StatusEffectNames.Select((string x) => (Object)(object)statusEffectManager.GetStatusEffectOfName(x) != (Object)null);
				return (Logic == LogicType.Any) ? source.Any((bool x) => x) : source.All((bool x) => x);
			}
			return false;
		}
	}
	public class AddNewStatusEffectRandom : AddStatusEffectRandom
	{
		protected override bool TryTriggerConditions()
		{
			List<StatusEffect> list = base.Statuses.ToList();
			list.Shuffle();
			base.ForceID = -1;
			for (int i = 0; i < list.Count; i++)
			{
				StatusEffect val = list[i];
				if (!((Object)(object)val == (Object)null) && !((Object)(object)((Effect)this).m_affectedCharacter == (Object)null) && !((Effect)this).m_affectedCharacter.StatusEffectMngr.HasStatusEffect(val.EffectFamily))
				{
					base.ForceID = UnityEngineExtensions.IndexOf<StatusEffect>(base.Statuses, val);
					break;
				}
			}
			return ((AddStatusEffectRandom)this).TryTriggerConditions();
		}
	}
	public class CooldownChangeEffect : Effect
	{
		public float HitKnockbackCooldown = -1f;

		protected override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			Item parentItem = ((Effect)this).ParentItem;
			Skill val = (Skill)(object)((parentItem is Skill) ? parentItem : null);
			if (val != null && HitKnockbackCooldown != -1f && _affectedCharacter.IsInKnockback)
			{
				At.SetValue(HitKnockbackCooldown, typeof(Skill), val, "m_remainingCooldownTime");
			}
		}
	}
	public class EquipSkillDurabilityCondition : EquipDurabilityCondition
	{
		protected override bool CheckIsValid(Character _affectedCharacter)
		{
			Skill component = ((Component)((Component)this).transform.parent.parent).gameObject.GetComponent<Skill>();
			if (component != null)
			{
				base.DurabilityRequired = component.DurabilityCost;
			}
			return ((EquipDurabilityCondition)this).CheckIsValid(_affectedCharacter);
		}

		public static ActivationCondition AddToSkill(Skill skill, EquipmentSlotIDs slot)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			Transform orMake = TinyGameObjectManager.GetOrMake(((Component)skill).transform, "AdditionalActivationConditions", setActive: true, dontDestroyOnLoad: true);
			GameObject gameObject = ((Component)TinyGameObjectManager.GetOrMake(orMake, "EquipSkillDurabilityCondition", setActive: true, dontDestroyOnLoad: true)).gameObject;
			ActivationCondition val = new ActivationCondition();
			EquipSkillDurabilityCondition equipSkillDurabilityCondition = gameObject.AddComponent<EquipSkillDurabilityCondition>();
			((EquipDurabilityCondition)equipSkillDurabilityCondition).EquipmentSlot = slot;
			val.Condition = (EffectCondition)(object)equipSkillDurabilityCondition;
			At.SetValue("A required piece of equipment is missing or too damaged to be used this way.", typeof(ActivationCondition), val, "m_defaultMessage");
			List<ActivationCondition> list = (At.GetValue(typeof(Skill), skill, "m_additionalConditions") as ActivationCondition[])?.ToList() ?? new List<ActivationCondition>();
			list.Add(val);
			At.SetValue(list.ToArray(), typeof(Skill), skill, "m_additionalConditions");
			return val;
		}

		public static ActivationCondition AddToSkillNotBroken(Skill skill, EquipmentSlotIDs slot)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			Transform orMake = TinyGameObjectManager.GetOrMake(((Component)skill).transform, "AdditionalActivationConditions", setActive: true, dontDestroyOnLoad: true);
			GameObject gameObject = ((Component)TinyGameObjectManager.GetOrMake(orMake, "EquipDurabilityCondition", setActive: true, dontDestroyOnLoad: true)).gameObject;
			ActivationCondition val = new ActivationCondition();
			EquipDurabilityCondition val2 = gameObject.AddComponent<EquipDurabilityCondition>();
			val2.EquipmentSlot = slot;
			val2.DurabilityRequired = 0f;
			val.Condition = (EffectCondition)(object)val2;
			At.SetValue("A required piece of equipment is missing or broken.", typeof(ActivationCondition), val, "m_defaultMessage");
			List<ActivationCondition> list = (At.GetValue(typeof(Skill), skill, "m_additionalConditions") as ActivationCondition[])?.ToList() ?? new List<ActivationCondition>();
			list.Add(val);
			At.SetValue(list.ToArray(), typeof(Skill), skill, "m_additionalConditions");
			return val;
		}
	}
	public class AffectCorruption : Effect
	{
		public float AffectQuantity = 0f;

		public bool AffectOwner = false;

		public bool IsRaw = false;

		protected override KeyValuePair<string, Type>[] GenerateSignature()
		{
			return new KeyValuePair<string, Type>[1]
			{
				new KeyValuePair<string, Type>("Value", typeof(float))
			};
		}

		public override void SetValue(string[] _data)
		{
			if (_data == null || _data.Length >= 1)
			{
				float.TryParse(_data[0], out AffectQuantity);
			}
		}

		protected override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			if (AffectOwner)
			{
				_affectedCharacter = ((Effect)this).OwnerCharacter;
			}
			if ((Object)(object)_affectedCharacter != (Object)null && _affectedCharacter.Alive && Object.op_Implicit((Object)(object)_affectedCharacter.PlayerStats))
			{
				_affectedCharacter.PlayerStats.AffectCorruptionLevel(AffectQuantity, !IsRaw);
			}
		}
	}
	public class UseMana : Effect
	{
		public float UsedMana = 0f;

		protected override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			_affectedCharacter.Stats.UseMana((Tag[])null, UsedMana);
		}
	}
	public class SpecificImbueCondition : EffectCondition
	{
		public ImbueEffectPreset imbueEffectPreset;

		private bool inverse = false;

		protected override bool CheckIsValid(Character _affectedCharacter)
		{
			Weapon val = ((_affectedCharacter != null) ? _affectedCharacter.CurrentWeapon : null);
			return val != null && val.HasImbuePreset(imbueEffectPreset);
		}

		public static ActivationCondition AddToSkill(Skill skill, ImbueEffectPreset imbueEffectPreset, bool inverse = false)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			GameObject val = new GameObject("SpecificImbueCondition");
			ActivationCondition val2 = new ActivationCondition();
			SpecificImbueCondition specificImbueCondition = val.AddComponent<SpecificImbueCondition>();
			Object.DontDestroyOnLoad((Object)(object)specificImbueCondition);
			val.SetActive(false);
			val2.Condition = (EffectCondition)(object)specificImbueCondition;
			specificImbueCondition.inverse = inverse;
			specificImbueCondition.imbueEffectPreset = imbueEffectPreset;
			At.SetValue("You do not have the required imbue effect.", typeof(ActivationCondition), val2, "m_defaultMessage");
			List<ActivationCondition> list = (At.GetValue(typeof(Skill), skill, "m_additionalConditions") as ActivationCondition[])?.ToList() ?? new List<ActivationCondition>();
			list.Add(val2);
			At.SetValue(list.ToArray(), typeof(Skill), skill, "m_additionalConditions");
			return val2;
		}
	}
	public class ExtendedAddStatusEffect : AddStatusEffect
	{
		public bool ExtendDuration = false;

		protected override void ActivateLocally(Character _targetCharacter, object[] _infos)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			StatusEffect status = base.Status;
			if (ExtendDuration)
			{
				bool? obj;
				if (_targetCharacter == null)
				{
					obj = null;
				}
				else
				{
					StatusEffectManager statusEffectMngr = _targetCharacter.StatusEffectMngr;
					obj = ((statusEffectMngr != null) ? new bool?(statusEffectMngr.HasStatusEffect(status.IdentifierName)) : null);
				}
				bool? flag = obj;
				if (flag.GetValueOrDefault())
				{
					StatusData statusData = status.StatusData;
					status.StatusData = new StatusData(statusData);
					StatusEffect statusEffectOfName = _targetCharacter.StatusEffectMngr.GetStatusEffectOfName(status.IdentifierName);
					float num = ((statusEffectOfName != null) ? statusEffectOfName.RemainingLifespan : 0f);
					float num2 = ((status.RemainingLifespan > 0f) ? status.RemainingLifespan : status.StartLifespan);
					status.StatusData.LifeSpan = num2 + num;
					((AddStatusEffect)this).ActivateLocally(_targetCharacter, _infos);
					status.StatusData = statusData;
					return;
				}
			}
			((AddStatusEffect)this).ActivateLocally(_targetCharacter, _infos);
		}
	}
	public static class AnimatorExtension
	{
		public static bool HasParameter(this Animator animator, string paramName)
		{
			AnimatorControllerParameter[] parameters = animator.parameters;
			foreach (AnimatorControllerParameter val in parameters)
			{
				if (val.name == paramName)
				{
					return true;
				}
			}
			return false;
		}
	}
	public class TinyCharacterManager
	{
		public static Character SpawnCharacter(string uid, Vector3 position, Vector3 rotation)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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)
			Character character = CharacterManager.Instance.GetCharacter(uid);
			if ((Object)(object)character != (Object)null)
			{
				return character;
			}
			object[] array = new object[4]
			{
				4,
				"NewPlayerPrefab",
				uid,
				string.Empty
			};
			GameObject val = PhotonNetwork.InstantiateSceneObject("_characters/NewPlayerPrefab", position, Quaternion.Euler(rotation), (byte)0, array);
			val.SetActive(false);
			Character component = val.GetComponent<Character>();
			component.SetUID(UID.op_Implicit(uid));
			At.SetValue<Character>(component, typeof(int), 1, "m_isAI");
			return component;
		}
	}
	public class TinyDialogueManager
	{
		public static GameObject AssignTrainerTemplate(Transform parentTransform)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			Object obj = Object.Instantiate(Resources.Load("editor/templates/TrainerTemplate"));
			GameObject val = (GameObject)(object)((obj is GameObject) ? obj : null);
			val.transform.parent = parentTransform;
			val.transform.position = parentTransform.position;
			val.transform.rotation = parentTransform.rotation;
			return val;
		}

		public static DialogueActor SetDialogueActorName(GameObject dialogueGameObject, string name)
		{
			DialogueActor componentInChildren = dialogueGameObject.GetComponentInChildren<DialogueActor>();
			componentInChildren.SetName(name);
			return componentInChildren;
		}

		public static Trainer SetTrainerSkillTree(GameObject trainerTemplate, UID skillTreeUID)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			Trainer componentInChildren = trainerTemplate.GetComponentInChildren<Trainer>();
			At.SetValue<UID>(skillTreeUID, typeof(Trainer), componentInChildren, "m_skillTreeUID");
			return componentInChildren;
		}

		public static Graph GetDialogueGraph(GameObject trainerTemplate)
		{
			DialogueTreeController componentInChildren = trainerTemplate.GetComponentInChildren<DialogueTreeController>();
			return ((GraphOwner)componentInChildren).graph;
		}

		public static void SetActorReference(Graph graph, DialogueActor actor)
		{
			List<ActorParameter> list = At.GetValue(typeof(DialogueTree), (graph is DialogueTree) ? graph : null, "_actorParameters") as List<ActorParameter>;
			list[0].actor = (IDialogueActor)(object)actor;
			list[0].name = actor.name;
		}

		public static ActionNode MakeTrainDialogueAction(Graph graph, Trainer trainer)
		{
			Node obj = graph.allNodes[1];
			ActionNode val = (ActionNode)(object)((obj is ActionNode) ? obj : null);
			ActionTask action = val.action;
			((TrainDialogueAction)((action is TrainDialogueAction) ? action : null)).Trainer = new BBParameter<Trainer>(trainer);
			return val;
		}

		public static ActionNode MakeStartQuest(Graph graph, int questID)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			ActionNode val = graph.AddNode<ActionNode>();
			GiveQuest val3 = (GiveQuest)(object)(val.action = (ActionTask)new GiveQuest());
			ref BBParameter<Quest> quest = ref val3.quest;
			Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(questID);
			quest = new BBParameter<Quest>((Quest)(object)((itemPrefab is Quest) ? itemPrefab : null));
			return val;
		}

		public static ActionNode MakeQuestEvent(Graph graph, string EventUID)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			ActionNode val = graph.AddNode<ActionNode>();
			SendQuestEvent val3 = (SendQuestEvent)(object)(val.action = (ActionTask)new SendQuestEvent());
			val3.QuestEventRef = new QuestEventReference
			{
				EventUID = EventUID
			};
			return val;
		}

		public static ConditionNode MakeEventOccuredCondition(Graph graph, string EventUID)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			ConditionNode val = graph.AddNode<ConditionNode>();
			val.condition = (ConditionTask)new Condition_QuestEventOccured();
			return val;
		}

		public static ActionNode MakeGiveItemReward(Graph graph, int itemID, Receiver receiver, int quantity = 1)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			ActionNode val = graph.AddNode<ActionNode>();
			GiveReward val3 = (GiveReward)(object)(val.action = (ActionTask)new GiveReward());
			val3.RewardReceiver = receiver;
			ItemQuantity val4 = new ItemQuantity();
			ItemReference val5 = new ItemReference();
			val5.ItemID = itemID;
			val4.Item = new BBParameter<ItemReference>(val5);
			val4.Quantity = BBParameter<int>.op_Implicit(quantity);
			val3.ItemReward = new List<ItemQuantity> { val4 };
			return val;
		}

		public static StatementNodeExt MakeStatementNode(Graph graph, string name, string statementText)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			StatementNodeExt val = graph.AddNode<StatementNodeExt>();
			val.statement = new Statement(statementText);
			val.SetActorName(name);
			return val;
		}

		public static MultipleChoiceNodeExt MakeMultipleChoiceNode(Graph graph, string[] statementTexts)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_0037: Expected O, but got Unknown
			MultipleChoiceNodeExt val = graph.AddNode<MultipleChoiceNodeExt>();
			foreach (string text in statementTexts)
			{
				val.availableChoices.Add(new Choice
				{
					statement = new Statement
					{
						text = text
					}
				});
			}
			return val;
		}
	}
	public class TinyGameObjectManager
	{
		public static Transform GetOrMake(Transform parent, string child, bool setActive, bool dontDestroyOnLoad)
		{
			return parent.Find(child) ?? MakeFreshObject(child, setActive, dontDestroyOnLoad, parent).transform;
		}

		public static GameObject InstantiateClone(GameObject sourceGameObject, bool setActive, bool dontDestroyOnLoad)
		{
			return InstantiateClone(sourceGameObject, ((Object)sourceGameObject).name + "(Clone)", setActive, dontDestroyOnLoad);
		}

		public static GameObject InstantiateClone(GameObject sourceGameObject, string newGameObjectName, bool setActive, bool dontDestroyOnLoad)
		{
			GameObject val = Object.Instantiate<GameObject>(sourceGameObject);
			val.SetActive(setActive);
			((Object)val).name = newGameObjectName;
			if (dontDestroyOnLoad)
			{
				Object.DontDestroyOnLoad((Object)(object)val);
			}
			return val;
		}

		public static Transform MakeFreshTransform(Transform parent, string child, bool setActive, bool dontDestroyOnLoad)
		{
			return MakeFreshObject(child, setActive, dontDestroyOnLoad, parent).transform;
		}

		public static GameObject MakeFreshObject(string newGameObjectName, bool setActive, bool dontDestroyOnLoad, Transform parent = null)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			GameObject val = new GameObject(newGameObjectName);
			val.SetActive(setActive);
			if ((Object)(object)parent != (Object)null)
			{
				val.transform.SetParent(parent);
			}
			if (dontDestroyOnLoad)
			{
				RecursiveDontDestroyOnLoad(val.transform);
			}
			return val;
		}

		public static void RecursiveDontDestroyOnLoad(Transform transform)
		{
			Transform val = transform;
			while ((Object)(object)val.parent != (Object)null)
			{
				val = val.parent;
			}
			Object.DontDestroyOnLoad((Object)(object)((Component)val).gameObject);
		}
	}
	public enum Behaviour
	{
		Add,
		Purge,
		Replace
	}
	public class TinyItemManager
	{
		private static Dictionary<int, ItemLocalization> m_ItemLocalizationDictionary;

		private static Dictionary<string, Item> m_ItemPrefabDictionary;

		private static Dictionary<int, ItemLocalization> ItemLocalizationDictionary
		{
			get
			{
				if (m_ItemLocalizationDictionary == null)
				{
					m_ItemLocalizationDictionary = At.GetValue(typeof(LocalizationManager), LocalizationManager.Instance, "m_itemLocalization") as Dictionary<int, ItemLocalization>;
				}
				return m_ItemLocalizationDictionary;
			}
		}

		private static Dictionary<string, Item> ItemPrefabDictionary
		{
			get
			{
				if (m_ItemPrefabDictionary == null)
				{
					m_ItemPrefabDictionary = At.GetValue(typeof(ResourcesPrefabManager), null, "ITEM_PREFABS") as Dictionary<string, Item>;
				}
				return m_ItemPrefabDictionary;
			}
		}

		public static bool SetLegacyResult(int itemID, int legacyOutcomeID)
		{
			Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(itemID);
			if ((Object)(object)itemPrefab != (Object)null)
			{
				itemPrefab.LegacyItemID = legacyOutcomeID;
				return true;
			}
			return false;
		}

		public static bool AddEnchantingOption(int itemID, int enchantingRecipeID)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(itemID);
			EnchantmentRecipe enchantmentRecipeForID = RecipeManager.Instance.GetEnchantmentRecipeForID(enchantingRecipeID);
			if ((Object)(object)enchantmentRecipeForID != (Object)null && (Object)(object)itemPrefab != (Object)null)
			{
				List<IngredientData> list = enchantmentRecipeForID.CompatibleEquipments.CompatibleEquipments.ToList();
				list.Add(new IngredientData
				{
					Type = (IngredientType)1,
					SpecificIngredient = itemPrefab
				});
				enchantmentRecipeForID.CompatibleEquipments = new EquipmentData
				{
					EquipmentTag = enchantmentRecipeForID.CompatibleEquipments.EquipmentTag,
					CompatibleEquipments = list.ToArray()
				};
				return true;
			}
			return false;
		}

		public static Item MakeItem(int newID, int targetID, string name = null, string description = null, string identifierName = null)
		{
			Item val = TryCloneTargetItem(newID, targetID, newID + "_" + identifierName);
			ApplyNameAndDescription(val, name, description);
			return val;
		}

		public static Skill MakeSkill(int newID, int targetID, string name = null, string description = null, string identifierName = null, int? manaCost = 0, int? staminaCost = 0, int? healthCost = 0, bool? ignoreLearnNotification = null, bool? hideInUI = null)
		{
			Item obj = MakeItem(newID, targetID, name, description, identifierName);
			Skill val = (Skill)(object)((obj is Skill) ? obj : null);
			if (manaCost.HasValue)
			{
				val.ManaCost = manaCost.GetValueOrDefault();
			}
			if (healthCost.HasValue)
			{
				val.HealthCost = healthCost.GetValueOrDefault();
			}
			if (staminaCost.HasValue)
			{
				val.StaminaCost = staminaCost.GetValueOrDefault();
			}
			val.IgnoreLearnNotification = ignoreLearnNotification.GetValueOrDefault();
			return val;
		}

		public static Item TryCloneTargetItem(int newID, int targetID, string identifierName = null)
		{
			Dictionary<string, Item> itemPrefabDictionary = ItemPrefabDictionary;
			Item item = GetItem(targetID.ToString());
			if ((Object)(object)item == (Object)null)
			{
				TinyHelper.TinyHelperPrint("Could not find target item with ID " + targetID + ".");
				return null;
			}
			if ((Object)(object)((Component)item).gameObject.GetComponent<Item>() == (Object)null)
			{
				TinyHelper.TinyHelperPrint(((Object)item).name + " is does not have an Item component.");
				return null;
			}
			GameObject val = Object.Instantiate<GameObject>(((Component)item).gameObject);
			val.SetActive(false);
			Object.DontDestroyOnLoad((Object)(object)val);
			Item component = val.GetComponent<Item>();
			component.ItemID = newID;
			((Object)component).name = identifierName ?? (newID + "_" + component.Name.Replace(" ", ""));
			ItemPrefabDictionary.Add(component.ItemID.ToString(), component);
			return component;
		}

		public static void ApplyNameAndDescription(Item item, string name, string description)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			ItemLocalization value = new ItemLocalization(name, description);
			At.SetValue(name, typeof(Item), item, "m_name");
			if (ItemLocalizationDictionary.ContainsKey(item.ItemID))
			{
				ItemLocalizationDictionary[item.ItemID] = value;
			}
			else
			{
				ItemLocalizationDictionary.Add(item.ItemID, value);
			}
		}

		private static Item GetItem(int itemID)
		{
			return GetItem(itemID.ToString());
		}

		private static Item GetItem(string itemID)
		{
			return ItemPrefabDictionary[itemID];
		}
	}
	public class TinyHelperRPCManager : MonoBehaviour
	{
		public static TinyHelperRPCManager Instance;

		internal void Start()
		{
			Instance = this;
			PhotonView val = ((Component)this).gameObject.AddComponent<PhotonView>();
			val.viewID = 954;
			Debug.Log((object)("Registered TinyHelpertRPC with ViewID " + ((MonoBehaviour)this).photonView.viewID));
		}

		[PunRPC]
		public void ApplyAddImbueEffectRPC(string weaponGUID, int infusionID, float duration)
		{
			Item item = ItemManager.Instance.GetItem(weaponGUID);
			Weapon val = (Weapon)(object)((item is Weapon) ? item : null);
			? val2 = val;
			EffectPreset effectPreset = ResourcesPrefabManager.Instance.GetEffectPreset(infusionID);
			((Weapon)val2).AddImbueEffect((ImbueEffectPreset)(object)((effectPreset is ImbueEffectPreset) ? effectPreset : null), duration, (ImbueStack)null);
		}
	}
	public class QuestRequirements
	{
		public static bool HasQuestEvent(string questEventUID)
		{
			return QuestEventManager.Instance.GetEventCurrentStack(questEventUID) > 0;
		}

		public static bool HasQuestKnowledge(Character character, int[] questIDs, LogicType logicType, bool inverted = false, bool requireCompleted = false)
		{
			bool flag = false;
			object obj;
			if (character == null)
			{
				obj = null;
			}
			else
			{
				CharacterInventory inventory = character.Inventory;
				obj = ((inventory != null) ? inventory.QuestKnowledge : null);
			}
			CharacterQuestKnowledge q = (CharacterQuestKnowledge)obj;
			if (q != null)
			{
				IEnumerable<bool> source = questIDs.Select((int x) => ((CharacterKnowledge)q).IsItemLearned(x) && (q.IsQuestCompleted(x) || !requireCompleted));
				flag = flag || ((logicType == LogicType.Any) ? source.Any((bool x) => x) : source.All((bool x) => x));
			}
			return flag ^ inverted;
		}
	}
	public enum LogicType
	{
		Any,
		All
	}
	public class SkillRequirements
	{
		public static bool SafeHasSkillKnowledge(Character character, int skillID)
		{
			bool? obj;
			if (character == null)
			{
				obj = null;
			}
			else
			{
				CharacterInventory inventory = character.Inventory;
				if (inventory == null)
				{
					obj = null;
				}
				else
				{
					CharacterSkillKnowledge skillKnowledge = inventory.SkillKnowledge;
					obj = ((skillKnowledge != null) ? new bool?(((CharacterKnowledge)skillKnowledge).IsItemLearned(skillID)) : null);
				}
			}
			bool? flag = obj;
			return flag.GetValueOrDefault();
		}
	}
	public class CustomTexture
	{
		public enum SpriteBorderTypes
		{
			None,
			Item,
			TrainerSkill
		}

		public enum IconName
		{
			m_itemIcon,
			SkillTreeIcon
		}

		private static Dictionary<string, byte[]> m_loadedTextures;

		private static Dictionary<string, byte[]> LoadedTextures
		{
			get
			{
				if (m_loadedTextures == null)
				{
					m_loadedTextures = new Dictionary<string, byte[]>();
				}
				return m_loadedTextures;
			}
		}

		public static Texture2D LoadTexture(string filePath, int mipCount, bool linear, FilterMode filterMode, float? mipMapBias = null, string rootPath = null)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			filePath = (rootPath ?? TinyHelper.PLUGIN_ROOT_PATH) + filePath;
			if (!LoadedTextures.ContainsKey(filePath))
			{
				LoadedTextures[filePath] = File.ReadAllBytes(filePath);
			}
			Texture2D val = new Texture2D(4, 4, (TextureFormat)12, mipCount > 0, linear);
			((Texture)val).filterMode = filterMode;
			((Texture)val).mipMapBias = mipMapBias ?? ((Texture)val).mipMapBias;
			ImageConversion.LoadImage(val, LoadedTextures[filePath]);
			((Texture)val).filterMode = (FilterMode)1;
			return val;
		}

		public static Sprite MakeSprite(Texture2D texture, SpriteBorderTypes spriteBorderType)
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			float num;
			float num2;
			float num3;
			float num4;
			switch (spriteBorderType)
			{
			case SpriteBorderTypes.Item:
				num = 1f;
				num2 = 2f;
				num3 = 2f;
				num4 = 3f;
				break;
			case SpriteBorderTypes.TrainerSkill:
				num = 1f;
				num2 = 1f;
				num3 = 1f;
				num4 = 2f;
				break;
			default:
				num = 0f;
				num2 = 0f;
				num3 = 0f;
				num4 = 0f;
				break;
			}
			return Sprite.Create(texture, new Rect(num, num3, (float)((Texture)texture).width - num2, (float)((Texture)texture).height - num4), new Vector2(0f, 0f), 100f, 0u);
		}
	}
	public class CooldownChangeWeaponDamageTargetHealth : WeaponDamageTargetHealth
	{
		public float ExecuteSetCooldown = -1f;

		public float HitKnockbackCooldown = -1f;

		protected override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			Item parentItem = ((Effect)this).ParentItem;
			Skill val = (Skill)(object)((parentItem is Skill) ? parentItem : null);
			if (val != null)
			{
				if (HitKnockbackCooldown != -1f && _affectedCharacter.IsInKnockback)
				{
					At.SetValue(HitKnockbackCooldown, typeof(Skill), val, "m_remainingCooldownTime");
				}
				bool isDead = _affectedCharacter.IsDead;
				((WeaponDamage)this).ActivateLocally(_affectedCharacter, _infos);
				if (!isDead && _affectedCharacter.IsDead && ExecuteSetCooldown != -1f)
				{
					At.SetValue(ExecuteSetCooldown, typeof(Skill), val, "m_remainingCooldownTime");
				}
			}
		}
	}
	public class ToggleEffect : Effect
	{
		public StatusEffect StatusEffectInstance;

		protected override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			if (_affectedCharacter.StatusEffectMngr.HasStatusEffect(StatusEffectInstance.IdentifierName))
			{
				_affectedCharacter.StatusEffectMngr.CleanseStatusEffect(((Object)StatusEffectInstance).name);
			}
			else
			{
				_affectedCharacter.StatusEffectMngr.AddStatusEffect(StatusEffectInstance, ((Effect)this).SourceCharacter);
			}
		}
	}
	public class AddThenSpreadStatus : AddStatusEffect
	{
		public float Range;

		protected override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			if (base.AffectController)
			{
				_affectedCharacter = ((Effect)this).OwnerCharacter;
			}
			if ((Object)(object)((_affectedCharacter != null) ? _affectedCharacter.StatusEffectMngr : null) == (Object)null || (Object)(object)base.Status == (Object)null)
			{
				return;
			}
			if (_affectedCharacter.StatusEffectMngr.HasStatusEffect(base.Status.IdentifierName))
			{
				List<Character> source = new List<Character>();
				CharacterManager.Instance.FindCharactersInRange(_affectedCharacter.CenterPosition, Range, ref source);
				foreach (Character item in source.Where((Character c) => !c.IsAlly(((Effect)this).SourceCharacter)))
				{
					((AddStatusEffect)this).ActivateLocally(item, _infos);
				}
			}
			((AddStatusEffect)this).ActivateLocally(_affectedCharacter, _infos);
		}
	}
	public class EmptyOffHandCondition : EffectCondition
	{
		public bool AllowDrawnTwoHandedInRight = false;

		public bool AllowSheathedTwoHandedInLeft = false;

		protected override bool CheckIsValid(Character _affectedCharacter)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_affectedCharacter == (Object)null)
			{
				goto IL_00dc;
			}
			bool? obj;
			if (_affectedCharacter == null)
			{
				obj = null;
			}
			else
			{
				Equipment leftHandEquipment = _affectedCharacter.LeftHandEquipment;
				obj = ((leftHandEquipment != null) ? new bool?(((Item)leftHandEquipment).HasTag(TinyTagManager.GetOrMakeTag("HandsFreeTag"))) : null);
			}
			if (obj ?? true)
			{
				bool? obj2;
				if (_affectedCharacter == null)
				{
					obj2 = null;
				}
				else
				{
					Weapon currentWeapon = _affectedCharacter.CurrentWeapon;
					obj2 = ((currentWeapon != null) ? new bool?(((Equipment)currentWeapon).TwoHanded) : null);
				}
				bool? flag = obj2;
				if (!flag.GetValueOrDefault())
				{
					goto IL_00dc;
				}
			}
			if (!_affectedCharacter.Sheathed && AllowDrawnTwoHandedInRight)
			{
				Weapon currentWeapon2 = _affectedCharacter.CurrentWeapon;
				if (currentWeapon2 == null || ((Equipment)currentWeapon2).TwoHandedRight)
				{
					goto IL_00dc;
				}
			}
			int result;
			if (_affectedCharacter.Sheathed && AllowSheathedTwoHandedInLeft)
			{
				Weapon currentWeapon3 = _affectedCharacter.CurrentWeapon;
				result = ((currentWeapon3 == null || ((Equipment)currentWeapon3).TwoHandedRight) ? 1 : 0);
			}
			else
			{
				result = 0;
			}
			goto IL_00dd;
			IL_00dc:
			result = 1;
			goto IL_00dd;
			IL_00dd:
			return (byte)result != 0;
		}

		public static ActivationCondition AddToSkill(Skill skill, bool allowDrawnTwoHandedInRight = false, bool allowSheathedTwoHandedInLeft = false)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			GameObject val = new GameObject("EmptyOffhandCondition");
			ActivationCondition val2 = new ActivationCondition();
			EmptyOffHandCondition emptyOffHandCondition = val.AddComponent<EmptyOffHandCondition>();
			Object.DontDestroyOnLoad((Object)(object)emptyOffHandCondition);
			val.SetActive(false);
			val2.Condition = (EffectCondition)(object)emptyOffHandCondition;
			emptyOffHandCondition.AllowDrawnTwoHandedInRight = allowDrawnTwoHandedInRight;
			emptyOffHandCondition.AllowSheathedTwoHandedInLeft = allowSheathedTwoHandedInLeft;
			At.SetValue("Requires an empty left hand.", typeof(ActivationCondition), val2, "m_defaultMessage");
			List<ActivationCondition> list = (At.GetValue(typeof(Skill), skill, "m_additionalConditions") as ActivationCondition[])?.ToList() ?? new List<ActivationCondition>();
			list.Add(val2);
			At.SetValue(list.ToArray(), typeof(Skill), skill, "m_additionalConditions");
			return val2;
		}
	}
	internal class InputEnablerEffect : Effect
	{
		protected override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			StatusEffect parentStatusEffect = base.m_parentStatusEffect;
			if (parentStatusEffect != null && (double)((_affectedCharacter != null) ? _affectedCharacter.AnimMoveSqMagnitude : 0f) > 0.1 && (double)parentStatusEffect.Age > 0.5)
			{
				StatusEffectManager statusEffectMngr = _affectedCharacter.StatusEffectMngr;
				if (statusEffectMngr != null)
				{
					statusEffectMngr.CleanseStatusEffect(parentStatusEffect.IdentifierName);
				}
				_affectedCharacter.ForceCancel(true, true);
			}
		}
	}
	internal class TinyUnofficialPatches
	{
	}
	[HarmonyPatch(typeof(Skill), "HasEnoughMana")]
	public class Skill_HasEnoughMana
	{
		[HarmonyPostfix]
		public static void Postfix(Skill __instance, ref bool _tryingToActivate, ref bool __result)
		{
			if (__instance.ManaCost <= 0f)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(Skill), "HasEnoughStamina")]
	public class Skill_HasEnoughStamina
	{
		[HarmonyPostfix]
		public static void Postfix(Skill __instance, ref bool _tryingToActivate, ref bool __result)
		{
			if (__instance.StaminaCost <= 0f)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(Skill), "HasEnoughHealth")]
	public class Skill_HasEnoughHealth
	{
		[HarmonyPostfix]
		public static void Postfix(Skill __instance, ref bool _tryingToActivate, ref bool __result)
		{
			if (__instance.HealthCost <= 0f)
			{
				__result = true;
			}
		}
	}
	public class WeaponManager
	{
		public static Dictionary<WeaponType, float> Speeds = new Dictionary<WeaponType, float>
		{
			{
				(WeaponType)0,
				1.251f
			},
			{
				(WeaponType)1,
				1.399f
			},
			{
				(WeaponType)2,
				1.629f
			},
			{
				(WeaponType)51,
				1.71f
			},
			{
				(WeaponType)52,
				1.667f
			},
			{
				(WeaponType)53,
				2.036f
			},
			{
				(WeaponType)54,
				1.499f
			},
			{
				(WeaponType)50,
				1.612f
			}
		};
	}
	public class TinyTagManager
	{
		public static Tag GetOrMakeTag(string name)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			Tag val = ((IEnumerable<Tag>)TagSourceManager.Instance.DbTags).FirstOrDefault((Func<Tag, bool>)((Tag x) => x.TagName == name));
			if (val == Tag.None)
			{
				((Tag)(ref val))..ctor(TagSourceManager.TagRoot, name);
				((Tag)(ref val)).SetTagType((TagTypes)0);
				TagSourceManager.Instance.DbTags.Add(val);
				TagSourceManager.Instance.RefreshTags(true);
				return val;
			}
			return val;
		}

		public static string[] GetOrMakeTags(string[] names)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			foreach (string name in names)
			{
				GetOrMakeTag(name);
			}
			return names;
		}

		public static string[] GetSafeTags(string[] tags)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			List<string> list = new List<string>();
			foreach (string tag in tags)
			{
				((IEnumerable<Tag>)TagSourceManager.Instance.DbTags).FirstOrDefault((Func<Tag, bool>)((Tag x) => x.TagName == tag || ((Tag)(ref x)).UID == UID.op_Implicit(tag)));
				if (true)
				{
					list.Add(tag);
				}
			}
			return list.ToArray();
		}
	}
	public class TinyUIDManager
	{
		public static UID MakeUID(string name, string modGUID, string category)
		{
			//IL_006e: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			if (modGUID == null || name == null || category == null)
			{
				Debug.LogError((object)$"TinyUIDManager.MakeUID({name}, {modGUID}, {category} returned a random UID. This will cause trouble in multiplayer!");
				return default(UID);
			}
			return new UID((modGUID + "." + category + "." + name).Replace(" ", "").ToLower());
		}
	}
	[BepInPlugin("com.ehaugw.tinyhelper", "Tiny Helper", "4.3.4")]
	public class TinyHelper : BaseUnityPlugin
	{
		public delegate void DescriptionModifier(Item item, ref string description);

		[HarmonyPatch(typeof(ResourcesPrefabManager), "Load")]
		public class ResourcesPrefabManager_Load
		{
			[HarmonyPostfix]
			public static void Postfix()
			{
				ResourcesPrefabManager instance = ResourcesPrefabManager.Instance;
				if (instance != null && instance.Loaded)
				{
					TinyHelper.OnPrefabLoaded();
				}
			}
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		public class Item_Description
		{
			[HarmonyPostfix]
			public static void Postfix(Item __instance, ref string __result)
			{
				OnDescriptionModified(__instance, ref __result);
			}
		}

		public const string GUID = "com.ehaugw.tinyhelper";

		public const string VERSION = "4.3.4";

		public const string NAME = "Tiny Helper";

		public static DescriptionModifier OnDescriptionModified;

		public static TinyHelper Instance;

		private static int tinyHelperPrintedMessages;

		public static string PLUGIN_ROOT_PATH => typeof(TinyHelper).Assembly.Location + "\\..\\..\\";

		public static event Action OnPrefabLoaded;

		internal void Awake()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			Instance = this;
			GameObject val = new GameObject("CrusaderRPC");
			Object.DontDestroyOnLoad((Object)(object)val);
			val.AddComponent<TinyHelperRPCManager>();
			Harmony val2 = new Harmony("com.ehaugw.tinyhelper");
			val2.PatchAll();
		}

		public static void TinyHelperPrint(string str)
		{
			Debug.Log((object)("TinyHelper #" + tinyHelperPrintedMessages++ + ": " + str));
		}

		static TinyHelper()
		{
			TinyHelper.OnPrefabLoaded = delegate
			{
			};
			OnDescriptionModified = delegate
			{
			};
			tinyHelperPrintedMessages = 0;
		}
	}
	public class DelayedTask
	{
		public static Task GetTask(int milliseconds)
		{
			TaskCompletionSource<object> tcs = new TaskCompletionSource<object>();
			new Timer(delegate
			{
				tcs.SetResult(null);
			}).Change(milliseconds, -1);
			return tcs.Task;
		}
	}
	public class TinyEffectManager
	{
		public static StatusEffect MakeStatusEffectPrefab(string effectName, string familyName, string description, float lifespan, float refreshRate, StackBehaviors stackBehavior, string targetStatusName, bool isMalusEffect, string tagID = null, UID? uid = null, string modGUID = null, string iconFileName = null, string displayName = null, string rootPath = null)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: 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_0168: Expected O, but got Unknown
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Expected O, but got Unknown
			//IL_0194: Expected O, but got Unknown
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Expected O, but got Unknown
			Dictionary<string, StatusEffect> dictionary = At.GetValue(typeof(ResourcesPrefabManager), null, "STATUSEFFECT_PREFABS") as Dictionary<string, StatusEffect>;
			StatusEffectFamily val = MakeStatusEffectFamiliy(familyName, stackBehavior, -1, (LengthTypes)0);
			GameObject val2 = TinyGameObjectManager.InstantiateClone(((Component)dictionary[targetStatusName]).gameObject, effectName, setActive: false, dontDestroyOnLoad: true);
			StatusEffect obj = val2.GetComponent<StatusEffect>() ?? val2.AddComponent<StatusEffect>();
			StatusEffect val3 = obj;
			dictionary[effectName] = obj;
			StatusEffect val4 = val3;
			At.SetValue(effectName, typeof(StatusEffect), val4, "m_identifierName");
			At.SetValue<StatusEffectFamily>(val, typeof(StatusEffect), val4, "m_bindFamily");
			At.SetValue(displayName ?? effectName, typeof(StatusEffect), val4, "m_nameLocKey");
			At.SetValue(description, typeof(StatusEffect), val4, "m_descriptionLocKey");
			val4.RefreshRate = refreshRate;
			val4.IsMalusEffect = isMalusEffect;
			At.SetValue<EffectSignatureModes>((EffectSignatureModes)1, typeof(StatusEffect), val4, "m_effectSignatureMode");
			At.SetValue<FamilyModes>((FamilyModes)0, typeof(StatusEffect), val4, "m_familyMode");
			val4.RequiredStatus = null;
			val4.RemoveRequiredStatus = false;
			if (iconFileName != null)
			{
				val4.OverrideIcon = CustomTexture.MakeSprite(CustomTexture.LoadTexture(iconFileName, 0, linear: false, (FilterMode)0, null, rootPath), CustomTexture.SpriteBorderTypes.None);
			}
			TagSourceSelector value = ((tagID != null) ? new TagSourceSelector(TagSourceManager.Instance.GetTag(UID.op_Implicit(tagID))) : new TagSourceSelector());
			At.SetValue<TagSourceSelector>(value, typeof(StatusEffect), val4, "m_effectType");
			StatusData val5 = new StatusData(val4.StatusData);
			StatusData val6 = val5;
			val4.StatusData = val5;
			StatusData val7 = val6;
			val7.LifeSpan = lifespan;
			List<StatusData> list = At.GetValue(typeof(StatusEffect), val4, "m_statusStack") as List<StatusData>;
			list[0] = val7;
			Object.Destroy((Object)(object)((Component)val2.GetComponentInChildren<EffectSignature>()).gameObject);
			EffectSignature val8 = TinyGameObjectManager.MakeFreshObject("Signature", setActive: true, dontDestroyOnLoad: true).AddComponent<EffectSignature>();
			((Object)val8).name = "Signature";
			val8.SignatureUID = (UID)(((??)uid) ?? TinyUIDManager.MakeUID(effectName, modGUID, "Status Effect"));
			EffectSignature effectSignature = (val7.EffectSignature = val8);
			val.EffectSignature = effectSignature;
			StatusEffectFamilySelector val10 = new StatusEffectFamilySelector();
			((UidSelector<StatusEffectFamily>)(object)val10).Set(val);
			At.SetValue<StatusEffectFamilySelector>(val10, typeof(StatusEffect), val4, "m_stackingFamily");
			return val4;
		}

		public static StatusEffectFamily MakeStatusEffectFamiliy(string familyName, StackBehaviors stackBehavior, int maxStackCount, LengthTypes lengthType, UID? uid = null, string modGUID = null)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			StatusEffectFamily val = new StatusEffectFamily();
			uid = (UID)(((??)uid) ?? ((modGUID != null) ? TinyUIDManager.MakeUID(familyName, modGUID, "Status Effect Family") : UID.Generate()));
			At.SetValue<UID>(uid.Value, typeof(StatusEffectFamily), val, "m_uid");
			val.Name = familyName;
			val.StackBehavior = stackBehavior;
			val.MaxStackCount = maxStackCount;
			val.LengthType = lengthType;
			return val;
		}

		public static void SetNameAndDesc(EffectPreset imbueEffect, string name, string desc)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			ItemLocalization value = new ItemLocalization(name, desc);
			if (At.GetValue(typeof(LocalizationManager), LocalizationManager.Instance, "m_itemLocalization") is Dictionary<int, ItemLocalization> dictionary)
			{
				if (dictionary.ContainsKey(imbueEffect.PresetID))
				{
					dictionary[imbueEffect.PresetID] = value;
				}
				else
				{
					dictionary.Add(imbueEffect.PresetID, value);
				}
			}
		}

		public static AddStatusEffectBuildUp MakeStatusEffectBuildup(Transform effectTransform, string statusEffectName, float buildup)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			AddStatusEffectBuildUp val = ((Component)effectTransform).gameObject.AddComponent<AddStatusEffectBuildUp>();
			val.BuildUpValue = buildup;
			val.Status = ResourcesPrefabManager.Instance.GetStatusEffectPrefab(statusEffectName);
			((Effect)val).OverrideEffectCategory = (EffectCategories)4;
			return val;
		}

		public static AddStatusEffect MakeStatusEffectChance(Transform effectTransform, string statusEffectName, int chance)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			AddStatusEffect val = ((Component)effectTransform).gameObject.AddComponent<AddStatusEffect>();
			val.SetChanceToContract(chance);
			val.Status = ResourcesPrefabManager.Instance.GetStatusEffectPrefab(statusEffectName);
			((Effect)val).OverrideEffectCategory = (EffectCategories)4;
			return val;
		}

		public static WeaponDamage MakeWeaponDamage(Transform effectTransform, float baseDamage, float damageScaling, Types damageType, float knockback)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_0032: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			WeaponDamage val = ((Component)effectTransform).gameObject.AddComponent<WeaponDamage>();
			val.WeaponDamageMult = 1f + damageScaling;
			val.OverrideDType = damageType;
			((PunctualDamage)val).Damages = (DamageType[])(object)new DamageType[1]
			{
				new DamageType(damageType, baseDamage)
			};
			((Effect)val).OverrideEffectCategory = (EffectCategories)4;
			((PunctualDamage)val).Knockback = knockback;
			return val;
		}

		public static WeaponDamage MakeDynamicWeaponDamage(Transform effectTransform, IDamageScaler damageScaler)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			DynamicWeaponDamage dynamicWeaponDamage = ((Component)effectTransform).gameObject.AddComponent<DynamicWeaponDamage>();
			((Effect)dynamicWeaponDamage).OverrideEffectCategory = (EffectCategories)4;
			dynamicWeaponDamage.DamageScaler = damageScaler;
			return (WeaponDamage)(object)dynamicWeaponDamage;
		}

		public static void MakeAbsorbHealth(Transform effectTransform, float absorbRatio)
		{
			AddAbsorbHealth obj = ((Component)effectTransform).gameObject.AddComponent<AddAbsorbHealth>();
			At.SetValue(absorbRatio, typeof(AddAbsorbHealth), obj, "m_healthRatio");
		}

		public static ImbueEffectPreset MakeImbuePreset(int imbueID, string name, string description, string iconFileName = null, int? visualEffectID = null, List<Skill> replaceOnSkills = null, string statusEffectName = null, int? chanceToContract = null, int? buildUp = null, float? scalingDamage = null, float? flatDamage = null, float? knockback = null, Types? damageType = null)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_00f4: 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_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Expected O, but got I4
			//IL_023b->IL023b: Incompatible stack types: O vs I4
			//IL_0234->IL023b: Incompatible stack types: I4 vs O
			//IL_0234->IL023b: Incompatible stack types: O vs I4
			Dictionary<int, EffectPreset> dictionary = (Dictionary<int, EffectPreset>)At.GetValue(typeof(ResourcesPrefabManager), null, "EFFECTPRESET_PREFABS");
			if (!dictionary.ContainsKey(imbueID))
			{
				GameObject val = new GameObject(imbueID + "_" + name.Replace(" ", ""));
				val.SetActive(true);
				Object.DontDestroyOnLoad((Object)(object)val);
				ImbueEffectPreset val2 = val.AddComponent<ImbueEffectPreset>();
				((Object)val2).name = imbueID + "_" + name.Replace(" ", "");
				At.SetValue(imbueID, typeof(EffectPreset), val2, "m_StatusEffectID");
				At.SetValue(name, typeof(ImbueEffectPreset), val2, "m_imbueNameKey");
				At.SetValue(description, typeof(ImbueEffectPreset), val2, "m_imbueDescKey");
				if (visualEffectID.HasValue)
				{
					val2.ImbueStatusIcon = ((ImbueEffectPreset)dictionary[visualEffectID.Value]).ImbueStatusIcon;
					val2.ImbueFX = ((ImbueEffectPreset)dictionary[visualEffectID.Value]).ImbueFX;
				}
				if (iconFileName != null)
				{
					val2.ImbueStatusIcon = CustomTexture.MakeSprite(CustomTexture.LoadTexture(iconFileName, 0, linear: false, (FilterMode)0), CustomTexture.SpriteBorderTypes.None);
				}
				SetNameAndDesc((EffectPreset)(object)val2, name, description);
				dictionary.Add(imbueID, (EffectPreset)(object)val2);
				if (statusEffectName != null && chanceToContract.GetValueOrDefault() > 0)
				{
					MakeStatusEffectChance(TinyGameObjectManager.GetOrMake(((Component)val2).transform, "Effects", setActive: true, dontDestroyOnLoad: true), statusEffectName, chanceToContract.GetValueOrDefault());
				}
				if (statusEffectName != null && buildUp.GetValueOrDefault() > 0)
				{
					MakeStatusEffectBuildup(TinyGameObjectManager.GetOrMake(((Component)val2).transform, "Effects", setActive: true, dontDestroyOnLoad: true), statusEffectName, buildUp.GetValueOrDefault());
				}
				if (scalingDamage.GetValueOrDefault() > 0f || flatDamage.GetValueOrDefault() > 0f || knockback.GetValueOrDefault() > 0f)
				{
					object obj = TinyGameObjectManager.GetOrMake(((Component)val2).transform, "Effects", setActive: true, dontDestroyOnLoad: true);
					float valueOrDefault = flatDamage.GetValueOrDefault();
					valueOrDefault = scalingDamage.GetValueOrDefault();
					Types? val3 = damageType;
					int num;
					if (val3.HasValue)
					{
						obj = val3.GetValueOrDefault();
						num = (int)obj;
					}
					else
					{
						num = 9;
						obj = num;
						num = (int)obj;
					}
					MakeWeaponDamage((Transform)(object)num, valueOrDefault, valueOrDefault, (Types)obj, knockback.GetValueOrDefault());
				}
				foreach (Skill item in replaceOnSkills ?? new List<Skill>())
				{
					if ((Object)(object)item != (Object)null)
					{
						((ImbueObject)((Component)item).GetComponentInChildren<ImbueWeapon>()).ImbuedEffect = val2;
					}
				}
				return val2;
			}
			return null;
		}

		public static EffectPreset GetEffectPreset(int effectID)
		{
			Dictionary<int, EffectPreset> dictionary = (Dictionary<int, EffectPreset>)At.GetValue(typeof(ResourcesPrefabManager), null, "EFFECTPRESET_PREFABS");
			if (dictionary.ContainsKey(effectID))
			{
				EffectPreset val = dictionary[effectID];
				if (val != null)
				{
					return val;
				}
			}
			return null;
		}

		public static void AddStatusEffectForDuration(Character character, StatusEffect statusEffect, float duration, Character source = null)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			StatusData statusData = statusEffect.StatusData;
			statusEffect.StatusData = new StatusData(statusData);
			statusEffect.StatusData.LifeSpan = duration;
			character.StatusEffectMngr.AddStatusEffect(statusEffect, source);
			statusEffect.StatusData = statusData;
		}

		public static void ChangeEffectPresetDamageTypeData(EffectPreset effect, Types originalType, Types newType)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			PunctualDamage[] componentsInChildren = ((Component)effect).gameObject.GetComponentsInChildren<PunctualDamage>();
			foreach (PunctualDamage val in componentsInChildren)
			{
				WeaponDamage val2 = (WeaponDamage)(object)((val is WeaponDamage) ? val : null);
				if (val2 != null && val2.OverrideDType == originalType)
				{
					val2.OverrideDType = newType;
				}
				DamageType[] damages = val.Damages;
				foreach (DamageType val3 in damages)
				{
					if (val3.Type == originalType)
					{
						val3.Type = newType;
					}
				}
			}
		}
	}
	public class CasualStagger : Effect
	{
		protected override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			Stagger(_affectedCharacter);
		}

		public static void Stagger(Character character)
		{
			At.SetValue<HurtType>((HurtType)1, typeof(Character), character, "m_hurtType");
			character.Animator.SetTrigger("Knockback");
			character.ForceCancel(false, true);
			((MonoBehaviour)character).Invoke("DelayedForceCancel", 0.3f);
			if (Object.op_Implicit((Object)(object)character.CharacterUI))
			{
				character.CharacterUI.OnPlayerKnocked();
			}
		}
	}
	public class CooldownChangeWeaponDamage : WeaponDamage
	{
		public float ExecutionSetCooldown = -1f;

		public float HitKnockbackCooldown = -1f;

		protected override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			Item parentItem = ((Effect)this).ParentItem;
			Skill val = (Skill)(object)((parentItem is Skill) ? parentItem : null);
			if (val != null)
			{
				if (HitKnockbackCooldown != -1f && _affectedCharacter.IsInKnockback)
				{
					At.SetValue(HitKnockbackCooldown, typeof(Skill), val, "m_remainingCooldownTime");
				}
				bool isDead = _affectedCharacter.IsDead;
				((WeaponDamage)this).ActivateLocally(_affectedCharacter, _infos);
				if (!isDead && _affectedCharacter.IsDead && ExecutionSetCooldown != -1f)
				{
					At.SetValue(ExecutionSetCooldown, typeof(Skill), val, "m_remainingCooldownTime");
				}
			}
		}
	}
}
namespace TinyHelper.Interfaces
{
	public interface IDamageScaler
	{
		float GetWeaponDamageMult(WeaponDamage weaponDamage);

		Types GetOverrideDType(WeaponDamage weaponDamage);

		DamageType[] GetDamages(WeaponDamage weaponDamage);

		float GetKnockback(WeaponDamage weaponDamage);
	}
}
namespace TinyHelper.Effects
{
	public class DynamicWeaponDamage : WeaponDamage
	{
		public IDamageScaler DamageScaler = null;

		private void Recalculate()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			Console.WriteLine("recalculated");
			Debug.WriteLine("recalculated");
			base.WeaponDamageMult = DamageScaler.GetWeaponDamageMult((WeaponDamage)(object)this);
			base.OverrideDType = DamageScaler.GetOverrideDType((WeaponDamage)(object)this);
			((PunctualDamage)this).Damages = DamageScaler.GetDamages((WeaponDamage)(object)this);
			((PunctualDamage)this).Knockback = DamageScaler.GetKnockback((WeaponDamage)(object)this);
		}

		protected override void StartInit()
		{
			Recalculate();
			((WeaponDamage)this).StartInit();
		}

		public override Weapon BuildDamage(Character _targetCharacter, ref DamageList _list, ref float _knockback)
		{
			Recalculate();
			return ((WeaponDamage)this).BuildDamage(_targetCharacter, ref _list, ref _knockback);
		}

		protected override void BuildDamage(Weapon _weapon, Character _targetCharacter, bool _isSkillOrShield, ref DamageList _list, ref float _knockback)
		{
			Recalculate();
			((WeaponDamage)this).BuildDamage(_weapon, _targetCharacter, _isSkillOrShield, ref _list, ref _knockback);
		}

		protected override void ActivateLocally(Character _targetCharacter, object[] _infos)
		{
			Recalculate();
			((WeaponDamage)this).ActivateLocally(_targetCharacter, _infos);
		}

		protected override DamageList DealHit(Character _targetCharacter)
		{
			Recalculate();
			return ((WeaponDamage)this).DealHit(_targetCharacter);
		}

		public override float DamageMult(Character _targetCharacter, bool _isSkill)
		{
			Recalculate();
			return ((WeaponDamage)this).DamageMult(_targetCharacter, _isSkill);
		}

		public override float KnockbackMult(Character _targetCharacter, bool _isSkill)
		{
			Recalculate();
			return ((WeaponDamage)this).KnockbackMult(_targetCharacter, _isSkill);
		}
	}
	public class ShootBlastFromEffect : ShootBlast
	{
		public override void Setup(TargetingSystem _targetSystem, Transform _parent)
		{
			Character sourceCharacter = ((Effect)this).SourceCharacter;
			((Shooter)this).Setup(((sourceCharacter != null) ? sourceCharacter.TargetingSystem : null) ?? _targetSystem, _parent);
		}
	}
}