Decompiled source of Companions Human v1.0.5

Companions.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Jotunn;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using SpawnThat.Spawners;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Companions")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Companions")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9b38765f-fb98-4014-99da-3b358b402e70")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Companions;

[BepInPlugin("horemvore.Companions", "Companions", "1.0.5")]
[BepInIncompatibility("Azumatt.AzuDevMod")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
internal class Companions : BaseUnityPlugin
{
	public const string PluginGUID = "horemvore.Companions";

	public const string PluginName = "Companions";

	public const string PluginVersion = "1.0.5";

	public static bool isModded = true;

	public AssetBundle NPCBundle;

	private CustomLocalization Localization;

	internal static ManualLogSource Log;

	public ConfigEntry<bool> ModEnable;

	public ConfigEntry<bool> LoggingEnable;

	public ConfigEntry<bool> SpawnsEnable;

	public string[] fxList = new string[2] { "FX_ShieldBreak_DoD", "FX_ShieldHit_DoD" };

	public string[] prefabList = new string[20]
	{
		"VFX_ShieldEffect_DoD", "NPC_Heal_AoE_DoD", "NPC_HealLesser_AoE_DoD", "NPC_HealGreater_AoE_DoD", "NPC_Shield_AoE_DoD", "HumanNPCBarry_RD_DoD", "HumanNPCBob_RD_DoD", "HumanNPCBobby_RD_DoD", "HumanNPCFred_RD_DoD", "HumanNPCJeff_RD_DoD",
		"HumanNPCFletch_RD_DoD", "HumanNPCBarbara_RD_DoD", "HumanNPCCathrine_RD_DoD", "HumanNPCDaisy_RD_DoD", "HumanNPCKaren_RD_DoD", "HumanNPCMandy_RD_DoD", "HumanNPCSandra_RD_DoD", "HumanNPCGary_RD_DoD", "HumanNPCTania_RD_DoD", "HumanNPCTina_RD_DoD"
	};

	public string[] itemList = new string[28]
	{
		"FriggGlobe_DoD", "LokiGlobe_DoD", "OdinGlobe_DoD", "NPC_Shield_DoD", "NPC_ShieldLesser_DoD", "NPC_ShieldGreater_DoD", "NPC_SelfHeal_DoD", "NPC_SelfHealLesser_DoD", "NPC_SelfHealGreater_DoD", "NPC_KickAttack_L_DoD",
		"NPC_KickAttack_R_DoD", "NPC_KoshAttack_L_DoD", "NPC_KoshAttack_R_DoD", "NPC_KnifeAttack_L_DoD", "NPC_KnifeAttack_R_DoD", "NPC_DaggerAttack_L_DoD", "NPC_GladiatorSwordAttack_R_DoD", "NPC_RedAxeAttack_R_DoD", "NPC_VikingAxeAttack_L_DoD", "NPC_VikingAxeAttack_R_DoD",
		"NPC_WoodAxeAttack_L_DoD", "NPC_DaggerAttack_R_DoD", "NPC_GladiatorSwordAttack_L_DoD", "NPC_GoldAxeAttack_L_DoD", "NPC_GoldAxeAttack_R_DoD", "NPC_BowAttack_DoD", "NPC_MageDaggerAttack_L_DoD", "NPC_StaffSledgeAttack_R_DoD"
	};

	public string[] seStatsList = new string[6] { "SE_FriggsBlessing_DoD", "SE_LokisBlessing_DoD", "SE_OdinBlessing_DoD", "SE_NPC_GreaterHeal_DoD", "SE_NPC_Heal_DoD", "SE_NPC_LesserHeal_DoD" };

	public string[] seShieldList = new string[3] { "SE_NPC_Shield_DoD", "SE_NPC_ShieldGreater_DoD", "SE_NPC_ShieldLesser_DoD" };

	public string[] companionList = new string[12]
	{
		"HumanNPCBob_DoD", "HumanNPCFred_DoD", "HumanNPCBarry_DoD", "HumanNPCBobby_DoD", "HumanNPCJeff_DoD", "HumanNPCMandy_DoD", "HumanNPCBarbara_DoD", "HumanNPCSandra_DoD", "HumanNPCDaisy_DoD", "HumanNPCCathrine_DoD",
		"HumanNPCKaren_DoD", "HumanNPCFletch_DoD"
	};

	public string[] bossList = new string[3] { "HumanNPCGary_DoD", "HumanNPCTania_DoD", "HumanNPCTina_DoD" };

	public string[] musicList = new string[2] { "NPCMusic_DoD", "ShrineMusic_DoD" };

	public string[] spawnersList = new string[1] { "Spawner_NPCCamp_DoD" };

	public void CreateConfigurationValues()
	{
		//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)
		//IL_003d: Expected O, but got Unknown
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Expected O, but got Unknown
		//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_007a: Expected O, but got Unknown
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Expected O, but got Unknown
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Expected O, but got Unknown
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Expected O, but got Unknown
		try
		{
			((BaseUnityPlugin)this).Config.SaveOnConfigSet = true;
			ModEnable = ((BaseUnityPlugin)this).Config.Bind<bool>("0 Companions", "Enable", true, new ConfigDescription("Admin only, Enables this mod", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			SpawnsEnable = ((BaseUnityPlugin)this).Config.Bind<bool>("1 Spawning", "Enable", true, new ConfigDescription("Enables default spawning of Companions. Set to false if you want to setup your own spawns via a 3rd party mod.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			LoggingEnable = ((BaseUnityPlugin)this).Config.Bind<bool>("99 Logging", "Enable", true, new ConfigDescription("Admin only, Enables logging", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} }));
			SynchronizationManager.OnConfigurationSynchronized += delegate(object obj, ConfigurationSynchronizationEventArgs attr)
			{
				if (attr.InitialSynchronization)
				{
					Logger.LogMessage((object)"Initial Config sync event received for Companions");
				}
				else
				{
					Logger.LogMessage((object)"Config sync event received for Companions");
				}
			};
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while adding configuration values: {arg}");
		}
	}

	private void Awake()
	{
		try
		{
			CreateConfigurationValues();
			Log = ((BaseUnityPlugin)this).Logger;
			if (ModEnable.Value)
			{
				if (LoggingEnable.Value)
				{
					((BaseUnityPlugin)this).Logger.LogWarning((object)"Logging is enabled in the config.");
				}
				AddLocalizations();
				LoadBundle();
				AddStatsEffects();
				AddShieldEffects();
				AddSFX();
				AddMusic();
				AddPrefabs();
				AddItems();
				AddCompanions();
				AddBosses();
				AddSpawners();
				ZoneManager.OnVanillaLocationsAvailable += AddNPCLocations;
				PrefabManager.OnVanillaPrefabsAvailable += FixSFX;
				if (SpawnsEnable.Value)
				{
					SpawnerConfigurationManager.OnConfigure += ConfigureNPCSpawners;
				}
			}
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while loading Companions: {arg}");
		}
	}

	private void AddLocalizations()
	{
		try
		{
			Localization = LocalizationManager.Instance.GetLocalization();
			CustomLocalization localization = Localization;
			string text = "English";
			localization.AddTranslation(ref text, new Dictionary<string, string>
			{
				{ "item_odin_globe_dod", "Odin's Blessing" },
				{ "item_odin_globe_desc_dod", "Gift of the Gods" },
				{ "item_loki_globe_dod", "Loki's Blessing" },
				{ "item_loki_globe_desc_dod", "Gift of the Gods" },
				{ "item_frigg_globe_dod", "Frigg's Blessing" },
				{ "item_frigg_globe_desc_dod", "Gift of the Gods" },
				{ "effect_odinsblessing_dod", "Odin's Blessing" },
				{ "effect_odinsblessing_tooltip_dod", "Clubs: +15% Damage" },
				{ "effect_odinsblessing_end_dod", "No longer blessed by Odin" },
				{ "effect_lokisblessing_dod", "Loki's Blessing" },
				{ "effect_lokisblessing_tooltip_dod", "Knives: +15% Damage" },
				{ "effect_lokisblessing_end_dod", "No longer blessed by Loki" },
				{ "effect_friggsblessing_dod", "Frigg's Blessing" },
				{ "effect_friggsblessing_tooltip_dod", "Polearms: +15% Damage" },
				{ "effect_friggsblessing_end_dod", "No longer blessed by Frigg" },
				{ "piece_shrine_odin_dod", "Odin" },
				{ "piece_shrine_offeritem_odin_dod", "Offer Infused Gemstones for a blessing" },
				{ "piece_shrine_frigg_dod", "Frigg" },
				{ "piece_shrine_offeritem_frigg_dod", "Offer Infused Gemstones for a blessing" },
				{ "piece_shrine_loki_dod", "Loki" },
				{ "piece_shrine_offeritem_loki_dod", "Offer Skull Tokens for a blessing" },
				{ "prop_npc_spawner_dod", "Mystical Runestone" },
				{ "npc_tina_dod", "Timid Tina the Traveller" },
				{ "npc_tania_dod", "Terrible Tania the Teacher" },
				{ "npc_gary_dod", "Greedy Gary the Green" },
				{ "npc_mandy_dod", "Mad Mandy the Mat Maker" },
				{ "npc_barbara_dod", "Barmy Barbara the Barbarian" },
				{ "npc_sandra_dod", "Soppy Sandra the Shoemaker" },
				{ "npc_daisy_dod", "Daisy the Dandy Dressmaker" },
				{ "npc_cathrine_dod", "Curious Cathrine the Cakemaker" },
				{ "npc_karen_dod", "Crazy Karen the Clockmaker" },
				{ "npc_fletch_dod", "Flinching Fletch the Fletcher" },
				{ "npc_bobby_dod", "Bobby Black the Batt Burgler" },
				{ "npc_jeff_dod", "Jobless Jeff the Joker" },
				{ "npc_bob_dod", "Bob Blobby the Bobsman" },
				{ "npc_fred_dod", "Freaky Fred the Ferryman" },
				{ "npc_barry_dod", "Barking Barry the Bagsman" }
			});
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while adding Localication for Companions: {arg}");
		}
	}

	private void LoadBundle()
	{
		try
		{
			NPCBundle = AssetUtils.LoadAssetBundleFromResources("companions", Assembly.GetExecutingAssembly());
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while loading Companions asset bundle: {arg}");
		}
	}

	private void AddStatsEffects()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected O, but got Unknown
		try
		{
			string[] array = seStatsList;
			foreach (string text in array)
			{
				SE_Stats val = NPCBundle.LoadAsset<SE_Stats>(text);
				if ((Object)(object)val != (Object)null)
				{
					CustomStatusEffect val2 = new CustomStatusEffect((StatusEffect)(object)val, true);
					ItemManager.Instance.AddStatusEffect(val2);
					if (LoggingEnable.Value)
					{
						((BaseUnityPlugin)this).Logger.LogMessage((object)("Added: " + text + " to the Status Effect database"));
					}
				}
				else
				{
					((BaseUnityPlugin)this).Logger.LogMessage((object)("Failed to add: " + text + " to the Status Effect database"));
				}
			}
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while adding SE_Stats Effects: {arg}");
		}
	}

	private void AddShieldEffects()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected O, but got Unknown
		try
		{
			string[] array = seShieldList;
			foreach (string text in array)
			{
				SE_Shield val = NPCBundle.LoadAsset<SE_Shield>(text);
				if ((Object)(object)val != (Object)null)
				{
					CustomStatusEffect val2 = new CustomStatusEffect((StatusEffect)(object)val, true);
					ItemManager.Instance.AddStatusEffect(val2);
					if (LoggingEnable.Value)
					{
						((BaseUnityPlugin)this).Logger.LogMessage((object)("Added: " + text + " to the Status Effect database"));
					}
				}
				else
				{
					((BaseUnityPlugin)this).Logger.LogMessage((object)("Failed to add: " + text + " to the Status Effect database"));
				}
			}
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while adding SE_Shield Effects: {arg}");
		}
	}

	private void AddPrefabs()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected O, but got Unknown
		try
		{
			string[] array = prefabList;
			foreach (string text in array)
			{
				GameObject val = NPCBundle.LoadAsset<GameObject>(text);
				if ((Object)(object)val != (Object)null)
				{
					CustomPrefab val2 = new CustomPrefab(val, true);
					PrefabManager.Instance.AddPrefab(val2);
					if (LoggingEnable.Value)
					{
						((BaseUnityPlugin)this).Logger.LogMessage((object)("Added: " + text + " to the Object database"));
					}
				}
				else
				{
					((BaseUnityPlugin)this).Logger.LogMessage((object)("Failed to add: " + text + " to the object database"));
				}
			}
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while adding prefabs: {arg}");
		}
	}

	private void AddSFX()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected O, but got Unknown
		try
		{
			string[] array = fxList;
			foreach (string text in array)
			{
				GameObject val = NPCBundle.LoadAsset<GameObject>(text);
				if ((Object)(object)val != (Object)null)
				{
					CustomPrefab val2 = new CustomPrefab(val, false);
					PrefabManager.Instance.AddPrefab(val2);
					if (LoggingEnable.Value)
					{
						((BaseUnityPlugin)this).Logger.LogMessage((object)("Added: " + text + " to the Object database"));
					}
				}
				else
				{
					((BaseUnityPlugin)this).Logger.LogMessage((object)("Failed to add: " + text + " to the object database"));
				}
			}
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while adding sfx prefabs: {arg}");
		}
	}

	private void AddMusic()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected O, but got Unknown
		try
		{
			string[] array = musicList;
			foreach (string text in array)
			{
				GameObject val = NPCBundle.LoadAsset<GameObject>(text);
				if ((Object)(object)val != (Object)null)
				{
					CustomPrefab val2 = new CustomPrefab(val, false);
					PrefabManager.Instance.AddPrefab(val2);
					if (LoggingEnable.Value)
					{
						((BaseUnityPlugin)this).Logger.LogMessage((object)("Added: " + text + " to the Object database"));
					}
				}
				else
				{
					((BaseUnityPlugin)this).Logger.LogMessage((object)("Failed to add: " + text + " to the object database"));
				}
			}
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while adding music prefabs: {arg}");
		}
	}

	private void AddItems()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected O, but got Unknown
		try
		{
			string[] array = itemList;
			foreach (string text in array)
			{
				GameObject val = NPCBundle.LoadAsset<GameObject>(text);
				if ((Object)(object)val != (Object)null)
				{
					CustomItem val2 = new CustomItem(val, true);
					ItemManager.Instance.AddItem(val2);
					if (LoggingEnable.Value)
					{
						((BaseUnityPlugin)this).Logger.LogMessage((object)("Added: " + text + " to the item database"));
					}
				}
				else
				{
					((BaseUnityPlugin)this).Logger.LogMessage((object)("Failed to add: " + text + " to the item database"));
				}
			}
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while adding item prefabs: {arg}");
		}
	}

	private void AddCompanions()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected O, but got Unknown
		try
		{
			string[] array = companionList;
			foreach (string text in array)
			{
				GameObject val = NPCBundle.LoadAsset<GameObject>(text);
				if ((Object)(object)val != (Object)null)
				{
					CustomCreature val2 = new CustomCreature(val, true);
					CreatureManager.Instance.AddCreature(val2);
					if (LoggingEnable.Value)
					{
						((BaseUnityPlugin)this).Logger.LogMessage((object)("Added monster: " + text));
					}
				}
				else
				{
					((BaseUnityPlugin)this).Logger.LogMessage((object)("Failed to add: " + text + " to the object database"));
				}
			}
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while adding monsters: {arg}");
		}
	}

	private void AddBosses()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected O, but got Unknown
		try
		{
			string[] array = bossList;
			foreach (string text in array)
			{
				GameObject val = NPCBundle.LoadAsset<GameObject>(text);
				if ((Object)(object)val != (Object)null)
				{
					CustomCreature val2 = new CustomCreature(val, true);
					CreatureManager.Instance.AddCreature(val2);
					if (LoggingEnable.Value)
					{
						((BaseUnityPlugin)this).Logger.LogMessage((object)("Added monster: " + text));
					}
				}
				else
				{
					((BaseUnityPlugin)this).Logger.LogMessage((object)("Failed to add: " + text + " to the object database"));
				}
			}
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while adding monsters: {arg}");
		}
	}

	private void AddSpawners()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected O, but got Unknown
		try
		{
			string[] array = spawnersList;
			foreach (string text in array)
			{
				GameObject val = NPCBundle.LoadAsset<GameObject>(text);
				if ((Object)(object)val != (Object)null)
				{
					CustomPrefab val2 = new CustomPrefab(val, true);
					PrefabManager.Instance.AddPrefab(val2);
					if (LoggingEnable.Value)
					{
						((BaseUnityPlugin)this).Logger.LogMessage((object)("Added: " + text + " to the Object database"));
					}
				}
				else
				{
					((BaseUnityPlugin)this).Logger.LogMessage((object)("Failed to add: " + text + " to the object database"));
				}
			}
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while adding spawners: {arg}");
		}
	}

	private void FixSFX()
	{
		try
		{
			AudioSource prefab = Cache.GetPrefab<AudioSource>("sfx_arrow_hit");
			string[] array = fxList;
			foreach (string text in array)
			{
				GameObject prefab2 = Cache.GetPrefab<GameObject>(text);
				prefab2.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = prefab.outputAudioMixerGroup;
				if (LoggingEnable.Value)
				{
					((BaseUnityPlugin)this).Logger.LogMessage((object)("Audio Mixer: SFX, set on: " + text));
				}
			}
			AudioSource prefab3 = Cache.GetPrefab<AudioSource>("Music_FulingCamp");
			string[] array2 = musicList;
			foreach (string text2 in array2)
			{
				GameObject prefab4 = Cache.GetPrefab<GameObject>(text2);
				prefab4.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = prefab3.outputAudioMixerGroup;
				if (LoggingEnable.Value)
				{
					((BaseUnityPlugin)this).Logger.LogMessage((object)("Audio Mixer: Music Ontop, set on: " + text2));
				}
			}
		}
		catch
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Mixer Fix Failed");
		}
	}

	private void AddNPCLocations()
	{
		//IL_0085: 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_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: 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)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Expected O, but got Unknown
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Expected O, but got Unknown
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_0190: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: 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)
		//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c9: Expected O, but got Unknown
		//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ce: Expected O, but got Unknown
		//IL_0265: Unknown result type (might be due to invalid IL or missing references)
		//IL_026a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0272: 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_0282: Unknown result type (might be due to invalid IL or missing references)
		//IL_028e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0296: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b3: Expected O, but got Unknown
		//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b8: Expected O, but got Unknown
		//IL_034f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0354: Unknown result type (might be due to invalid IL or missing references)
		//IL_035c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0364: Unknown result type (might be due to invalid IL or missing references)
		//IL_036c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0378: Unknown result type (might be due to invalid IL or missing references)
		//IL_0380: Unknown result type (might be due to invalid IL or missing references)
		//IL_038c: Unknown result type (might be due to invalid IL or missing references)
		//IL_039d: Expected O, but got Unknown
		//IL_0398: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a2: Expected O, but got Unknown
		try
		{
			AudioSource prefab = Cache.GetPrefab<AudioSource>("sfx_arrow_hit");
			AudioSource prefab2 = Cache.GetPrefab<AudioSource>("Music_FulingCamp");
			GameObject val = ZoneManager.Instance.CreateLocationContainer(NPCBundle.LoadAsset<GameObject>("Loc_NPCCamp_DoD"));
			if ((Object)(object)val == (Object)null)
			{
				if (LoggingEnable.Value)
				{
					((BaseUnityPlugin)this).Logger.LogWarning((object)"Locations not found");
				}
			}
			else
			{
				val.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = prefab.outputAudioMixerGroup;
				ZoneManager.Instance.AddCustomLocation(new CustomLocation(val, true, new LocationConfig
				{
					Biome = (Biome)512,
					Quantity = 3,
					Priotized = true,
					ExteriorRadius = 32f,
					ClearArea = true,
					MinAltitude = 0.25f,
					MinDistanceFromSimilar = 1000f,
					Unique = true
				}));
				if (LoggingEnable.Value)
				{
					((BaseUnityPlugin)this).Logger.LogMessage((object)"Location Added: Mistlands NPC Camp");
				}
			}
			GameObject val2 = ZoneManager.Instance.CreateLocationContainer(NPCBundle.LoadAsset<GameObject>("Loc_ShrineOdin_DoD"));
			if ((Object)(object)val2 == (Object)null)
			{
				if (LoggingEnable.Value)
				{
					((BaseUnityPlugin)this).Logger.LogWarning((object)"Loc_ShrineOdin_DoD not found");
				}
			}
			else
			{
				val2.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = prefab2.outputAudioMixerGroup;
				ZoneManager.Instance.AddCustomLocation(new CustomLocation(val2, true, new LocationConfig
				{
					Biome = (Biome)512,
					Quantity = 3,
					Priotized = true,
					ExteriorRadius = 6f,
					ClearArea = true,
					MinAltitude = 0.25f,
					MinDistanceFromSimilar = 1000f
				}));
				if (LoggingEnable.Value)
				{
					((BaseUnityPlugin)this).Logger.LogMessage((object)"Location Added: Odin Shrine");
				}
			}
			GameObject val3 = ZoneManager.Instance.CreateLocationContainer(NPCBundle.LoadAsset<GameObject>("Loc_ShrineLoki_DoD"));
			if ((Object)(object)val3 == (Object)null)
			{
				if (LoggingEnable.Value)
				{
					((BaseUnityPlugin)this).Logger.LogWarning((object)"Loc_ShrineLoki_DoD not found");
				}
			}
			else
			{
				val3.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = prefab2.outputAudioMixerGroup;
				ZoneManager.Instance.AddCustomLocation(new CustomLocation(val3, true, new LocationConfig
				{
					Biome = (Biome)2,
					Quantity = 3,
					Priotized = true,
					ExteriorRadius = 6f,
					ClearArea = true,
					MinAltitude = 0.25f,
					MinDistanceFromSimilar = 1000f
				}));
				if (LoggingEnable.Value)
				{
					((BaseUnityPlugin)this).Logger.LogMessage((object)"Location Added: Loki Shrine");
				}
			}
			GameObject val4 = ZoneManager.Instance.CreateLocationContainer(NPCBundle.LoadAsset<GameObject>("Loc_ShrineFrigg_DoD"));
			if ((Object)(object)val4 == (Object)null)
			{
				if (LoggingEnable.Value)
				{
					((BaseUnityPlugin)this).Logger.LogWarning((object)"Loc_ShrineFrigg_DoD not found");
				}
				return;
			}
			val4.GetComponentInChildren<AudioSource>().outputAudioMixerGroup = prefab2.outputAudioMixerGroup;
			ZoneManager.Instance.AddCustomLocation(new CustomLocation(val4, true, new LocationConfig
			{
				Biome = (Biome)8,
				Quantity = 3,
				Priotized = true,
				ExteriorRadius = 6f,
				ClearArea = true,
				MinAltitude = 0.25f,
				MinDistanceFromSimilar = 1000f
			}));
			if (LoggingEnable.Value)
			{
				((BaseUnityPlugin)this).Logger.LogMessage((object)"Location Added: Frigg Shrine");
			}
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while adding Companion Locations: {arg}");
		}
		finally
		{
			ZoneManager.OnVanillaLocationsAvailable -= AddNPCLocations;
			NPCBundle.Unload(false);
		}
	}

	public static void ConfigureNPCSpawners(ISpawnerConfigurationCollection config)
	{
		try
		{
			ConfigureWorldSpawner(config);
		}
		catch (Exception ex)
		{
			Console.WriteLine("Something went horribly wrong: " + ex.Message + "\nStackTrace:\n" + ex.StackTrace);
		}
	}

	private static void ConfigureWorldSpawner(ISpawnerConfigurationCollection config)
	{
		try
		{
			ISpawnerConfigurationCollectionWorldSpawnerExtensions.ConfigureWorldSpawner(config, 29000u).SetPrefabName("HumanNPCBob_DoD").SetTemplateName("NPC")
				.SetConditionBiomes((Biome[])(object)new Biome[1] { (Biome)1 })
				.SetSpawnChance(10f)
				.SetSpawnInterval(TimeSpan.FromSeconds(300.0))
				.SetPackSizeMin(1u)
				.SetPackSizeMax(1u)
				.SetMaxSpawned(1u);
			ISpawnerConfigurationCollectionWorldSpawnerExtensions.ConfigureWorldSpawner(config, 29001u).SetPrefabName("HumanNPCFred_DoD").SetTemplateName("NPC")
				.SetConditionBiomes((Biome[])(object)new Biome[1] { (Biome)8 })
				.SetSpawnChance(10f)
				.SetSpawnInterval(TimeSpan.FromSeconds(300.0))
				.SetPackSizeMin(1u)
				.SetPackSizeMax(1u)
				.SetMaxSpawned(1u);
			ISpawnerConfigurationCollectionWorldSpawnerExtensions.ConfigureWorldSpawner(config, 29002u).SetPrefabName("HumanNPCBarry_DoD").SetTemplateName("NPC")
				.SetConditionBiomes((Biome[])(object)new Biome[1] { (Biome)2 })
				.SetSpawnChance(10f)
				.SetSpawnInterval(TimeSpan.FromSeconds(300.0))
				.SetPackSizeMin(1u)
				.SetPackSizeMax(1u)
				.SetMaxSpawned(1u);
			ISpawnerConfigurationCollectionWorldSpawnerExtensions.ConfigureWorldSpawner(config, 29003u).SetPrefabName("HumanNPCBobby_DoD").SetTemplateName("NPC")
				.SetConditionBiomes((Biome[])(object)new Biome[1] { (Biome)4 })
				.SetSpawnChance(10f)
				.SetSpawnInterval(TimeSpan.FromSeconds(300.0))
				.SetPackSizeMin(1u)
				.SetPackSizeMax(1u)
				.SetMaxSpawned(1u);
			ISpawnerConfigurationCollectionWorldSpawnerExtensions.ConfigureWorldSpawner(config, 29004u).SetPrefabName("HumanNPCJeff_DoD").SetTemplateName("NPC")
				.SetConditionBiomes((Biome[])(object)new Biome[1] { (Biome)16 })
				.SetSpawnChance(10f)
				.SetSpawnInterval(TimeSpan.FromSeconds(300.0))
				.SetPackSizeMin(1u)
				.SetPackSizeMax(1u)
				.SetMaxSpawned(1u);
			ISpawnerConfigurationCollectionWorldSpawnerExtensions.ConfigureWorldSpawner(config, 29005u).SetPrefabName("HumanNPCFletch_DoD").SetTemplateName("NPC")
				.SetConditionBiomes((Biome[])(object)new Biome[1] { (Biome)512 })
				.SetSpawnChance(10f)
				.SetSpawnInterval(TimeSpan.FromSeconds(300.0))
				.SetPackSizeMin(1u)
				.SetPackSizeMax(1u)
				.SetMaxSpawned(1u);
			ISpawnerConfigurationCollectionWorldSpawnerExtensions.ConfigureWorldSpawner(config, 29006u).SetPrefabName("HumanNPCMandy_DoD").SetTemplateName("NPC")
				.SetConditionBiomes((Biome[])(object)new Biome[1] { (Biome)1 })
				.SetSpawnChance(10f)
				.SetSpawnInterval(TimeSpan.FromSeconds(300.0))
				.SetPackSizeMin(1u)
				.SetPackSizeMax(1u)
				.SetMaxSpawned(1u);
			ISpawnerConfigurationCollectionWorldSpawnerExtensions.ConfigureWorldSpawner(config, 29007u).SetPrefabName("HumanNPCBarbara_DoD").SetTemplateName("NPC")
				.SetConditionBiomes((Biome[])(object)new Biome[1] { (Biome)8 })
				.SetSpawnChance(10f)
				.SetSpawnInterval(TimeSpan.FromSeconds(300.0))
				.SetPackSizeMin(1u)
				.SetPackSizeMax(1u)
				.SetMaxSpawned(1u);
			ISpawnerConfigurationCollectionWorldSpawnerExtensions.ConfigureWorldSpawner(config, 29008u).SetPrefabName("HumanNPCSandra_DoD").SetTemplateName("NPC")
				.SetConditionBiomes((Biome[])(object)new Biome[1] { (Biome)2 })
				.SetSpawnChance(10f)
				.SetSpawnInterval(TimeSpan.FromSeconds(300.0))
				.SetPackSizeMin(1u)
				.SetPackSizeMax(1u)
				.SetMaxSpawned(1u);
			ISpawnerConfigurationCollectionWorldSpawnerExtensions.ConfigureWorldSpawner(config, 29009u).SetPrefabName("HumanNPCDaisy_DoD").SetTemplateName("NPC")
				.SetConditionBiomes((Biome[])(object)new Biome[1] { (Biome)4 })
				.SetSpawnChance(10f)
				.SetSpawnInterval(TimeSpan.FromSeconds(300.0))
				.SetPackSizeMin(1u)
				.SetPackSizeMax(1u)
				.SetMaxSpawned(1u);
			ISpawnerConfigurationCollectionWorldSpawnerExtensions.ConfigureWorldSpawner(config, 29010u).SetPrefabName("HumanNPCCathrine_DoD").SetTemplateName("NPC")
				.SetConditionBiomes((Biome[])(object)new Biome[1] { (Biome)16 })
				.SetSpawnChance(10f)
				.SetSpawnInterval(TimeSpan.FromSeconds(300.0))
				.SetPackSizeMin(1u)
				.SetPackSizeMax(1u)
				.SetMaxSpawned(1u);
			ISpawnerConfigurationCollectionWorldSpawnerExtensions.ConfigureWorldSpawner(config, 29011u).SetPrefabName("HumanNPCKaren_DoD").SetTemplateName("NPC")
				.SetConditionBiomes((Biome[])(object)new Biome[1] { (Biome)512 })
				.SetSpawnChance(10f)
				.SetSpawnInterval(TimeSpan.FromSeconds(300.0))
				.SetPackSizeMin(1u)
				.SetPackSizeMax(1u)
				.SetMaxSpawned(1u);
		}
		catch (Exception ex)
		{
			Log.LogError((object)ex);
		}
	}
}