Decompiled source of Fenrir Curse v1.1.0

FenrirCurseMod.dll

Decompiled a day ago
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Jotunn;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("FenrirCurseMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FenrirCurseMod")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace FenrirCurseMod;

[BepInPlugin("com.nandor.fenrircurse", "Fenrir Curse", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class FenrirCurseMod : BaseUnityPlugin
{
	public const string PluginGUID = "com.nandor.fenrircurse";

	public const string PluginName = "Fenrir Curse";

	public const string PluginVersion = "1.0.0";

	private readonly Harmony harmony = new Harmony("com.nandor.fenrircurse");

	public static SE_FenrirCurse curseSE;

	public static SE_Stats formBuffSE;

	public static SE_FenrirCure cureSE;

	public static SE_EnhancedCurse enhancedCurseSE;

	public static SE_Stats enhancedFormBuffSE;

	public static SE_CurseBerry curseBerrySE;

	public static SE_Stats wolfFormBuffSE;

	private GameObject currentTransformation;

	private bool isTransformed = false;

	private bool isTransformingSequence = false;

	public static FenrirCurseMod Instance;

	private void Awake()
	{
		Instance = this;
		harmony.PatchAll();
		PrefabManager.OnVanillaPrefabsAvailable += CreateAllModAssets;
	}

	private void CreateAllModAssets()
	{
		//IL_0058: 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_006d: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Expected O, but got Unknown
		//IL_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ad: Expected O, but got Unknown
		//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fb: Expected O, but got Unknown
		//IL_0241: Unknown result type (might be due to invalid IL or missing references)
		//IL_024e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0256: Unknown result type (might be due to invalid IL or missing references)
		//IL_025b: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f2: Expected O, but got Unknown
		//IL_033f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0344: Unknown result type (might be due to invalid IL or missing references)
		//IL_038c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0396: Expected O, but got Unknown
		//IL_0412: Unknown result type (might be due to invalid IL or missing references)
		//IL_041c: Expected O, but got Unknown
		//IL_0460: Unknown result type (might be due to invalid IL or missing references)
		//IL_046a: Expected O, but got Unknown
		//IL_0475: Unknown result type (might be due to invalid IL or missing references)
		//IL_047b: Expected O, but got Unknown
		//IL_0534: Unknown result type (might be due to invalid IL or missing references)
		//IL_053a: Expected O, but got Unknown
		//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ab: Expected O, but got Unknown
		//IL_05d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_05dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f2: Expected O, but got Unknown
		//IL_05f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0605: Unknown result type (might be due to invalid IL or missing references)
		//IL_060e: Expected O, but got Unknown
		//IL_0610: Unknown result type (might be due to invalid IL or missing references)
		//IL_0615: Unknown result type (might be due to invalid IL or missing references)
		//IL_0621: Unknown result type (might be due to invalid IL or missing references)
		//IL_062a: Expected O, but got Unknown
		//IL_0632: Unknown result type (might be due to invalid IL or missing references)
		//IL_0639: Expected O, but got Unknown
		PrefabManager.OnVanillaPrefabsAvailable -= CreateAllModAssets;
		curseSE = ScriptableObject.CreateInstance<SE_FenrirCurse>();
		((Object)curseSE).name = "SE_FenrirCurse";
		((StatusEffect)curseSE).m_name = "Fenrir's Curse";
		((StatusEffect)curseSE).m_tooltip = "You feel the beast's blood. You can transform at night.";
		((SE_Stats)curseSE).m_mods = new List<DamageModPair>
		{
			new DamageModPair
			{
				m_type = (DamageType)512,
				m_modifier = (DamageModifier)2
			}
		};
		ItemDrop prefab = Cache.GetPrefab<ItemDrop>("TrophyFenring");
		GameObject val = ((prefab != null) ? ((Component)prefab).gameObject : null);
		if ((Object)(object)val != (Object)null)
		{
			ItemDrop component = val.GetComponent<ItemDrop>();
			if ((Object)(object)component != (Object)null && component.m_itemData.m_shared.m_icons.Length != 0)
			{
				((StatusEffect)curseSE).m_icon = component.m_itemData.m_shared.m_icons[0];
			}
		}
		ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)curseSE, false));
		formBuffSE = ScriptableObject.CreateInstance<SE_Stats>();
		((Object)formBuffSE).name = "SE_FenrirForm";
		((StatusEffect)formBuffSE).m_name = "Bestial Fury";
		formBuffSE.m_speedModifier = 1f;
		formBuffSE.m_jumpModifier = new Vector3(0f, 1f, 0f);
		formBuffSE.m_fallDamageModifier = -1f;
		formBuffSE.m_staminaRegenMultiplier = 1.3f;
		formBuffSE.m_runStaminaDrainModifier = -0.2f;
		((StatusEffect)formBuffSE).m_icon = null;
		ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)formBuffSE, false));
		cureSE = ScriptableObject.CreateInstance<SE_FenrirCure>();
		((Object)cureSE).name = "SE_FenrirCure";
		((StatusEffect)cureSE).m_name = "Purification";
		((StatusEffect)cureSE).m_ttl = 1f;
		ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)cureSE, false));
		enhancedCurseSE = ScriptableObject.CreateInstance<SE_EnhancedCurse>();
		((Object)enhancedCurseSE).name = "SE_EnhancedCurse";
		((StatusEffect)enhancedCurseSE).m_name = "Enhanced Curse";
		((StatusEffect)enhancedCurseSE).m_tooltip = "The beast's blood boils. You can transform into a Cultist at night.";
		((SE_Stats)enhancedCurseSE).m_mods = new List<DamageModPair>
		{
			new DamageModPair
			{
				m_type = (DamageType)512,
				m_modifier = (DamageModifier)2
			}
		};
		ItemDrop prefab2 = Cache.GetPrefab<ItemDrop>("TrophyCultist");
		GameObject val2 = ((prefab2 != null) ? ((Component)prefab2).gameObject : null);
		if ((Object)(object)val2 != (Object)null)
		{
			ItemDrop component2 = val2.GetComponent<ItemDrop>();
			if ((Object)(object)component2 != (Object)null && component2.m_itemData.m_shared.m_icons.Length != 0)
			{
				((StatusEffect)enhancedCurseSE).m_icon = component2.m_itemData.m_shared.m_icons[0];
			}
		}
		ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)enhancedCurseSE, false));
		enhancedFormBuffSE = ScriptableObject.CreateInstance<SE_Stats>();
		((Object)enhancedFormBuffSE).name = "SE_EnhancedForm";
		((StatusEffect)enhancedFormBuffSE).m_name = "Cultist Fury";
		enhancedFormBuffSE.m_speedModifier = 1f;
		enhancedFormBuffSE.m_jumpModifier = new Vector3(0f, 1f, 0f);
		enhancedFormBuffSE.m_fallDamageModifier = -1f;
		enhancedFormBuffSE.m_staminaRegenMultiplier = 1.3f;
		enhancedFormBuffSE.m_runStaminaDrainModifier = -0.2f;
		((StatusEffect)enhancedFormBuffSE).m_icon = null;
		ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)enhancedFormBuffSE, false));
		wolfFormBuffSE = ScriptableObject.CreateInstance<SE_Stats>();
		((Object)wolfFormBuffSE).name = "SE_WolfForm";
		((StatusEffect)wolfFormBuffSE).m_name = "Wolf Senses";
		wolfFormBuffSE.m_speedModifier = 0.5f;
		wolfFormBuffSE.m_fallDamageModifier = -0.5f;
		wolfFormBuffSE.m_staminaRegenMultiplier = 1.3f;
		wolfFormBuffSE.m_runStaminaDrainModifier = -0.2f;
		((StatusEffect)wolfFormBuffSE).m_icon = null;
		ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)wolfFormBuffSE, false));
		curseBerrySE = ScriptableObject.CreateInstance<SE_CurseBerry>();
		((Object)curseBerrySE).name = "SE_CurseBerry";
		((StatusEffect)curseBerrySE).m_name = "Curse Infection";
		((StatusEffect)curseBerrySE).m_ttl = 1f;
		ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)curseBerrySE, false));
		CustomItem val3 = new CustomItem("Curseberry", "Raspberry");
		if ((Object)(object)val3.ItemPrefab != (Object)null)
		{
			ItemDrop itemDrop = val3.ItemDrop;
			itemDrop.m_itemData.m_shared.m_name = "Curseberry (TEST)";
			itemDrop.m_itemData.m_shared.m_description = "Infects you with the permanent curse.";
			itemDrop.m_itemData.m_shared.m_food = 0f;
			itemDrop.m_itemData.m_shared.m_foodStamina = 0f;
			itemDrop.m_itemData.m_shared.m_foodEitr = 0f;
			itemDrop.m_itemData.m_shared.m_consumeStatusEffect = (StatusEffect)(object)curseBerrySE;
		}
		ItemManager.Instance.AddItem(val3);
		CustomItem val4 = new CustomItem("Potion_FenrirCure", "MeadFrostResist");
		if ((Object)(object)val4.ItemPrefab != (Object)null)
		{
			ItemDrop itemDrop2 = val4.ItemDrop;
			itemDrop2.m_itemData.m_shared.m_name = "Purifying Potion";
			itemDrop2.m_itemData.m_shared.m_description = "Permanently removes Fenrir's curse.";
			itemDrop2.m_itemData.m_shared.m_consumeStatusEffect = (StatusEffect)(object)cureSE;
		}
		ItemManager.Instance.AddItem(val4);
		RecipeConfig val5 = new RecipeConfig();
		val5.Item = "Potion_FenrirCure";
		val5.CraftingStation = "piece_cauldron";
		val5.Amount = 1;
		val5.Requirements = (RequirementConfig[])(object)new RequirementConfig[3]
		{
			new RequirementConfig
			{
				Item = "MeadBaseFrostResist",
				Amount = 1
			},
			new RequirementConfig
			{
				Item = "Onion",
				Amount = 5
			},
			new RequirementConfig
			{
				Item = "Silver",
				Amount = 1
			}
		};
		CustomRecipe val6 = new CustomRecipe(val5);
		ItemManager.Instance.AddRecipe(val6);
	}

	private void Update()
	{
		if (Input.GetKeyDown((KeyCode)103) && !isTransformingSequence)
		{
			TryTransform(isCanineForm: false);
		}
		if (Input.GetKeyDown((KeyCode)104) && !isTransformingSequence)
		{
			TryTransform(isCanineForm: true);
		}
	}

	private void TryTransform(bool isCanineForm)
	{
		if ((Object)(object)EnvMan.instance == (Object)null || (Object)(object)Player.m_localPlayer == (Object)null)
		{
			return;
		}
		bool flag = ((Character)Player.m_localPlayer).GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_FenrirCurse"));
		bool flag2 = ((Character)Player.m_localPlayer).GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_EnhancedCurse"));
		if (!(flag || flag2))
		{
			return;
		}
		if (isCanineForm)
		{
			if (!isTransformed)
			{
				((MonoBehaviour)this).StartCoroutine(TransformIntoWolfRoutine(isCanineForm: true));
			}
			else
			{
				((MonoBehaviour)this).StartCoroutine(RevertToHumanRoutine());
			}
			return;
		}
		if (EnvMan.IsNight())
		{
			if (!isTransformed)
			{
				((MonoBehaviour)this).StartCoroutine(TransformIntoWolfRoutine());
			}
			else
			{
				((MonoBehaviour)this).StartCoroutine(RevertToHumanRoutine());
			}
			return;
		}
		if (isTransformed)
		{
			((MonoBehaviour)this).StartCoroutine(RevertToHumanRoutine());
		}
		((Character)Player.m_localPlayer).Message((MessageType)2, "The beast rests. You can only transform at night.", 0, (Sprite)null);
	}

	public void ForceRevert()
	{
		if (isTransformed && !isTransformingSequence)
		{
			((MonoBehaviour)this).StartCoroutine(RevertToHumanRoutine());
		}
	}

	private IEnumerator TransformIntoWolfRoutine(bool isCanineForm = false)
	{
		isTransformingSequence = true;
		ZSyncAnimation zAnim = ((Component)Player.m_localPlayer).GetComponent<ZSyncAnimation>();
		if ((Object)(object)zAnim != (Object)null)
		{
			zAnim.SetTrigger("gpower");
		}
		yield return (object)new WaitForSeconds(1.1f);
		SpawnPoofEffect();
		if ((Object)(object)ZNetScene.instance != (Object)null)
		{
			GameObject howlPrefab = ZNetScene.instance.GetPrefab("sfx_wolf_howl") ?? ZNetScene.instance.GetPrefab("sfx_fenring_idle");
			if ((Object)(object)howlPrefab != (Object)null)
			{
				Object.Instantiate<GameObject>(howlPrefab, ((Component)Player.m_localPlayer).transform.position, Quaternion.identity);
			}
		}
		yield return (object)new WaitForSeconds(0.1f);
		ExecuteTransformation(isCanineForm);
		bool hasEnhancedCurse = ((Character)Player.m_localPlayer).GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_EnhancedCurse"));
		if ((Object)(object)currentTransformation != (Object)null && (Object)(object)currentTransformation.GetComponent<WolfFormBehavior>() == (Object)null && (Object)(object)currentTransformation.GetComponent<UlvFormBehavior>() == (Object)null)
		{
			float elapsed = 0f;
			float duration = 0.5f;
			float startMultiplier = (hasEnhancedCurse ? 0.75f : 0.5f);
			Vector3 startScale = Vector3.one * startMultiplier;
			Vector3 endScale = Vector3.one;
			currentTransformation.transform.localScale = startScale;
			while (elapsed < duration && !((Object)(object)currentTransformation == (Object)null))
			{
				currentTransformation.transform.localScale = Vector3.Lerp(startScale, endScale, elapsed / duration);
				elapsed += Time.deltaTime;
				yield return null;
			}
			if ((Object)(object)currentTransformation != (Object)null)
			{
				currentTransformation.transform.localScale = endScale;
			}
		}
		isTransformingSequence = false;
	}

	private IEnumerator RevertToHumanRoutine()
	{
		isTransformingSequence = true;
		if ((Object)(object)currentTransformation != (Object)null)
		{
			FenrirFormBehavior fenrirBehavior = currentTransformation.GetComponent<FenrirFormBehavior>();
			if ((Object)(object)fenrirBehavior != (Object)null)
			{
				((Behaviour)fenrirBehavior).enabled = false;
			}
			CultistFormBehavior cultistBehavior = currentTransformation.GetComponent<CultistFormBehavior>();
			if ((Object)(object)cultistBehavior != (Object)null)
			{
				((Behaviour)cultistBehavior).enabled = false;
			}
			WolfFormBehavior wolfBehavior = currentTransformation.GetComponent<WolfFormBehavior>();
			if ((Object)(object)wolfBehavior != (Object)null)
			{
				((Behaviour)wolfBehavior).enabled = false;
			}
			UlvFormBehavior ulvBehavior = currentTransformation.GetComponent<UlvFormBehavior>();
			if ((Object)(object)ulvBehavior != (Object)null)
			{
				((Behaviour)ulvBehavior).enabled = false;
			}
			if ((Object)(object)wolfBehavior == (Object)null && (Object)(object)ulvBehavior == (Object)null)
			{
				float elapsed = 0f;
				float duration = 0.5f;
				Vector3 startScale = currentTransformation.transform.localScale;
				float endMultiplier = (((Object)(object)cultistBehavior != (Object)null) ? 0.75f : 0.5f);
				Vector3 endScale = startScale * endMultiplier;
				while (elapsed < duration && !((Object)(object)currentTransformation == (Object)null))
				{
					currentTransformation.transform.localScale = Vector3.Lerp(startScale, endScale, elapsed / duration);
					elapsed += Time.deltaTime;
					yield return null;
				}
			}
		}
		SpawnPoofEffect();
		yield return (object)new WaitForSeconds(0.1f);
		ExecuteReversion();
		isTransformingSequence = false;
	}

	private void SpawnPoofEffect()
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: 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_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: 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)
		if (!((Object)(object)Player.m_localPlayer == (Object)null))
		{
			Vector3 val = ((Component)Player.m_localPlayer).transform.position + Vector3.up;
			GameObject prefab = Cache.GetPrefab<GameObject>("vfx_corpse_destruction");
			if ((Object)(object)prefab != (Object)null)
			{
				Object.Instantiate<GameObject>(prefab, val, Quaternion.identity);
			}
			GameObject prefab2 = Cache.GetPrefab<GameObject>("vfx_HitSparks");
			if ((Object)(object)prefab2 != (Object)null)
			{
				Object.Instantiate<GameObject>(prefab2, val, Quaternion.identity);
			}
		}
	}

	private void ExecuteTransformation(bool isCanineForm = false)
	{
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		Transform val = ((Component)Player.m_localPlayer).transform.Find("Visual");
		bool flag = ((Character)Player.m_localPlayer).GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_EnhancedCurse"));
		string text = "";
		text = (isCanineForm ? ((!flag) ? "Wolf" : "Ulv") : (flag ? "Fenring_Cultist" : ((!EnvMan.IsNight()) ? "Wolf" : "Fenring")));
		GameObject prefab = Cache.GetPrefab<GameObject>(text);
		if (!((Object)(object)prefab != (Object)null) || !((Object)(object)val != (Object)null))
		{
			return;
		}
		val.localScale = Vector3.one * 0.001f;
		Transform val2 = prefab.transform.Find("Visual");
		if ((Object)(object)val2 != (Object)null)
		{
			currentTransformation = Object.Instantiate<GameObject>(((Component)val2).gameObject, ((Component)Player.m_localPlayer).transform);
			currentTransformation.transform.localPosition = Vector3.zero;
			currentTransformation.transform.localRotation = Quaternion.identity;
			Component component = currentTransformation.GetComponent("AnimEvent");
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			if (text == "Ulv")
			{
				currentTransformation.AddComponent<UlvFormBehavior>();
				((Character)Player.m_localPlayer).GetSEMan().AddStatusEffect(StringExtensionMethods.GetStableHashCode("SE_WolfForm"), true, 0, 0f);
				((Character)Player.m_localPlayer).Message((MessageType)2, "You are an Ulv!", 0, (Sprite)null);
			}
			else if (text == "Wolf")
			{
				currentTransformation.AddComponent<WolfFormBehavior>();
				((Character)Player.m_localPlayer).GetSEMan().AddStatusEffect(StringExtensionMethods.GetStableHashCode("SE_WolfForm"), true, 0, 0f);
				((Character)Player.m_localPlayer).Message((MessageType)2, "You are a Wolf!", 0, (Sprite)null);
			}
			else if (flag)
			{
				currentTransformation.AddComponent<CultistFormBehavior>();
				((Character)Player.m_localPlayer).GetSEMan().AddStatusEffect(StringExtensionMethods.GetStableHashCode("SE_EnhancedForm"), true, 0, 0f);
				((Character)Player.m_localPlayer).Message((MessageType)2, "You are a Cultist!", 0, (Sprite)null);
			}
			else
			{
				currentTransformation.AddComponent<FenrirFormBehavior>();
				((Character)Player.m_localPlayer).GetSEMan().AddStatusEffect(StringExtensionMethods.GetStableHashCode("SE_FenrirForm"), true, 0, 0f);
				((Character)Player.m_localPlayer).Message((MessageType)2, "You are a Fenring!", 0, (Sprite)null);
			}
			isTransformed = true;
		}
	}

	private void ExecuteReversion()
	{
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		Transform val = ((Component)Player.m_localPlayer).transform.Find("Visual");
		if ((Object)(object)currentTransformation != (Object)null)
		{
			Object.Destroy((Object)(object)currentTransformation);
		}
		if ((Object)(object)val != (Object)null)
		{
			val.localScale = Vector3.one;
			((Component)val).gameObject.SetActive(true);
		}
		((Character)Player.m_localPlayer).GetSEMan().RemoveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_FenrirForm"), false);
		((Character)Player.m_localPlayer).GetSEMan().RemoveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_EnhancedForm"), false);
		isTransformed = false;
		((Character)Player.m_localPlayer).Message((MessageType)2, "You returned to human form.", 0, (Sprite)null);
	}
}
[HarmonyPatch(typeof(Character), "StartAttack")]
public static class BlockPlayerLogicAttackPatch
{
	public static bool Prefix(Character __instance)
	{
		if ((Object)(object)__instance != (Object)null && (Object)(object)__instance == (Object)(object)Player.m_localPlayer && (__instance.GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_FenrirForm")) || __instance.GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_EnhancedForm"))))
		{
			return false;
		}
		return true;
	}
}
[HarmonyPatch(typeof(ZSyncAnimation), "SetTrigger")]
public static class BlockPlayerAnimationsPatch
{
	public static bool Prefix(ZSyncAnimation __instance, string name)
	{
		if ((Object)(object)Player.m_localPlayer != (Object)null && (Object)(object)((Component)__instance).gameObject == (Object)(object)((Component)Player.m_localPlayer).gameObject && (((Character)Player.m_localPlayer).GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_FenrirForm")) || ((Character)Player.m_localPlayer).GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_EnhancedForm"))))
		{
			string text = name.ToLower();
			if (text.Contains("attack") || text.Contains("swing") || text.Contains("punch"))
			{
				return false;
			}
		}
		return true;
	}
}
public class SE_FenrirCurse : SE_Stats
{
	public override void Setup(Character character)
	{
		((SE_Stats)this).Setup(character);
		if ((Object)(object)character == (Object)(object)Player.m_localPlayer)
		{
			Player.m_localPlayer.m_customData["FenrirCurse_Active"] = "true";
		}
	}
}
public class SE_FenrirCure : StatusEffect
{
	public override void Setup(Character character)
	{
		((StatusEffect)this).Setup(character);
		if ((Object)(object)character == (Object)(object)Player.m_localPlayer)
		{
			Player.m_localPlayer.m_customData.Remove("FenrirCurse_Active");
			Player.m_localPlayer.m_customData.Remove("EnhancedCurse_Active");
			((Character)Player.m_localPlayer).GetSEMan().RemoveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_FenrirCurse"), false);
			((Character)Player.m_localPlayer).GetSEMan().RemoveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_EnhancedCurse"), false);
			((Character)Player.m_localPlayer).Message((MessageType)2, "The curse has been broken.", 0, (Sprite)null);
			if ((Object)(object)FenrirCurseMod.Instance != (Object)null)
			{
				FenrirCurseMod.Instance.ForceRevert();
			}
		}
	}
}
public class SE_EnhancedCurse : SE_Stats
{
	public override void Setup(Character character)
	{
		((SE_Stats)this).Setup(character);
		if ((Object)(object)character == (Object)(object)Player.m_localPlayer)
		{
			Player.m_localPlayer.m_customData["EnhancedCurse_Active"] = "true";
			Player.m_localPlayer.m_customData.Remove("FenrirCurse_Active");
		}
	}
}
public class SE_CurseBerry : StatusEffect
{
	public override void Setup(Character character)
	{
		((StatusEffect)this).Setup(character);
		if ((Object)(object)character == (Object)(object)Player.m_localPlayer)
		{
			if (((Character)Player.m_localPlayer).GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_FenrirCurse")))
			{
				((Character)Player.m_localPlayer).GetSEMan().RemoveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_FenrirCurse"), false);
				((Character)Player.m_localPlayer).GetSEMan().AddStatusEffect(StringExtensionMethods.GetStableHashCode("SE_EnhancedCurse"), true, 0, 0f);
				((Character)Player.m_localPlayer).Message((MessageType)2, "Curse Empowered", 0, (Sprite)null);
			}
			else if (!((Character)Player.m_localPlayer).GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_EnhancedCurse")))
			{
				((Character)Player.m_localPlayer).GetSEMan().AddStatusEffect(StringExtensionMethods.GetStableHashCode("SE_FenrirCurse"), true, 0, 0f);
			}
		}
	}
}
[HarmonyPatch(typeof(Player), "OnSpawned")]
public static class PlayerSpawnPatch
{
	public static void Postfix(Player __instance)
	{
		if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer)
		{
			if (__instance.m_customData.ContainsKey("FenrirCurse_Active") && __instance.m_customData["FenrirCurse_Active"] == "true")
			{
				((Character)__instance).GetSEMan().AddStatusEffect(StringExtensionMethods.GetStableHashCode("SE_FenrirCurse"), true, 0, 0f);
			}
			if (__instance.m_customData.ContainsKey("EnhancedCurse_Active") && __instance.m_customData["EnhancedCurse_Active"] == "true")
			{
				((Character)__instance).GetSEMan().AddStatusEffect(StringExtensionMethods.GetStableHashCode("SE_EnhancedCurse"), true, 0, 0f);
			}
		}
	}
}
[HarmonyPatch(typeof(Player), "UpdateHover")]
public static class KvasturInteractPatch
{
	public static void Postfix(Player __instance)
	{
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		if (!ZInput.GetButtonDown("Use"))
		{
			return;
		}
		GameObject hoverObject = ((Humanoid)__instance).GetHoverObject();
		if ((Object)(object)hoverObject != (Object)null && ((Object)hoverObject).name.Contains("Kvastur") && ((Character)__instance).GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_FenrirCurse")))
		{
			__instance.m_customData.TryGetValue("KvasturDialogState", out var value);
			if (string.IsNullOrEmpty(value))
			{
				value = "0";
			}
			if (value == "0")
			{
				Chat.instance.SetNpcText(hoverObject, Vector3.up * 1.5f, 20f, 5f, "Kvastur", "Wait! I've seen this before! You have a curse on yourself!", false);
				__instance.m_customData["KvasturDialogState"] = "1";
			}
			else if (value == "1")
			{
				Chat.instance.SetNpcText(hoverObject, Vector3.up * 1.5f, 20f, 5f, "Kvastur", "Bring me the head of a cultist and i'll unlock your true power!", false);
				__instance.m_customData["KvasturDialogState"] = "0";
			}
		}
	}
}
[HarmonyPatch(typeof(Player), "UseHotbarItem")]
public static class KvasturUseItemPatch
{
	public static bool Prefix(Player __instance, int index)
	{
		ItemData itemAt = ((Humanoid)__instance).GetInventory().GetItemAt(index - 1, 0);
		if (itemAt != null && (Object)(object)itemAt.m_dropPrefab != (Object)null && ((Object)itemAt.m_dropPrefab).name == "TrophyCultist")
		{
			GameObject hoverObject = ((Humanoid)__instance).GetHoverObject();
			if ((Object)(object)hoverObject != (Object)null && ((Object)hoverObject).name.Contains("Kvastur") && ((Character)__instance).GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_FenrirCurse")))
			{
				((Humanoid)__instance).GetInventory().RemoveItem(itemAt, 1);
				((Character)__instance).Message((MessageType)2, "Curse Empowered", 0, (Sprite)null);
				((Character)__instance).GetSEMan().RemoveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_FenrirCurse"), false);
				((Character)__instance).GetSEMan().AddStatusEffect(StringExtensionMethods.GetStableHashCode("SE_EnhancedCurse"), true, 0, 0f);
				return false;
			}
		}
		return true;
	}
}
[HarmonyPatch(typeof(Player), "GetTotalFoodValue")]
public static class EnhancedFormEitrPatch
{
	public static void Postfix(Player __instance, ref float hp, ref float stamina, ref float eitr)
	{
		if ((Object)(object)__instance != (Object)null && ((Character)__instance).GetSEMan() != null && ((Character)__instance).GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_EnhancedForm")))
		{
			eitr += 50f;
		}
	}
}
public class FenrirFormBehavior : MonoBehaviour
{
	private Animator playerAnim;

