Decompiled source of Vanaheim v1.1.3

Vanaheim.dll

Decompiled 6 days ago
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
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("Vanaheim")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HP")]
[assembly: AssemblyProduct("Vanaheim")]
[assembly: AssemblyCopyright("Copyright © HP 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("75197ad0-6f9f-4b64-9c56-795ccdd26874")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Vanaheim;

public class Class1
{
}
internal class Class2
{
}
[BepInPlugin("vanaheim.havstormr", "Vanaheim - Havstormr", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class VanaheimPlugin : BaseUnityPlugin
{
	public class HavstormrController : MonoBehaviour
	{
		public string StormEnvironment = "ThunderStorm";

		public string DrakeAddPrefab = "Havstormr_Drake";

		public string SerpentAddPrefab = "Havstormr_Serpent";

		private Character character;

		private float drakeTimer = 50f;

		private float serpentTimer = 115f;

		private bool deathHandled = false;

		private bool stormStarted = false;

		private void Awake()
		{
			character = ((Component)this).GetComponent<Character>();
		}

		private void Start()
		{
			ForceStorm();
			stormStarted = true;
			if ((Object)(object)MessageHud.instance != (Object)null)
			{
				MessageHud.instance.ShowMessage((MessageType)2, "The sea blackens beneath Havstormr's wings...", 0, (Sprite)null, false);
			}
		}

		private void Update()
		{
			if ((Object)(object)character == (Object)null)
			{
				return;
			}
			if (character.IsDead())
			{
				if (!deathHandled)
				{
					deathHandled = true;
					ResetStorm();
					if ((Object)(object)MessageHud.instance != (Object)null)
					{
						MessageHud.instance.ShowMessage((MessageType)2, "Havstormr falls. The eternal storm begins to break.", 0, (Sprite)null, false);
					}
				}
				return;
			}
			ForceStorm();
			if (IsServer())
			{
				drakeTimer -= Time.deltaTime;
				serpentTimer -= Time.deltaTime;
				if (drakeTimer <= 0f)
				{
					SpawnDrakes();
					drakeTimer = Random.Range(45f, 60f);
				}
				if (serpentTimer <= 0f)
				{
					SpawnSerpent();
					serpentTimer = Random.Range(100f, 130f);
				}
			}
		}

		private void OnDestroy()
		{
			if (stormStarted && !deathHandled)
			{
				ResetStorm();
			}
		}

		private bool IsServer()
		{
			return (Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsServer();
		}

		private void ForceStorm()
		{
			if ((Object)(object)EnvMan.instance != (Object)null)
			{
				EnvMan.instance.m_debugEnv = StormEnvironment;
			}
		}

		private void ResetStorm()
		{
			if ((Object)(object)EnvMan.instance != (Object)null)
			{
				EnvMan.instance.m_debugEnv = "";
			}
		}

		private void SpawnDrakes()
		{
			//IL_000e: 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_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_0047: 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)
			int num = Random.Range(1, 3);
			for (int i = 0; i < num; i++)
			{
				Vector3 val = Random.insideUnitSphere * 14f;
				val.y = Random.Range(4f, 8f);
				SpawnPrefab(DrakeAddPrefab, ((Component)this).transform.position + val, Quaternion.identity);
			}
			if ((Object)(object)MessageHud.instance != (Object)null)
			{
				MessageHud.instance.ShowMessage((MessageType)1, "Storm drakes descend from the clouds.", 0, (Sprite)null, false);
			}
		}

		private void SpawnSerpent()
		{
			//IL_0001: 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_0010: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Random.insideUnitSphere * 22f;
			val.y = 0f;
			SpawnPrefab(SerpentAddPrefab, ((Component)this).transform.position + val, Quaternion.identity);
			if ((Object)(object)MessageHud.instance != (Object)null)
			{
				MessageHud.instance.ShowMessage((MessageType)1, "Something coils beneath the waves...", 0, (Sprite)null, false);
			}
		}

		private void SpawnPrefab(string prefabName, Vector3 position, Quaternion rotation)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)ZNetScene.instance == (Object)null))
			{
				GameObject prefab = ZNetScene.instance.GetPrefab(prefabName);
				if ((Object)(object)prefab == (Object)null)
				{
					Debug.LogError((object)("Could not find prefab: " + prefabName));
				}
				else
				{
					Object.Instantiate<GameObject>(prefab, position, rotation);
				}
			}
		}
	}

	public class HavstormrLightningImpactAoE : MonoBehaviour
	{
		public float Radius = 4f;

		public float LightningDamage = 12f;

		public float BluntDamage = 4f;

		public float PushForce = 12f;

		public GameObject ImpactFx;

		private bool hasTriggered = false;

		private void OnDestroy()
		{
			TriggerImpact();
		}

		private void TriggerImpact()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if (!hasTriggered)
			{
				hasTriggered = true;
				if ((Object)(object)ImpactFx != (Object)null)
				{
					Object.Instantiate<GameObject>(ImpactFx, ((Component)this).transform.position, Quaternion.identity);
				}
				ApplyAoE();
			}
		}

		private void ApplyAoE()
		{
			//IL_0007: 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_0057: Invalid comparison between Unknown and I4
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, Radius);
			Collider[] array2 = array;
			foreach (Collider val in array2)
			{
				Character componentInParent = ((Component)val).GetComponentInParent<Character>();
				if (!((Object)(object)componentInParent == (Object)null) && !componentInParent.IsDead() && (int)componentInParent.GetFaction() != 8)
				{
					HitData val2 = new HitData();
					val2.m_damage.m_lightning = LightningDamage;
					val2.m_damage.m_blunt = BluntDamage;
					val2.m_point = ((Component)componentInParent).transform.position;
					Vector3 val3 = ((Component)componentInParent).transform.position - ((Component)this).transform.position;
					val2.m_dir = ((Vector3)(ref val3)).normalized;
					val2.m_pushForce = PushForce;
					val2.m_backstabBonus = 1f;
					componentInParent.Damage(val2);
				}
			}
		}
	}

	public class ErikSpawnerController : MonoBehaviour
	{
		public string ErikPrefabName = "ErikTheRed";

		public float SpawnRadius = 5f;

		public float TriggerDistance = 60f;

		public float CheckInterval = 500f;

		public int MaxAlive = 1;

		private float timer;

		private readonly List<Character> spawned = new List<Character>();

		private void Start()
		{
			timer = 2f;
		}

		private void Update()
		{
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			timer -= Time.deltaTime;
			if (timer > 0f)
			{
				return;
			}
			timer = CheckInterval;
			if ((Object)(object)ZNet.instance != (Object)null && !ZNet.instance.IsServer())
			{
				return;
			}
			CleanupDead();
			if (spawned.Count < MaxAlive)
			{
				Player closestPlayer = Player.GetClosestPlayer(((Component)this).transform.position, TriggerDistance);
				if (!((Object)(object)closestPlayer == (Object)null))
				{
					SpawnErik();
				}
			}
		}

		private void CleanupDead()
		{
			for (int num = spawned.Count - 1; num >= 0; num--)
			{
				if ((Object)(object)spawned[num] == (Object)null || spawned[num].IsDead())
				{
					spawned.RemoveAt(num);
				}
			}
		}

		private void SpawnErik()
		{
			//IL_0052: 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_0062: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ZNetScene.instance == (Object)null)
			{
				return;
			}
			GameObject prefab = ZNetScene.instance.GetPrefab(ErikPrefabName);
			if ((Object)(object)prefab == (Object)null)
			{
				Debug.LogWarning((object)("[Vanaheim] ErikSpawner could not find prefab: " + ErikPrefabName));
				return;
			}
			Vector2 val = Random.insideUnitCircle * SpawnRadius;
			Vector3 val2 = ((Component)this).transform.position + new Vector3(val.x, 0f, val.y);
			val2.y = ((Component)this).transform.position.y;
			GameObject val3 = Object.Instantiate<GameObject>(prefab, val2, Quaternion.identity);
			Character component = val3.GetComponent<Character>();
			if ((Object)(object)component != (Object)null)
			{
				spawned.Add(component);
			}
		}
	}

	private const string PluginGuid = "vanaheim.havstormr";

	private const string PluginName = "Vanaheim - Havstormr";

	private const string PluginVersion = "1.0.0";

	private void Awake()
	{
		PrefabManager.OnVanillaPrefabsAvailable += CreatePrefabs;
		ItemManager.OnItemsRegistered += FixJournalIcon;
	}

	private void CreatePrefabs()
	{
		CreateHavstormrTrophy();
		CreateStormpiercerBow();
		CreateErikJournal();
		CreateEnchantedBlackmetal();
		CreateHavstormrChains();
		CreateHavstormr();
		CreateStormDrake();
		CreateStormSerpent();
		CreateErikTheRed();
		CreateErikSpawner();
		CreatePortalStone();
		LoadDeadSerpentRock();
		PrefabManager.OnVanillaPrefabsAvailable -= CreatePrefabs;
	}

	private void LoadDeadSerpentRock()
	{
		string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
		string text = Path.Combine(directoryName, "deadserpentbundle");
		AssetBundle val = AssetBundle.LoadFromFile(text);
		if ((Object)(object)val == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("Failed to load deadserpentbundle at: " + text));
			return;
		}
		RegisterBundlePrefab(val, "DeadSerpent_Rock");
		RegisterBundlePrefab(val, "DeadSerpent_Rock2");
	}

	private void RegisterBundlePrefab(AssetBundle bundle, string prefabName)
	{
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Expected O, but got Unknown
		GameObject val = bundle.LoadAsset<GameObject>(prefabName);
		if ((Object)(object)val == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("Failed to load prefab named " + prefabName + " from deadserpentbundle."));
			return;
		}
		((Object)val).name = prefabName;
		StripMineRockComponents(val);
		CustomPrefab val2 = new CustomPrefab(val, true);
		PrefabManager.Instance.AddPrefab(val2);
	}

	private GameObject GetItemPrefabSafe(string prefabName)
	{
		GameObject val = null;
		if ((Object)(object)ObjectDB.instance != (Object)null)
		{
			val = ObjectDB.instance.GetItemPrefab(prefabName);
		}
		if ((Object)(object)val == (Object)null)
		{
			val = PrefabManager.Instance.GetPrefab(prefabName);
		}
		if ((Object)(object)val == (Object)null && (Object)(object)ZNetScene.instance != (Object)null)
		{
			val = ZNetScene.instance.GetPrefab(prefabName);
		}
		if ((Object)(object)val == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not find item prefab: " + prefabName));
		}
		return val;
	}

	private Transform FindDeepChild(Transform parent, string name)
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		foreach (Transform item in parent)
		{
			Transform val = item;
			if (((Object)val).name == name)
			{
				return val;
			}
			Transform val2 = FindDeepChild(val, name);
			if ((Object)(object)val2 != (Object)null)
			{
				return val2;
			}
		}
		return null;
	}

	private void StripMineRockComponents(GameObject prefab)
	{
		MineRock5[] componentsInChildren = prefab.GetComponentsInChildren<MineRock5>(true);
		foreach (MineRock5 val in componentsInChildren)
		{
			Object.DestroyImmediate((Object)(object)val);
		}
		MineRock[] componentsInChildren2 = prefab.GetComponentsInChildren<MineRock>(true);
		foreach (MineRock val2 in componentsInChildren2)
		{
			Object.DestroyImmediate((Object)(object)val2);
		}
		Destructible[] componentsInChildren3 = prefab.GetComponentsInChildren<Destructible>(true);
		foreach (Destructible val3 in componentsInChildren3)
		{
			Object.DestroyImmediate((Object)(object)val3);
		}
		WearNTear[] componentsInChildren4 = prefab.GetComponentsInChildren<WearNTear>(true);
		foreach (WearNTear val4 in componentsInChildren4)
		{
			Object.DestroyImmediate((Object)(object)val4);
		}
	}

	private void CreateErikTheRed()
	{
		//IL_001c: 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_0164: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = PrefabManager.Instance.CreateClonedPrefab("ErikTheRed", "Skeleton");
		val.transform.localScale = Vector3.one * 1.5f;
		Character component = val.GetComponent<Character>();
		if ((Object)(object)component != (Object)null)
		{
			component.m_name = "Erik the Red";
			component.m_health = 500f;
		}
		Humanoid component2 = val.GetComponent<Humanoid>();
		if ((Object)(object)component2 != (Object)null)
		{
			GameObject itemPrefabSafe = GetItemPrefabSafe("ArmorCaptainHelmetDO");
			if ((Object)(object)itemPrefabSafe != (Object)null)
			{
				AdjustErikHelmetPrefab(itemPrefabSafe);
			}
			GameObject itemPrefabSafe2 = GetItemPrefabSafe("skeleton_sword_hildir");
			if ((Object)(object)itemPrefabSafe2 != (Object)null)
			{
				TintErikSword(itemPrefabSafe2);
			}
			GameObject itemPrefabSafe3 = GetItemPrefabSafe("ArmorIronChest");
			List<GameObject> list = new List<GameObject>();
			if ((Object)(object)itemPrefabSafe2 != (Object)null)
			{
				list.Add(itemPrefabSafe2);
			}
			if ((Object)(object)itemPrefabSafe3 != (Object)null)
			{
				list.Add(itemPrefabSafe3);
			}
			component2.m_defaultItems = list.ToArray();
			component2.m_randomWeapon = (GameObject[])(object)new GameObject[0];
			component2.m_randomArmor = (GameObject[])(object)new GameObject[0];
			component2.m_randomShield = (GameObject[])(object)new GameObject[0];
		}
		else
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"ErikTheRed clone has no Humanoid component.");
		}
		TintObject(val, new Color(0.55f, 0.48f, 0.42f, 1f));
		AddErikHat(val);
		ConfigureErikDrops(val);
		PrefabManager.Instance.AddPrefab(val);
	}

	private void CreateHavstormr()
	{
		//IL_001c: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = PrefabManager.Instance.CreateClonedPrefab("Havstormr", "Dragon");
		val.transform.localScale = Vector3.one * 1.5f;
		Character component = val.GetComponent<Character>();
		if ((Object)(object)component != (Object)null)
		{
			component.m_name = "Havstormr, the Abyssal Tyrant";
			component.m_health = 10000f;
			component.m_defeatSetGlobalKey = null;
			component.m_bossEvent = "";
			ConfigureResistances(component);
		}
		ConfigureHavstormrAI(val);
		ConfigureHavstormrBreathDamage(val);
		ConfigureHavstormrLightningVisuals(val);
		TintObject(val, new Color(0.05f, 0.12f, 0.35f, 1f));
		ConfigureHavstormrDrops(val);
		HavstormrController havstormrController = val.AddComponent<HavstormrController>();
		havstormrController.StormEnvironment = "ThunderStorm";
		havstormrController.DrakeAddPrefab = "Havstormr_Drake";
		havstormrController.SerpentAddPrefab = "Havstormr_Serpent";
		PrefabManager.Instance.AddPrefab(val);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Created Havstormr prefab.");
	}

	private void ConfigureHavstormrLightningVisuals(GameObject boss)
	{
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0180: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
		Humanoid component = boss.GetComponent<Humanoid>();
		if ((Object)(object)component == (Object)null)
		{
			return;
		}
		GameObject prefab = PrefabManager.Instance.GetPrefab("fx_eikthyr_forwardshockwave");
		if ((Object)(object)prefab == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not find lightning FX prefab.");
			return;
		}
		GameObject[] defaultItems = component.m_defaultItems;
		foreach (GameObject val in defaultItems)
		{
			if ((Object)(object)val == (Object)null)
			{
				continue;
			}
			string text = ((Object)val).name.ToLower();
			if (!text.Contains("spit") && !text.Contains("cold") && !text.Contains("breath"))
			{
				continue;
			}
			ItemDrop component2 = val.GetComponent<ItemDrop>();
			if ((Object)(object)component2 == (Object)null)
			{
				continue;
			}
			SharedData shared = component2.m_itemData.m_shared;
			if (shared.m_attack != null && !((Object)(object)shared.m_attack.m_attackProjectile == (Object)null))
			{
				GameObject attackProjectile = shared.m_attack.m_attackProjectile;
				Projectile component3 = attackProjectile.GetComponent<Projectile>();
				TintObject(attackProjectile, new Color(0.15f, 0.55f, 1f, 1f));
				Light[] componentsInChildren = attackProjectile.GetComponentsInChildren<Light>(true);
				Light[] array = componentsInChildren;
				foreach (Light val2 in array)
				{
					val2.color = new Color(0.25f, 0.65f, 1f, 1f);
					val2.intensity = 3f;
				}
				ParticleSystem[] componentsInChildren2 = attackProjectile.GetComponentsInChildren<ParticleSystem>(true);
				ParticleSystem[] array2 = componentsInChildren2;
				foreach (ParticleSystem val3 in array2)
				{
					MainModule main = val3.main;
					((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.25f, 0.75f, 1f, 1f));
				}
				if (!((Object)(object)component3 == (Object)null))
				{
					component3.m_spawnOnHit = prefab;
				}
			}
		}
	}

	private void FixJournalIcon()
	{
		GameObject val = PrefabManager.Instance.GetPrefab("MWL_SkillBook_Run_bookTier1") ?? PrefabManager.Instance.GetPrefab("MWL_skillBook_Run_bookTier1");
		if ((Object)(object)val == (Object)null)
		{
			return;
		}
		ItemDrop component = val.GetComponent<ItemDrop>();
		object obj;
		if (component == null)
		{
			obj = null;
		}
		else
		{
			ItemData itemData = component.m_itemData;
			if (itemData == null)
			{
				obj = null;
			}
			else
			{
				SharedData shared = itemData.m_shared;
				if (shared == null)
				{
					obj = null;
				}
				else
				{
					Sprite[] icons = shared.m_icons;
					obj = ((icons != null) ? icons[0] : null);
				}
			}
		}
		Sprite val2 = (Sprite)obj;
		GameObject prefab = PrefabManager.Instance.GetPrefab("Journal_ErikTheRed");
		if ((Object)(object)prefab == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Journal_ErikTheRed prefab missing during icon patch.");
			return;
		}
		ItemDrop component2 = prefab.GetComponent<ItemDrop>();
		if ((Object)(object)component2 != (Object)null && (Object)(object)val2 != (Object)null)
		{
			component2.m_itemData.m_shared.m_icons = (Sprite[])(object)new Sprite[1] { val2 };
		}
	}

	private void ConfigureHavstormrAI(GameObject boss)
	{
		MonsterAI component = boss.GetComponent<MonsterAI>();
		if ((Object)(object)component == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Havstormr has no MonsterAI component.");
			return;
		}
		((BaseAI)component).m_deathMessage = "Havstormr falls. The storm begins to break.";
		((BaseAI)component).m_randomFly = true;
		((BaseAI)component).m_chanceToLand = 0f;
		((BaseAI)component).m_groundDuration = 0f;
		((BaseAI)component).m_airDuration = 9999f;
		((BaseAI)component).m_flyAltitudeMin = 10f;
		((BaseAI)component).m_flyAltitudeMax = 25f;
		((BaseAI)component).m_flyAbsMinAltitude = 10f;
		((BaseAI)component).m_maxLandAltitude = -1000f;
		((BaseAI)component).m_takeoffTime = 1f;
		((BaseAI)component).m_viewRange = 90f;
		((BaseAI)component).m_viewAngle = 160f;
		((BaseAI)component).m_hearRange = 9999f;
		component.m_maxChaseDistance = 120f;
		component.m_attackPlayerObjects = true;
		((BaseAI)component).m_randomMoveRange = 32f;
		component.m_circleTargetDistance = 25f;
		component.m_circleTargetInterval = 2f;
		Character component2 = boss.GetComponent<Character>();
		if ((Object)(object)component2 != (Object)null)
		{
			component2.m_flySlowSpeed = 8f;
			component2.m_flyFastSpeed = 18f;
			component2.m_flyTurnSpeed = 130f;
			component2.m_acceleration = 0.8f;
		}
	}

	private void ConfigureHavstormrBreathDamage(GameObject boss)
	{
		Humanoid component = boss.GetComponent<Humanoid>();
		if ((Object)(object)component == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Havstormr has no Humanoid component.");
			return;
		}
		GameObject[] defaultItems = component.m_defaultItems;
		foreach (GameObject val in defaultItems)
		{
			if ((Object)(object)val == (Object)null)
			{
				continue;
			}
			string text = ((Object)val).name.ToLower();
			if (!text.Contains("spit") && !text.Contains("cold") && !text.Contains("breath"))
			{
				continue;
			}
			ItemDrop component2 = val.GetComponent<ItemDrop>();
			if ((Object)(object)component2 == (Object)null)
			{
				continue;
			}
			SharedData shared = component2.m_itemData.m_shared;
			if (shared.m_attack == null || (Object)(object)shared.m_attack.m_attackProjectile == (Object)null)
			{
				continue;
			}
			shared.m_attack.m_projectiles = 4;
			shared.m_attack.m_projectileBursts = 1;
			GameObject attackProjectile = shared.m_attack.m_attackProjectile;
			Projectile component3 = attackProjectile.GetComponent<Projectile>();
			if ((Object)(object)component3 == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Breath projectile has no Projectile component: " + ((Object)attackProjectile).name));
				continue;
			}
			HavstormrLightningImpactAoE havstormrLightningImpactAoE = attackProjectile.GetComponent<HavstormrLightningImpactAoE>();
			if ((Object)(object)havstormrLightningImpactAoE == (Object)null)
			{
				havstormrLightningImpactAoE = attackProjectile.AddComponent<HavstormrLightningImpactAoE>();
			}
			GameObject prefab = PrefabManager.Instance.GetPrefab("fx_eikthyr_forwardshockwave");
			havstormrLightningImpactAoE.ImpactFx = prefab;
			havstormrLightningImpactAoE.Radius = 4f;
			havstormrLightningImpactAoE.LightningDamage = 8f;
			havstormrLightningImpactAoE.BluntDamage = 4f;
			havstormrLightningImpactAoE.PushForce = 12f;
			component3.m_damage.m_lightning = 65f;
			component3.m_damage.m_frost = 0f;
		}
	}

	private void CreateStormDrake()
	{
		//IL_001c: 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_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = PrefabManager.Instance.CreateClonedPrefab("Havstormr_Drake", "Hatchling");
		val.transform.localScale = Vector3.one * 1.1f;
		Character component = val.GetComponent<Character>();
		if ((Object)(object)component != (Object)null)
		{
			component.m_name = "Storm Drake";
			component.m_health = 325f;
			component.m_faction = (Faction)8;
		}
		TintObject(val, new Color(0.1f, 0.25f, 0.65f, 1f));
		PrefabManager.Instance.AddPrefab(val);
	}

	private void CreateStormSerpent()
	{
		//IL_001c: 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_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = PrefabManager.Instance.CreateClonedPrefab("Havstormr_Serpent", "Serpent");
		val.transform.localScale = Vector3.one * 0.8f;
		Character component = val.GetComponent<Character>();
		if ((Object)(object)component != (Object)null)
		{
			component.m_name = "Abyssal Serpent";
			component.m_health = 650f;
			component.m_faction = (Faction)8;
		}
		TintObject(val, new Color(0.02f, 0.08f, 0.22f, 1f));
		PrefabManager.Instance.AddPrefab(val);
	}

	private void CreatePortalStone()
	{
		//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_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		ItemConfig val = new ItemConfig
		{
			Name = "Portal Stone",
			Description = "A charged stone humming with portal magic."
		};
		CustomItem val2 = new CustomItem("PortalStone", "Thunderstone", val);
		ItemManager.Instance.AddItem(val2);
	}

	private void CreateEnchantedBlackmetal()
	{
		//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_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		ItemConfig val = new ItemConfig
		{
			Name = "Enchanted Blackmetal",
			Description = "A dark alloy humming with stormbound power."
		};
		CustomItem val2 = new CustomItem("EnchantedBlackmetal", "BlackMetalScrap", val);
		TintObject(val2.ItemPrefab, new Color(0.3f, 0.3f, 0.6f, 1f));
		ItemManager.Instance.AddItem(val2);
	}

	private void CreateHavstormrChains()
	{
		//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_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Expected O, but got Unknown
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Expected O, but got Unknown
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Expected O, but got Unknown
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Expected O, but got Unknown
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Expected O, but got Unknown
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Expected O, but got Unknown
		ItemConfig val = new ItemConfig
		{
			Name = "Havstormr's Chains",
			Description = "Forged to bind the storm itself. The metal hums with restrained lightning, as if something within struggles to break free."
		};
		CustomItem val2 = new CustomItem("HavstormrChains", "Chain", val);
		ItemManager.Instance.AddItem(val2);
		RecipeConfig val3 = new RecipeConfig();
		val3.Name = "Recipe_HavstormrChains";
		val3.Item = "HavstormrChains";
		val3.Amount = 1;
		val3.CraftingStation = "forge";
		val3.MinStationLevel = 1;
		val3.Requirements = (RequirementConfig[])(object)new RequirementConfig[4]
		{
			new RequirementConfig("EnchantedBlackmetal", 1, 0, true),
			new RequirementConfig("Chain", 3, 0, true),
			new RequirementConfig("Iron", 25, 0, true),
			new RequirementConfig("Silver", 25, 0, true)
		};
		RecipeConfig val4 = val3;
		CustomRecipe val5 = new CustomRecipe(val4);
		ItemManager.Instance.AddRecipe(val5);
	}

	private void CreateErikJournal()
	{
		//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_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		ItemConfig val = new ItemConfig
		{
			Name = "Journal of Erik the Red",
			Description = "You see numerous references to a great storm and beast. Erik was obsessed with taking its power and treasure for himself. You see a map with a set of coordinates."
		};
		CustomItem val2 = new CustomItem("Journal_ErikTheRed", "TrophyNeck", val);
		GameObject val3 = GetItemPrefabSafe("MWL_SkillBook_Run_bookTier1") ?? GetItemPrefabSafe("MWL_skillBook_Run_bookTier1");
		if ((Object)(object)val3 != (Object)null)
		{
			ItemDrop component = val3.GetComponent<ItemDrop>();
			ItemDrop component2 = val2.ItemPrefab.GetComponent<ItemDrop>();
			if ((Object)(object)component != (Object)null && (Object)(object)component2 != (Object)null)
			{
				component2.m_itemData.m_shared.m_icons = component.m_itemData.m_shared.m_icons;
			}
		}
		ItemManager.Instance.AddItem(val2);
	}

	private void CreateHavstormrTrophy()
	{
		//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_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		ItemConfig val = new ItemConfig
		{
			Name = "Havstormr Trophy",
			Description = "A storm-darkened trophy torn from Havstormr, the Abyssal Tyrant."
		};
		CustomItem val2 = new CustomItem("Havstormr_Trophy", "TrophyDragonQueen", val);
		TintObject(val2.ItemPrefab, new Color(0.05f, 0.12f, 0.35f, 1f));
		ItemManager.Instance.AddItem(val2);
	}

	private void CreateStormpiercerBow()
	{
		//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_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		ItemConfig val = new ItemConfig
		{
			Name = "Stormpiercer",
			Description = "A bow carved from stormbone and abyssal scale. Its arrows crackle with thunder and freezing sea-wind."
		};
		CustomItem val2 = new CustomItem("Havstormr_Bow", "BowDraugrFang", val);
		ItemDrop component = val2.ItemPrefab.GetComponent<ItemDrop>();
		if ((Object)(object)component != (Object)null)
		{
			component.m_itemData.m_shared.m_name = "Stormpiercer";
			component.m_itemData.m_shared.m_description = "A bow carved from stormbone and abyssal scale. Its arrows crackle with thunder and freezing sea-wind.";
			component.m_itemData.m_shared.m_damages.m_pierce = 85f;
			component.m_itemData.m_shared.m_damages.m_frost = 12f;
			component.m_itemData.m_shared.m_damages.m_lightning = 18f;
			component.m_itemData.m_shared.m_damages.m_poison = 0f;
			component.m_itemData.m_shared.m_damages.m_spirit = 0f;
			component.m_itemData.m_shared.m_attackForce = 25f;
			component.m_itemData.m_shared.m_maxDurability = 250f;
			component.m_itemData.m_shared.m_useDurabilityDrain = 1f;
			component.m_itemData.m_shared.m_movementModifier = -0.05f;
		}
		TintStormpiercer(val2.ItemPrefab);
		ItemManager.Instance.AddItem(val2);
	}

	private void ConfigureResistances(Character character)
	{
		//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_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		DamageModifiers damageModifiers = character.m_damageModifiers;
		damageModifiers.m_frost = (DamageModifier)3;
		damageModifiers.m_lightning = (DamageModifier)3;
		damageModifiers.m_pierce = (DamageModifier)2;
		character.m_damageModifiers = damageModifiers;
	}

	private void ConfigureErikDrops(GameObject erik)
	{
		CharacterDrop val = erik.GetComponent<CharacterDrop>();
		if ((Object)(object)val == (Object)null)
		{
			val = erik.AddComponent<CharacterDrop>();
		}
		val.m_drops.Clear();
		AddDrop(val, "Journal_ErikTheRed", 1, 1, 1f);
	}

	private void ConfigureHavstormrDrops(GameObject boss)
	{
		CharacterDrop val = boss.GetComponent<CharacterDrop>();
		if ((Object)(object)val == (Object)null)
		{
			val = boss.AddComponent<CharacterDrop>();
		}
		val.m_drops.Clear();
		AddDrop(val, "Havstormr_Trophy", 1, 1, 1f);
		AddDrop(val, "SerpentScale", 8, 16, 1f);
		AddDrop(val, "Coins", 100, 250, 1f);
	}

	private void AddDrop(CharacterDrop drops, string prefabName, int min, int max, float chance)
	{
		//IL_0038: 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_0044: 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_0053: 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_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Expected O, but got Unknown
		GameObject prefab = PrefabManager.Instance.GetPrefab(prefabName);
		if ((Object)(object)prefab == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)("Drop prefab not found: " + prefabName));
			return;
		}
		drops.m_drops.Add(new Drop
		{
			m_prefab = prefab,
			m_amountMin = min,
			m_amountMax = max,
			m_chance = chance,
			m_levelMultiplier = false,
			m_onePerPlayer = false
		});
	}

	private void CreateErikSpawner()
	{
		GameObject val = PrefabManager.Instance.CreateClonedPrefab("Spawner_ErikTheRed", "Spawner_Ghost");
		SpawnArea[] componentsInChildren = val.GetComponentsInChildren<SpawnArea>(true);
		foreach (SpawnArea val2 in componentsInChildren)
		{
			Object.DestroyImmediate((Object)(object)val2);
		}
		CreatureSpawner[] componentsInChildren2 = val.GetComponentsInChildren<CreatureSpawner>(true);
		foreach (CreatureSpawner val3 in componentsInChildren2)
		{
			Object.DestroyImmediate((Object)(object)val3);
		}
		ErikSpawnerController erikSpawnerController = val.GetComponent<ErikSpawnerController>();
		if ((Object)(object)erikSpawnerController == (Object)null)
		{
			erikSpawnerController = val.AddComponent<ErikSpawnerController>();
		}
		erikSpawnerController.ErikPrefabName = "ErikTheRed";
		erikSpawnerController.SpawnRadius = 5f;
		erikSpawnerController.TriggerDistance = 60f;
		erikSpawnerController.CheckInterval = 500f;
		erikSpawnerController.MaxAlive = 1;
		PrefabManager.Instance.AddPrefab(val);
	}

	private void AddErikHat(GameObject erik)
	{
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
		GameObject itemPrefabSafe = GetItemPrefabSafe("ArmorCaptainHelmetDO");
		if ((Object)(object)itemPrefabSafe == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"ArmorCaptainHelmetDO not found for Erik visual hat.");
			return;
		}
		Transform val = FindDeepChild(erik.transform, "Head");
		if ((Object)(object)val == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Erik head bone not found for visual hat.");
			return;
		}
		GameObject val2 = Object.Instantiate<GameObject>(itemPrefabSafe, val, false);
		((Object)val2).name = "ErikTheRed_VisualHat";
		Collider[] componentsInChildren = val2.GetComponentsInChildren<Collider>(true);
		foreach (Collider val3 in componentsInChildren)
		{
			Object.DestroyImmediate((Object)(object)val3);
		}
		Rigidbody[] componentsInChildren2 = val2.GetComponentsInChildren<Rigidbody>(true);
		foreach (Rigidbody val4 in componentsInChildren2)
		{
			Object.DestroyImmediate((Object)(object)val4);
		}
		ZSyncTransform[] componentsInChildren3 = val2.GetComponentsInChildren<ZSyncTransform>(true);
		foreach (ZSyncTransform val5 in componentsInChildren3)
		{
			Object.DestroyImmediate((Object)(object)val5);
		}
		ZNetView[] componentsInChildren4 = val2.GetComponentsInChildren<ZNetView>(true);
		foreach (ZNetView val6 in componentsInChildren4)
		{
			Object.DestroyImmediate((Object)(object)val6);
		}
		ItemDrop[] componentsInChildren5 = val2.GetComponentsInChildren<ItemDrop>(true);
		foreach (ItemDrop val7 in componentsInChildren5)
		{
			Object.DestroyImmediate((Object)(object)val7);
		}
		val2.transform.localPosition = new Vector3(0.001f, 0.0021f, -0.0004f);
		val2.transform.localRotation = Quaternion.Euler(350f, 295.3f, 345f);
		val2.transform.localScale = Vector3.one * 0.013f;
	}

	private void TintErikSword(GameObject sword)
	{
		//IL_026e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0273: Unknown result type (might be due to invalid IL or missing references)
		//IL_028b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0290: Unknown result type (might be due to invalid IL or missing references)
		//IL_029d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b4: Expected O, but got Unknown
		//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02dc: 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)
		//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0301: Unknown result type (might be due to invalid IL or missing references)
		//IL_0317: Unknown result type (might be due to invalid IL or missing references)
		//IL_0321: Unknown result type (might be due to invalid IL or missing references)
		//IL_0326: Unknown result type (might be due to invalid IL or missing references)
		//IL_033d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0342: Unknown result type (might be due to invalid IL or missing references)
		//IL_0353: Unknown result type (might be due to invalid IL or missing references)
		//IL_0358: Unknown result type (might be due to invalid IL or missing references)
		//IL_0369: Unknown result type (might be due to invalid IL or missing references)
		//IL_036e: Unknown result type (might be due to invalid IL or missing references)
		//IL_037d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0413: Unknown result type (might be due to invalid IL or missing references)
		//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c3: Expected O, but got Unknown
		//IL_04dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0501: Unknown result type (might be due to invalid IL or missing references)
		//IL_050b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0510: Unknown result type (might be due to invalid IL or missing references)
		//IL_0526: Unknown result type (might be due to invalid IL or missing references)
		//IL_0530: Unknown result type (might be due to invalid IL or missing references)
		//IL_0535: Unknown result type (might be due to invalid IL or missing references)
		//IL_054c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0551: Unknown result type (might be due to invalid IL or missing references)
		//IL_0562: Unknown result type (might be due to invalid IL or missing references)
		//IL_0567: Unknown result type (might be due to invalid IL or missing references)
		//IL_0578: Unknown result type (might be due to invalid IL or missing references)
		//IL_057d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_044d: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_0482: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d5: Unknown result type (might be due to invalid IL or missing references)
		Renderer[] componentsInChildren = sword.GetComponentsInChildren<Renderer>(true);
		Renderer[] array = componentsInChildren;
		foreach (Renderer val in array)
		{
			string text = ((Object)((Component)val).gameObject).name.ToLower();
			bool flag = text.Contains("fx") || text.Contains("vfx") || text.Contains("eff") || text.Contains("particle") || text.Contains("trail") || text.Contains("flame") || text.Contains("fire") || text.Contains("glow");
			Material[] materials = val.materials;
			foreach (Material val2 in materials)
			{
				if (!flag)
				{
					if (val2.HasProperty("_EmissionColor"))
					{
						val2.DisableKeyword("_EMISSION");
						val2.SetColor("_EmissionColor", Color.black);
					}
					if (val2.HasProperty("_Color"))
					{
						val2.color = new Color(0.72f, 0.74f, 0.76f, 1f);
					}
					if (val2.HasProperty("_TintColor"))
					{
						val2.SetColor("_TintColor", new Color(0.72f, 0.74f, 0.76f, 1f));
					}
				}
				else
				{
					if (val2.HasProperty("_EmissionColor"))
					{
						val2.EnableKeyword("_EMISSION");
						val2.SetColor("_EmissionColor", new Color(0.1f, 0.65f, 2f, 1f));
					}
					if (val2.HasProperty("_TintColor"))
					{
						val2.SetColor("_TintColor", new Color(0.15f, 0.65f, 1.6f, 1f));
					}
					if (val2.HasProperty("_Color"))
					{
						val2.color = new Color(0.2f, 0.7f, 1.4f, 1f);
					}
				}
			}
		}
		ParticleSystem[] componentsInChildren2 = sword.GetComponentsInChildren<ParticleSystem>(true);
		ParticleSystem[] array2 = componentsInChildren2;
		foreach (ParticleSystem val3 in array2)
		{
			MainModule main = val3.main;
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.25f, 0.75f, 1.8f, 1f));
			ColorOverLifetimeModule colorOverLifetime = val3.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			Gradient val4 = new Gradient();
			val4.SetKeys((GradientColorKey[])(object)new GradientColorKey[3]
			{
				new GradientColorKey(new Color(0.15f, 0.55f, 2f), 0f),
				new GradientColorKey(new Color(0.55f, 0.9f, 2.2f), 0.45f),
				new GradientColorKey(new Color(0.05f, 0.25f, 1.2f), 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[3]
			{
				new GradientAlphaKey(1f, 0f),
				new GradientAlphaKey(0.85f, 0.45f),
				new GradientAlphaKey(0f, 1f)
			});
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val4);
		}
		ParticleSystemRenderer[] componentsInChildren3 = sword.GetComponentsInChildren<ParticleSystemRenderer>(true);
		ParticleSystemRenderer[] array3 = componentsInChildren3;
		foreach (ParticleSystemRenderer val5 in array3)
		{
			if (!((Object)(object)((Renderer)val5).material == (Object)null))
			{
				Material material = ((Renderer)val5).material;
				if (material.HasProperty("_EmissionColor"))
				{
					material.EnableKeyword("_EMISSION");
					material.SetColor("_EmissionColor", new Color(0.1f, 0.65f, 2f, 1f));
				}
				if (material.HasProperty("_TintColor"))
				{
					material.SetColor("_TintColor", new Color(0.15f, 0.65f, 1.6f, 1f));
				}
				if (material.HasProperty("_Color"))
				{
					material.color = new Color(0.2f, 0.7f, 1.4f, 1f);
				}
			}
		}
		TrailRenderer[] componentsInChildren4 = sword.GetComponentsInChildren<TrailRenderer>(true);
		TrailRenderer[] array4 = componentsInChildren4;
		foreach (TrailRenderer val6 in array4)
		{
			Gradient val7 = new Gradient();
			val7.SetKeys((GradientColorKey[])(object)new GradientColorKey[3]
			{
				new GradientColorKey(new Color(0.15f, 0.55f, 2f), 0f),
				new GradientColorKey(new Color(0.6f, 0.9f, 2.2f), 0.5f),
				new GradientColorKey(new Color(0.05f, 0.25f, 1.2f), 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[3]
			{
				new GradientAlphaKey(1f, 0f),
				new GradientAlphaKey(0.8f, 0.5f),
				new GradientAlphaKey(0f, 1f)
			});
			val6.colorGradient = val7;
		}
		Light[] componentsInChildren5 = sword.GetComponentsInChildren<Light>(true);
		Light[] array5 = componentsInChildren5;
		foreach (Light val8 in array5)
		{
			val8.color = new Color(0.25f, 0.65f, 1f, 1f);
			val8.intensity = 3f;
			val8.range = Mathf.Max(val8.range, 4f);
		}
	}

	private void AdjustErikHelmetPrefab(GameObject helmet)
	{
		//IL_0016: 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)
		//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)
		helmet.transform.localPosition = new Vector3(0f, 0.45f, 0.02f);
		helmet.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
		helmet.transform.localScale = Vector3.one * 1.05f;
	}

	private void TintObject(GameObject obj, Color tint)
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		Renderer[] componentsInChildren = obj.GetComponentsInChildren<Renderer>(true);
		Renderer[] array = componentsInChildren;
		foreach (Renderer val in array)
		{
			Material[] materials = val.materials;
			foreach (Material val2 in materials)
			{
				val2.color = tint;
			}
		}
	}

	private void TintStormpiercer(GameObject bow)
	{
		//IL_0168: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c2: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
		Renderer[] componentsInChildren = bow.GetComponentsInChildren<Renderer>(true);
		Renderer[] array = componentsInChildren;
		foreach (Renderer val in array)
		{
			Material[] materials = val.materials;
			foreach (Material val2 in materials)
			{
				if (val2.HasProperty("_Color"))
				{
					val2.color = new Color(0.08f, 0.12f, 0.2f, 1f);
				}
				if (val2.HasProperty("_EmissionColor"))
				{
					val2.EnableKeyword("_EMISSION");
					val2.SetColor("_EmissionColor", new Color(0.01f, 0.04f, 0.1f, 1f));
				}
				if (val2.HasProperty("_TintColor"))
				{
					val2.SetColor("_TintColor", new Color(0.08f, 0.18f, 0.3f, 1f));
				}
			}
		}
		Light[] componentsInChildren2 = bow.GetComponentsInChildren<Light>(true);
		Light[] array2 = componentsInChildren2;
		foreach (Light val3 in array2)
		{
			val3.intensity *= 0.25f;
			val3.range *= 0.5f;
			val3.color = new Color(0.25f, 0.45f, 0.65f, 1f);
		}
		ParticleSystem[] componentsInChildren3 = bow.GetComponentsInChildren<ParticleSystem>(true);
		ParticleSystem[] array3 = componentsInChildren3;
		foreach (ParticleSystem val4 in array3)
		{
			MainModule main = val4.main;
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.15f, 0.35f, 0.65f, 0.45f));
			((MainModule)(ref main)).startSizeMultiplier = ((MainModule)(ref main)).startSizeMultiplier * 0.65f;
			((MainModule)(ref main)).startLifetimeMultiplier = ((MainModule)(ref main)).startLifetimeMultiplier * 0.75f;
			EmissionModule emission = val4.emission;
			((EmissionModule)(ref emission)).rateOverTimeMultiplier = ((EmissionModule)(ref emission)).rateOverTimeMultiplier * 0.35f;
		}
		TrailRenderer[] componentsInChildren4 = bow.GetComponentsInChildren<TrailRenderer>(true);
		TrailRenderer[] array4 = componentsInChildren4;
		foreach (TrailRenderer val5 in array4)
		{
			val5.time *= 0.5f;
			val5.widthMultiplier *= 0.5f;
		}
	}
}