Decompiled source of CalderaTweaks v0.5.1

plugins/CalderaTweaks.dll

Decompiled 3 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using NodeCanvas.DialogueTrees;
using NodeCanvas.Framework;
using NodeCanvas.Tasks.Actions;
using SideLoader;
using SideLoader.Model;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("OutwardModTemplate")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OutwardModTemplate")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c5450fe0-edcf-483f-b9ea-4b1ef9d36da7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace CalderaConfig
{
	public static class GameObjectFinder
	{
		public static GameObject[] FindAllInPaths(List<string> basePaths, string targetName)
		{
			List<GameObject> list = new List<GameObject>();
			foreach (string basePath in basePaths)
			{
				GameObject val = GameObject.Find(basePath.TrimEnd(new char[1] { '/' }));
				if (!((Object)(object)val == (Object)null))
				{
					SearchChildren(val.transform, targetName, list);
				}
			}
			return list.ToArray();
		}

		private static void SearchChildren(Transform parent, string targetName, List<GameObject> results)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			if (((Object)parent).name == targetName)
			{
				results.Add(((Component)parent).gameObject);
			}
			foreach (Transform item in parent)
			{
				Transform parent2 = item;
				SearchChildren(parent2, targetName, results);
			}
		}
	}
}
namespace CalderaTweaks
{
	public static class ConfigElements
	{
		public static ConfigEntry<int> oreSampleFunds;

		public static ConfigEntry<int> oreSampleMaterial;

		public static ConfigEntry<int> oreSampleMaterialHigh;

		public static ConfigEntry<int> plantSampleFunds;

		public static ConfigEntry<int> plantSampleMaterial;

		public static ConfigEntry<int> plantSampleMaterialHigh;

		public static ConfigEntry<int> molepigSampleFunds;

		public static ConfigEntry<int> molepigSampleMaterial;

		public static ConfigEntry<int> molepigSampleMaterialHigh;

		public static ConfigEntry<int> fromTheAshesFundReward;

		public static ConfigEntry<float> oreSampleWeight;

		public static ConfigEntry<float> plantSampleWeight;

		public static ConfigEntry<float> molepigSampleWeight;

		public static ConfigEntry<float> foodStoreLCookingKitChance;

		public static ConfigEntry<float> generalStoreLCookingKitChance;

		public static ConfigEntry<float> generalStoreLAlchemyKitChance;

		public static ConfigEntry<float> alchemyStoreLAlchemyKitChance;

		public static ConfigEntry<bool> giantsSaunaStashPay;

		public static ConfigEntry<bool> giantsSaunaStash;

		public static ConfigEntry<bool> kitLegacy;

		public static ConfigEntry<bool> shortcutRiverOfRed;

		public static ConfigEntry<bool> shortcutChalcedonyMine;

		public static ConfigEntry<bool> shortcutSteamBath;

		public static ConfigEntry<bool> shortcutMyrmitaur;

		public static ConfigEntry<bool> shortcutOutflowPipe;

		public static ConfigEntry<bool> predictableArkRotation;

		public static ConfigEntry<float> calygreyArenaRareMaterials;

		public static ConfigEntry<bool> shortcutTowerOfRegrets;