	private Animator fenrirAnim;

	private bool isAttacking = false;

	private void Start()
	{
		playerAnim = ((Component)((Component)Player.m_localPlayer).transform.Find("Visual")).GetComponent<Animator>();
		fenrirAnim = ((Component)this).GetComponent<Animator>();
		if ((Object)(object)fenrirAnim == (Object)null)
		{
			fenrirAnim = ((Component)this).GetComponentInChildren<Animator>();
		}
	}

	private void Update()
	{
		if ((Object)(object)playerAnim == (Object)null || (Object)(object)fenrirAnim == (Object)null || isAttacking)
		{
			return;
		}
		bool flag = playerAnim.GetBool("onGround");
		fenrirAnim.SetBool("onGround", flag);
		fenrirAnim.SetBool("inWater", playerAnim.GetBool("inWater"));
		if (!flag)
		{
			fenrirAnim.SetFloat("forward_speed", 0f);
			fenrirAnim.SetFloat("sideway_speed", 0f);
		}
		else if (((Character)Player.m_localPlayer).IsCrouching())
		{
			fenrirAnim.SetFloat("forward_speed", 0f);
			fenrirAnim.SetFloat("sideway_speed", 0f);
		}
		else
		{
			fenrirAnim.SetFloat("forward_speed", playerAnim.GetFloat("forward_speed"));
			fenrirAnim.SetFloat("sideway_speed", playerAnim.GetFloat("sideway_speed"));
		}
		if (flag)
		{
			if (Input.GetKeyDown((KeyCode)111))
			{
				((MonoBehaviour)this).StartCoroutine(HowlRoutine());
			}
			else if (Input.GetMouseButtonDown(1))
			{
				((MonoBehaviour)this).StartCoroutine(ClawRoutine("attack_claw1", 110f, 1.2f, 0.5f));
			}
			else if (Input.GetMouseButtonDown(0))
			{
				((MonoBehaviour)this).StartCoroutine(ClawRoutine("attack_claw0", 60f, 1f, 0.4f));
			}
			else if (Input.GetMouseButtonDown(2))
			{
				((MonoBehaviour)this).StartCoroutine(JumpAttackRoutine());
			}
		}
	}

