Decompiled source of Vanaheim v2.1.2

Vanaheim.dll

Decompiled 2 weeks 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.IgnoreSymbolStoreSequencePoints)]
[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("2.1.2.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("2.1.2.0")]
namespace Vanaheim;

public class Class1
{
}
internal class Class2
{
}
[BepInPlugin("vanaheim.havstormr", "Vanaheim - Havstormr", "2.1.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class VanaheimPlugin : BaseUnityPlugin
{
	public class MoldrikrController : MonoBehaviour
	{
		private const string BlackTickPrefabName = "Vanaheim_BlackBrood";

		private const string ChannelEffectPrefab = "fx_leviathanLava_leave";

		private const string SlamImpactEffectPrefab = "fx_seekerbrute_death";

		private const string PoisonCloudPrefab = "vfx_blob_attack";

		private const float FirstBreakHp = 0.9f;

		private const float SecondBreakHp = 0.45f;

		private const float VulnerableDuration = 20f;

		private const float FinalPulseInterval = 7f;

		private const float FinalPulseRange = 25f;

		private const float FinalPoisonDamage = 180f;

		private const int FirstBreakTickCount = 3;

		private const int SecondBreakTickCount = 4;

		private const float PhaseOneSpeedMultiplier = 0.85f;

		private const float PhaseOneDamageMultiplier = 1f;

		private const float PhaseTwoSpeedMultiplier = 1.25f;

		private const float PhaseTwoDamageMultiplier = 1.5f;

		private const float PhaseThreeSpeedMultiplier = 1.45f;

		private const float PhaseThreeDamageMultiplier = 2f;

		private Character _character;

		private MonsterAI _ai;

		private ZNetView _zNetView;

		private Rigidbody _body;

		private Animator _animator;

		private bool _firstBreakTriggered;

		private bool _secondBreakTriggered;

		private bool _isChanneling;

		private float _channelEndTime;

		private float _nextTickSummonTime;

		private float _nextFinalPoisonPulseTime;

		private bool _groundSlamEffectQueued;

		private float _groundSlamEffectTime;

		private bool _groundSlamEffectFired;

		private bool _finalPhaseStarted;

		private bool _deathAnnouncementSent;

		private float _baseSpeed;

		private float _baseRunSpeed;

		private readonly List<Attack> _attacks = new List<Attack>();

		private readonly Dictionary<Attack, float> _baseAttackMultipliers = new Dictionary<Attack, float>();

		private void Awake()
		{
			_character = ((Component)this).GetComponent<Character>();
			_ai = ((Component)this).GetComponent<MonsterAI>();
			_zNetView = ((Component)this).GetComponent<ZNetView>();
			_body = ((Component)this).GetComponent<Rigidbody>();
			_animator = ((Component)this).GetComponentInChildren<Animator>();
		}

		private void Start()
		{
			if ((Object)(object)_character != (Object)null)
			{
				_baseSpeed = _character.m_speed;
				_baseRunSpeed = _character.m_runSpeed;
			}
			_attacks.Clear();
			_baseAttackMultipliers.Clear();
			Attack[] componentsInChildren = ((Component)this).GetComponentsInChildren<Attack>(true);
			foreach (Attack val in componentsInChildren)
			{
				if (val != null)
				{
					_attacks.Add(val);
					_baseAttackMultipliers[val] = val.m_damageMultiplier;
				}
			}
			_nextFinalPoisonPulseTime = Time.time + 10f;
			ApplyPhaseBuffs(0.85f, 1f);
			ApplyVeryResistantPhase();
			Announce("The earth trembles as Moldrikr, the Black Carapace, emerges!");
		}

		private void Update()
		{
			if ((Object)(object)_character == (Object)null || (Object)(object)_zNetView == (Object)null || !_zNetView.IsValid() || !_zNetView.IsOwner())
			{
				return;
			}
			if (_character.IsDead())
			{
				if (!_deathAnnouncementSent)
				{
					_deathAnnouncementSent = true;
					Announce("Moldrikr's shell shatters, and the brood scatters into the darkness.");
				}
				return;
			}
			float healthPercentage = _character.GetHealthPercentage();
			if (!_firstBreakTriggered && healthPercentage <= 0.9f)
			{
				_firstBreakTriggered = true;
				StartChannel(1);
			}
			else if (!_secondBreakTriggered && healthPercentage <= 0.45f)
			{
				_secondBreakTriggered = true;
				StartChannel(2);
			}
			else if (_isChanneling)
			{
				UpdateChannel();
			}
			else
			{
				UpdateGroundSlamDetection();
				UpdateFinalPoisonPulse();
			}
		}

		private void ApplyPhaseBuffs(float speedMultiplier, float damageMultiplier)
		{
			if ((Object)(object)_character != (Object)null)
			{
				_character.m_speed = _baseSpeed * speedMultiplier;
				_character.m_runSpeed = _baseRunSpeed * speedMultiplier;
			}
			foreach (Attack attack in _attacks)
			{
				if (attack != null && _baseAttackMultipliers.TryGetValue(attack, out var value))
				{
					attack.m_damageMultiplier = value * damageMultiplier;
				}
			}
		}

		private void StartChannel(int breakNumber)
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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)
			if (breakNumber == 1)
			{
				Announce("The Black Carapace cracks open, spilling forth its brood! He is exposed!");
			}
			else
			{
				Announce("Moldrikr can no longer contain the corruption within!");
			}
			_isChanneling = true;
			_channelEndTime = Time.time + 20f;
			_nextTickSummonTime = Time.time + 2f;
			if ((Object)(object)_ai != (Object)null)
			{
				((Behaviour)_ai).enabled = false;
			}
			if ((Object)(object)_body != (Object)null)
			{
				_body.velocity = Vector3.zero;
			}
			ApplyWeakPhase();
			if ((Object)(object)_character != (Object)null)
			{
				_character.Stagger(Vector3.zero);
			}
			if ((Object)(object)_body != (Object)null)
			{
				_body.velocity = Vector3.zero;
				_body.angularVelocity = Vector3.zero;
			}
			SpawnEffect("fx_leviathanLava_leave", ((Component)this).transform.position, Quaternion.identity, 2.5f);
			SpawnEffect("fx_leviathanLava_leave", ((Component)this).transform.position, Quaternion.Euler(0f, 90f, 0f), 2.2f);
		}

		private void UpdateChannel()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_body != (Object)null)
			{
				_body.velocity = Vector3.zero;
				_body.angularVelocity = Vector3.zero;
			}
			if (Time.time >= _nextTickSummonTime)
			{
				_nextTickSummonTime = Time.time + 4f;
				if (_secondBreakTriggered)
				{
					SummonTicks(4);
				}
				else
				{
					SummonTicks(3);
				}
			}
			if (Time.time >= _channelEndTime)
			{
				EndChannel();
			}
		}

		private void EndChannel()
		{
			_isChanneling = false;
			if ((Object)(object)_ai != (Object)null)
			{
				((Behaviour)_ai).enabled = true;
			}
			if (_character.GetHealthPercentage() > 0.45f)
			{
				Announce("Moldrikr's cracked shell hardens once more!");
				ApplyPhaseBuffs(1.25f, 1.5f);
				ApplyResistantPhase();
			}
			else
			{
				Announce("Moldrikr's shell is shattered! Toxic Fumes emanate from his broken carapace!");
				_finalPhaseStarted = true;
				_nextFinalPoisonPulseTime = Time.time + 3f;
				ApplyPhaseBuffs(1.45f, 2f);
				ApplyNormalPhase();
			}
		}

		private void SummonTicks(int count)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			GameObject prefab = ZNetScene.instance.GetPrefab("Vanaheim_BlackBrood");
			if ((Object)(object)prefab == (Object)null)
			{
				Debug.LogWarning((object)"[Moldrikr] Black tick prefab not found.");
				return;
			}
			for (int i = 0; i < count; i++)
			{
				Vector2 insideUnitCircle = Random.insideUnitCircle;
				Vector2 val = ((Vector2)(ref insideUnitCircle)).normalized * Random.Range(5f, 12f);
				Vector3 val2 = ((Component)this).transform.position + new Vector3(val.x, 1f, val.y);
				Object.Instantiate<GameObject>(prefab, val2, Quaternion.identity);
			}
		}

		private void UpdateGroundSlamDetection()
		{
			//IL_0016: 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)
			if ((Object)(object)_animator == (Object)null)
			{
				return;
			}
			AnimatorStateInfo currentAnimatorStateInfo = _animator.GetCurrentAnimatorStateInfo(0);
			int num;
			if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("SeekerBrute_groundslam") && !((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Base Layer.SeekerBrute_groundslam"))
			{
				num = ((((AnimatorStateInfo)(ref currentAnimatorStateInfo)).shortNameHash == Animator.StringToHash("SeekerBrute_groundslam")) ? 1 : 0);
				if (num == 0)
				{
					goto IL_0079;
				}
			}
			else
			{
				num = 1;
			}
			if (!_groundSlamEffectQueued && !_groundSlamEffectFired)
			{
				_groundSlamEffectQueued = true;
				_groundSlamEffectTime = Time.time + 0.9f;
			}
			goto IL_0079;
			IL_0079:
			if (_groundSlamEffectQueued && !_groundSlamEffectFired && Time.time >= _groundSlamEffectTime)
			{
				_groundSlamEffectQueued = false;
				_groundSlamEffectFired = true;
				DoPoisonSlamEffect();
			}
			if (num == 0)
			{
				_groundSlamEffectQueued = false;
				_groundSlamEffectFired = false;
			}
		}

		private void UpdateFinalPoisonPulse()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			if (!_finalPhaseStarted || Time.time < _nextFinalPoisonPulseTime)
			{
				return;
			}
			_nextFinalPoisonPulseTime = Time.time + 7f;
			SpawnEffect("vfx_blob_attack", ((Component)this).transform.position, Quaternion.identity, 3f);
			foreach (Player allPlayer in Player.GetAllPlayers())
			{
				if (!((Object)(object)allPlayer == (Object)null) && !(Vector3.Distance(((Component)this).transform.position, ((Component)allPlayer).transform.position) > 25f))
				{
					HitData val = new HitData
					{
						m_point = ((Component)allPlayer).transform.position
					};
					Vector3 val2 = ((Component)allPlayer).transform.position - ((Component)this).transform.position;
					val.m_dir = ((Vector3)(ref val2)).normalized;
					val.m_pushForce = 0f;
					HitData val3 = val;
					val3.m_damage.m_poison = 180f;
					((Character)allPlayer).Damage(val3);
				}
			}
		}

		private void DoPoisonSlamEffect()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			SpawnEffect("fx_seekerbrute_death", ((Component)this).transform.position, Quaternion.identity, 2f);
		}

		private void Announce(string message)
		{
			if ((Object)(object)MessageHud.instance != (Object)null)
			{
				MessageHud.instance.ShowMessage((MessageType)2, message, 0, (Sprite)null, false);
			}
		}

		private void TintEffectGreen(GameObject effect)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)effect == (Object)null)
			{
				return;
			}
			Color val = default(Color);
			((Color)(ref val))..ctor(0.02f, 0.55f, 0.08f, 1f);
			ParticleSystem[] componentsInChildren = effect.GetComponentsInChildren<ParticleSystem>(true);
			foreach (ParticleSystem obj in componentsInChildren)
			{
				MainModule main = obj.main;
				((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(val);
				ColorOverLifetimeModule colorOverLifetime = obj.colorOverLifetime;
				if (((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled)
				{
					((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val);
				}
			}
			Renderer[] componentsInChildren2 = effect.GetComponentsInChildren<Renderer>(true);
			for (int i = 0; i < componentsInChildren2.Length; i++)
			{
				Material[] materials = componentsInChildren2[i].materials;
				foreach (Material val2 in materials)
				{
					if (!((Object)(object)val2 == (Object)null))
					{
						if (val2.HasProperty("_Color"))
						{
							val2.color = val;
						}
						if (val2.HasProperty("_EmissionColor"))
						{
							val2.SetColor("_EmissionColor", val);
						}
					}
				}
			}
		}

		private void SpawnEffect(string prefabName, Vector3 position, Quaternion rotation, float scale)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ZNetScene.instance == (Object)null)
			{
				return;
			}
			GameObject prefab = ZNetScene.instance.GetPrefab(prefabName);
			if ((Object)(object)prefab == (Object)null)
			{
				Debug.LogWarning((object)("[Moldrikr] Effect prefab not found: " + prefabName));
				return;
			}
			GameObject val = Object.Instantiate<GameObject>(prefab, position, rotation);
			val.transform.localScale = Vector3.one * scale;
			if (prefabName == "fx_leviathanLava_leave")
			{
				TintEffectGreen(val);
			}
		}

		private void ApplyVeryResistantPhase()
		{
			SetAllDamageModifiers(_character, (DamageModifier)5);
		}

		private void ApplyResistantPhase()
		{
			SetAllDamageModifiers(_character, (DamageModifier)1);
		}

		private void ApplyWeakPhase()
		{
			SetAllDamageModifiers(_character, (DamageModifier)2);
		}

		private void ApplyNormalPhase()
		{
			SetAllDamageModifiers(_character, (DamageModifier)0);
		}
	}

	public class TimedSummon : MonoBehaviour
	{
		private const float LifeTime = 60f;

		private const int MaxActiveSummons = 3;

		private static readonly List<TimedSummon> ActiveSummons = new List<TimedSummon>();

		private ZNetView _zNetView;

		private float _despawnTime;

		private void Awake()
		{
			_zNetView = ((Component)this).GetComponent<ZNetView>();
			_despawnTime = Time.time + 60f;
			ActiveSummons.RemoveAll((TimedSummon s) => (Object)(object)s == (Object)null);
			ActiveSummons.Add(this);
			while (ActiveSummons.Count > 3)
			{
				TimedSummon timedSummon = ActiveSummons[0];
				ActiveSummons.RemoveAt(0);
				if ((Object)(object)timedSummon != (Object)null)
				{
					timedSummon.ExpireSummon();
				}
			}
		}

		private void Update()
		{
			if (!((Object)(object)_zNetView == (Object)null) && _zNetView.IsValid() && _zNetView.IsOwner() && Time.time >= _despawnTime)
			{
				ExpireSummon();
			}
		}

		private void OnDestroy()
		{
			ActiveSummons.Remove(this);
		}

		private void ExpireSummon()
		{
			Character component = ((Component)this).GetComponent<Character>();
			if ((Object)(object)component != (Object)null && !component.IsDead())
			{
				component.SetHealth(0f);
			}
		}
	}

	public class HavstormrController : MonoBehaviour
	{
		public string StormEnvironment = "ThunderStorm";

		public string DrakeAddPrefab = "Havstormr_Drake";

		public string SerpentAddPrefab = "Havstormr_Serpent";

		private Character character;

		private ZNetView zNetView;

		private float drakeTimer = 50f;

		private float serpentTimer = 115f;

		private bool deathHandled;

		private bool stormStarted;

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

		private void Start()
		{
			//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)
			ForceStorm();
			stormStarted = true;
			Debug.Log((object)("[Vanaheim] HavstormrController active at: " + ((object)((Component)this).transform.position/*cast due to .constrained prefix*/).ToString()));
			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 (CanControlSummons())
			{
				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 CanControlSummons()
		{
			if ((Object)(object)zNetView != (Object)null && zNetView.IsValid())
			{
				return zNetView.IsOwner();
			}
			if (!((Object)(object)ZNet.instance == (Object)null))
			{
				return ZNet.instance.IsServer();
			}
			return true;
		}

		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_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: 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_003f: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			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, 0.05f);
			}
			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_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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, 0.1f);
			if ((Object)(object)MessageHud.instance != (Object)null)
			{
				MessageHud.instance.ShowMessage((MessageType)1, "Something coils beneath the waves...", 0, (Sprite)null, false);
			}
		}

		private unsafe void SpawnPrefab(string prefabName, Vector3 position, Quaternion rotation, float havstormrDamageFraction)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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)
			if (!((Object)(object)ZNetScene.instance == (Object)null))
			{
				GameObject prefab = ZNetScene.instance.GetPrefab(prefabName);
				if ((Object)(object)prefab == (Object)null)
				{
					Debug.LogError((object)("[Vanaheim] Havstormr could not find summon prefab: " + prefabName));
					return;
				}
				Object.Instantiate<GameObject>(prefab, position, rotation).AddComponent<HavstormrAddDeathDamage>().Configure(character, havstormrDamageFraction);
				Vector3 val = position;
				Debug.Log((object)("[Vanaheim] Havstormr spawned summon " + prefabName + " at: " + ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString()));
			}
		}
	}

	public class HavstormrAddDeathDamage : MonoBehaviour
	{
		private static bool s_hasAnnouncedBroodPain;

		private Character addCharacter;

		private Character havstormr;

		private ZNetView zNetView;

		private float damageFraction;

		private bool damageApplied;

		public void Configure(Character target, float fraction)
		{
			havstormr = target;
			damageFraction = fraction;
		}

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

		private void Update()
		{
			if (!damageApplied && !((Object)(object)addCharacter == (Object)null) && addCharacter.IsDead() && CanApplyDamage())
			{
				DamageHavstormr();
			}
		}

		private void OnDestroy()
		{
			if (!damageApplied && (Object)(object)addCharacter != (Object)null && addCharacter.IsDead() && CanApplyDamage())
			{
				DamageHavstormr();
			}
		}

		private bool CanApplyDamage()
		{
			if (!((Object)(object)zNetView == (Object)null) && zNetView.IsValid())
			{
				return zNetView.IsOwner();
			}
			return true;
		}

		private void DamageHavstormr()
		{
			damageApplied = true;
			if (!((Object)(object)havstormr == (Object)null) && !havstormr.IsDead())
			{
				float health = havstormr.GetHealth();
				float num = havstormr.m_health * damageFraction;
				float health2 = Mathf.Max(1f, health - num);
				havstormr.SetHealth(health2);
				AnnounceBroodPain();
				Debug.Log((object)("[Vanaheim] Havstormr took " + damageFraction.ToString("P0") + " max health damage from a slain summon."));
			}
		}

		private void AnnounceBroodPain()
		{
			if (!s_hasAnnouncedBroodPain)
			{
				s_hasAnnouncedBroodPain = true;
				if ((Object)(object)MessageHud.instance != (Object)null)
				{
					MessageHud.instance.ShowMessage((MessageType)2, "Havstormr screams as the storm-blood of his brood is spilled.", 0, (Sprite)null, false);
				}
			}
		}
	}

	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;

		private void OnDestroy()
		{
			TriggerImpact();
		}

		private void TriggerImpact()
		{
			//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)
			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_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Invalid comparison between Unknown and I4
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, Radius);
			for (int i = 0; i < array.Length; i++)
			{
				Character componentInParent = ((Component)array[i]).GetComponentInParent<Character>();
				if (!((Object)(object)componentInParent == (Object)null) && !componentInParent.IsDead() && (int)componentInParent.GetFaction() != 8)
				{
					HitData val = new HitData();
					val.m_damage.m_lightning = LightningDamage;
					val.m_damage.m_blunt = BluntDamage;
					val.m_point = ((Component)componentInParent).transform.position;
					Vector3 val2 = ((Component)componentInParent).transform.position - ((Component)this).transform.position;
					val.m_dir = ((Vector3)(ref val2)).normalized;
					val.m_pushForce = PushForce;
					val.m_backstabBonus = 1f;
					componentInParent.Damage(val);
				}
			}
		}
	}

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

		public float SpawnRadius = 5f;

		public float TriggerDistance = 60f;

		public float CheckInterval = 15f;

		public int MaxAlive = 1;

		private float timer;

		private ZNetView zNetView;

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

		private void Awake()
		{
			zNetView = ((Component)this).GetComponent<ZNetView>();
		}

		private void Start()
		{
			//IL_0016: 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)
			timer = 2f;
			Debug.Log((object)("[Vanaheim] ErikSpawner active at: " + ((object)((Component)this).transform.position/*cast due to .constrained prefix*/).ToString()));
		}

		private void Update()
		{
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			timer -= Time.deltaTime;
			if (timer > 0f)
			{
				return;
			}
			timer = CheckInterval;
			if ((Object)(object)zNetView != (Object)null && zNetView.IsValid() && !zNetView.IsOwner())
			{
				return;
			}
			CleanupDead();
			if (spawned.Count < MaxAlive && CountLivingEriksNearby() < MaxAlive)
			{
				if ((Object)(object)Player.GetClosestPlayer(((Component)this).transform.position, TriggerDistance) == (Object)null)
				{
					Debug.Log((object)("[Vanaheim] ErikSpawner found no player within " + TriggerDistance + "m at: " + ((object)((Component)this).transform.position/*cast due to .constrained prefix*/).ToString()));
				}
				else
				{
					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 int CountLivingEriksNearby()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, TriggerDistance);
			for (int i = 0; i < array.Length; i++)
			{
				Character componentInParent = ((Component)array[i]).GetComponentInParent<Character>();
				if (!((Object)(object)componentInParent == (Object)null) && !componentInParent.IsDead() && IsErik(componentInParent))
				{
					num++;
				}
			}
			return num;
		}

		private bool IsErik(Character character)
		{
			if (((Object)character).name.StartsWith(ErikPrefabName))
			{
				return true;
			}
			return character.m_name == "Erik the Red";
		}

		private unsafe void SpawnErik()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_0065: 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)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: 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_00ba: 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;
			Character component = Object.Instantiate<GameObject>(prefab, val2, Quaternion.identity).GetComponent<Character>();
			if ((Object)(object)component != (Object)null)
			{
				spawned.Add(component);
				Vector3 val3 = val2;
				Debug.Log((object)("[Vanaheim] ErikSpawner spawned Erik at: " + ((object)(*(Vector3*)(&val3))/*cast due to .constrained prefix*/).ToString()));
			}
		}
	}

	private const string PluginGuid = "vanaheim.havstormr";

	private const string PluginName = "Vanaheim - Havstormr";

	private const string PluginVersion = "2.1.2";

	private const string MoldrikrBossPrefabName = "Vanaheim_Moldrikr";

	private const string BlackTickPrefabName = "Vanaheim_BlackBrood";

	private const string BaseMoldrikrBossPrefabName = "SeekerBrute";

	private const string BaseTickPrefabName = "Tick";

	private const string MoldrikrBundleName = "moldrikrvisual";

	private const string MoldrikrStaffPrefabName = "Vanaheim_StaffMoldrikr";

	private const string BaseMoldrikrStaffPrefabName = "StaffGreenRoots";

	private const string BlackBroodSpawnPrefabName = "staff_blackbrood_spawn";

	private const string BlackBroodProjectilePrefabName = "staff_blackbrood_projectile";

	private const string BaseGreenRootsSpawnPrefabName = "staff_greenroots_spawn";

	private const string BaseGreenRootsProjectilePrefabName = "staff_greenroots_projectile";

	private const float MoldrikrHealth = 18000f;

	private const float MoldrikrBaseAttackDamageMultiplier = 2.25f;

	private const float BlackTickHealth = 180f;

	private const float BlackTickDamageMultiplier = 1.5f;

	private const string MoldrikrSeekerSummonPrefabName = "Vanaheim_MoldrikrSeeker";

	private const string BaseSeekerPrefabName = "Seeker";

	private AssetBundle moldrikrVisualBundle;

	private GameObject moldrikrVisualPrefab;

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

	private void CreatePrefabs()
	{
		LoadMoldrikrVisualBundle();
		CreateHavstormrTrophy();
		CreateStormpiercerBow();
		CreateErikJournal();
		CreateEnchantedBlackmetal();
		CreateHavstormrChains();
		CreateHavstormr();
		CreateStormDrake();
		CreateStormSerpent();
		CreateErikTheRed();
		CreateErikSpawner();
		CreatePortalStone();
		AddOdinsFavor();
		CreateBlackTick();
		CreateMoldrikr();
		CreateMoldrikrSeekerSummon();
		CreateBlackBroodSpawn();
		CreateBlackBroodProjectile();
		CreateMoldrikrStaff();
		LoadDeadSerpentRock();
		PrefabManager.OnVanillaPrefabsAvailable -= CreatePrefabs;
	}

	private void LoadDeadSerpentRock()
	{
		string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
		string text = Path.Combine(directoryName, "Bundles", "deadserpentbundle");
		if (!File.Exists(text))
		{
			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_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: 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_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: 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);
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			Object.DestroyImmediate((Object)(object)componentsInChildren[i]);
		}
		MineRock[] componentsInChildren2 = prefab.GetComponentsInChildren<MineRock>(true);
		for (int i = 0; i < componentsInChildren2.Length; i++)
		{
			Object.DestroyImmediate((Object)(object)componentsInChildren2[i]);
		}
		Destructible[] componentsInChildren3 = prefab.GetComponentsInChildren<Destructible>(true);
		for (int i = 0; i < componentsInChildren3.Length; i++)
		{
			Object.DestroyImmediate((Object)(object)componentsInChildren3[i]);
		}
		WearNTear[] componentsInChildren4 = prefab.GetComponentsInChildren<WearNTear>(true);
		for (int i = 0; i < componentsInChildren4.Length; i++)
		{
			Object.DestroyImmediate((Object)(object)componentsInChildren4[i]);
		}
	}

	private void CreateErikTheRed()
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: 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 = 1200f;
		}
		Humanoid component2 = val.GetComponent<Humanoid>();
		if ((Object)(object)component2 != (Object)null)
		{
			GameObject itemPrefabSafe = GetItemPrefabSafe("ArmorCaptainHelmetDO");
			if ((Object)(object)itemPrefabSafe != (Object)null)
			{
				AdjustErikHelmetPrefab(itemPrefabSafe);
			}
			GameObject val2 = GetItemPrefabSafe("skeleton_sword_hildir");
			if ((Object)(object)val2 != (Object)null)
			{
				val2 = CreateErikSword(val2);
			}
			GameObject itemPrefabSafe2 = GetItemPrefabSafe("ArmorIronChest");
			List<GameObject> list = new List<GameObject>();
			if ((Object)(object)val2 != (Object)null)
			{
				list.Add(val2);
			}
			if ((Object)(object)itemPrefabSafe2 != (Object)null)
			{
				list.Add(itemPrefabSafe2);
			}
			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 GameObject CreateErikSword(GameObject baseSword)
	{
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Expected O, but got Unknown
		GameObject val = PrefabManager.Instance.CreateClonedPrefab("ErikTheRed_Sword", ((Object)baseSword).name);
		if ((Object)(object)val == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Failed to clone ErikTheRed_Sword. Falling back to base skeleton sword.");
			return baseSword;
		}
		ItemDrop component = val.GetComponent<ItemDrop>();
		if ((Object)(object)component != (Object)null)
		{
			SharedData shared = component.m_itemData.m_shared;
			shared.m_name = "Erik's Sword";
			shared.m_damages.m_slash = 55f;
			shared.m_damages.m_frost = 15f;
			shared.m_damages.m_lightning = 0f;
			shared.m_attackForce = 30f;
			if (shared.m_attack != null)
			{
				shared.m_attack.m_damageMultiplier = 1f;
			}
		}
		TintErikSword(val);
		PrefabManager.Instance.AddPrefab(new CustomPrefab(val, false));
		return val;
	}

	private void CreateHavstormr()
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: 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 = 15000f;
			component.m_defeatSetGlobalKey = null;
			component.m_bossEvent = "";
			ConfigureResistances(component);
		}
		ConfigureHavstormrAI(val);
		IsolateHavstormrBreathAssets(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 IsolateHavstormrBreathAssets(GameObject boss)
	{
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0189: Expected O, but got Unknown
		//IL_0190: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Expected O, but got Unknown
		Humanoid component = boss.GetComponent<Humanoid>();
		if ((Object)(object)component == (Object)null || component.m_defaultItems == null)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Havstormr has no default items to isolate.");
			return;
		}
		for (int i = 0; i < component.m_defaultItems.Length; i++)
		{
			GameObject val = component.m_defaultItems[i];
			if (!IsHavstormrBreathItem(val))
			{
				continue;
			}
			GameObject val2 = PrefabManager.Instance.CreateClonedPrefab("Havstormr_" + ((Object)val).name, ((Object)val).name);
			if ((Object)(object)val2 == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Failed to clone Havstormr breath item: " + ((Object)val).name));
				continue;
			}
			ItemDrop component2 = val2.GetComponent<ItemDrop>();
			if ((Object)(object)component2 == (Object)null || component2.m_itemData.m_shared.m_attack == null || (Object)(object)component2.m_itemData.m_shared.m_attack.m_attackProjectile == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Havstormr breath item clone has no projectile attack: " + ((Object)val2).name));
				continue;
			}
			GameObject attackProjectile = component2.m_itemData.m_shared.m_attack.m_attackProjectile;
			GameObject val3 = PrefabManager.Instance.CreateClonedPrefab("Havstormr_" + ((Object)attackProjectile).name, ((Object)attackProjectile).name);
			if ((Object)(object)val3 == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Failed to clone Havstormr breath projectile: " + ((Object)attackProjectile).name));
				continue;
			}
			component2.m_itemData.m_shared.m_attack.m_attackProjectile = val3;
			component.m_defaultItems[i] = val2;
			PrefabManager.Instance.AddPrefab(new CustomPrefab(val3, false));
			PrefabManager.Instance.AddPrefab(new CustomPrefab(val2, false));
		}
	}

	private bool IsHavstormrBreathItem(GameObject itemPrefab)
	{
		if ((Object)(object)itemPrefab == (Object)null)
		{
			return false;
		}
		string text = ((Object)itemPrefab).name.ToLower();
		if (!text.Contains("spit") && !text.Contains("cold"))
		{
			return text.Contains("breath");
		}
		return true;
	}

	private void ConfigureHavstormrLightningVisuals(GameObject boss)
	{
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: 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 || !IsHavstormrBreathItem(val) || !((Object)val).name.StartsWith("Havstormr_"))
			{
				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);
				foreach (Light obj in componentsInChildren)
				{
					obj.color = new Color(0.25f, 0.65f, 1f, 1f);
					obj.intensity = 3f;
				}
				ParticleSystem[] componentsInChildren2 = attackProjectile.GetComponentsInChildren<ParticleSystem>(true);
				for (int j = 0; j < componentsInChildren2.Length; j++)
				{
					MainModule main = componentsInChildren2[j].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 || !IsHavstormrBreathItem(val) || !((Object)val).name.StartsWith("Havstormr_"))
			{
				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_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		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_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		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_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: 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 AddOdinsFavor()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Expected O, but got Unknown
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		ItemConfig val = new ItemConfig
		{
			Name = "Odin's Favor",
			Description = "A token of Odin's blessing. Certain merchants may find these... persuasive."
		};
		CustomItem val2 = new CustomItem("OdinsFavor", "Amber", val);
		ItemDrop component = val2.ItemPrefab.GetComponent<ItemDrop>();
		if ((Object)(object)component != (Object)null)
		{
			SharedData shared = component.m_itemData.m_shared;
			shared.m_name = "Odin's Favor";
			shared.m_description = val.Description;
			shared.m_itemType = (ItemType)1;
			shared.m_maxStackSize = 9999;
			shared.m_weight = 0.1f;
			shared.m_teleportable = true;
			shared.m_questItem = false;
			if (shared.m_icons != null && shared.m_icons.Length != 0 && (Object)(object)shared.m_icons[0] != (Object)null)
			{
				shared.m_icons = (Sprite[])(object)new Sprite[1] { TintSprite(shared.m_icons[0], new Color(0.45f, 0.9f, 2f, 1f)) };
			}
		}
		ItemManager.Instance.AddItem(val2);
	}

	private Sprite TintSprite(Sprite original, Color tint)
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Expected O, but got Unknown
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_019f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)original == (Object)null || (Object)(object)original.texture == (Object)null)
		{
			return original;
		}
		Rect textureRect = original.textureRect;
		int num = Mathf.RoundToInt(((Rect)(ref textureRect)).width);
		int num2 = Mathf.RoundToInt(((Rect)(ref textureRect)).height);
		RenderTexture temporary = RenderTexture.GetTemporary(((Texture)original.texture).width, ((Texture)original.texture).height, 0, (RenderTextureFormat)7, (RenderTextureReadWrite)1);
		Graphics.Blit((Texture)(object)original.texture, temporary);
		RenderTexture active = RenderTexture.active;
		RenderTexture.active = temporary;
		Texture2D val = new Texture2D(((Texture)original.texture).width, ((Texture)original.texture).height, (TextureFormat)4, false);
		val.ReadPixels(new Rect(0f, 0f, (float)((Texture)temporary).width, (float)((Texture)temporary).height), 0, 0);
		val.Apply();
		RenderTexture.active = active;
		RenderTexture.ReleaseTemporary(temporary);
		Texture2D val2 = new Texture2D(num, num2, (TextureFormat)4, false);
		Color[] pixels = val.GetPixels(Mathf.RoundToInt(((Rect)(ref textureRect)).x), Mathf.RoundToInt(((Rect)(ref textureRect)).y), num, num2);
		for (int i = 0; i < pixels.Length; i++)
		{
			pixels[i].r *= tint.r;
			pixels[i].g *= tint.g;
			pixels[i].b *= tint.b;
			pixels[i].a *= tint.a;
		}
		val2.SetPixels(pixels);
		val2.Apply();
		return Sprite.Create(val2, new Rect(0f, 0f, (float)num, (float)num2), original.pivot / new Vector2(((Rect)(ref textureRect)).width, ((Rect)(ref textureRect)).height), original.pixelsPerUnit);
	}

	private void CreateEnchantedBlackmetal()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Expected O, but got Unknown
		//IL_0048: 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_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Expected O, but got Unknown
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Expected O, but got Unknown
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Expected O, but got Unknown
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Expected O, but got Unknown
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Expected O, but got Unknown
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Expected O, but got Unknown
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: 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)
		};
		CustomRecipe val4 = new CustomRecipe(val3);
		ItemManager.Instance.AddRecipe(val4);
	}

	private void CreateErikJournal()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: 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_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Expected O, but got Unknown
		//IL_0048: 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_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: 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_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_000a: 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_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: 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_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)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: 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_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: 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);
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			Object.DestroyImmediate((Object)(object)componentsInChildren[i]);
		}
		CreatureSpawner[] componentsInChildren2 = val.GetComponentsInChildren<CreatureSpawner>(true);
		for (int i = 0; i < componentsInChildren2.Length; i++)
		{
			Object.DestroyImmediate((Object)(object)componentsInChildren2[i]);
		}
		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 = 15f;
		erikSpawnerController.MaxAlive = 1;
		PrefabManager.Instance.AddPrefab(val);
	}

	private void AddErikHat(GameObject erik)
	{
		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		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);
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			Object.DestroyImmediate((Object)(object)componentsInChildren[i]);
		}
		Rigidbody[] componentsInChildren2 = val2.GetComponentsInChildren<Rigidbody>(true);
		for (int i = 0; i < componentsInChildren2.Length; i++)
		{
			Object.DestroyImmediate((Object)(object)componentsInChildren2[i]);
		}
		ZSyncTransform[] componentsInChildren3 = val2.GetComponentsInChildren<ZSyncTransform>(true);
		for (int i = 0; i < componentsInChildren3.Length; i++)
		{
			Object.DestroyImmediate((Object)(object)componentsInChildren3[i]);
		}
		ZNetView[] componentsInChildren4 = val2.GetComponentsInChildren<ZNetView>(true);
		for (int i = 0; i < componentsInChildren4.Length; i++)
		{
			Object.DestroyImmediate((Object)(object)componentsInChildren4[i]);
		}
		ItemDrop[] componentsInChildren5 = val2.GetComponentsInChildren<ItemDrop>(true);
		for (int i = 0; i < componentsInChildren5.Length; i++)
		{
			Object.DestroyImmediate((Object)(object)componentsInChildren5[i]);
		}
		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_0210: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_022d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0232: Unknown result type (might be due to invalid IL or missing references)
		//IL_023c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0241: Unknown result type (might be due to invalid IL or missing references)
		//IL_024b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0252: Expected O, but got Unknown
		//IL_026b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0275: Unknown result type (might be due to invalid IL or missing references)
		//IL_027a: 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_029a: Unknown result type (might be due to invalid IL or missing references)
		//IL_029f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02db: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0307: Unknown result type (might be due to invalid IL or missing references)
		//IL_030c: Unknown result type (might be due to invalid IL or missing references)
		//IL_031a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: 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)
		//IL_0398: Unknown result type (might be due to invalid IL or missing references)
		//IL_0427: Unknown result type (might be due to invalid IL or missing references)
		//IL_042e: Expected O, but got Unknown
		//IL_0447: Unknown result type (might be due to invalid IL or missing references)
		//IL_0451: Unknown result type (might be due to invalid IL or missing references)
		//IL_0456: Unknown result type (might be due to invalid IL or missing references)
		//IL_046c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0476: Unknown result type (might be due to invalid IL or missing references)
		//IL_047b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0491: Unknown result type (might be due to invalid IL or missing references)
		//IL_049b: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b7: 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_04cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e8: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_052f: Unknown result type (might be due to invalid IL or missing references)
		Renderer[] componentsInChildren = sword.GetComponentsInChildren<Renderer>(true);
		foreach (Renderer obj in componentsInChildren)
		{
			string text = ((Object)((Component)obj).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 = obj.materials;
			foreach (Material val in materials)
			{
				if (!flag)
				{
					if (val.HasProperty("_EmissionColor"))
					{
						val.DisableKeyword("_EMISSION");
						val.SetColor("_EmissionColor", Color.black);
					}
					if (val.HasProperty("_Color"))
					{
						val.color = new Color(0.72f, 0.74f, 0.76f, 1f);
					}
					if (val.HasProperty("_TintColor"))
					{
						val.SetColor("_TintColor", new Color(0.72f, 0.74f, 0.76f, 1f));
					}
				}
				else
				{
					if (val.HasProperty("_EmissionColor"))
					{
						val.EnableKeyword("_EMISSION");
						val.SetColor("_EmissionColor", new Color(0.1f, 0.65f, 2f, 1f));
					}
					if (val.HasProperty("_TintColor"))
					{
						val.SetColor("_TintColor", new Color(0.15f, 0.65f, 1.6f, 1f));
					}
					if (val.HasProperty("_Color"))
					{
						val.color = new Color(0.2f, 0.7f, 1.4f, 1f);
					}
				}
			}
		}
		ParticleSystem[] componentsInChildren2 = sword.GetComponentsInChildren<ParticleSystem>(true);
		foreach (ParticleSystem obj2 in componentsInChildren2)
		{
			MainModule main = obj2.main;
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.25f, 0.75f, 1.8f, 1f));
			ColorOverLifetimeModule colorOverLifetime = obj2.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			Gradient val2 = new Gradient();
			val2.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(val2);
		}
		ParticleSystemRenderer[] componentsInChildren3 = sword.GetComponentsInChildren<ParticleSystemRenderer>(true);
		foreach (ParticleSystemRenderer val3 in componentsInChildren3)
		{
			if (!((Object)(object)((Renderer)val3).material == (Object)null))
			{
				Material material = ((Renderer)val3).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);
		foreach (TrailRenderer val4 in componentsInChildren4)
		{
			Gradient val5 = new Gradient();
			val5.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)
			});
			val4.colorGradient = val5;
		}
		Light[] componentsInChildren5 = sword.GetComponentsInChildren<Light>(true);
		foreach (Light obj3 in componentsInChildren5)
		{
			obj3.color = new Color(0.25f, 0.65f, 1f, 1f);
			obj3.intensity = 3f;
			obj3.range = Mathf.Max(obj3.range, 4f);
		}
	}

	private void AdjustErikHelmetPrefab(GameObject helmet)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		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_001c: Unknown result type (might be due to invalid IL or missing references)
		Renderer[] componentsInChildren = obj.GetComponentsInChildren<Renderer>(true);
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			Material[] materials = componentsInChildren[i].materials;
			for (int j = 0; j < materials.Length; j++)
			{
				materials[j].color = tint;
			}
		}
	}

	private void TintStormpiercer(GameObject bow)
	{
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_016b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
		Renderer[] componentsInChildren = bow.GetComponentsInChildren<Renderer>(true);
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			Material[] materials = componentsInChildren[i].materials;
			foreach (Material val in materials)
			{
				if (val.HasProperty("_Color"))
				{
					val.color = new Color(0.08f, 0.12f, 0.2f, 1f);
				}
				if (val.HasProperty("_EmissionColor"))
				{
					val.EnableKeyword("_EMISSION");
					val.SetColor("_EmissionColor", new Color(0.01f, 0.04f, 0.1f, 1f));
				}
				if (val.HasProperty("_TintColor"))
				{
					val.SetColor("_TintColor", new Color(0.08f, 0.18f, 0.3f, 1f));
				}
			}
		}
		Light[] componentsInChildren2 = bow.GetComponentsInChildren<Light>(true);
		foreach (Light obj in componentsInChildren2)
		{
			obj.intensity *= 0.25f;
			obj.range *= 0.5f;
			obj.color = new Color(0.25f, 0.45f, 0.65f, 1f);
		}
		ParticleSystem[] componentsInChildren3 = bow.GetComponentsInChildren<ParticleSystem>(true);
		foreach (ParticleSystem obj2 in componentsInChildren3)
		{
			MainModule main = obj2.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 = obj2.emission;
			((EmissionModule)(ref emission)).rateOverTimeMultiplier = ((EmissionModule)(ref emission)).rateOverTimeMultiplier * 0.35f;
		}
		TrailRenderer[] componentsInChildren4 = bow.GetComponentsInChildren<TrailRenderer>(true);
		foreach (TrailRenderer obj3 in componentsInChildren4)
		{
			obj3.time *= 0.5f;
			obj3.widthMultiplier *= 0.5f;
		}
	}

	private void LoadMoldrikrVisualBundle()
	{
		string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
		string text = Path.Combine(directoryName, "Bundles", "moldrikrvisual");
		if (!File.Exists(text))
		{
			text = Path.Combine(directoryName, "moldrikrvisual");
		}
		moldrikrVisualBundle = AssetBundle.LoadFromFile(text);
		if ((Object)(object)moldrikrVisualBundle == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("Failed to load Moldrikr visual bundle at: " + text));
			return;
		}
		string[] allAssetNames = moldrikrVisualBundle.GetAllAssetNames();
		foreach (string text2 in allAssetNames)
		{
			string text3 = text2.ToLower();
			if (text3.Contains("moldrikrvisual") && text3.EndsWith(".prefab"))
			{
				moldrikrVisualPrefab = moldrikrVisualBundle.LoadAsset<GameObject>(text2);
			}
		}
		if ((Object)(object)moldrikrVisualPrefab == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"Could not find moldrikrvisual prefab in bundle.");
		}
	}

	private void CreateMoldrikr()
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Expected O, but got Unknown
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_0180: Expected O, but got Unknown
		GameObject val = PrefabManager.Instance.CreateClonedPrefab("Vanaheim_Moldrikr", "SeekerBrute");
		if ((Object)(object)val == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"Failed to clone prefab: SeekerBrute");
			return;
		}
		val.transform.localScale = Vector3.one * 2.3f;
		ApplyCustomTextureToVanillaVisual(val);
		Character component = val.GetComponent<Character>();
		if ((Object)(object)component != (Object)null)
		{
			component.m_name = "$enemy_moldrikr";
			component.m_boss = true;
			component.m_health = 18000f;
			component.m_faction = (Faction)8;
			SetAllDamageModifiers(component, (DamageModifier)5);
		}
		Humanoid component2 = val.GetComponent<Humanoid>();
		if ((Object)(object)component2 != (Object)null)
		{
			((Character)component2).m_name = "$enemy_moldrikr";
		}
		MonsterAI component3 = val.GetComponent<MonsterAI>();
		if ((Object)(object)component3 != (Object)null)
		{
			((BaseAI)component3).m_viewRange = 60f;
			component3.m_attackPlayerObjects = true;
			component3.m_circulateWhileCharging = true;
		}
		Attack[] componentsInChildren = val.GetComponentsInChildren<Attack>(true);
		foreach (Attack obj in componentsInChildren)
		{
			obj.m_damageMultiplier *= 2.25f;
		}
		CharacterDrop component4 = val.GetComponent<CharacterDrop>();
		if ((Object)(object)component4 != (Object)null)
		{
			component4.m_drops.Clear();
			AddDrop(component4, "Carapace", 8, 14, 1f);
			AddDrop(component4, "Mandible", 2, 4, 1f);
		}
		val.AddComponent<MoldrikrController>();
		CreatureConfig val2 = new CreatureConfig
		{
			Name = "$enemy_moldrikr",
			Faction = (Faction)8
		};
		CreatureManager.Instance.AddCreature(new CustomCreature(val, false, val2));
		CustomLocalization localization = LocalizationManager.Instance.GetLocalization();
		string text = "English";
		localization.AddTranslation(ref text, new Dictionary<string, string> { { "enemy_moldrikr", "Moldrikr, The Black Carapace" } });
	}

	private void CreateBlackTick()
	{
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Expected O, but got Unknown
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Expected O, but got Unknown
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = PrefabManager.Instance.CreateClonedPrefab("Vanaheim_BlackBrood", "Tick");
		if ((Object)(object)val == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"Failed to clone prefab: Tick");
			return;
		}
		Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>(true);
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			Material[] materials = componentsInChildren[i].materials;
			foreach (Material val2 in materials)
			{
				if (!((Object)(object)val2 == (Object)null) && val2.HasProperty("_Color"))
				{
					val2.color = new Color(0.05f, 0.05f, 0.05f, 1f);
				}
			}
		}
		Character component = val.GetComponent<Character>();
		if ((Object)(object)component != (Object)null)
		{
			component.m_name = "$enemy_blackbrood";
			component.m_health = 180f;
		}
		Attack[] componentsInChildren2 = val.GetComponentsInChildren<Attack>(true);
		foreach (Attack obj in componentsInChildren2)
		{
			obj.m_damageMultiplier *= 1.5f;
		}
		CreatureConfig val3 = new CreatureConfig
		{
			Name = "$enemy_blackbrood",
			Faction = (Faction)8
		};
		CreatureManager.Instance.AddCreature(new CustomCreature(val, false, val3));
		CustomLocalization localization = LocalizationManager.Instance.GetLocalization();
		string text = "English";
		localization.AddTranslation(ref text, new Dictionary<string, string> { { "enemy_blackbrood", "Black Brood" } });
	}

	private void CreateMoldrikrSeekerSummon()
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Expected O, but got Unknown
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Expected O, but got Unknown
		GameObject val = PrefabManager.Instance.CreateClonedPrefab("Vanaheim_MoldrikrSeeker", "Seeker");
		if ((Object)(object)val == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"Failed to clone prefab: Seeker");
			return;
		}
		val.transform.localScale = Vector3.one * 0.85f;
		val.AddComponent<TimedSummon>();
		ApplyCustomTextureToVanillaVisual(val);
		Character component = val.GetComponent<Character>();
		if ((Object)(object)component != (Object)null)
		{
			component.m_name = "$enemy_moldrikr_seeker";
			component.m_faction = (Faction)0;
		}
		CharacterDrop component2 = val.GetComponent<CharacterDrop>();
		if ((Object)(object)component2 != (Object)null)
		{
			component2.m_drops.Clear();
		}
		Humanoid component3 = val.GetComponent<Humanoid>();
		if ((Object)(object)component3 != (Object)null)
		{
			((Character)component3).m_name = "$enemy_moldrikr_seeker";
		}
		MonsterAI component4 = val.GetComponent<MonsterAI>();
		if ((Object)(object)component4 != (Object)null)
		{
			component4.m_attackPlayerObjects = false;
		}
		CreatureConfig val2 = new CreatureConfig
		{
			Name = "$enemy_moldrikr_seeker",
			Faction = (Faction)0
		};
		CreatureManager.Instance.AddCreature(new CustomCreature(val, false, val2));
		CustomLocalization localization = LocalizationManager.Instance.GetLocalization();
		string text = "English";
		localization.AddTranslation(ref text, new Dictionary<string, string> { { "enemy_moldrikr_seeker", "Black Brood Seeker" } });
	}

	private void CreateBlackBroodSpawn()
	{
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Expected O, but got Unknown
		GameObject val = PrefabManager.Instance.CreateClonedPrefab("staff_blackbrood_spawn", "staff_greenroots_spawn");
		if ((Object)(object)val == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"Failed to clone prefab: staff_greenroots_spawn");
			return;
		}
		GameObject prefab = PrefabManager.Instance.GetPrefab("Vanaheim_MoldrikrSeeker");
		if ((Object)(object)prefab == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"Could not find seeker summon prefab: Vanaheim_MoldrikrSeeker");
			return;
		}
		SpawnAbility component = val.GetComponent<SpawnAbility>();
		if ((Object)(object)component == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"Black Brood spawn is missing SpawnAbility.");
			return;
		}
		component.m_spawnPrefab = (GameObject[])(object)new GameObject[1] { prefab };
		PrefabManager.Instance.AddPrefab(new CustomPrefab(val, false));
	}

	private void CreateBlackBroodProjectile()
	{
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Expected O, but got Unknown
		GameObject val = PrefabManager.Instance.CreateClonedPrefab("staff_blackbrood_projectile", "staff_greenroots_projectile");
		if ((Object)(object)val == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"Failed to clone prefab: staff_greenroots_projectile");
			return;
		}
		GameObject prefab = PrefabManager.Instance.GetPrefab("staff_blackbrood_spawn");
		if ((Object)(object)prefab == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"Could not find Black Brood spawn prefab: staff_blackbrood_spawn");
			return;
		}
		Projectile component = val.GetComponent<Projectile>();
		if ((Object)(object)component == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"Black Brood projectile is missing Projectile component.");
			return;
		}
		component.m_spawnOnHit = prefab;
		PrefabManager.Instance.AddPrefab(new CustomPrefab(val, false));
	}

	private void CreateMoldrikrStaff()
	{
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Expected O, but got Unknown
		GameObject val = PrefabManager.Instance.CreateClonedPrefab("Vanaheim_StaffMoldrikr", "StaffGreenRoots");
		if ((Object)(object)val == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"Failed to clone prefab: StaffGreenRoots");
			return;
		}
		ItemDrop component = val.GetComponent<ItemDrop>();
		if ((Object)(object)component != (Object)null)
		{
			component.m_itemData.m_shared.m_name = "$item_staff_moldrikr";
			component.m_itemData.m_shared.m_description = "A blackened staff pulsing with corrupted brood magic.";
		}
		GameObject prefab = PrefabManager.Instance.GetPrefab("staff_blackbrood_projectile");
		if ((Object)(object)prefab == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"Could not find Black Brood projectile prefab: staff_blackbrood_projectile");
		}
		else if ((Object)(object)component != (Object)null)
		{
			component.m_itemData.m_shared.m_attack.m_attackProjectile = prefab;
		}
		RethemeStaffVFX(val);
		ItemManager.Instance.AddItem(new CustomItem(val, false));
		CustomLocalization localization = LocalizationManager.Instance.GetLocalization();
		string text = "English";
		localization.AddTranslation(ref text, new Dictionary<string, string> { { "item_staff_moldrikr", "Staff of the Black Brood" } });
	}

	private void RethemeStaffVFX(GameObject staff)
	{
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: 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_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e6: 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)
		Color val = default(Color);
		((Color)(ref val))..ctor(0.04f, 0.35f, 0.07f, 0.65f);
		Color color = default(Color);
		((Color)(ref color))..ctor(0.005f, 0.04f, 0.015f, 0.55f);
		Color color2 = default(Color);
		((Color)(ref color2))..ctor(0.12f, 0.65f, 0.1f, 0.45f);
		ParticleSystem[] componentsInChildren = staff.GetComponentsInChildren<ParticleSystem>(true);
		foreach (ParticleSystem val2 in componentsInChildren)
		{
			if (GetTransformPath(((Component)val2).transform).ToLower().Contains("spores"))
			{
				((Component)val2).gameObject.SetActive(false);
				continue;
			}
			MainModule main = val2.main;
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(val);
			((MainModule)(ref main)).startSizeMultiplier = ((MainModule)(ref main)).startSizeMultiplier * 0.75f;
			EmissionModule emission = val2.emission;
			((EmissionModule)(ref emission)).rateOverTimeMultiplier = ((EmissionModule)(ref emission)).rateOverTimeMultiplier * 0.35f;
			ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime;
			if (((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled)
			{
				((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val);
			}
		}
		Light[] componentsInChildren2 = staff.GetComponentsInChildren<Light>(true);
		foreach (Light obj in componentsInChildren2)
		{
			obj.color = color2;
			obj.intensity *= 0.25f;
			obj.range *= 0.75f;
		}
		Renderer[] componentsInChildren3 = staff.GetComponentsInChildren<Renderer>(true);
		foreach (Renderer val3 in componentsInChildren3)
		{
			string text = GetTransformPath(((Component)val3).transform).ToLower();
			if (!text.Contains("glow") && !text.Contains("flare") && !text.Contains("flames") && !text.Contains("embers"))
			{
				continue;
			}
			Material[] materials = val3.materials;
			foreach (Material val4 in materials)
			{
				if (!((Object)(object)val4 == (Object)null))
				{
					if (val4.HasProperty("_Color"))
					{
						val4.color = color;
					}
					if (val4.HasProperty("_EmissionColor"))
					{
						val4.SetColor("_EmissionColor", val);
					}
				}
			}
		}
	}

	private string GetTransformPath(Transform transform)
	{
		if ((Object)(object)transform == (Object)null)
		{
			return "";
		}
		string text = ((Object)transform).name;
		while ((Object)(object)transform.parent != (Object)null)
		{
			transform = transform.parent;
			text = ((Object)transform).name + "/" + text;
		}
		return text;
	}

	private void ApplyCustomTextureToVanillaVisual(GameObject boss)
	{
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Expected O, but got Unknown
		if ((Object)(object)moldrikrVisualPrefab == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"No custom visual prefab loaded. Keeping vanilla material.");
			return;
		}
		Renderer componentInChildren = moldrikrVisualPrefab.GetComponentInChildren<Renderer>(true);
		if ((Object)(object)componentInChildren == (Object)null || (Object)(object)componentInChildren.sharedMaterial == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not find material on custom visual prefab.");
			return;
		}
		Material sharedMaterial = componentInChildren.sharedMaterial;
		Texture val = null;
		if (sharedMaterial.HasProperty("_MainTex"))
		{
			val = sharedMaterial.GetTexture("_MainTex");
		}
		if ((Object)(object)val == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not find Moldrikr albedo texture on source material.");
			return;
		}
		Transform val2 = boss.transform.Find("Visual");
		if ((Object)(object)val2 == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not find boss Visual child.");
			return;
		}
		Renderer[] componentsInChildren = ((Component)val2).GetComponentsInChildren<Renderer>(true);
		foreach (Renderer obj in componentsInChildren)
		{
			Material val3 = new Material(obj.sharedMaterial);
			if (val3.HasProperty("_MainTex"))
			{
				val3.SetTexture("_MainTex", val);
			}
			obj.material = val3;
		}
	}

	public static void SetAllDamageModifiers(Character character, DamageModifier modifier)
	{
		//IL_0006: 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_0012: 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_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)