		public static void Init(ConfigFile config)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Expected O, but got Unknown
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Expected O, but got Unknown
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Expected O, but got Unknown
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Expected O, but got Unknown
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Expected O, but got Unknown
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Expected O, but got Unknown
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Expected O, but got Unknown
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Expected O, but got Unknown
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Expected O, but got Unknown
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Expected O, but got Unknown
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Expected O, but got Unknown
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Expected O, but got Unknown
			//IL_0387: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Expected O, but got Unknown
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Expected O, but got Unknown
			//IL_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_040b: Expected O, but got Unknown
			//IL_0427: Unknown result type (might be due to invalid IL or missing references)
			//IL_0431: Expected O, but got Unknown
			//IL_044d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0457: Expected O, but got Unknown
			//IL_0473: Unknown result type (might be due to invalid IL or missing references)
			//IL_047d: Expected O, but got Unknown
			//IL_0499: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Expected O, but got Unknown
			//IL_04bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c9: Expected O, but got Unknown
			//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ef: Expected O, but got Unknown
			//IL_051e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0528: Expected O, but got Unknown
			oreSampleFunds = config.Bind<int>("Expedition (Evangeline)", "Ore Sample, Funds", 5000, new ConfigDescription("How many funds does the Ore Samples give? (Vanila = 1000)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10000), new object[0]));
			oreSampleMaterial = config.Bind<int>("Expedition (Evangeline)", "Ore Sample, Stone", 40, new ConfigDescription("How much stone does the Ore Samples give? (Vanila = 40)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 300), new object[0]));
			oreSampleMaterialHigh = config.Bind<int>("Expedition (Evangeline)", "Ore Sample, Stone (large)", 80, new ConfigDescription("How much stone does the Ore Samples give when lucky? (Vanila = 80)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 300), new object[0]));
			plantSampleFunds = config.Bind<int>("Expedition (Evangeline)", "Plant Sample, Funds", 1000, new ConfigDescription("How many funds does the Plant Samples give? (Vanila = 1000)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10000), new object[0]));
			plantSampleMaterial = config.Bind<int>("Expedition (Evangeline)", "Plant Sample, Timber", 60, new ConfigDescription("How much timber does the Plant Samples give? (Vanila = 40)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 300), new object[0]));
			plantSampleMaterialHigh = config.Bind<int>("Expedition (Evangeline)", "Plant Sample, Timber (large)", 120, new ConfigDescription("How much timber does the Plant Samples give when lucky? (Vanila = 80)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 300), new object[0]));
			molepigSampleFunds = config.Bind<int>("Expedition (Evangeline)", "Molepig Specimen, Funds", 1000, new ConfigDescription("How many funds does the Molepig Specimen give? (Vanila = 1000)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10000), new object[0]));
			molepigSampleMaterial = config.Bind<int>("Expedition (Evangeline)", "Molepig Specimen, Food", 200, new ConfigDescription("How much food does the Molepig Specimen give? (Vanila = 200)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 300), new object[0]));
			molepigSampleMaterialHigh = config.Bind<int>("Expedition (Evangeline)", "Molepig Specimen, Food (large)", 300, new ConfigDescription("How much food does the Molepig Specimen give when lucky? (Vanila = 300)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 300), new object[0]));
			fromTheAshesFundReward = config.Bind<int>("From The Ashes Quest Reward", "Funds", 10000, new ConfigDescription("How many funds are given as a reward from completing From The Ashes successfully? (Vanila = 5000)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20000), new object[0]));
			oreSampleWeight = config.Bind<float>("Sample Weight", "Ore Sample", 4f, new ConfigDescription("How much does the Ore Sample weigh? (Vanila = 6)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), new object[0]));
			plantSampleWeight = config.Bind<float>("Sample Weight", "Plant Sample", 1f, new ConfigDescription("How much does the Plant Sample weigh? (Vanila = 6)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), new object[0]));
			molepigSampleWeight = config.Bind<float>("Sample Weight", "Molepig Specimen Sample", 2f, new ConfigDescription("How much does the Molepig Specimen weigh? (Vanila = 6)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), new object[0]));
			foodStoreLCookingKitChance = config.Bind<float>("Chance of Lightweight Kits from New Sirocco Stores", "Food Store: Lightweight Cooking Pot", 0.1f, new ConfigDescription("Chance of getting a Lightweight Cooking Pot from the New Sirocco Food Store?", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), new object[0]));
			generalStoreLCookingKitChance = config.Bind<float>("Chance of Lightweight Kits from New Sirocco Stores", "General Store: Lightweight Cooking Pot", 1f, new ConfigDescription("Chance of getting a Lightweight Cooking Pot from the New Sirocco General Store?", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), new object[0]));
			generalStoreLAlchemyKitChance = config.Bind<float>("Chance of Lightweight Kits from New Sirocco Stores", "General Store: Lightweight Alchemy Kit", 1f, new ConfigDescription("Chance of getting a Lightweight Alchemy Kit from the New Sirocco General Store?", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), new object[0]));
			alchemyStoreLAlchemyKitChance = config.Bind<float>("Chance of Lightweight Kits from New Sirocco Stores", "Alchemist Store: Lightweight Alchemy Kit", 0.1f, new ConfigDescription("Chance of getting a Lightweight Alchemy Kit from the New Sirocco Alchemist Store?", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), new object[0]));
			giantsSaunaStashPay = config.Bind<bool>("Stash", "Giants Sauna, Paywalled", true, (ConfigDescription)null);
			giantsSaunaStash = config.Bind<bool>("Stash", "Giants Sauna, Not Paywalled", false, (ConfigDescription)null);
			kitLegacy = config.Bind<bool>("Legacy Upgrade Crafting Station Items", "Cooking Pot and Alchemy Kit", true, new ConfigDescription("Allows the Cooking Pot and the Alchemy Kit to be legacy chest upgraded into the lightweight version.", (AcceptableValueBase)null, Array.Empty<object>()));
			shortcutRiverOfRed = config.Bind<bool>("Shortcuts", "New Sirocco Mines and River of Red", true, new ConfigDescription("Unlocks a shortcut between the New Sirocco Mines and the River of Red.", (AcceptableValueBase)null, Array.Empty<object>()));
			shortcutChalcedonyMine = config.Bind<bool>("Shortcuts", "Caldera and The Grotto of Chalcedony", true, new ConfigDescription("Unlocks a 'shortcut' between Caldera and a hidden section of The Grotto of Chalcedony.", (AcceptableValueBase)null, Array.Empty<object>()));
			shortcutSteamBath = config.Bind<bool>("Shortcuts", "Steam Bath Tunnels and Oily Cavern", true, new ConfigDescription("Unlocks a shortcut between Steam Bath Tunnels and Oily Cavern.", (AcceptableValueBase)null, Array.Empty<object>()));
			shortcutMyrmitaur = config.Bind<bool>("Shortcuts", "Myrmitaur Haven (Outside)", true, new ConfigDescription("Unlocks a shortcut at the Myrmitaur Haven Exterior.", (AcceptableValueBase)null, Array.Empty<object>()));
			shortcutOutflowPipe = config.Bind<bool>("Shortcuts", "Refinery Outflow Pipe (Outside)", true, new ConfigDescription("Unlocks a shortcut at the Refinery Outflow Pipe.", (AcceptableValueBase)null, Array.Empty<object>()));
			shortcutTowerOfRegrets = config.Bind<bool>("Shortcuts", "Tower of Regrets (Outside)", true, new ConfigDescription("Unlocks a shortcuts at the Tower of Regrets.", (AcceptableValueBase)null, Array.Empty<object>()));
			predictableArkRotation = config.Bind<bool>("Ark of the Exiled", "Consistent ark rotation", true, new ConfigDescription("Ark will always move every 2 days in a clockwise rotation.", (AcceptableValueBase)null, Array.Empty<object>()));
			calygreyArenaRareMaterials = config.Bind<float>("Calygrey Arena", "Rare Material", 0.67f, new ConfigDescription("Chance of getting Rare Materials from the loot of the Calygrey Arena Chest.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), new object[0]));
		}
	}
	public static class DiceConverter
	{
		public static (int sidesA, int sidesB, int totalSides) ProbabilityToDie(double p, int maxSides = 100)
		{
			if (p < 0.0 || p > 1.0)
			{
				throw new ArgumentOutOfRangeException("p", "Probability must be between 0 and 1.");
			}
			if (maxSides < 1)
			{
				throw new ArgumentOutOfRangeException("maxSides", "Die must have at least 1 side.");
			}
			int num = 0;
			int num2 = 1;
			double num3 = Math.Abs(p - 0.0);
			for (int i = 1; i <= maxSides; i++)
			{
				int num4 = (int)Math.Round(p * (double)i);
				double num5 = (double)num4 / (double)i;
				double num6 = Math.Abs(p - num5);
				if (num6 < num3)
				{
					num = num4;
					num2 = i;
					num3 = num6;
				}
			}
			int item = num;
			int item2 = num2 - num;
			return (item, item2, num2);
		}
	}
	public class InteractionSwitchAreaCustom : InteractionSwitchArea
	{
		public Vector3 position;

		public Vector3 rotation;

		public override void OnActivate()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			((InteractionSwitchArea)this).OnActivate();
			CalderaTweaksPlugin.teleportPositon = position;
			CalderaTweaksPlugin.teleportRotation = rotation;
			CalderaTweaksPlugin.teleportQueued = true;
			CalderaTweaksPlugin.teleportScene = base.Area;
		}
	}
	[BepInPlugin("johbenji.calderatweaks", "Caldera Tweaks", "0.7.0")]
	public class CalderaTweaksPlugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <DelaySceneHandlingMethod>d__35 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public CalderaTweaksPlugin <>4__this;

			private bool <hasTeleported>5__1;

			private DictionaryExt<string, string> <playercharacters>5__2;

			private int <i>5__3;

			private string <key>5__4;

			private string <value>5__5;

			private Character <character>5__6;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DelaySceneHandlingMethod>d__35(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<playercharacters>5__2 = null;
				<key>5__4 = null;
				<value>5__5 = null;
				<character>5__6 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_0074: Invalid comparison between Unknown and I4
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_0091: Expected O, but got Unknown
				//IL_015b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0160: Unknown result type (might be due to invalid IL or missing references)
				//IL_024a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0254: Expected O, but got Unknown
				//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ca: Expected O, but got Unknown
				//IL_0336: Unknown result type (might be due to invalid IL or missing references)
				//IL_0340: Expected O, but got Unknown
				//IL_0394: Unknown result type (might be due to invalid IL or missing references)
				//IL_039e: Expected O, but got Unknown
				//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f6: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<hasTeleported>5__1 = false;
					if (teleportQueued && (int)teleportScene == AreaManager.Instance.CurrentArea.ID)
					{
						<>2__current = (object)new WaitForSeconds(0.5f);
						<>1__state = 1;
						return true;
					}
					goto IL_01b6;
				case 1:
					<>1__state = -1;
					teleportQueued = false;
					<hasTeleported>5__1 = true;
					<playercharacters>5__2 = CharacterManager.Instance.PlayerCharacters;
					<i>5__3 = 0;
					while (<i>5__3 < <playercharacters>5__2.Count)
					{
						<key>5__4 = <playercharacters>5__2.Keys.ElementAt(<i>5__3);
						<value>5__5 = <playercharacters>5__2.Values.ElementAt(<i>5__3);
						<character>5__6 = CharacterManager.Instance.GetCharacter(<value>5__5);
						if ((Object)(object)<character>5__6 != (Object)null)
						{
							Log.LogMessage((object)("Teleporting player " + <playercharacters>5__2.Keys.ElementAt(<i>5__3)));
							<character>5__6.Teleport(teleportPositon, teleportRotation);
						}
						<key>5__4 = null;
						<value>5__5 = null;
						<character>5__6 = null;
						<i>5__3++;
					}
					<playercharacters>5__2 = null;
					goto IL_01b6;
				case 2:
					<>1__state = -1;
					goto IL_0207;
				case 3:
					<>1__state = -1;
					goto IL_0265;
				case 4:
					<>1__state = -1;
					goto IL_02db;
				case 5:
					<>1__state = -1;
					goto IL_0351;
				case 6:
					{
						<>1__state = -1;
						goto IL_03af;
					}
					IL_0265:
					<>4__this.RemoveChestRigidBodyComponent();
					<>4__this.NewSiroccoMinesShortCut();
					<>4__this.OilyCavernToSteamBath();
					goto IL_028a;
					IL_028a:
					if (AreaManager.Instance.CurrentArea.SceneName == "Caldera")
					{
						if (!<hasTeleported>5__1)
						{
							<>2__current = (object)new WaitForSeconds(0.5f);
							<>1__state = 4;
							return true;
						}
						goto IL_02db;
					}
					goto IL_0300;
					IL_0351:
					<>4__this.AddTeleportToCalderaFromDG5();
					goto IL_035e;
					IL_035e:
					if (!(AreaManager.Instance.CurrentArea.SceneName == "Caldera_Dungeon1"))
					{
						break;
					}
					if (!<hasTeleported>5__1)
					{
						<>2__current = (object)new WaitForSeconds(0.5f);
						<>1__state = 6;
						return true;
					}
					goto IL_03af;
					IL_01b6:
					if (AreaManager.Instance.CurrentArea.SceneName == "NewSirocco")
					{
						if (!<hasTeleported>5__1)
						{
							<>2__current = (object)new WaitForSeconds(0.5f);
							<>1__state = 2;
							return true;
						}
						goto IL_0207;
					}
					goto IL_0214;
					IL_02db:
					<>4__this.RefineryShortcut();
					<>4__this.CalderaToChalcedonyCaveShortcut();
					<>4__this.CalderaToTowerOfRegrets();
					goto IL_0300;
					IL_0300:
					if (AreaManager.Instance.CurrentArea.SceneName == "Caldera_Dungeon5")
					{
						if (!<hasTeleported>5__1)
						{
							<>2__current = (object)new WaitForSeconds(0.5f);
							<>1__state = 5;
							return true;
						}
						goto IL_0351;
					}
					goto IL_035e;
					IL_0207:
					<>4__this.SceneHandlingMethod();
					goto IL_0214;
					IL_0214:
					if (AreaManager.Instance.CurrentArea.SceneName == "CalderaDungeonsSmall")
					{
						if (!<hasTeleported>5__1)
						{
							<>2__current = (object)new WaitForSeconds(0.5f);
							<>1__state = 3;
							return true;
						}
						goto IL_0265;
					}
					goto IL_028a;
					IL_03af:
					<>4__this.SteambathToOilyCavern();
					break;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public const string GUID = "johbenji.calderatweaks";

		public const string NAME = "Caldera Tweaks";

		public const string VERSION = "0.7.0";

		internal static ManualLogSource Log;

		private static int payChestID = -78005;

		private static string paychestName = "Stash Pack Paywalled";

		private static int freeChestID = -78006;

		private static string freechestName = "Stash Pack NoPaywall";

		public static Vector3 teleportPositon = new Vector3(0f, 0f, 0f);

		public static Vector3 teleportRotation = new Vector3(0f, 0f, 0f);

		public static bool teleportQueued = false;

		public static AreaEnum teleportScene;

		public bool isSubscribedToOnDayEvent = false;

		public static CalderaTweaksPlugin Instance { get; private set; }

		internal void Awake()
		{
			Instance = this;
			ConfigElements.Init(((BaseUnityPlugin)this).Config);
			Log = ((BaseUnityPlugin)this).Logger;
			SL.OnSceneLoaded += SceneManager_sceneLoaded;
			setSampleWeight();
			setLightWeightKitStoreDropTable();
			setStash();
			setLighKitLegacy();
			setCalygreyArenaRewards();
		}

		private void setCalygreyArenaRewards()
		{
			if (ConfigElements.calygreyArenaRareMaterials.Value > 0f)
			{
				string sourceUID = "DropTable_Caldera_Equipment_WeaponSmoke_1";
				string text = "DT_johbenji.CalygreyArenaRareMaterials";
				List<int> itemIDs = new List<int> { 6000360, 6000370, 6000400, 6000350, 6000450, 6000430, 6000390, 6000440, 6000410 };
				setDropTableItems(text, itemIDs, ConfigElements.calygreyArenaRareMaterials.Value);
				setItemSource(text + "DTA", sourceUID, text);
			}
		}

		private void setLighKitLegacy()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_0039: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			if (ConfigElements.kitLegacy.Value)
			{
				((ContentTemplate)new SL_Item
				{
					Target_ItemID = 5010100,
					New_ItemID = 5010100,
					Name = "Cooking Pot",
					Description = "Heavy pot that enables the preparation of recipes with more than one ingredient, to be used on a lit campfire.",
					LegacyItemID = 5010105
				}).ApplyTemplate();
				((ContentTemplate)new SL_Item
				{
					Target_ItemID = 5010200,
					New_ItemID = 5010200,
					Name = "Alchemy Kit",
					Description = "Tools used to distill ingredients into potions, to be used on a lit campfire.",
					LegacyItemID = 5010205
				}).ApplyTemplate();
			}
		}

		private void setLightWeightKitStoreDropTable()
		{
			setStore(ConfigElements.alchemyStoreLAlchemyKitChance.Value, 5010205, "NewSiroccoAlchemyStoreLAlchemyKitDT", "FOpFrLmF1kucItj8NJXfjQ_3-Finished");
			setStore(ConfigElements.foodStoreLCookingKitChance.Value, 5010105, "NewSiroccoFoodStoreLCookingKitDT", "LfgxRx6-dkKEUTdxntBEgQ_3-Finished");
			setStore(ConfigElements.generalStoreLAlchemyKitChance.Value, 5010205, "NewSiroccoGeneralStoreLAlchemyKitDT", "9AIXwwQGCkuX3T0ZOCSbfQ_3-Finished");
			setStore(ConfigElements.generalStoreLCookingKitChance.Value, 5010105, "NewSiroccoGeneralStoreLCookingPotDT", "9AIXwwQGCkuX3T0ZOCSbfQ_3-Finished");
		}

		private void setStash()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			if (ConfigElements.giantsSaunaStash.Value || ConfigElements.giantsSaunaStashPay.Value)
			{
				createTreasureChest(paychestName, payChestID);
				createTreasureChest(freechestName, freeChestID);
				if (ConfigElements.giantsSaunaStashPay.Value)
				{
					((ContentTemplate)new SL_ItemSpawn
					{
						IdentifierName = "johbenji_saunachest_pay",
						ItemID = payChestID,
						Quantity = 1,
						SceneToSpawnIn = "CalderaDungeonsSmall",
						SpawnPosition = new Vector3(1491.341f, 0.2659f, 14.9281f),
						SpawnRotation = new Vector3(0f, 180f, 0f),
						ForceNonPickable = false,
						TryLightFueledContainer = true
					}).ApplyTemplate();
				}
				if (ConfigElements.giantsSaunaStash.Value)
				{
					((ContentTemplate)new SL_ItemSpawn
					{
						IdentifierName = "johbenji_saunachest_free",
						ItemID = freeChestID,
						Quantity = 1,
						SceneToSpawnIn = "CalderaDungeonsSmall",
						SpawnPosition = new Vector3(1485.221f, 0.03f, 21.4986f),
						SpawnRotation = new Vector3(0f, 90f, 0f),
						ForceNonPickable = false,
						TryLightFueledContainer = true
					}).ApplyTemplate();
				}
			}
		}

		private void createTreasureChest(string name, int itemID)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_0066: 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_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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: 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_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: 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_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Expected O, but got Unknown
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0316: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Expected O, but got Unknown
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Expected O, but got Unknown
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0400: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			((ContentTemplate)new SL_TreasureChest
			{
				Target_ItemID = 5300050,
				New_ItemID = itemID,
				Name = name,
				Description = "This backpack allows for tranfering of items to and from an owner's home Stash. In reality it is less a backpack and more a small hole torn through the ethereal plane.",
				LegacyItemID = -1,
				IsPickable = true,
				IsUsable = false,
				QtyRemovedOnUse = 1,
				GroupItemInDisplay = false,
				HasPhysicsWhenWorld = false,
				RepairedInRest = true,
				BehaviorOnNoDurability = (BehaviorOnNoDurabilityType)0,
				CastType = (SpellCastType)(-1),
				CastModifier = (SpellCastModifier)0,
				CastLocomotionEnabled = false,
				OverrideSellModifier = -1f,
				Tags = new List<string> { "StashPack", "Item" }.ToArray(),
				StatsHolder = (SL_ItemStats)new SL_EquipmentStats
				{
					BaseValue = 100,
					RawWeight = 2f,
					MaxDurability = -1,
					Damage_Resistance = new List<float> { 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f }.ToArray(),
					Impact_Resistance = 0f,
					Damage_Protection = 0f,
					Damage_Bonus = new List<float> { 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f, 0f }.ToArray(),
					Impact_Bonus = 0f,
					Stamina_Use_Penalty = 0f,
					Mana_Use_Modifier = 0f,
					Mana_Regen = 0f,
					Movement_Penalty = 0f,
					Pouch_Bonus = 0f,
					Heat_Protection = 0f,
					Cold_Protection = 0f,
					Corruption_Protection = 0f,
					Health_Regen = 0f,
					Cooldown_Reduction = 0f,
					BarrierProtection = 0f,
					GlobalStatusEffectResistance = 0f,
					StaminaRegenModifier = 0f
				},
				ExtensionsEditBehaviour = (EditBehaviours)0,
				ItemExtensions = new List<SL_ItemExtension> { (SL_ItemExtension)new SL_Preserver
				{
					NullifyPerish = true
				} }.ToArray(),
				EffectBehaviour = (EditBehaviours)1,
				ItemVisuals = new SL_ItemVisual
				{
					ResourcesPrefabPath = "Assets/_Prefabs/_ItemsAssets/1000000_Containers/1000000_Chests/1000000_ChestSimpleA_v",
					Position = new Vector3(0f, -0.0389f, 0f),
					Rotation = new Vector3(270f, 180.00002f, 0f),
					Scale = new Vector3(1f, 1f, 1f)
				},
				SpecialType = (SpecialContainerTypes)4,
				OpenSound = (Sounds)0,
				AllowOverCapacity = true,
				CanContainMoney = true,
				CanReceiveCharacterItems = true,
				CanRemoveItems = true,
				NonSavableContent = false,
				ShowMoneyIfEmpty = false,
				VisibleIfEmpty = true,
				HoldInteractionTime = 0f
			}).ApplyTemplate();
		}

		private void setStore(float probability, int itemID, string dT_UIDbase, string merchantUID)
		{
			if (probability > 0f)
			{
				string text = dT_UIDbase + merchantUID;
				setDropTable(text, itemID, calcEmptyDiceValue(probability), calcDiceValue(probability));
				setItemSource(text + "DTA", merchantUID, text);
				Log.LogMessage((object)$"Droptable set for {itemID} in {dT_UIDbase} with {probability}");
			}
		}

		private int calcDiceValue(float probability)
		{
			float num = probability * 1000f;
			return Mathf.RoundToInt(num);
		}

		private int calcEmptyDiceValue(float probability)
		{
			float num = probability * 1000f;
			int num2 = Mathf.RoundToInt(num);
			return 1000 - num2;
		}

		private void setDropTableItems(string dropTableUID, List<int> itemIDs, float probability)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0033: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Expected O, but got Unknown
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Expected O, but got Unknown
			if (probability == 1f)
			{
				int index = Random.Range(0, itemIDs.Count);
				((ContentTemplate)new SL_DropTable
				{
					UID = dropTableUID,
					GuaranteedDrops = new List<SL_ItemDrop>
					{
						new SL_ItemDrop
						{
							MaxQty = 1,
							MinQty = 1,
							DroppedItemID = itemIDs[index]
						}
					}
				}).ApplyTemplate();
				return;
			}
			float num = probability / (float)itemIDs.Count;
			(int, int, int) tuple = DiceConverter.ProbabilityToDie(num, 20);
			int item = tuple.Item1;
			int item2 = tuple.Item2;
			List<SL_ItemDropChance> list = new List<SL_ItemDropChance>();
			for (int i = 0; i < itemIDs.Count; i++)
			{
				list.Add(new SL_ItemDropChance
				{
					MinQty = 1,
					MaxQty = 1,
					DroppedItemID = itemIDs[i],
					DiceValue = item
				});
			}
			((ContentTemplate)new SL_DropTable
			{
				UID = dropTableUID,
				RandomTables = new List<SL_RandomDropGenerator>
				{
					new SL_RandomDropGenerator
					{
						MinNumberOfDrops = 1,
						MaxNumberOfDrops = 1,
						NoDrop_DiceValue = item2,
						Drops = list
					}
				}
			}).ApplyTemplate();
		}

		private void setDropTable(string dropTableUID, int itemID, int emptyDice, int loadedDice)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_00a7: Expected O, but got Unknown
			//IL_00b2: Expected O, but got Unknown
			//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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			if (emptyDice == 0)
			{
				((ContentTemplate)new SL_DropTable
				{
					UID = dropTableUID,
					GuaranteedDrops = new List<SL_ItemDrop>
					{
						new SL_ItemDrop
						{
							MaxQty = 1,
							MinQty = 1,
							DroppedItemID = itemID
						}
					}
				}).ApplyTemplate();
			}
			else
			{
				((ContentTemplate)new SL_DropTable
				{
					UID = dropTableUID,
					RandomTables = new List<SL_RandomDropGenerator>
					{
						new SL_RandomDropGenerator
						{
							MinNumberOfDrops = 1,
							MaxNumberOfDrops = 1,
							NoDrop_DiceValue = emptyDice,
							Drops = new List<SL_ItemDropChance>
							{
								new SL_ItemDropChance
								{
									MinQty = 1,
									MaxQty = 1,
									DroppedItemID = itemID,
									DiceValue = loadedDice
								}
							}
						}
					}
				}).ApplyTemplate();
			}
		}

		private void setItemSource(string identifier, string sourceUID, string dropTableUID)
		{
			//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_000d: 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)
			((ContentTemplate)new SL_DropTableAddition
			{
				IdentifierName = identifier,
				SelectorTargets = new List<string> { sourceUID },
				DropTableUIDsToAdd = new List<string> { dropTableUID }
			}).ApplyTemplate();
		}

		private void setSampleWeight()
		{
			setSampleTemplate(6000340, "Ore Sample", "A sample of unidentified ore...", ConfigElements.oreSampleWeight.Value);
			setSampleTemplate(6000341, "Ore Sample", "A sample of unidentified ore...", ConfigElements.oreSampleWeight.Value);
			setSampleTemplate(6000342, "Ore Sample", "A sample of unidentified ore...", ConfigElements.oreSampleWeight.Value);
			setSampleTemplate(6000343, "Ore Sample", "A sample of unidentified ore...", ConfigElements.oreSampleWeight.Value);
			setSampleTemplate(6000344, "Ore Sample", "A sample of unidentified ore...", ConfigElements.oreSampleWeight.Value);
			setSampleTemplate(6000345, "Ore Sample", "A sample of unidentified ore...", ConfigElements.oreSampleWeight.Value);
			setSampleTemplate(6000380, "Plant Sample", "A sample of an unidentified root...", ConfigElements.plantSampleWeight.Value);
			setSampleTemplate(6000381, "Plant Sample", "A sample of an unidentified root...", ConfigElements.plantSampleWeight.Value);
			setSampleTemplate(6000382, "Plant Sample", "A sample of an unidentified root...", ConfigElements.plantSampleWeight.Value);
			setSampleTemplate(6000383, "Plant Sample", "A sample of an unidentified root...", ConfigElements.plantSampleWeight.Value);
			setSampleTemplate(6000384, "Plant Sample", "A sample of an unidentified root...", ConfigElements.plantSampleWeight.Value);
			setSampleTemplate(6000385, "Plant Sample", "A sample of an unidentified root...", ConfigElements.plantSampleWeight.Value);
			setSampleTemplate(6000420, "Molepig Specimen", "An unidentified little runt from a Molepig Warren. It seems cozy in your pack...", ConfigElements.molepigSampleWeight.Value);
			setSampleTemplate(6000421, "Molepig Specimen", "An unidentified little runt from a Molepig Warren. It seems cozy in your pack...", ConfigElements.molepigSampleWeight.Value);
			setSampleTemplate(6000422, "Molepig Specimen", "An unidentified little runt from a Molepig Warren. It seems cozy in your pack...", ConfigElements.molepigSampleWeight.Value);
			setSampleTemplate(6000423, "Molepig Specimen", "An unidentified little runt from a Molepig Warren. It seems cozy in your pack...", ConfigElements.molepigSampleWeight.Value);
			setSampleTemplate(6000424, "Molepig Specimen", "An unidentified little runt from a Molepig Warren. It seems cozy in your pack...", ConfigElements.molepigSampleWeight.Value);
			setSampleTemplate(6000425, "Molepig Specimen", "An unidentified little runt from a Molepig Warren. It seems cozy in your pack...", ConfigElements.molepigSampleWeight.Value);
		}

		private void setSampleTemplate(int itemID, string name, string description, float weight)
		{
			//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_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: 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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_0054: Expected O, but got Unknown
			((ContentTemplate)new SL_Item
			{
				Target_ItemID = itemID,
				New_ItemID = itemID,
				Name = name,
				Description = description,
				StatsHolder = new SL_ItemStats
				{
					BaseValue = 30,
					RawWeight = weight,
					MaxDurability = -1
				}
			}).ApplyTemplate();
		}

		internal void UpdateArk()
		{
			if (ConfigElements.predictableArkRotation.Value)
			{
				float num = EnvironmentConditions.GameTimeF / 24f;
				int num2 = Mathf.FloorToInt(num);
				int[] array = new int[12]
				{
					0, 0, 1, 1, 2, 2, 3, 3, 4, 4,
					5, 5
				};
				int num3 = array[(num2 - 1) % 12];
				Log.LogMessage((object)$"Set Ark Position to Index (day: {num}): {num3}");
				setArkRotation(num3);
			}
		}

		private void setArkRotation(int arkRotation)
		{
			QuestEventManager instance = QuestEventManager.Instance;
			List<string> list = new List<string> { "Caldera_FortressPosA", "Caldera_FortressPosB", "Caldera_FortressPosC", "Caldera_FortressPosD", "Caldera_FortressPosE", "Caldera_FortressPosF" };
			IList<QuestEventData> currentQuestEvents = instance.CurrentQuestEvents;
			for (int i = 0; i < currentQuestEvents.Count; i++)
			{
				QuestEventData val = currentQuestEvents[i];
				if (list.Contains(val.Name))
				{
					Log.LogMessage((object)("Removing existing ark position event: " + val.Name));
					instance.RemoveEvent(val.EventUID, true);
				}
			}
			addQuestEvent(list[arkRotation]);
		}

		private void addQuestEvent(string Name)
		{
			for (int i = 0; i < QuestEventDictionary.Sections.Count; i++)
			{
				for (int j = 0; j < QuestEventDictionary.Sections[i].Events.Count; j++)
				{
					QuestEventSignature val = QuestEventDictionary.Sections[i].Events[j];
					if (val != null && val.EventName == Name)
					{
						Log.LogMessage((object)("Adding ark position event: " + val.EventName));
						QuestEventManager.Instance.AddEvent(val.EventUID, 1, true);
						return;
					}
				}
			}
			Log.LogMessage((object)"No ark position event found.");
		}

		internal void SceneManager_sceneLoaded()
		{
			((MonoBehaviour)Instance).StartCoroutine(DelaySceneHandlingMethod());
			if (ConfigElements.predictableArkRotation.Value)
			{
				UpdateArk();
				if (!isSubscribedToOnDayEvent)
				{
					TOD_Sky.Instance.TODTime.OnDay += UpdateArk;
					isSubscribedToOnDayEvent = true;
				}
				if (isSubscribedToOnDayEvent && AreaManager.Instance.CurrentArea.SceneName == "MainMenu_Empty")
				{
					isSubscribedToOnDayEvent = false;
					TOD_Sky.Instance.TODTime.OnDay -= UpdateArk;
				}
			}
		}

		[IteratorStateMachine(typeof(<DelaySceneHandlingMethod>d__35))]
		private IEnumerator DelaySceneHandlingMethod()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DelaySceneHandlingMethod>d__35(0)
			{
				<>4__this = this
			};
		}

		private void CalderaToTowerOfRegrets()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: 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_0179: 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_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			if (ConfigElements.shortcutTowerOfRegrets.Value)
			{
				GameObject fromAssetBundle = CalderaTweaksPlugin.GetFromAssetBundle<GameObject>("permittivity-calderatweaks", "environment", "johbenji_bridge");
				GameObject val = Object.Instantiate<GameObject>(fromAssetBundle);
				val.transform.position = new Vector3(631.6663f, 16.8363f, 1269.801f);
				val.transform.rotation = Quaternion.Euler(0f, 347.5929f, 0f);
				val.transform.localScale = new Vector3(1f, 1f, 1f);
				val.layer = LayerMask.NameToLayer("LargeTerrainEnvironment");
				AdjustCollisionBox("Environment/Assets/MapBounds/prf_CalderaColliders/ZoneWater/Cube (1074)", new Vector3(629.6788f, 22.2473f, 1268.13f), new Vector3(0f, 342.8861f, 0f), new Vector3(1f, 3.4091f, 9.565f));
				AdjustCollisionBox("Environment/Assets/MapBounds/prf_CalderaColliders/ZoneWater/Cube (1071)", new Vector3(623.8945f, 22.6384f, 1278.638f), new Vector3(0f, 233.4728f, 0f), new Vector3(15.3728f, 2.6691f, 1f));
				RemoveCollisionBox("Environment/Assets/MapBounds/prf_CalderaColliders/ZoneWater/Cube (1072)");
				AdjustCollisionBox("Environment/Assets/MapBounds/prf_CalderaColliders/ZoneWater/Cube (437)", new Vector3(689.9014f, 40.4128f, 1447.794f), new Vector3(0f, 352.1488f, 1.4433f), new Vector3(1.9395f, 74.4018f, 21.9476f));
				RemoveCollisionBox("Environment/Assets/MapBounds/prf_CalderaColliders/ZoneWater/Cube (435)");
				AdjustCollisionBox("Environment/Assets/MapBounds/prf_CalderaColliders/ZoneWater/Cube (450)", new Vector3(686.1935f, 41.4066f, 1452.427f), new Vector3(0f, 269.3703f, 0f), new Vector3(29.7878f, 45.6991f, 1.5329f));
				AdjustCollisionBox("Environment/Assets/MapBounds/prf_CalderaColliders/ZoneWater/Cube (127)", new Vector3(685.728f, 26.1166f, 1436.21f), new Vector3(0f, 347.3135f, 0f), new Vector3(12.136f, 33.1138f, 2.5171f));
				GameObject fromAssetBundle2 = CalderaTweaksPlugin.GetFromAssetBundle<GameObject>("permittivity-calderatweaks", "environment", "johbenji_bridge");
				GameObject val2 = Object.Instantiate<GameObject>(fromAssetBundle2);
				val2.transform.position = new Vector3(694.6957f, 15.0765f, 1448.184f);
				val2.transform.rotation = Quaternion.Euler(8.4074f, 357.5752f, 0f);
				val2.transform.localScale = new Vector3(1.4f, 1.56f, 1.2f);
				val2.layer = LayerMask.NameToLayer("LargeTerrainEnvironment");
			}
		}

		private void RemoveCollisionBox(string path)
		{
			GameObject val = GameObject.Find(path);
			if ((Object)(object)val != (Object)null)
			{
				Object.Destroy((Object)(object)val);
			}
			Log.LogMessage((object)("Collision box not found at path " + path));
		}

		private void AdjustCollisionBox(string path, Vector3 position, Vector3 rotation, Vector3 scale)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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)
			GameObject val = GameObject.Find(path);
			if ((Object)(object)val != (Object)null)
			{
				val.transform.position = position;
				val.transform.rotation = Quaternion.Euler(rotation);
				val.transform.localScale = scale;
			}
		}

		private void OilyCavernToSteamBath()
		{
			//IL_0023: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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)
			if (ConfigElements.shortcutSteamBath.Value)
			{
				setCaveFrame(new Vector3(-38.5494f, -4.7395f, -52.126f), new Vector3(-220.0266f, -40.2744f, -0.8917f), new Vector3(0f, 60.0187f, 0f), new Vector3(-39.5208f, -4.7342f, -53.956f), Quaternion.Euler(359.7455f, 25.2872f, 353.8593f), new Vector3(0.8f, 0.6f, 0.7f), (AreaEnum)603);
			}
		}

		private void SteambathToOilyCavern()
		{
			//IL_0023: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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)
			if (ConfigElements.shortcutSteamBath.Value)
			{
				setCaveFrame(new Vector3(-220.8329f, -40.4828f, -4.0615f), new Vector3(-38.6749f, -4.9177f, -49.695f), new Vector3(0f, 30f, 0f), new Vector3(-220.7733f, -40.6517f, -5.52f), Quaternion.Euler(0f, 337.137f, 0f), new Vector3(0.8f, 0.6f, 0.7f), (AreaEnum)650);
			}
		}

		private void ChalcedonyCaveShortCut()
		{
			//IL_0011: 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_0039: 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_0061: 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_0090: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			setCave(new Vector3(-157.2397f, -35.8848f, -74.9938f), new Vector3(-312.2836f, 4.4144f, 8.2811f), new Vector3(0f, 81.1785f, 0f), new Vector3(-159.4049f, -36.2456f, -79.7631f), Quaternion.Euler(0f, 22.6092f, 0f), new Vector3(0.8f, 0.6f, 0.7f));
			setCave(new Vector3(-314.004f, 4.6734f, 8.4477f), new Vector3(-157.5998f, -36.22f, -74.313f), new Vector3(0f, 43.8923f, 0f), new Vector3(-318.9112f, 4.2967f, 6.9892f), Quaternion.Euler(0f, 71.1785f, 0f), new Vector3(0.8f, 0.6f, 0.7f));
		}

		private void AddTeleportToCalderaFromDG5()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0021: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Trigger");
			val.transform.position = new Vector3(-170.8278f, -35.6546f, -66.0925f);
			BoxCollider val2 = val.AddComponent<BoxCollider>();
			val2.size = new Vector3(1f, 2f, 1f);
			((Collider)val2).isTrigger = true;
			InteractionActivator val3 = val.AddComponent<InteractionActivator>();
			InteractionTriggerBase val4 = val.AddComponent<InteractionTriggerBase>();
			InteractionSwitchAreaCustom interactionSwitchAreaCustom = (InteractionSwitchAreaCustom)(object)(val3.BasicInteraction = (IInteraction)(object)val.AddComponent<InteractionSwitchAreaCustom>());
			((InteractionSwitchArea)interactionSwitchAreaCustom).Area = (AreaEnum)602;
			((InteractionSwitchArea)interactionSwitchAreaCustom).DistanceBetweenPlayers = 5f;
			((InteractionSwitchArea)interactionSwitchAreaCustom).FastTravelTime = 0;
			((InteractionSwitchArea)interactionSwitchAreaCustom).SpawnOffset = 0.5f;
			((InteractionSwitchArea)interactionSwitchAreaCustom).SpawnPoint = 0;
			((InteractionBase)interactionSwitchAreaCustom).AwakeInit();
			interactionSwitchAreaCustom.position = new Vector3(698.4728f, 70.6011f, 482.7674f);
			interactionSwitchAreaCustom.rotation = new Vector3(0f, 54f, 0f);
		}

		private void CalderaToChalcedonyCaveShortcut()
		{
			//IL_0023: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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)
			if (ConfigElements.shortcutChalcedonyMine.Value)
			{
				setCaveFrame(new Vector3(696.8574f, 70.4476f, 478.9635f), new Vector3(-170.629f, -35.6238f, -65.059f), new Vector3(0f, 43.8923f, 0f), new Vector3(696.8574f, 70.4476f, 478.9635f), Quaternion.Euler(0f, 355.7726f, 0f), new Vector3(0.8f, 0.6f, 0.7f), (AreaEnum)607);
			}
		}

		private void setCaveFrame(Vector3 enterPosition, Vector3 exitPosition, Vector3 exitRotation, Vector3 cavePosition, Quaternion caveRotation, Vector3 caveScale, AreaEnum area)
		{
			//IL_0023: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			GameObject fromAssetBundle = CalderaTweaksPlugin.GetFromAssetBundle<GameObject>("permittivity-calderatweaks", "environment", "johbenji_dungeonframe");
			GameObject val = Object.Instantiate<GameObject>(fromAssetBundle);
			val.transform.position = cavePosition;
			val.transform.rotation = caveRotation;
			val.transform.localScale = caveScale;
			val.layer = LayerMask.NameToLayer("LargeTerrainEnvironment");
			GameObject val2 = new GameObject("Trigger");
			val2.transform.parent = val.transform;
			val2.transform.position = enterPosition;
			BoxCollider val3 = val2.AddComponent<BoxCollider>();
			val3.size = new Vector3(1f, 2f, 1f);
			((Collider)val3).isTrigger = true;
			InteractionActivator val4 = val2.AddComponent<InteractionActivator>();
			InteractionTriggerBase val5 = val2.AddComponent<InteractionTriggerBase>();
			InteractionSwitchAreaCustom interactionSwitchAreaCustom = (InteractionSwitchAreaCustom)(object)(val4.BasicInteraction = (IInteraction)(object)val2.AddComponent<InteractionSwitchAreaCustom>());
			((InteractionSwitchArea)interactionSwitchAreaCustom).Area = area;
			((InteractionSwitchArea)interactionSwitchAreaCustom).DistanceBetweenPlayers = 5f;
			((InteractionSwitchArea)interactionSwitchAreaCustom).FastTravelTime = 0;
			((InteractionSwitchArea)interactionSwitchAreaCustom).SpawnOffset = 0.5f;
			((InteractionSwitchArea)interactionSwitchAreaCustom).SpawnPoint = 0;
			((InteractionBase)interactionSwitchAreaCustom).AwakeInit();
			interactionSwitchAreaCustom.position = exitPosition;
			interactionSwitchAreaCustom.rotation = exitRotation;
		}

		private void RefineryShortcut()
		{
			//IL_006b: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			if (ConfigElements.shortcutOutflowPipe.Value)
			{
				removeObjectFromScene("Environment/Assets/PropsArea/Rocks/OilHoleCustom/Colliders/Cube (30)");
				removeObjectFromScene("Environment/Assets/PropsArea/Rocks/OilHoleCustom/Colliders/Cube (29)");
				removeObjectFromScene("Environment/Assets/PropsArea/Rocks/OilHoleCustom/Colliders/Cube (19)");
				removeObjectFromScene("Environment/Assets/PropsArea/Rocks/OilHoleCustom/Colliders/Cube (34)");
				removeObjectFromScene("Environment/Assets/MapBounds/prf_CalderaColliders/ZoneWater/Cube (1322)");
				Material[] materials = getMaterials("Environment/Assets/PropsArea/OilFactory/mdl_env_buildingMetalVigilSmallPlatform (2)/mdl_env_buildingMetalVigilSmallPlatform_LOD0");
				createBridge(new Vector3(1471.316f, 29.4725f, 312.0653f), new Vector3(0f, 90f, 0f), new Vector3(1f, 1f, 1f), materials);
				createBridge(new Vector3(1458.728f, 27.2725f, 312.1653f), new Vector3(345.8663f, 90f, 351.8792f), new Vector3(1f, 1f, 1f), materials);
				createBridge(new Vector3(1446.902f, 26.1452f, 311.8653f), new Vector3(327.3919f, 271.4579f, 0.9346f), new Vector3(1f, 1f, 1f), materials);
				blackPlaneTeleporter(new Vector3(1245.981f, 61.8663f, 1540.37f), new Vector3(1235.962f, 57.1338f, 1448.388f), new Vector3(0f, 154.9043f, 0f), new Vector3(1245.994f, 63.4993f, 1538.693f), new Vector3(90f, 14.8528f, 0f), new Vector3(1f, 1f, 1f));
				blackPlaneTeleporter(new Vector3(1234.638f, 56.2838f, 1451.358f), new Vector3(1246.708f, 62.5874f, 1543.056f), new Vector3(0f, 3.0337f, 0f), new Vector3(1232.74f, 56.5404f, 1452.806f), new Vector3(90f, 180f, 0f), new Vector3(1f, 1f, 1f));
			}
		}

		private void blackPlaneTeleporter(Vector3 enterPosition, Vector3 exitPosition, Vector3 exitRotation, Vector3 planePosition, Vector3 planeRotation, Vector3 planeScale)
		{
			//IL_0023: 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_0033: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_0080: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			GameObject fromAssetBundle = CalderaTweaksPlugin.GetFromAssetBundle<GameObject>("permittivity-calderatweaks", "environment", "johbenji_plane");
			GameObject val = Object.Instantiate<GameObject>(fromAssetBundle);
			val.transform.position = planePosition;
			val.transform.rotation = Quaternion.Euler(planeRotation);
			val.transform.localScale = planeScale;
			val.layer = LayerMask.NameToLayer("LargeTerrainEnvironment");
			GameObject val2 = new GameObject("Trigger");
			val2.transform.parent = val.transform;
			val2.transform.position = enterPosition;
			BoxCollider val3 = val2.AddComponent<BoxCollider>();
			val3.size = new Vector3(1f, 2f, 1f);
			((Collider)val3).isTrigger = true;
			InteractionActivator val4 = val2.AddComponent<InteractionActivator>();
			InteractionTriggerBase val5 = val2.AddComponent<InteractionTriggerBase>();
			Teleporter teleporter = (Teleporter)(object)(val4.BasicInteraction = (IInteraction)(object)val2.AddComponent<Teleporter>());
			((EventActivator)val4).m_overrideBasicText = "Enter";
			teleporter.position = exitPosition;
			teleporter.rotation = exitRotation;
		}

		private void createBridge(Vector3 position, Vector3 rotation, Vector3 localscale, Material[] material)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			GameObject fromAssetBundle = CalderaTweaksPlugin.GetFromAssetBundle<GameObject>("permittivity-calderatweaks", "environment", "johbenji_pylonplatform");
			GameObject val = Object.Instantiate<GameObject>(fromAssetBundle);
			val.transform.position = position;
			val.transform.rotation = Quaternion.Euler(rotation);
			val.transform.localScale = localscale;
			val.layer = LayerMask.NameToLayer("LargeTerrainEnvironment");
			setMaterials(val, material);
		}

		private void setMaterials(GameObject gobject, Material[] materials)
		{
			if ((Object)(object)gobject != (Object)null)
			{
				MeshRenderer component = gobject.GetComponent<MeshRenderer>();
				if ((Object)(object)component != (Object)null)
				{
					((Renderer)component).materials = materials;
				}
			}
		}

		private Material[] getMaterials(string path)
		{
			GameObject val = GameObject.Find(path);
			if ((Object)(object)val != (Object)null)
			{
				MeshRenderer component = val.GetComponent<MeshRenderer>();
				if ((Object)(object)component != (Object)null)
				{
					return ((Renderer)component).materials;
				}
			}
			return null;
		}

		private void removeObjectFromScene(string path)
		{
			GameObject val = GameObject.Find(path);
			if ((Object)(object)val != (Object)null)
			{
				Object.Destroy((Object)(object)val);
				Log.LogMessage((object)("Removed object at " + path));
			}
		}

		private void NewSiroccoMinesShortCut()
		{
			//IL_0023: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_00a2: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			if (ConfigElements.shortcutRiverOfRed.Value)
			{
				setCave(new Vector3(2346.651f, -13.5258f, 198.5633f), new Vector3(656.5908f, -6.765f, 60.0234f), new Vector3(0f, 188f, 0f), new Vector3(2341.094f, -14.2212f, 202.7751f), Quaternion.Euler(0f, 119.9354f, 0f), new Vector3(1f, 1f, 1f));
				setCave(new Vector3(657.2622f, -6.6434f, 60.7846f), new Vector3(2347.897f, -13.9494f, 196.5019f), new Vector3(0f, 141.2724f, 0f), new Vector3(657.4185f, -7.4741f, 63.991f), Quaternion.Euler(0f, 180f, 0f), new Vector3(0.7f, 1f, 0.5f));
			}
		}

		private void setCave(Vector3 enterPosition, Vector3 exitPosition, Vector3 exitRotation, Vector3 cavePosition, Quaternion caveRotation, Vector3 caveScale)
		{
			//IL_0023: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			GameObject fromAssetBundle = CalderaTweaksPlugin.GetFromAssetBundle<GameObject>("permittivity-calderatweaks", "environment", "johbenji_caveentrance");
			GameObject val = Object.Instantiate<GameObject>(fromAssetBundle);
			val.transform.position = cavePosition;
			val.transform.rotation = caveRotation;
			val.transform.localScale = caveScale;
			val.layer = LayerMask.NameToLayer("LargeTerrainEnvironment");
			GameObject val2 = new GameObject("Trigger");
			val2.transform.parent = val.transform;
			val2.transform.position = enterPosition;
			BoxCollider val3 = val2.AddComponent<BoxCollider>();
			val3.size = new Vector3(1f, 2f, 1f);
			((Collider)val3).isTrigger = true;
			InteractionActivator val4 = val2.AddComponent<InteractionActivator>();
			InteractionTriggerBase val5 = val2.AddComponent<InteractionTriggerBase>();
			Teleporter teleporter = (Teleporter)(object)(val4.BasicInteraction = (IInteraction)(object)val2.AddComponent<Teleporter>());
			((EventActivator)val4).m_overrideBasicText = "Enter";
			teleporter.position = exitPosition;
			teleporter.rotation = exitRotation;
		}

		public static T GetFromAssetBundle<T>(string SLPackName, string AssetBundle, string key) where T : Object
		{
			if (!SL.PacksLoaded)
			{
				return default(T);
			}
			return SL.GetSLPack(SLPackName).AssetBundles[AssetBundle].LoadAsset<T>(key);
		}

		private void RemoveChestRigidBodyComponent()
		{
			GameObject val = FindTopLevelObjectsWithPrefix(payChestID.ToString());
			if ((Object)(object)val != (Object)null)
			{
				Rigidbody component = val.GetComponent<Rigidbody>();
				if ((Object)(object)component != (Object)null)
				{
					Object.Destroy((Object)(object)component);
					Log.LogMessage((object)"Removed RigidBody from Pay Chest");
				}
			}
			GameObject val2 = FindTopLevelObjectsWithPrefix(freeChestID.ToString());
			if ((Object)(object)val2 != (Object)null)
			{
				Rigidbody component2 = val2.GetComponent<Rigidbody>();
				if ((Object)(object)component2 != (Object)null)
				{
					Object.Destroy((Object)(object)component2);
					Log.LogMessage((object)"Removed RigidBody from Free Chest");
				}
			}
		}

		private GameObject FindTopLevelObjectsWithPrefix(string prefix)
		{
			//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)
			Scene activeScene = SceneManager.GetActiveScene();
			GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
			GameObject[] array = rootGameObjects;
			foreach (GameObject val in array)
			{
				if (((Object)val).name.StartsWith(prefix))
				{
					return val;
				}
			}
			return null;
		}

		private void SceneHandlingMethod()
		{
			setDorionDialogue();
			setEvangelineBuildingDialogue();
		}

		private void setEvangelineBuildingDialogue()
		{
			string scenePath = "Interactions/Core Quest NPCS/UNPC_DLC2_Evangeline_Scholar/Evangeline_Dialog/NPC/Dialogue_1_Basebuilding";
			DialogueTreeController tree = fetchDialogueTreeController(scenePath);
			changeDialogueTreeActionNodeValue(tree, 145, ConfigElements.oreSampleFunds.Value);
			changeDialogueTreeActionNodeValue(tree, 150, ConfigElements.oreSampleMaterial.Value);
			changeDialogueTreeActionNodeValue(tree, 155, ConfigElements.oreSampleMaterialHigh.Value);
			changeDialogueTreeActionNodeValue(tree, 254, ConfigElements.plantSampleFunds.Value);
			changeDialogueTreeActionNodeValue(tree, 259, ConfigElements.plantSampleMaterial.Value);
			changeDialogueTreeActionNodeValue(tree, 264, ConfigElements.plantSampleMaterialHigh.Value);
			changeDialogueTreeActionNodeValue(tree, 264, ConfigElements.plantSampleMaterialHigh.Value);
			changeDialogueTreeActionNodeValue(tree, 294, ConfigElements.molepigSampleFunds.Value);
			changeDialogueTreeActionNodeValue(tree, 299, ConfigElements.molepigSampleMaterial.Value);
			changeDialogueTreeActionNodeValue(tree, 304, ConfigElements.molepigSampleMaterialHigh.Value);
		}

		private void setDorionDialogue()
		{
			string scenePath = "Interactions/Core Quest NPCS/UNPC_DLC2_Dorion_Supplier/DorionMerchant_Dialog/NPC/ShopDialogue";
			DialogueTreeController tree = fetchDialogueTreeController(scenePath);
			changeDialogueTreeActionNodeValue(tree, 40, ConfigElements.fromTheAshesFundReward.Value);
		}

		private DialogueTreeController fetchDialogueTreeController(string scenePath)
		{
			GameObject val = GameObject.Find(scenePath);
			if ((Object)(object)val != (Object)null)
			{
				DialogueTreeController component = val.GetComponent<DialogueTreeController>();
				if ((Object)(object)component != (Object)null)
				{
					return component;
				}
			}
			return null;
		}

		private void changeDialogueTreeActionNodeValue(DialogueTreeController tree, int nodeID, int Value)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			if ((Object)(object)tree != (Object)null && (Object)(object)((GraphOwner)tree).graph != (Object)null)
			{
				Graph graph = ((GraphOwner)tree).graph;
				if ((Object)(object)graph != (Object)null && graph.allNodes != null && graph.allNodes.Count >= nodeID)
				{
					ActionNode node = (ActionNode)graph.allNodes[nodeID];
					changeActionNodeValue(node, Value);
				}
			}
		}

		private void changeActionNodeValue(ActionNode node, int Value)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			GiveRewardBuildingResource val = (GiveRewardBuildingResource)node.action;
			val.Amount = Value;
		}
	}
	public class Teleporter : InteractionBase
	{
		private static Character targetCharacter;

		public Vector3 position = new Vector3(0f, 0f, 0f);

		public Vector3 rotation = new Vector3(0f, 0f, 0f);

		public override void Activate(Character _character)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			CustomTeleport(_character, position, rotation);
		}

		public static void CustomTeleport(Character character, Vector3 position, Vector3 rotation)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			character.Teleport(position, rotation);
		}
	}
}