	private void PlaySFX(params string[] prefabNames)
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		foreach (string text in prefabNames)
		{
			GameObject prefab = Cache.GetPrefab<GameObject>(text);
			if ((Object)(object)prefab != (Object)null)
			{
				Object.Instantiate<GameObject>(prefab, ((Component)Player.m_localPlayer).transform.position, Quaternion.identity);
				return;
			}
		}
		Logger.LogWarning((object)("[FenrirForm] Nessun suono trovato tra: " + string.Join(", ", prefabNames)));
	}

	private IEnumerator HowlRoutine()
	{
		isAttacking = true;
		fenrirAnim.SetFloat("forward_speed", 0f);
		fenrirAnim.SetFloat("sideway_speed", 0f);
		fenrirAnim.SetTrigger("attack_taunt");
		PlaySFX("sfx_wolf_howl", "sfx_wolf_alert", "sfx_fenring_idle");
		yield return (object)new WaitForSeconds(2f);
		isAttacking = false;
	}

	private IEnumerator ClawRoutine(string triggerName, float baseDamage, float lockDuration, float dmgDelay)
	{
		isAttacking = true;
		fenrirAnim.SetFloat("forward_speed", 0f);
		fenrirAnim.SetFloat("sideway_speed", 0f);
		fenrirAnim.SetTrigger(triggerName);
		PlaySFX("sfx_fenring_attack", "sfx_fenring_attack_claw", "sfx_wolf_attack");
		yield return (object)new WaitForSeconds(dmgDelay);
		if ((Object)(object)ZNetScene.instance != (Object)null)
		{
			GameObject attackSfx = ZNetScene.instance.GetPrefab("sfx_fenring_attack");
			if ((Object)(object)attackSfx != (Object)null)
			{
				Object.Instantiate<GameObject>(attackSfx, ((Component)Player.m_localPlayer).transform.position, Quaternion.identity);
			}
		}
		ExecuteClawDamage(baseDamage);
		float remainingTimeToIdle = lockDuration - dmgDelay;
		if (remainingTimeToIdle > 0f)
		{
			yield return (object)new WaitForSeconds(remainingTimeToIdle);
		}
		fenrirAnim.ResetTrigger(triggerName);
		isAttacking = false;
	}

	private IEnumerator JumpAttackRoutine()
	{
		isAttacking = true;
		fenrirAnim.SetFloat("forward_speed", 0f);
		fenrirAnim.SetFloat("sideway_speed", 0f);
		fenrirAnim.SetTrigger("attack_jump");
		yield return (object)new WaitForSeconds(0.75f);
		if ((Object)(object)ZNetScene.instance != (Object)null)
		{
			GameObject attackSfx = ZNetScene.instance.GetPrefab("sfx_fenring_attack");
			if ((Object)(object)attackSfx != (Object)null)
			{
				Object.Instantiate<GameObject>(attackSfx, ((Component)Player.m_localPlayer).transform.position, Quaternion.identity);
			}
		}
		float dashDuration = 0.2f;
		float elapsedDash = 0f;
		while (elapsedDash < dashDuration)
		{
			if ((Object)(object)Player.m_localPlayer != (Object)null)
			{
				Rigidbody rb = ((Component)Player.m_localPlayer).GetComponent<Rigidbody>();
				if ((Object)(object)rb != (Object)null)
				{
					Vector3 dashVelocity = ((Component)Player.m_localPlayer).transform.forward * 31.5f;
					if (elapsedDash < dashDuration / 2f)
					{
						dashVelocity += Vector3.up * 13.1f;
					}
					rb.MovePosition(rb.position + dashVelocity * Time.fixedDeltaTime);
				}
			}
			elapsedDash += Time.fixedDeltaTime;
			yield return (object)new WaitForFixedUpdate();
		}
		ExecuteClawDamage(95f);
		yield return (object)new WaitForSeconds(0.55f);
		fenrirAnim.ResetTrigger("attack_jump");
		isAttacking = false;
	}

	private void ExecuteClawDamage(float baseDamage)
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: 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_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0200: Unknown result type (might be due to invalid IL or missing references)
		//IL_0201: Unknown result type (might be due to invalid IL or missing references)
		//IL_0206: Unknown result type (might be due to invalid IL or missing references)
		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
		//IL_020f: Unknown result type (might be due to invalid IL or missing references)
		//IL_021b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0220: Unknown result type (might be due to invalid IL or missing references)
		//IL_023c: Unknown result type (might be due to invalid IL or missing references)
		//IL_023d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0247: Unknown result type (might be due to invalid IL or missing references)
		//IL_024c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: Unknown result type (might be due to invalid IL or missing references)
		//IL_0253: Unknown result type (might be due to invalid IL or missing references)
		//IL_0255: Unknown result type (might be due to invalid IL or missing references)
		//IL_0296: Unknown result type (might be due to invalid IL or missing references)
		//IL_029d: Expected O, but got Unknown
		//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02da: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)Player.m_localPlayer == (Object)null)
		{
			return;
		}
		Vector3 position = ((Component)Player.m_localPlayer).transform.position;
		Vector3 val = position + ((Component)Player.m_localPlayer).transform.forward * 1.5f + Vector3.up * 1f;
		float num = 2.5f;
		float skillLevel = ((Character)Player.m_localPlayer).GetSkillLevel((SkillType)11);
		float slash = baseDamage + skillLevel;
		int mask = LayerMask.GetMask(new string[12]
		{
			"Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "terrain", "character", "character_net", "character_ghost", "hitbox",
			"character_noenv", "vehicle"
		});
		Collider[] array = Physics.OverlapSphere(val, num, mask);
		HashSet<GameObject> hashSet = new HashSet<GameObject>();
		Collider[] array2 = array;
		RaycastHit val7 = default(RaycastHit);
		foreach (Collider val2 in array2)
		{
			if ((Object)(object)((Component)val2).gameObject == (Object)(object)((Component)Player.m_localPlayer).gameObject || ((Object)(object)val2.attachedRigidbody != (Object)null && (Object)(object)((Component)val2.attachedRigidbody).gameObject == (Object)(object)((Component)Player.m_localPlayer).gameObject))
			{
				continue;
			}
			IDestructible componentInParent = ((Component)val2).GetComponentInParent<IDestructible>();
			if (componentInParent == null)
			{
				continue;
			}
			Character val3 = (Character)(object)((componentInParent is Character) ? componentInParent : null);
			if ((Object)(object)val3 != (Object)null && (Object)(object)val3 == (Object)(object)Player.m_localPlayer)
			{
				continue;
			}
			IDestructible obj = ((componentInParent is MonoBehaviour) ? componentInParent : null);
			GameObject val4 = ((obj != null) ? ((Component)obj).gameObject : null);
			if ((Object)(object)val4 != (Object)null)
			{
				if (hashSet.Contains(val4))
				{
					continue;
				}
				hashSet.Add(val4);
			}
			Bounds bounds = val2.bounds;
			Vector3 center = ((Bounds)(ref bounds)).center;
			Vector3 val5 = center - position;
			Vector3 normalized = ((Vector3)(ref val5)).normalized;
			float num2 = Vector3.Angle(((Component)Player.m_localPlayer).transform.forward, normalized);
			if (num2 < 70f)
			{
				Vector3 val6 = position + Vector3.up * 1.5f;
				if (!Physics.Linecast(val6, center, ref val7, LayerMask.GetMask(new string[4] { "Default", "static_solid", "terrain", "piece" })))
				{
					HitData val8 = new HitData();
					val8.m_damage.m_slash = slash;
					val8.m_pushForce = 30f;
					val8.m_point = center;
					val8.m_dir = ((Component)Player.m_localPlayer).transform.forward;
					val8.m_skill = (SkillType)11;
					val8.m_dodgeable = true;
					val8.m_blockable = true;
					val8.m_hitType = (HitType)2;
					val8.m_toolTier = 0;
					val8.SetAttacker((Character)(object)Player.m_localPlayer);
					componentInParent.Damage(val8);
				}
			}
		}
	}
}
public class CultistFormBehavior : MonoBehaviour
{
	private Animator playerAnim;

	private Animator cultistAnim;

	private bool isAttacking = false;

	private bool isShootingFire = false;

	private float fireTimer = 0f;

	private GameObject fireEffectInstance;

	private void Start()
	{
		playerAnim = ((Component)((Component)Player.m_localPlayer).transform.Find("Visual")).GetComponent<Animator>();
		cultistAnim = ((Component)this).GetComponent<Animator>();
		if ((Object)(object)cultistAnim == (Object)null)
		{
			cultistAnim = ((Component)this).GetComponentInChildren<Animator>();
		}
	}

	private void Update()
	{
		if ((Object)(object)playerAnim == (Object)null || (Object)(object)cultistAnim == (Object)null || isAttacking)
		{
			return;
		}
		bool flag = playerAnim.GetBool("onGround");
		cultistAnim.SetBool("onGround", flag);
		cultistAnim.SetBool("inWater", playerAnim.GetBool("inWater"));
		if (!flag)
		{
			cultistAnim.SetFloat("forward_speed", 0f);
			cultistAnim.SetFloat("sideway_speed", 0f);
		}
		else if (((Character)Player.m_localPlayer).IsCrouching())
		{
			cultistAnim.SetFloat("forward_speed", 0f);
			cultistAnim.SetFloat("sideway_speed", 0f);
		}
		else
		{
			cultistAnim.SetFloat("forward_speed", playerAnim.GetFloat("forward_speed"));
			cultistAnim.SetFloat("sideway_speed", playerAnim.GetFloat("sideway_speed"));
		}
		if (flag)
		{
			if (Input.GetMouseButton(1))
			{
				if (Player.m_localPlayer.GetEitr() > 0f)
				{
					if (!isShootingFire)
					{
						StartFire();
					}
					else
					{
						UpdateFire();
					}
				}
				else if (isShootingFire)
				{
					StopFire();
				}
			}
			else if (isShootingFire)
			{
				StopFire();
			}
			if (Input.GetKeyDown((KeyCode)111))
			{
				((MonoBehaviour)this).StartCoroutine(HowlRoutine());
			}
			if (Input.GetMouseButtonDown(0) && !isShootingFire)
			{
				((MonoBehaviour)this).StartCoroutine(ClawRoutine());
			}
			else if (Input.GetMouseButtonDown(2) && !isShootingFire)
			{
				((MonoBehaviour)this).StartCoroutine(DoubleClawRoutine());
			}
		}
		else if (isShootingFire)
		{
			StopFire();
		}
	}

	private void PlaySFX(params string[] prefabNames)
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		foreach (string text in prefabNames)
		{
			GameObject prefab = Cache.GetPrefab<GameObject>(text);
			if ((Object)(object)prefab != (Object)null)
			{
				Object.Instantiate<GameObject>(prefab, ((Component)Player.m_localPlayer).transform.position, Quaternion.identity);
				return;
			}
		}
		Logger.LogWarning((object)("[CultistForm] Nessun suono trovato tra: " + string.Join(", ", prefabNames)));
	}

	private IEnumerator HowlRoutine()
	{
		isAttacking = true;
		cultistAnim.SetFloat("forward_speed", 0f);
		cultistAnim.SetFloat("sideway_speed", 0f);
		cultistAnim.SetTrigger("attack_taunt");
		PlaySFX("sfx_wolf_howl", "sfx_wolf_alert", "sfx_fenring_idle");
		yield return (object)new WaitForSeconds(2f);
		isAttacking = false;
	}

	private void StartFire()
	{
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: 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_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)Player.m_localPlayer == (Object)null || isShootingFire)
		{
			return;
		}
		isShootingFire = true;
		cultistAnim.SetFloat("forward_speed", 0f);
		cultistAnim.SetFloat("sideway_speed", 0f);
		cultistAnim.SetBool("attack_fire", true);
		PlaySFX("sfx_cultist_attack_fire_start");
		cultistAnim.SetTrigger("attack_flames");
		if (!((Object)(object)ZNetScene.instance != (Object)null) || !((Object)(object)fireEffectInstance == (Object)null))
		{
			return;
		}
		GameObject prefab = ZNetScene.instance.GetPrefab("fx_fenring_flames");
		if ((Object)(object)prefab != (Object)null)
		{
			fireEffectInstance = Object.Instantiate<GameObject>(prefab, ((Component)Player.m_localPlayer).transform.position + Vector3.up * 1.5f + ((Component)Player.m_localPlayer).transform.forward, ((Component)Player.m_localPlayer).transform.rotation, ((Component)Player.m_localPlayer).transform);
			ParticleSystem[] componentsInChildren = fireEffectInstance.GetComponentsInChildren<ParticleSystem>();
			ParticleSystem[] array = componentsInChildren;
			foreach (ParticleSystem val in array)
			{
				MainModule main = val.main;
				((MainModule)(ref main)).startLifetimeMultiplier = ((MainModule)(ref main)).startLifetimeMultiplier * 1.2f;
			}
		}
	}

	private void UpdateFire()
	{
		((Character)Player.m_localPlayer).UseEitr(12.5f * Time.deltaTime);
		cultistAnim.SetFloat("forward_speed", 0f);
		cultistAnim.SetFloat("sideway_speed", 0f);
		fireTimer += Time.deltaTime;
		if (fireTimer >= 0.2f)
		{
			fireTimer = 0f;
			ExecuteFireDamage();
		}
	}

	private void StopFire()
	{
		isShootingFire = false;
		cultistAnim.ResetTrigger("attack_flames");
		if ((Object)(object)fireEffectInstance != (Object)null)
		{
			Object.Destroy((Object)(object)fireEffectInstance);
			fireEffectInstance = null;
		}
	}

	private void ExecuteFireDamage()
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: 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_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0201: Unknown result type (might be due to invalid IL or missing references)
		//IL_0205: Unknown result type (might be due to invalid IL or missing references)
		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
		//IL_020c: Unknown result type (might be due to invalid IL or missing references)
		//IL_020e: Unknown result type (might be due to invalid IL or missing references)
		//IL_020f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0214: Unknown result type (might be due to invalid IL or missing references)
		//IL_0218: Unknown result type (might be due to invalid IL or missing references)
		//IL_021d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0229: Unknown result type (might be due to invalid IL or missing references)
		//IL_022e: Unknown result type (might be due to invalid IL or missing references)
		//IL_024a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: Expected O, but got Unknown
		//IL_0261: Unknown result type (might be due to invalid IL or missing references)
		//IL_0263: Unknown result type (might be due to invalid IL or missing references)
		//IL_0274: Unknown result type (might be due to invalid IL or missing references)
		//IL_0279: Unknown result type (might be due to invalid IL or missing references)
		//IL_0282: Unknown result type (might be due to invalid IL or missing references)
		//IL_029a: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)Player.m_localPlayer == (Object)null)
		{
			return;
		}
		Vector3 position = ((Component)Player.m_localPlayer).transform.position;
		Vector3 val = position + ((Component)Player.m_localPlayer).transform.forward * 2.5f + Vector3.up * 1f;
		float num = 3f;
		float skillLevel = ((Character)Player.m_localPlayer).GetSkillLevel((SkillType)9);
		float num2 = 20f;
		float fire = num2 + skillLevel * 0.5f;
		int mask = LayerMask.GetMask(new string[12]
		{
			"Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "terrain", "character", "character_net", "character_ghost", "hitbox",
			"character_noenv", "vehicle"
		});
		Collider[] array = Physics.OverlapSphere(val, num, mask);
		HashSet<GameObject> hashSet = new HashSet<GameObject>();
		Collider[] array2 = array;
		foreach (Collider val2 in array2)
		{
			if ((Object)(object)((Component)val2).gameObject == (Object)(object)((Component)Player.m_localPlayer).gameObject || ((Object)(object)val2.attachedRigidbody != (Object)null && (Object)(object)((Component)val2.attachedRigidbody).gameObject == (Object)(object)((Component)Player.m_localPlayer).gameObject))
			{
				continue;
			}
			IDestructible componentInParent = ((Component)val2).GetComponentInParent<IDestructible>();
			if (componentInParent == null)
			{
				continue;
			}
			Character val3 = (Character)(object)((componentInParent is Character) ? componentInParent : null);
			if ((Object)(object)val3 != (Object)null && (Object)(object)val3 == (Object)(object)Player.m_localPlayer)
			{
				continue;
			}
			IDestructible obj = ((componentInParent is MonoBehaviour) ? componentInParent : null);
			GameObject val4 = ((obj != null) ? ((Component)obj).gameObject : null);
			if ((Object)(object)val4 != (Object)null)
			{
				if (hashSet.Contains(val4))
				{
					continue;
				}
				hashSet.Add(val4);
			}
			Bounds bounds = val2.bounds;
			Vector3 center = ((Bounds)(ref bounds)).center;
			Vector3 val5 = center - position;
			Vector3 normalized = ((Vector3)(ref val5)).normalized;
			float num3 = Vector3.Angle(((Component)Player.m_localPlayer).transform.forward, normalized);
			if (!(num3 < 45f))
			{
				continue;
			}
			HitData val6 = new HitData();
			val6.m_damage.m_fire = fire;
			val6.m_point = center;
			val6.m_dir = ((Component)Player.m_localPlayer).transform.forward;
			val6.m_skill = (SkillType)9;
			val6.m_dodgeable = true;
			val6.m_blockable = true;
			val6.m_hitType = (HitType)2;
			val6.SetAttacker((Character)(object)Player.m_localPlayer);
			componentInParent.Damage(val6);
			if ((Object)(object)ZNetScene.instance != (Object)null)
			{
				GameObject prefab = ZNetScene.instance.GetPrefab("vfx_FireballHit");
				if ((Object)(object)prefab != (Object)null)
				{
					Object.Instantiate<GameObject>(prefab, center, Quaternion.identity);
				}
			}
		}
	}

	private IEnumerator ClawRoutine()
	{
		isAttacking = true;
		cultistAnim.SetFloat("forward_speed", 0f);
		cultistAnim.SetFloat("sideway_speed", 0f);
		cultistAnim.SetTrigger("attack_claw");
		yield return (object)new WaitForSeconds(0.4f);
		PlaySFX("sfx_cultist_attack", "sfx_fenring_attack", "sfx_wolf_attack");
		ExecuteClawDamage(85f);
		float remainingTimeToIdle = 0.099999994f;
		if (remainingTimeToIdle > 0f)
		{
			yield return (object)new WaitForSeconds(remainingTimeToIdle);
		}
		cultistAnim.ResetTrigger("attack_claw");
		isAttacking = false;
	}

	private IEnumerator DoubleClawRoutine()
	{
		isAttacking = true;
		cultistAnim.SetFloat("forward_speed", 0f);
		cultistAnim.SetFloat("sideway_speed", 0f);
		cultistAnim.SetTrigger("attack_claw_double");
		yield return (object)new WaitForSeconds(0.6f);
		PlaySFX("sfx_cultist_attack_double", "sfx_cultist_attack", "sfx_fenring_attack");
		ExecuteClawDamage(140f);
		yield return (object)new WaitForSeconds(1.2f);
		cultistAnim.ResetTrigger("attack_claw_double");
		isAttacking = false;
	}

	private void ExecuteClawDamage(float baseDamage)
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: 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_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0200: Unknown result type (might be due to invalid IL or missing references)
		//IL_0201: Unknown result type (might be due to invalid IL or missing references)
		//IL_0206: Unknown result type (might be due to invalid IL or missing references)
		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
		//IL_020f: Unknown result type (might be due to invalid IL or missing references)
		//IL_021b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0220: Unknown result type (might be due to invalid IL or missing references)
		//IL_023c: Unknown result type (might be due to invalid IL or missing references)
		//IL_023d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0247: Unknown result type (might be due to invalid IL or missing references)
		//IL_024c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: Unknown result type (might be due to invalid IL or missing references)
		//IL_0253: Unknown result type (might be due to invalid IL or missing references)
		//IL_0255: Unknown result type (might be due to invalid IL or missing references)
		//IL_0296: Unknown result type (might be due to invalid IL or missing references)
		//IL_029d: Expected O, but got Unknown
		//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02da: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)Player.m_localPlayer == (Object)null)
		{
			return;
		}
		Vector3 position = ((Component)Player.m_localPlayer).transform.position;
		Vector3 val = position + ((Component)Player.m_localPlayer).transform.forward * 1.5f + Vector3.up * 1f;
		float num = 2.5f;
		float skillLevel = ((Character)Player.m_localPlayer).GetSkillLevel((SkillType)11);
		float slash = baseDamage + skillLevel;
		int mask = LayerMask.GetMask(new string[12]
		{
			"Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "terrain", "character", "character_net", "character_ghost", "hitbox",
			"character_noenv", "vehicle"
		});
		Collider[] array = Physics.OverlapSphere(val, num, mask);
		HashSet<GameObject> hashSet = new HashSet<GameObject>();
		Collider[] array2 = array;
		RaycastHit val7 = default(RaycastHit);
		foreach (Collider val2 in array2)
		{
			if ((Object)(object)((Component)val2).gameObject == (Object)(object)((Component)Player.m_localPlayer).gameObject || ((Object)(object)val2.attachedRigidbody != (Object)null && (Object)(object)((Component)val2.attachedRigidbody).gameObject == (Object)(object)((Component)Player.m_localPlayer).gameObject))
			{
				continue;
			}
			IDestructible componentInParent = ((Component)val2).GetComponentInParent<IDestructible>();
			if (componentInParent == null)
			{
				continue;
			}
			Character val3 = (Character)(object)((componentInParent is Character) ? componentInParent : null);
			if ((Object)(object)val3 != (Object)null && (Object)(object)val3 == (Object)(object)Player.m_localPlayer)
			{
				continue;
			}
			IDestructible obj = ((componentInParent is MonoBehaviour) ? componentInParent : null);
			GameObject val4 = ((obj != null) ? ((Component)obj).gameObject : null);
			if ((Object)(object)val4 != (Object)null)
			{
				if (hashSet.Contains(val4))
				{
					continue;
				}
				hashSet.Add(val4);
			}
			Bounds bounds = val2.bounds;
			Vector3 center = ((Bounds)(ref bounds)).center;
			Vector3 val5 = center - position;
			Vector3 normalized = ((Vector3)(ref val5)).normalized;
			float num2 = Vector3.Angle(((Component)Player.m_localPlayer).transform.forward, normalized);
			if (num2 < 70f)
			{
				Vector3 val6 = position + Vector3.up * 1.5f;
				if (!Physics.Linecast(val6, center, ref val7, LayerMask.GetMask(new string[4] { "Default", "static_solid", "terrain", "piece" })))
				{
					HitData val8 = new HitData();
					val8.m_damage.m_slash = slash;
					val8.m_pushForce = 30f;
					val8.m_point = center;
					val8.m_dir = ((Component)Player.m_localPlayer).transform.forward;
					val8.m_skill = (SkillType)11;
					val8.m_dodgeable = true;
					val8.m_blockable = true;
					val8.m_hitType = (HitType)2;
					val8.m_toolTier = 0;
					val8.SetAttacker((Character)(object)Player.m_localPlayer);
					componentInParent.Damage(val8);
				}
			}
		}
	}
}
public class WolfFormBehavior : MonoBehaviour
{
	private Animator playerAnim;

	private Animator wolfAnim;

	private bool isAttacking = false;

	private void Start()
	{
		playerAnim = ((Component)((Component)Player.m_localPlayer).transform.Find("Visual")).GetComponent<Animator>();
		wolfAnim = ((Component)this).GetComponent<Animator>();
		if ((Object)(object)wolfAnim == (Object)null)
		{
			wolfAnim = ((Component)this).GetComponentInChildren<Animator>();
		}
	}

	private void Update()
	{
		if ((Object)(object)playerAnim == (Object)null || (Object)(object)wolfAnim == (Object)null || isAttacking)
		{
			return;
		}
		bool flag = playerAnim.GetBool("onGround");
		try
		{
			wolfAnim.SetBool("onGround", flag);
		}
		catch
		{
		}
		try
		{
			wolfAnim.SetBool("inWater", playerAnim.GetBool("inWater"));
		}
		catch
		{
		}
		if (!flag)
		{
			try
			{
				wolfAnim.SetFloat("forward_speed", 0f);
			}
			catch
			{
			}
			try
			{
				wolfAnim.SetFloat("sideway_speed", 0f);
			}
			catch
			{
			}
		}
		else if (((Character)Player.m_localPlayer).IsCrouching())
		{
			try
			{
				wolfAnim.SetFloat("forward_speed", 0f);
			}
			catch
			{
			}
			try
			{
				wolfAnim.SetFloat("sideway_speed", 0f);
			}
			catch
			{
			}
		}
		else
		{
			try
			{
				wolfAnim.SetFloat("forward_speed", playerAnim.GetFloat("forward_speed"));
			}
			catch
			{
			}
			try
			{
				wolfAnim.SetFloat("sideway_speed", playerAnim.GetFloat("sideway_speed"));
			}
			catch
			{
			}
		}
		if (flag)
		{
			if (Input.GetMouseButtonDown(0))
			{
				((MonoBehaviour)this).StartCoroutine(WolfAttackRoutine("attack1", 40f, 0.6f, 0.2f));
			}
			else if (Input.GetMouseButtonDown(1))
			{
				((MonoBehaviour)this).StartCoroutine(WolfAttackRoutine("attack2", 60f, 0.8f, 0.3f));
			}
			else if (Input.GetMouseButtonDown(2))
			{
				((MonoBehaviour)this).StartCoroutine(WolfAttackRoutine("attack3", 80f, 1f, 0.4f));
			}
		}
	}

	private void PlaySFX(params string[] prefabNames)
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		foreach (string text in prefabNames)
		{
			GameObject prefab = Cache.GetPrefab<GameObject>(text);
			if ((Object)(object)prefab != (Object)null)
			{
				Object.Instantiate<GameObject>(prefab, ((Component)Player.m_localPlayer).transform.position, Quaternion.identity);
				break;
			}
		}
	}

	private IEnumerator WolfAttackRoutine(string triggerName, float baseDamage, float lockDuration, float dmgDelay)
	{
		isAttacking = true;
		try
		{
			wolfAnim.SetFloat("forward_speed", 0f);
		}
		catch
		{
		}
		try
		{
			wolfAnim.SetFloat("sideway_speed", 0f);
		}
		catch
		{
		}
		wolfAnim.SetTrigger(triggerName);
		yield return (object)new WaitForSeconds(dmgDelay);
		if ((Object)(object)ZNetScene.instance != (Object)null)
		{
			GameObject attackSfx = ZNetScene.instance.GetPrefab("sfx_wolf_attack");
			if ((Object)(object)attackSfx != (Object)null)
			{
				Object.Instantiate<GameObject>(attackSfx, ((Component)Player.m_localPlayer).transform.position, Quaternion.identity);
			}
		}
		ExecuteBiteDamage(baseDamage);
		float remainingTimeToIdle = lockDuration - dmgDelay;
		if (remainingTimeToIdle > 0f)
		{
			yield return (object)new WaitForSeconds(remainingTimeToIdle);
		}
		wolfAnim.ResetTrigger(triggerName);
		isAttacking = false;
	}

	private void ExecuteBiteDamage(float baseDamage)
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: 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_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0200: Unknown result type (might be due to invalid IL or missing references)
		//IL_0201: Unknown result type (might be due to invalid IL or missing references)
		//IL_0206: Unknown result type (might be due to invalid IL or missing references)
		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
		//IL_020f: Unknown result type (might be due to invalid IL or missing references)
		//IL_021b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0220: Unknown result type (might be due to invalid IL or missing references)
		//IL_023c: Unknown result type (might be due to invalid IL or missing references)
		//IL_023d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0247: Unknown result type (might be due to invalid IL or missing references)
		//IL_024c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: Unknown result type (might be due to invalid IL or missing references)
		//IL_0253: Unknown result type (might be due to invalid IL or missing references)
		//IL_0255: Unknown result type (might be due to invalid IL or missing references)
		//IL_0296: Unknown result type (might be due to invalid IL or missing references)
		//IL_029d: Expected O, but got Unknown
		//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02da: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)Player.m_localPlayer == (Object)null)
		{
			return;
		}
		Vector3 position = ((Component)Player.m_localPlayer).transform.position;
		Vector3 val = position + ((Component)Player.m_localPlayer).transform.forward * 1.5f + Vector3.up * 0.5f;
		float num = 2f;
		float skillLevel = ((Character)Player.m_localPlayer).GetSkillLevel((SkillType)11);
		float slash = baseDamage + skillLevel;
		int mask = LayerMask.GetMask(new string[12]
		{
			"Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "terrain", "character", "character_net", "character_ghost", "hitbox",
			"character_noenv", "vehicle"
		});
		Collider[] array = Physics.OverlapSphere(val, num, mask);
		HashSet<GameObject> hashSet = new HashSet<GameObject>();
		Collider[] array2 = array;
		RaycastHit val7 = default(RaycastHit);
		foreach (Collider val2 in array2)
		{
			if ((Object)(object)((Component)val2).gameObject == (Object)(object)((Component)Player.m_localPlayer).gameObject || ((Object)(object)val2.attachedRigidbody != (Object)null && (Object)(object)((Component)val2.attachedRigidbody).gameObject == (Object)(object)((Component)Player.m_localPlayer).gameObject))
			{
				continue;
			}
			IDestructible componentInParent = ((Component)val2).GetComponentInParent<IDestructible>();
			if (componentInParent == null)
			{
				continue;
			}
			Character val3 = (Character)(object)((componentInParent is Character) ? componentInParent : null);
			if ((Object)(object)val3 != (Object)null && (Object)(object)val3 == (Object)(object)Player.m_localPlayer)
			{
				continue;
			}
			IDestructible obj = ((componentInParent is MonoBehaviour) ? componentInParent : null);
			GameObject val4 = ((obj != null) ? ((Component)obj).gameObject : null);
			if ((Object)(object)val4 != (Object)null)
			{
				if (hashSet.Contains(val4))
				{
					continue;
				}
				hashSet.Add(val4);
			}
			Bounds bounds = val2.bounds;
			Vector3 center = ((Bounds)(ref bounds)).center;
			Vector3 val5 = center - position;
			Vector3 normalized = ((Vector3)(ref val5)).normalized;
			float num2 = Vector3.Angle(((Component)Player.m_localPlayer).transform.forward, normalized);
			if (num2 < 70f)
			{
				Vector3 val6 = position + Vector3.up * 1f;
				if (!Physics.Linecast(val6, center, ref val7, LayerMask.GetMask(new string[4] { "Default", "static_solid", "terrain", "piece" })))
				{
					HitData val8 = new HitData();
					val8.m_damage.m_slash = slash;
					val8.m_pushForce = 20f;
					val8.m_point = center;
					val8.m_dir = ((Component)Player.m_localPlayer).transform.forward;
					val8.m_skill = (SkillType)11;
					val8.m_dodgeable = true;
					val8.m_blockable = true;
					val8.m_hitType = (HitType)2;
					val8.m_toolTier = 0;
					val8.SetAttacker((Character)(object)Player.m_localPlayer);
					componentInParent.Damage(val8);
				}
			}
		}
	}
}
public class UlvFormBehavior : MonoBehaviour
{
	private Animator playerAnim;

	private Animator ulvAnim;

	private bool isAttacking = false;

	private void Start()
	{
		playerAnim = ((Component)((Component)Player.m_localPlayer).transform.Find("Visual")).GetComponent<Animator>();
		ulvAnim = ((Component)this).GetComponent<Animator>();
		if ((Object)(object)ulvAnim == (Object)null)
		{
			ulvAnim = ((Component)this).GetComponentInChildren<Animator>();
		}
	}

	private void Update()
	{
		if ((Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)playerAnim == (Object)null || (Object)(object)ulvAnim == (Object)null || isAttacking)
		{
			return;
		}
		bool flag = playerAnim.GetBool("onGround");
		try
		{
			ulvAnim.SetBool("onGround", flag);
		}
		catch
		{
		}
		try
		{
			ulvAnim.SetBool("inWater", playerAnim.GetBool("inWater"));
		}
		catch
		{
		}
		if (!flag)
		{
			try
			{
				ulvAnim.SetFloat("forward_speed", 0f);
			}
			catch
			{
			}
			try
			{
				ulvAnim.SetFloat("sideway_speed", 0f);
			}
			catch
			{
			}
		}
		else if (((Character)Player.m_localPlayer).IsCrouching())
		{
			try
			{
				ulvAnim.SetFloat("forward_speed", 0f);
			}
			catch
			{
			}
			try
			{
				ulvAnim.SetFloat("sideway_speed", 0f);
			}
			catch
			{
			}
		}
		else
		{
			try
			{
				ulvAnim.SetFloat("forward_speed", playerAnim.GetFloat("forward_speed"));
			}
			catch
			{
			}
			try
			{
				ulvAnim.SetFloat("sideway_speed", playerAnim.GetFloat("sideway_speed"));
			}
			catch
			{
			}
		}
		if (flag)
		{
			if (Input.GetMouseButtonDown(0))
			{
				((MonoBehaviour)this).StartCoroutine(UlvAttackRoutine("attack_bite", 40f, 0.6f, 0.2f));
			}
			else if (Input.GetMouseButtonDown(1))
			{
				((MonoBehaviour)this).StartCoroutine(UlvAttackRoutine("attack_bite", 60f, 0.8f, 0.3f));
			}
			else if (Input.GetMouseButtonDown(2))
			{
				((MonoBehaviour)this).StartCoroutine(UlvJumpAttackRoutine());
			}
		}
	}

	private void PlaySFX(params string[] prefabNames)
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		foreach (string text in prefabNames)
		{
			GameObject prefab = Cache.GetPrefab<GameObject>(text);
			if ((Object)(object)prefab != (Object)null)
			{
				Object.Instantiate<GameObject>(prefab, ((Component)Player.m_localPlayer).transform.position, Quaternion.identity);
				break;
			}
		}
	}

	private IEnumerator UlvAttackRoutine(string triggerName, float baseDamage, float lockDuration, float dmgDelay)
	{
		isAttacking = true;
		try
		{
			ulvAnim.SetFloat("forward_speed", 0f);
		}
		catch
		{
		}
		try
		{
			ulvAnim.SetFloat("sideway_speed", 0f);
		}
		catch
		{
		}
		try
		{
			ulvAnim.SetTrigger(triggerName);
		}
		catch
		{
		}
		if (triggerName == "attack_bite")
		{
			PlaySFX("sfx_ulv_attack", "sfx_wolf_attack", "sfx_fenring_attack");
		}
		else
		{
			PlaySFX("sfx_ulv_attack", "sfx_wolf_attack", "sfx_fenring_attack");
		}
		yield return (object)new WaitForSeconds(dmgDelay);
		if ((Object)(object)ZNetScene.instance != (Object)null)
		{
			GameObject attackSfx = ZNetScene.instance.GetPrefab("sfx_wood_hit");
			if ((Object)(object)attackSfx != (Object)null)
			{
				Object.Instantiate<GameObject>(attackSfx, ((Component)Player.m_localPlayer).transform.position, Quaternion.identity);
			}
		}
		ExecuteBiteDamage(baseDamage);
		float remainingTimeToIdle = lockDuration - dmgDelay;
		if (remainingTimeToIdle > 0f)
		{
			yield return (object)new WaitForSeconds(remainingTimeToIdle);
		}
		try
		{
			ulvAnim.ResetTrigger(triggerName);
		}
		catch
		{
		}
		isAttacking = false;
	}

	private void ExecuteBiteDamage(float baseDamage)
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: 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_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0200: Unknown result type (might be due to invalid IL or missing references)
		//IL_0201: Unknown result type (might be due to invalid IL or missing references)
		//IL_0206: Unknown result type (might be due to invalid IL or missing references)
		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
		//IL_020f: Unknown result type (might be due to invalid IL or missing references)
		//IL_021b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0220: Unknown result type (might be due to invalid IL or missing references)
		//IL_023c: Unknown result type (might be due to invalid IL or missing references)
		//IL_023d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0247: Unknown result type (might be due to invalid IL or missing references)
		//IL_024c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: Unknown result type (might be due to invalid IL or missing references)
		//IL_0253: Unknown result type (might be due to invalid IL or missing references)
		//IL_0255: Unknown result type (might be due to invalid IL or missing references)
		//IL_0296: Unknown result type (might be due to invalid IL or missing references)
		//IL_029d: Expected O, but got Unknown
		//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02da: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)Player.m_localPlayer == (Object)null)
		{
			return;
		}
		Vector3 position = ((Component)Player.m_localPlayer).transform.position;
		Vector3 val = position + ((Component)Player.m_localPlayer).transform.forward * 1.5f + Vector3.up * 0.5f;
		float num = 2f;
		float skillLevel = ((Character)Player.m_localPlayer).GetSkillLevel((SkillType)11);
		float slash = baseDamage + skillLevel;
		int mask = LayerMask.GetMask(new string[12]
		{
			"Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "terrain", "character", "character_net", "character_ghost", "hitbox",
			"character_noenv", "vehicle"
		});
		Collider[] array = Physics.OverlapSphere(val, num, mask);
		HashSet<GameObject> hashSet = new HashSet<GameObject>();
		Collider[] array2 = array;
		RaycastHit val7 = default(RaycastHit);
		foreach (Collider val2 in array2)
		{
			if ((Object)(object)((Component)val2).gameObject == (Object)(object)((Component)Player.m_localPlayer).gameObject || ((Object)(object)val2.attachedRigidbody != (Object)null && (Object)(object)((Component)val2.attachedRigidbody).gameObject == (Object)(object)((Component)Player.m_localPlayer).gameObject))
			{
				continue;
			}
			IDestructible componentInParent = ((Component)val2).GetComponentInParent<IDestructible>();
			if (componentInParent == null)
			{
				continue;
			}
			Character val3 = (Character)(object)((componentInParent is Character) ? componentInParent : null);
			if ((Object)(object)val3 != (Object)null && (Object)(object)val3 == (Object)(object)Player.m_localPlayer)
			{
				continue;
			}
			IDestructible obj = ((componentInParent is MonoBehaviour) ? componentInParent : null);
			GameObject val4 = ((obj != null) ? ((Component)obj).gameObject : null);
			if ((Object)(object)val4 != (Object)null)
			{
				if (hashSet.Contains(val4))
				{
					continue;
				}
				hashSet.Add(val4);
			}
			Bounds bounds = val2.bounds;
			Vector3 center = ((Bounds)(ref bounds)).center;
			Vector3 val5 = center - position;
			Vector3 normalized = ((Vector3)(ref val5)).normalized;
			float num2 = Vector3.Angle(((Component)Player.m_localPlayer).transform.forward, normalized);
			if (num2 < 70f)
			{
				Vector3 val6 = position + Vector3.up * 1f;
				if (!Physics.Linecast(val6, center, ref val7, LayerMask.GetMask(new string[4] { "Default", "static_solid", "terrain", "piece" })))
				{
					HitData val8 = new HitData();
					val8.m_damage.m_slash = slash;
					val8.m_pushForce = 25f;
					val8.m_point = center;
					val8.m_dir = ((Component)Player.m_localPlayer).transform.forward;
					val8.m_skill = (SkillType)11;
					val8.m_dodgeable = true;
					val8.m_blockable = true;
					val8.m_hitType = (HitType)2;
					val8.m_toolTier = 0;
					val8.SetAttacker((Character)(object)Player.m_localPlayer);
					componentInParent.Damage(val8);
				}
			}
		}
	}

	private IEnumerator UlvJumpAttackRoutine()
	{
		isAttacking = true;
		try
		{
			ulvAnim.SetFloat("forward_speed", 0f);
		}
		catch
		{
		}
		try
		{
			ulvAnim.SetFloat("sideway_speed", 0f);
		}
		catch
		{
		}
		try
		{
			ulvAnim.SetTrigger("attack_slash");
		}
		catch
		{
		}
		PlaySFX("sfx_ulv_attack", "sfx_wolf_attack");
		yield return (object)new WaitForSeconds(0.3f);
		float leapDuration = 0.25f;
		float leapSpeed = 18f;
		float elapsed = 0f;
		while (elapsed < leapDuration)
		{
			if ((Object)(object)Player.m_localPlayer != (Object)null)
			{
				Vector3 moveDir = ((Component)Player.m_localPlayer).transform.forward;
				Transform transform = ((Component)Player.m_localPlayer).transform;
				transform.position += moveDir * leapSpeed * Time.deltaTime;
			}
			elapsed += Time.deltaTime;
			yield return null;
		}
		if ((Object)(object)ZNetScene.instance != (Object)null)
		{
			GameObject attackSfx = ZNetScene.instance.GetPrefab("sfx_wood_hit");
			if ((Object)(object)attackSfx != (Object)null)
			{
				Object.Instantiate<GameObject>(attackSfx, ((Component)Player.m_localPlayer).transform.position, Quaternion.identity);
			}
		}
		ExecuteBiteDamage(80f);
		yield return (object)new WaitForSeconds(0.4f);
		try
		{
			ulvAnim.ResetTrigger("attack_slash");
		}
		catch
		{
		}
		isAttacking = false;
	}
}
[HarmonyPatch(typeof(Player), "OnDamaged")]
public class FenrirInfectionPatch
{
	private static void Postfix(Player __instance, HitData hit)
	{
		if (((Character)__instance).IsDead() || hit == null)
		{
			return;
		}
		Character attacker = hit.GetAttacker();
		if ((Object)(object)attacker != (Object)null)
		{
			string name = ((Object)((Component)attacker).gameObject).name;
			float num = 0f;
			string text = "";
			if (name.Contains("Fenring_Cultist") || name.Contains("Cultist"))
			{
				num = 0.5f;
				text = "Cultist";
			}
			else if (name.Contains("Fenring"))
			{
				num = 0.25f;
				text = "Fenring";
			}
			else if (name.Contains("Ulv"))
			{
				num = 0.25f;
				text = "Ulv";
			}
			else if (name.Contains("Wolf"))
			{
				num = 0.1f;
				text = "Wolf";
			}
			if (num > 0f && Random.value <= num && !((Character)__instance).GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_FenrirCurse")) && !((Character)__instance).GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_EnhancedCurse")))
			{
				Logger.LogInfo((object)("The player has been infected by a " + text + "!"));
				((Character)__instance).Message((MessageType)2, "The beast's blood enters your veins...", 0, (Sprite)null);
				((Character)__instance).GetSEMan().AddStatusEffect(StringExtensionMethods.GetStableHashCode("SE_FenrirCurse"), true, 0, 0f);
			}
		}
	}
}