Decompiled source of Obeliskial Content v1.2.2

BepInEx/plugins/Obeliskial Content.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Obeliskial_Essentials;
using Photon.Pun;
using TMPro;
using Unity.Collections;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.TextCore;
using UnityEngine.U2D;
using UnityEngine.U2D.Animation;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.stiffmeds.obeliskialcontent")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Enables custom content in Across the Obelisk.")]
[assembly: AssemblyFileVersion("1.2.2.0")]
[assembly: AssemblyInformationalVersion("1.2.2")]
[assembly: AssemblyProduct("Obeliskial Content")]
[assembly: AssemblyTitle("com.stiffmeds.obeliskialcontent")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Obeliskial_Content
{
	[BepInPlugin("com.stiffmeds.obeliskialcontent", "Obeliskial Content", "1.2.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInProcess("AcrossTheObelisk.exe")]
	public class Content : BaseUnityPlugin
	{
		internal const int ModDate = 20240311;

		private readonly Harmony harmony = new Harmony("com.stiffmeds.obeliskialcontent");

		internal static ManualLogSource Log;

		public static Dictionary<string, CardData> medsCardsSource = new Dictionary<string, CardData>();

		public static Dictionary<string, SubClassData> medsSubClassesSource = new Dictionary<string, SubClassData>();

		public static Dictionary<string, CardbackData> medsCardbacksSource = new Dictionary<string, CardbackData>();

		public static Dictionary<string, SkinData> medsSkinsSource = new Dictionary<string, SkinData>();

		public static Dictionary<string, TraitData> medsTraitsSource = new Dictionary<string, TraitData>();

		public static List<string> medsCustomTraitsSource = new List<string>();

		public static Dictionary<string, NPCData> medsNPCsSource = new Dictionary<string, NPCData>();

		public static Dictionary<string, AuraCurseData> medsAurasCursesSource = new Dictionary<string, AuraCurseData>();

		public static Dictionary<string, NodeData> medsNodeDataSource = new Dictionary<string, NodeData>();

		public static Dictionary<string, LootData> medsLootDataSource = new Dictionary<string, LootData>();

		public static Dictionary<string, PerkData> medsPerksSource = new Dictionary<string, PerkData>();

		public static Dictionary<string, PerkNodeData> medsPerksNodesSource = new Dictionary<string, PerkNodeData>();

		public static Dictionary<string, ChallengeTrait> medsChallengeTraitsSource = new Dictionary<string, ChallengeTrait>();

		public static Dictionary<string, CombatData> medsCombatDataSource = new Dictionary<string, CombatData>();

		public static Dictionary<string, EventData> medsEventDataSource = new Dictionary<string, EventData>();

		public static Dictionary<string, EventRequirementData> medsEventRequirementDataSource = new Dictionary<string, EventRequirementData>();

		public static Dictionary<string, ZoneData> medsZoneDataSource = new Dictionary<string, ZoneData>();

		public static SortedDictionary<string, KeyNotesData> medsKeyNotesDataSource = new SortedDictionary<string, KeyNotesData>();

		public static Dictionary<string, ChallengeData> medsChallengeDataSource = new Dictionary<string, ChallengeData>();

		public static Dictionary<string, PackData> medsPackDataSource = new Dictionary<string, PackData>();

		public static Dictionary<string, ItemData> medsItemDataSource = new Dictionary<string, ItemData>();

		public static Dictionary<string, CardPlayerPackData> medsCardPlayerPackDataSource = new Dictionary<string, CardPlayerPackData>();

		public static Dictionary<string, CorruptionPackData> medsCorruptionPackDataSource = new Dictionary<string, CorruptionPackData>();

		public static Dictionary<string, CinematicData> medsCinematicDataSource = new Dictionary<string, CinematicData>();

		public static Dictionary<string, Sprite> medsSprites = new Dictionary<string, Sprite>();

		public static Dictionary<int, TierRewardData> medsTierRewardDataSource = new Dictionary<int, TierRewardData>();

		public static Dictionary<string, Node> medsNodeSource = new Dictionary<string, Node>();

		public static Dictionary<string, string[]> medsSecondRunImport = new Dictionary<string, string[]>();

		public static Dictionary<string, string> medsSecondRunImport2 = new Dictionary<string, string>();

		public static Dictionary<string[], string> medsSecondRunImport3 = new Dictionary<string[], string>();

		public static Dictionary<string, string> medsCardsNeedingItems = new Dictionary<string, string>();

		public static Dictionary<string, string> medsCardsNeedingItemEnchants = new Dictionary<string, string>();

		public static List<string> medsCustomUnlocks = new List<string>();

		public static TMP_SpriteAsset medsFallbackSpriteAsset = ScriptableObject.CreateInstance<TMP_SpriteAsset>();

		public static Dictionary<string, AudioClip> medsAudioClips = new Dictionary<string, AudioClip>();

		public static Dictionary<string, Sprite> medsVanillaSprites = new Dictionary<string, Sprite>();

		public static Dictionary<string, GameObject> medsGOs = new Dictionary<string, GameObject>();

		public static Dictionary<string, string> medsNodeCombatEventRelation = new Dictionary<string, string>();

		public static Dictionary<string, CardPlayerPairsPackData> medsCardPlayerPairsPackDataSource = new Dictionary<string, CardPlayerPairsPackData>();

		public static Dictionary<string, string> medsNodeEvent = new Dictionary<string, string>();

		public static Dictionary<string, int> medsNodeEventPercent = new Dictionary<string, int>();

		public static Dictionary<string, int> medsNodeEventPriority = new Dictionary<string, int>();

		public static Dictionary<string, ThermometerTierData> medsThermometerTierData = new Dictionary<string, ThermometerTierData>();

		public static Dictionary<string, string> medsSecondRunCombatEvent = new Dictionary<string, string>();

		public static Dictionary<string, string> medsSecondRunCinematicCombat = new Dictionary<string, string>();

		public static Dictionary<string, string> medsSecondRunCinematicEvent = new Dictionary<string, string>();

		public static Dictionary<string, string[]> medsSecondRunNodesConnected = new Dictionary<string, string[]>();

		public static Dictionary<string, EventReplyDataText> medsEventReplyDataText = new Dictionary<string, EventReplyDataText>();

		public static Dictionary<string, string> medsCardsNeedingSummonUnits = new Dictionary<string, string>();

		public static int medsMaxHeroesInClass = 6;

		public static Dictionary<string, ZoneDataText> medsCustomZones = new Dictionary<string, ZoneDataText>();

		public static Dictionary<string, GameObject> medsCustomZoneGOs = new Dictionary<string, GameObject>();

		public static Dictionary<string, List<NodeDataText>> medsNodesByZone = new Dictionary<string, List<NodeDataText>>();

		public static bool medsLoadedCustomNodes = false;

		public static Dictionary<string, Vector3> medsNodePositions = new Dictionary<string, Vector3>();

		public static GameObject medsBaseRoadGO = null;

		public static Dictionary<string, List<Vector3>> medsCustomRoads = new Dictionary<string, List<Vector3>>();

		public static GameObject medsInvisibleGOHolder = new GameObject();

		public static List<string> medsVanillaIntroNodes = new List<string>
		{
			"sen_0", "tutorial_0", "secta_0", "spider_0", "forge_0", "sewers_0", "sewers_1", "wolf_0", "pyr_0", "velka_0",
			"aqua_0", "voidlow_0", "faen_0", "ulmin_0", "voidhigh_0"
		};

		public static GameObject medsZoneTransitionGO = null;

		public static Dictionary<string, PrestigeDeck> medsPrestigeDecks = new Dictionary<string, PrestigeDeck>();

		public static bool medsDoNotLetCombatFinish = false;

		public static Dictionary<string, CardData> medsExtendedEnchantments = new Dictionary<string, CardData>();

		public static string medsAwaitingKill = "";

		public static List<string> medsAutoUnlockHeroes = new List<string>();

		internal static List<string> medsACIndex = new List<string>();

		internal static Dictionary<string, NPCData> medsNPCs = new Dictionary<string, NPCData>();

		internal static Dictionary<string, NPCData> medsNPCsNamed = new Dictionary<string, NPCData>();

		internal static SortedDictionary<string, string> sortedDictionary = new SortedDictionary<string, string>();

		internal static Dictionary<string, TraitData> medsTraitsCopy = new Dictionary<string, TraitData>();

		internal static Dictionary<string, SubClassData> medsSubClassCopy = new Dictionary<string, SubClassData>();

		public static ConfigEntry<bool> medsVanillaContentLog { get; private set; }

		private void Awake()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_0037: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			medsVanillaContentLog = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Debug", "Vanilla Content Logging"), false, new ConfigDescription("Logs the loading of each individual piece of vanilla content.", (AcceptableValueBase)null, Array.Empty<object>()));
			LogInfo("com.stiffmeds.obeliskialcontent 1.2.2 has loaded!");
			Essentials.RegisterMod("Obeliskial Content", "stiffmeds", "Enables custom content in Across the Obelisk.", "1.2.2", 20240311, "https://across-the-obelisk.thunderstore.io/package/meds/Obeliskial_Content/", (string[])null, "", 2000000000, new string[2] { "Core", "Content" }, "", true);
			harmony.PatchAll();
		}

		internal static void LogDebug(string msg)
		{
			Log.LogDebug((object)msg);
		}

		internal static void LogInfo(string msg)
		{
			Log.LogInfo((object)msg);
		}

		internal static void LogWarning(string msg)
		{
			Log.LogWarning((object)msg);
		}

		internal static void LogError(string msg)
		{
			Log.LogError((object)msg);
		}

		internal static void LoadVanillaContent()
		{
			LogInfo("Loading vanilla content...");
			KeyNotesData[] array = Resources.LoadAll<KeyNotesData>("KeyNotes");
			AuraCurseData[] array2 = Resources.LoadAll<AuraCurseData>("Auras");
			AuraCurseData[] array3 = Resources.LoadAll<AuraCurseData>("Curses");
			CardData[] array4 = Resources.LoadAll<CardData>("Cards");
			TraitData[] array5 = Resources.LoadAll<TraitData>("Traits");
			HeroData[] array6 = Resources.LoadAll<HeroData>("Heroes");
			PerkData[] array7 = Resources.LoadAll<PerkData>("Perks");
			PackData[] array8 = Resources.LoadAll<PackData>("Packs");
			SubClassData[] array9 = Resources.LoadAll<SubClassData>("SubClass");
			NPCData[] array10 = Resources.LoadAll<NPCData>("NPCs");
			PerkNodeData[] array11 = Resources.LoadAll<PerkNodeData>("PerkNode");
			EventData[] array12 = Resources.LoadAll<EventData>("World/Events");
			EventRequirementData[] array13 = Resources.LoadAll<EventRequirementData>("World/Events/Requirements");
			CombatData[] array14 = Resources.LoadAll<CombatData>("World/Combats");
			NodeData[] array15 = Resources.LoadAll<NodeData>("World/MapNodes");
			TierRewardData[] array16 = Resources.LoadAll<TierRewardData>("Rewards");
			ItemData[] array17 = Resources.LoadAll<ItemData>("Items");
			LootData[] array18 = Resources.LoadAll<LootData>("Loot");
			SkinData[] array19 = Resources.LoadAll<SkinData>("Skins");
			CardbackData[] array20 = Resources.LoadAll<CardbackData>("Cardbacks");
			CorruptionPackData[] array21 = Resources.LoadAll<CorruptionPackData>("CorruptionRewards");
			CardPlayerPackData[] array22 = Resources.LoadAll<CardPlayerPackData>("CardPlayer");
			CinematicData[] array23 = Resources.LoadAll<CinematicData>("Cinematics");
			ZoneData[] array24 = Resources.LoadAll<ZoneData>("World/Zones");
			ChallengeTrait[] array25 = Resources.LoadAll<ChallengeTrait>("Challenge/Traits");
			ChallengeData[] array26 = Resources.LoadAll<ChallengeData>("Challenge/Weeks");
			CardPlayerPairsPackData[] array27 = Resources.LoadAll<CardPlayerPairsPackData>("CardPlayerPairs");
			Traverse.Create((object)Globals.Instance).Field("_CardsListSearch").SetValue((object)new Dictionary<string, List<string>>());
			Globals.Instance.CardItemByType = new Dictionary<CardType, List<string>>();
			Globals.Instance.CardEnergyCost = new Dictionary<string, int>();
			LogInfo("Loading vanilla AudioClips...");
			try
			{
				AudioClip[] array28 = Resources.FindObjectsOfTypeAll<AudioClip>();
				AudioClip[] array29 = array28;
				foreach (AudioClip val in array29)
				{
					if (medsVanillaContentLog.Value)
					{
						LogInfo("Loading vanilla AudioClip: " + ((Object)val).name);
					}
					medsAudioClips[((Object)val).name] = val;
				}
				LogInfo(medsAudioClips.Count + " vanilla AudioClips loaded");
			}
			catch (Exception ex)
			{
				LogError("Error loading AudioClips: " + ex.Message);
			}
			LogInfo("Loading vanilla Sprites...");
			try
			{
				Sprite[] array30 = Resources.FindObjectsOfTypeAll<Sprite>();
				Sprite[] array31 = array30;
				foreach (Sprite val2 in array31)
				{
					if (medsVanillaContentLog.Value)
					{
						LogInfo("Loading vanilla Sprite: " + ((Object)val2).name);
					}
					medsSprites[((Object)val2).name.Trim().ToLower()] = val2;
				}
				LogInfo(medsSprites.Count + " vanilla Sprites loaded");
			}
			catch (Exception ex2)
			{
				LogError("Error loading Sprites: " + ex2.Message);
			}
			LogInfo("Loading vanilla gameObjects...");
			try
			{
				GameObject[] array32 = Resources.FindObjectsOfTypeAll<GameObject>();
				GameObject[] array33 = array32;
				foreach (GameObject val3 in array33)
				{
					if (medsVanillaContentLog.Value)
					{
						LogInfo("Loading vanilla gameObject: " + ((Object)val3).name);
					}
					if (medsGOs.ContainsKey(((Object)val3).name))
					{
						int num = medsGOs[((Object)val3).name].GetComponents(typeof(Component)).Count();
						int num2 = val3.GetComponents(typeof(Component)).Count();
						if (num > num2)
						{
							continue;
						}
					}
					medsGOs[((Object)val3).name] = val3;
				}
				LogInfo(medsGOs.Count + " vanilla GameObjects loaded");
			}
			catch (Exception ex3)
			{
				LogError("Error loading GameObjects: " + ex3.Message);
			}
			LogInfo("Loading vanilla thermometerTierData...");
			try
			{
				ThermometerTierData[] array34 = Resources.FindObjectsOfTypeAll<ThermometerTierData>();
				ThermometerTierData[] array35 = array34;
				foreach (ThermometerTierData val4 in array35)
				{
					if (medsVanillaContentLog.Value)
					{
						LogInfo("Loading vanilla thermometerTierData: " + ((Object)val4).name);
					}
					medsThermometerTierData[((Object)val4).name] = val4;
				}
				LogInfo("Loaded " + medsThermometerTierData.Count + " vanilla thermometerTierData");
			}
			catch (Exception ex4)
			{
				LogError("Error loading vanilla thermometerTierData: " + ex4.Message);
			}
			LogInfo("Loading vanilla keynotes...");
			for (int m = 0; m < array.Length; m++)
			{
				try
				{
					string text = array[m].KeynoteName.Replace(" ", "").ToLower();
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla keynote: " + text);
					}
					array[m].Id = text;
					medsKeyNotesDataSource[text] = Object.Instantiate<KeyNotesData>(array[m]);
					medsKeyNotesDataSource[text].KeynoteName = Texts.Instance.GetText(medsKeyNotesDataSource[text].KeynoteName, "");
					string text2 = Texts.Instance.GetText(text + "_description", "keynotes");
					if (text2 != "")
					{
						medsKeyNotesDataSource[text].Description = text2;
					}
					string text3 = Texts.Instance.GetText(text + "_descriptionExtended", "keynotes");
					if (text3 != "")
					{
						medsKeyNotesDataSource[text].DescriptionExtended = text3;
					}
				}
				catch (Exception ex5)
				{
					LogError("Error loading vanilla keynotes: " + ex5.Message);
				}
			}
			LogInfo(medsKeyNotesDataSource.Count + " vanilla keynotes loaded");
			Globals.Instance.KeyNotes = medsKeyNotesDataSource;
			LogInfo("Loading auras & curses...");
			for (int n = 0; n < array2.Length; n++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla auraCurse: " + array2[n].ACName);
					}
					array2[n].Init();
					medsAurasCursesSource.Add(array2[n].Id, Object.Instantiate<AuraCurseData>(array2[n]));
					medsAurasCursesSource[array2[n].Id].Init();
					medsAurasCursesSource[array2[n].Id].ACName = Texts.Instance.GetText(medsAurasCursesSource[array2[n].Id].Id, "");
					string text4 = Texts.Instance.GetText(array2[n].Id + "_description", "auracurse");
					if (text4 != "")
					{
						medsAurasCursesSource[array2[n].Id].Description = text4;
					}
					medsACIndex.Add(array2[n].Id.ToLower());
				}
				catch (Exception ex6)
				{
					LogError("Error loading vanilla auraCurse: " + ex6.Message);
				}
			}
			for (int num3 = 0; num3 < array3.Length; num3++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla auraCurse: " + array3[num3].ACName);
					}
					array3[num3].Init();
					medsAurasCursesSource[array3[num3].Id] = Object.Instantiate<AuraCurseData>(array3[num3]);
					medsAurasCursesSource[array3[num3].Id].Init();
					medsAurasCursesSource[array3[num3].Id].ACName = Texts.Instance.GetText(medsAurasCursesSource[array3[num3].Id].Id, "");
					string text5 = Texts.Instance.GetText(array3[num3].Id + "_description", "auracurse");
					if (text5 != "")
					{
						medsAurasCursesSource[array3[num3].Id].Description = text5;
					}
					medsACIndex.Add(array3[num3].Id.ToLower());
				}
				catch (Exception ex7)
				{
					LogError("Error loading vanilla auraCurse: " + ex7.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_AurasCursesSource").SetValue((object)medsAurasCursesSource);
			Traverse.Create((object)Globals.Instance).Field("_AurasCursesIndex").SetValue((object)medsACIndex);
			Traverse.Create((object)Globals.Instance).Field("_AurasCurses").SetValue((object)medsAurasCursesSource);
			LogInfo("Loading cards...");
			for (int num4 = 0; num4 < array4.Length; num4++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla card: " + ((Object)array4[num4]).name);
					}
					array4[num4].Id = ((Object)array4[num4]).name.ToLower();
					medsCardsSource[array4[num4].Id] = Object.Instantiate<CardData>(array4[num4]);
				}
				catch (Exception ex8)
				{
					LogError("Error loading vanilla card: " + ex8.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_CardsSource").SetValue((object)medsCardsSource);
			LogInfo("Loading tier reward data...");
			for (int num5 = 0; num5 < array16.Length; num5++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla tier reward data: " + ((Object)array16[num5]).name);
					}
					medsTierRewardDataSource[array16[num5].TierNum] = Object.Instantiate<TierRewardData>(array16[num5]);
				}
				catch (Exception ex9)
				{
					LogError("Error loading vanilla tier reward data: " + ex9.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_TierRewardDataSource").SetValue((object)medsTierRewardDataSource);
			LogInfo("Tier reward data loaded!");
			LogInfo("Loading NPCs...");
			medsSecondRunImport = new Dictionary<string, string[]>();
			for (int num6 = 0; num6 < array10.Length; num6++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla NPC: " + array10[num6].Id);
					}
					medsNPCsSource[array10[num6].Id] = Object.Instantiate<NPCData>(array10[num6]);
				}
				catch (Exception ex10)
				{
					LogError("Error loading vanilla NPC: " + ex10.Message);
				}
			}
			LogInfo("Creating vanilla NPC clones...");
			foreach (string key in medsNPCsSource.Keys)
			{
				try
				{
					if (!sortedDictionary.ContainsKey(key))
					{
						sortedDictionary.Add(key, medsNPCsSource[key].NPCName);
					}
					if (medsSecondRunImport.ContainsKey(key))
					{
						medsNPCsSource[key].BaseMonster = ((!Utility.IsNullOrWhiteSpace(medsSecondRunImport[key][0]) && medsNPCsSource.ContainsKey(medsSecondRunImport[key][0])) ? medsNPCsSource[medsSecondRunImport[key][0]] : null);
						medsNPCsSource[key].HellModeMob = ((!Utility.IsNullOrWhiteSpace(medsSecondRunImport[key][1]) && medsNPCsSource.ContainsKey(medsSecondRunImport[key][1])) ? medsNPCsSource[medsSecondRunImport[key][1]] : null);
						medsNPCsSource[key].NgPlusMob = ((!Utility.IsNullOrWhiteSpace(medsSecondRunImport[key][2]) && medsNPCsSource.ContainsKey(medsSecondRunImport[key][2])) ? medsNPCsSource[medsSecondRunImport[key][2]] : null);
						medsNPCsSource[key].UpgradedMob = ((!Utility.IsNullOrWhiteSpace(medsSecondRunImport[key][3]) && medsNPCsSource.ContainsKey(medsSecondRunImport[key][3])) ? medsNPCsSource[medsSecondRunImport[key][3]] : null);
					}
					medsNPCs.Add(key, Object.Instantiate<NPCData>(medsNPCsSource[key]));
					string text6 = Texts.Instance.GetText(key + "_name", "monsters");
					if (text6 != "")
					{
						medsNPCs[key].NPCName = text6;
					}
					if (medsNPCsSource[key].IsNamed && medsNPCsSource[key].Difficulty > -1)
					{
						medsNPCsNamed.Add(key, Object.Instantiate<NPCData>(medsNPCsSource[key]));
						string text7 = Texts.Instance.GetText(key + "_name", "monsters");
						if (text7 != "")
						{
							medsNPCsNamed[key].NPCName = text7;
						}
					}
				}
				catch (Exception ex11)
				{
					LogError("Error creating NPC clones: " + ex11.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_NPCsSource").SetValue((object)medsNPCsSource);
			Traverse.Create((object)Globals.Instance).Field("_NPCs").SetValue((object)medsNPCs);
			Traverse.Create((object)Globals.Instance).Field("_NPCsNamed").SetValue((object)medsNPCsNamed);
			LogInfo("NPCs loaded!");
			LogInfo("Loading item data...");
			for (int num7 = 0; num7 < array17.Length; num7++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla item data: " + ((Object)array17[num7]).name);
					}
					array17[num7].Id = ((Object)array17[num7]).name.ToLower();
					medsItemDataSource[array17[num7].Id] = Object.Instantiate<ItemData>(array17[num7]);
				}
				catch (Exception ex12)
				{
					LogError("Error loading vanilla item data: " + ex12.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_ItemDataSource").SetValue((object)medsItemDataSource);
			LogInfo("Loading traits...");
			for (int num8 = 0; num8 < array5.Length; num8++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla trait: " + array5[num8].TraitName);
					}
					array5[num8].Init();
					medsTraitsSource[array5[num8].Id] = Object.Instantiate<TraitData>(array5[num8]);
					medsTraitsSource[array5[num8].Id].SetNameAndDescription();
					medsTraitsCopy[array5[num8].Id] = Object.Instantiate<TraitData>(medsTraitsSource[array5[num8].Id]);
				}
				catch (Exception ex13)
				{
					LogError("Error loading vanilla trait: " + ex13.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_TraitsSource").SetValue((object)medsTraitsSource);
			Traverse.Create((object)Globals.Instance).Field("_Traits").SetValue((object)medsTraitsCopy);
			LogDebug("Loading vanilla heroes...");
			Dictionary<string, HeroData> dictionary = new Dictionary<string, HeroData>();
			for (int num9 = 0; num9 < array6.Length; num9++)
			{
				try
				{
					dictionary.Add(array6[num9].Id, Object.Instantiate<HeroData>(array6[num9]));
				}
				catch (Exception ex14)
				{
					LogError("Error loading vanilla heroes: " + ex14.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_Heroes").SetValue((object)dictionary);
			LogInfo("Heroes loaded!");
			for (int num10 = 0; num10 < array7.Length; num10++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla perk: " + array7[num10].Id);
					}
					array7[num10].Init();
					medsPerksSource[array7[num10].Id] = Object.Instantiate<PerkData>(array7[num10]);
				}
				catch (Exception ex15)
				{
					LogError("Error loading vanilla perk: " + ex15.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_PerksSource").SetValue((object)medsPerksSource);
			LogInfo("Loading PackData...");
			for (int num11 = 0; num11 < array8.Length; num11++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla PackData: " + array8[num11].PackId);
					}
					medsPackDataSource[array8[num11].PackId.ToLower()] = Object.Instantiate<PackData>(array8[num11]);
				}
				catch (Exception ex16)
				{
					LogError("Error loading vanilla PackData: " + ex16.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_PackDataSource").SetValue((object)medsPackDataSource);
			LogInfo("Loading subclasses...");
			for (int num12 = 0; num12 < array9.Length; num12++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla subclass: " + array9[num12].SubClassName);
					}
					medsSubClassesSource[array9[num12].SubClassName.Replace(" ", "").ToLower()] = Object.Instantiate<SubClassData>(array9[num12]);
				}
				catch (Exception ex17)
				{
					LogError("Error loading vanilla subclass: " + ex17.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_SubClassSource").SetValue((object)medsSubClassesSource);
			LogInfo("Creating subclass text...");
			foreach (string key2 in medsSubClassesSource.Keys)
			{
				try
				{
					medsSubClassCopy[key2] = Object.Instantiate<SubClassData>(medsSubClassesSource[key2]);
					if (medsSubClassCopy[key2].CharacterName.Length < 2)
					{
						medsSubClassCopy[key2].CharacterName = Texts.Instance.GetText(key2 + "_name", "class");
					}
					if (medsSubClassCopy[key2].CharacterDescription.Length < 2)
					{
						medsSubClassCopy[key2].CharacterDescription = Texts.Instance.GetText(key2 + "_description", "class");
					}
					if (medsSubClassCopy[key2].CharacterDescriptionStrength.Length < 2)
					{
						medsSubClassCopy[key2].CharacterDescriptionStrength = Texts.Instance.GetText(key2 + "_strength", "class");
					}
				}
				catch (Exception ex18)
				{
					LogError("Error creating subclass text: " + ex18.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_SubClass").SetValue((object)medsSubClassCopy);
			LogInfo("Subclass text created!");
			LogInfo("Loading SkinData...");
			for (int num13 = 0; num13 < array19.Length; num13++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla SkinData: " + array19[num13].SkinId);
					}
					medsSkinsSource[array19[num13].SkinId.ToLower()] = Object.Instantiate<SkinData>(array19[num13]);
				}
				catch (Exception ex19)
				{
					LogError("Error loading vanilla SkinData: " + ex19.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_SkinDataSource").SetValue((object)medsSkinsSource);
			LogInfo("Loading CardbackData...");
			for (int num14 = 0; num14 < array20.Length; num14++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla CardbackData: " + array20[num14].CardbackId);
					}
					medsCardbacksSource[array20[num14].CardbackId.ToLower()] = Object.Instantiate<CardbackData>(array20[num14]);
				}
				catch (Exception ex20)
				{
					LogError("Error loading vanilla CardbackData: " + ex20.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_CardbackDataSource").SetValue((object)medsCardbacksSource);
			LogInfo("Loading perknodes...");
			for (int num15 = 0; num15 < array11.Length; num15++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla perknode: " + array11[num15].Id);
					}
					medsPerksNodesSource[array11[num15].Id] = Object.Instantiate<PerkNodeData>(array11[num15]);
				}
				catch (Exception ex21)
				{
					LogError("Error loading vanilla perknode: " + ex21.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_PerksNodesSource").SetValue((object)medsPerksNodesSource);
			LogInfo("Loading event requirements...");
			for (int num16 = 0; num16 < array13.Length; num16++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla event requirement: " + array13[num16].RequirementId);
					}
					string text8 = array13[num16].RequirementId.ToLower();
					medsEventRequirementDataSource[text8] = Object.Instantiate<EventRequirementData>(array13[num16]);
					if (medsEventRequirementDataSource[text8].ItemTrack || medsEventRequirementDataSource[text8].RequirementTrack)
					{
						string text9 = Texts.Instance.GetText(text8 + "_name", "requirements");
						if (text9 != "")
						{
							medsEventRequirementDataSource[text8].RequirementName = text9;
						}
						string text10 = Texts.Instance.GetText(text8 + "_description", "requirements");
						if (text10 != "")
						{
							medsEventRequirementDataSource[text8].Description = text10;
						}
					}
				}
				catch (Exception ex22)
				{
					LogError("Error loading vanilla event requirement: " + ex22.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_Requirements").SetValue((object)medsEventRequirementDataSource);
			LogInfo("Loading pairs packs...");
			for (int num17 = 0; num17 < array27.Length; num17++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla pairs pack data: " + array27[num17].PackId);
					}
					medsCardPlayerPairsPackDataSource[array27[num17].PackId.ToLower()] = Object.Instantiate<CardPlayerPairsPackData>(array27[num17]);
				}
				catch (Exception ex23)
				{
					LogError("Error loading vanilla pairs pack data: " + ex23.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_CardPlayerPairsPackDataSource").SetValue((object)medsCardPlayerPairsPackDataSource);
			LogInfo("Loading CorruptionPackData...");
			for (int num18 = 0; num18 < array21.Length; num18++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla CorruptionPackData: " + ((Object)array21[num18]).name);
					}
					medsCorruptionPackDataSource[((Object)array21[num18]).name] = Object.Instantiate<CorruptionPackData>(array21[num18]);
				}
				catch (Exception ex24)
				{
					LogError("Error loading vanilla CorruptionPackData: " + ex24.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_CorruptionPackDataSource").SetValue((object)medsCorruptionPackDataSource);
			LogInfo("Loading CardPlayerPackData...");
			for (int num19 = 0; num19 < array22.Length; num19++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla CardPlayerPackData: " + array22[num19].PackId);
					}
					medsCardPlayerPackDataSource[array22[num19].PackId.ToLower()] = Object.Instantiate<CardPlayerPackData>(array22[num19]);
				}
				catch (Exception ex25)
				{
					LogError("Error loading vanilla CardPlayerPackData: " + ex25.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_CardPlayerPackDataSource").SetValue((object)medsCardPlayerPackDataSource);
			LogInfo("Loading cinematic data...");
			for (int num20 = 0; num20 < array23.Length; num20++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla cinematic data: " + array23[num20].CinematicId);
					}
					medsCinematicDataSource[array23[num20].CinematicId.Replace(" ", "").ToLower()] = Object.Instantiate<CinematicData>(array23[num20]);
				}
				catch (Exception ex26)
				{
					LogError("Error loading vanilla cinematic: " + ex26.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_Cinematics").SetValue((object)medsCinematicDataSource);
			LogInfo("Loading combat data...");
			for (int num21 = 0; num21 < array14.Length; num21++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla combatData: " + array14[num21].CombatId);
					}
					medsCombatDataSource[array14[num21].CombatId.Replace(" ", "").ToLower()] = Object.Instantiate<CombatData>(array14[num21]);
				}
				catch (Exception ex27)
				{
					LogError("Error loading vanilla combatData: " + ex27.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_CombatDataSource").SetValue((object)medsCombatDataSource);
			LogInfo("Loading LootData...");
			for (int num22 = 0; num22 < array18.Length; num22++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla LootData: " + array18[num22].Id);
					}
					medsLootDataSource[array18[num22].Id.ToLower()] = Object.Instantiate<LootData>(array18[num22]);
				}
				catch (Exception ex28)
				{
					LogError("Error loading vanilla LootData: " + ex28.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_LootDataSource").SetValue((object)medsLootDataSource);
			LogInfo("Loading zone data...");
			for (int num23 = 0; num23 < array24.Length; num23++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla zone data: " + array24[num23].ZoneId);
					}
					medsZoneDataSource[array24[num23].ZoneId.ToLower()] = Object.Instantiate<ZoneData>(array24[num23]);
				}
				catch (Exception ex29)
				{
					LogError("Error loading vanilla zone data: " + ex29.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_ZoneDataSource").SetValue((object)medsZoneDataSource);
			LogInfo("Loading node data...");
			for (int num24 = 0; num24 < array15.Length; num24++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla node data: " + array15[num24].NodeId);
					}
					string text11 = array15[num24].NodeId.ToLower();
					if (!medsNodesByZone.ContainsKey(array15[num24].NodeZone.ZoneId.ToLower()))
					{
						medsNodesByZone[array15[num24].NodeZone.ZoneId.ToLower()] = new List<NodeDataText>();
					}
					if (!medsNodesByZone[array15[num24].NodeZone.ZoneId.ToLower()].Contains(DataTextConvert.ToText(array15[num24])))
					{
						medsNodesByZone[array15[num24].NodeZone.ZoneId.ToLower()].Add(DataTextConvert.ToText(array15[num24]));
					}
					medsNodeDataSource[text11] = array15[num24];
					((Object)medsNodeDataSource[text11]).name = text11;
				}
				catch (Exception ex30)
				{
					LogError("Error loading vanilla node data: " + ex30.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_NodeDataSource").SetValue((object)medsNodeDataSource);
			Traverse.Create((object)Globals.Instance).Field("_NodeCombatEventRelation").SetValue((object)medsNodeCombatEventRelation);
			LogInfo("Loading events...");
			for (int num25 = 0; num25 < array12.Length; num25++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla event: " + array12[num25].EventId);
					}
					EventData val5 = Object.Instantiate<EventData>(array12[num25]);
					val5.Init();
					medsEventDataSource[val5.EventId.ToLower()] = val5;
				}
				catch (Exception ex31)
				{
					LogError("Error loading vanilla events: " + ex31.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_Events").SetValue((object)medsEventDataSource);
			LogInfo("Loading challenge traits...");
			for (int num26 = 0; num26 < array25.Length; num26++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla challengeTrait: " + array25[num26].Id);
					}
					medsChallengeTraitsSource[array25[num26].Id.ToLower()] = Object.Instantiate<ChallengeTrait>(array25[num26]);
				}
				catch (Exception ex32)
				{
					LogError("Error loading vanilla challengeTrait: " + ex32.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_ChallengeTraitsSource").SetValue((object)medsChallengeTraitsSource);
			LogInfo("Loading challenge data...");
			for (int num27 = 0; num27 < array26.Length; num27++)
			{
				try
				{
					if (medsVanillaContentLog.Value)
					{
						LogDebug("Loading vanilla challengeData: " + array26[num27].Id);
					}
					medsChallengeDataSource[array26[num27].Id.ToLower()] = Object.Instantiate<ChallengeData>(array26[num27]);
				}
				catch (Exception ex33)
				{
					LogError("Error loading vanilla challengeData: " + ex33.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_WeeklyDataSource").SetValue((object)medsChallengeDataSource);
		}

		internal static bool LoadCustomContent(string sFolderName)
		{
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Expected O, but got Unknown
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_44cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Invalid comparison between Unknown and I4
			//IL_04c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_051b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0534: Unknown result type (might be due to invalid IL or missing references)
			//IL_053e: Unknown result type (might be due to invalid IL or missing references)
			//IL_059e: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0642: Unknown result type (might be due to invalid IL or missing references)
			//IL_0647: Unknown result type (might be due to invalid IL or missing references)
			//IL_0657: Unknown result type (might be due to invalid IL or missing references)
			//IL_065c: Unknown result type (might be due to invalid IL or missing references)
			//IL_066c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0671: Unknown result type (might be due to invalid IL or missing references)
			//IL_0681: Unknown result type (might be due to invalid IL or missing references)
			//IL_0686: Unknown result type (might be due to invalid IL or missing references)
			//IL_068f: Unknown result type (might be due to invalid IL or missing references)
			//IL_069b: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0730: Unknown result type (might be due to invalid IL or missing references)
			//IL_0735: Unknown result type (might be due to invalid IL or missing references)
			//IL_073f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0744: Unknown result type (might be due to invalid IL or missing references)
			//IL_074e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0753: Unknown result type (might be due to invalid IL or missing references)
			//IL_075e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0763: Unknown result type (might be due to invalid IL or missing references)
			//IL_0773: Unknown result type (might be due to invalid IL or missing references)
			//IL_0786: Unknown result type (might be due to invalid IL or missing references)
			//IL_0799: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0800: Unknown result type (might be due to invalid IL or missing references)
			//IL_080b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0817: Unknown result type (might be due to invalid IL or missing references)
			//IL_085c: Unknown result type (might be due to invalid IL or missing references)
			if (!Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName)))
			{
				LogError("Cannot find content pack folder: " + sFolderName);
				return false;
			}
			LogInfo("Loading content pack: " + sFolderName);
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "audio")))
			{
				int num = 0;
				LogInfo("Loading AudioClips from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "audio")).GetFiles("*.wav");
				FileInfo[] array = files;
				foreach (FileInfo fileInfo in array)
				{
					LogInfo("Loading " + sFolderName + " AudioClip: " + fileInfo.Name);
					string text = "file:///" + fileInfo.ToString().Replace("\\", "/");
					try
					{
						UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(text, (AudioType)20);
						try
						{
							audioClip.SendWebRequest();
							while (!audioClip.isDone)
							{
							}
							if ((int)audioClip.result == 2)
							{
								LogError(audioClip.error);
								continue;
							}
							AudioClip content = DownloadHandlerAudioClip.GetContent(audioClip);
							((Object)content).name = Path.GetFileNameWithoutExtension(fileInfo.Name);
							medsAudioClips[Path.GetFileNameWithoutExtension(fileInfo.Name)] = content;
							num++;
						}
						finally
						{
							((IDisposable)audioClip)?.Dispose();
						}
					}
					catch (Exception ex)
					{
						LogError("Error loading custom " + sFolderName + " AudioClip " + fileInfo.Name + ": " + ex.Message);
					}
				}
				if (num > 0)
				{
					LogInfo("Loaded " + num + " AudioClips from " + sFolderName);
				}
			}
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "sprite")))
			{
				int num = 0;
				LogInfo("Loading Sprites from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "sprite")).GetFiles("*.png");
				FileInfo[] array2 = files;
				foreach (FileInfo fileInfo2 in array2)
				{
					LogInfo("Loading " + sFolderName + " Sprite: " + fileInfo2.Name);
					try
					{
						Texture2D val = new Texture2D(0, 0);
						ImageConversion.LoadImage(val, File.ReadAllBytes(fileInfo2.ToString()));
						Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0);
						((Object)val2).name = Path.GetFileNameWithoutExtension(fileInfo2.Name).Trim().ToLower();
						medsSprites[Path.GetFileNameWithoutExtension(fileInfo2.Name).Trim().ToLower()] = val2;
						num++;
					}
					catch (Exception ex2)
					{
						LogError("Error loading custom " + sFolderName + " Sprite " + fileInfo2.Name + ": " + ex2.Message);
					}
				}
				if (num > 0)
				{
					LogInfo("Loaded " + num + " Sprites from " + sFolderName);
				}
			}
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "gameObject")))
			{
				int num = 0;
				LogInfo("Loading gameObjects from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "gameObject")).GetFiles("*.json");
				FileInfo[] array3 = files;
				NativeArray<Vector2> val8 = default(NativeArray<Vector2>);
				NativeArray<Vector3> val9 = default(NativeArray<Vector3>);
				NativeArray<Vector4> val10 = default(NativeArray<Vector4>);
				NativeArray<BoneWeight> val11 = default(NativeArray<BoneWeight>);
				foreach (FileInfo fileInfo3 in array3)
				{
					LogInfo("Loading " + sFolderName + " gameObject retexture: " + fileInfo3.Name);
					try
					{
						GameObjectRetexture val3 = JsonUtility.FromJson<GameObjectRetexture>(File.ReadAllText(fileInfo3.ToString()));
						GameObject gO = DataTextConvert.GetGO(val3.BaseGameObjectID);
						if ((Object)(object)gO != (Object)null)
						{
							((Object)gO).name = val3.NewGameObjectID;
							Sprite val4 = (Utility.IsNullOrWhiteSpace(val3.SpriteToUse) ? null : DataTextConvert.GetSprite(val3.SpriteToUse));
							Vector3 localScale = gO.transform.localScale;
							LogInfo("localScale: " + ((object)(Vector3)(ref localScale)).ToString());
							gO.transform.localScale = new Vector3(gO.transform.localScale.x * val3.ScaleX * (float)((!val3.Flip) ? 1 : (-1)), gO.transform.localScale.y * val3.ScaleY, gO.transform.localScale.z);
							LogInfo("Flip: " + val3.Flip);
							LogInfo("Scale: " + val3.ScaleX + "," + val3.ScaleY);
							localScale = gO.transform.localScale;
							LogInfo("NEW localScale: " + ((object)(Vector3)(ref localScale)).ToString());
							if ((Object)(object)val4 != (Object)null)
							{
								try
								{
									SpriteRenderer[] componentsInChildren = gO.GetComponentsInChildren<SpriteRenderer>(true);
									SpriteRenderer[] array4 = componentsInChildren;
									foreach (SpriteRenderer val5 in array4)
									{
										if ((Object)(object)val5.sprite != (Object)null && (Object)(object)((Component)val5).gameObject.GetComponent<SpriteSkin>() != (Object)null)
										{
											LogDebug("trying to change sprite for spriterenderer: " + ((Object)val5).name);
											Texture2D texture = val4.texture;
											Rect rect = val5.sprite.rect;
											float x = ((Rect)(ref rect)).x;
											rect = val5.sprite.rect;
											float y = ((Rect)(ref rect)).y;
											rect = val5.sprite.rect;
											float width = ((Rect)(ref rect)).width;
											rect = val5.sprite.rect;
											Rect val6 = new Rect(x, y, width, ((Rect)(ref rect)).height);
											float x2 = val5.sprite.pivot.x;
											rect = val5.sprite.rect;
											float num2 = x2 / ((Rect)(ref rect)).width;
											float y2 = val5.sprite.pivot.y;
											rect = val5.sprite.rect;
											Sprite val7 = Sprite.Create(texture, val6, new Vector2(num2, y2 / ((Rect)(ref rect)).height));
											int vertexCount = SpriteDataAccessExtensions.GetVertexCount(val5.sprite);
											val8..ctor(vertexCount, (Allocator)2, (NativeArrayOptions)1);
											val9..ctor(vertexCount, (Allocator)2, (NativeArrayOptions)1);
											val10..ctor(vertexCount, (Allocator)2, (NativeArrayOptions)1);
											val11..ctor(vertexCount, (Allocator)2, (NativeArrayOptions)1);
											NativeSlice<Vector2> vertexAttribute = SpriteDataAccessExtensions.GetVertexAttribute<Vector2>(val5.sprite, (VertexAttribute)4);
											NativeSlice<Vector3> vertexAttribute2 = SpriteDataAccessExtensions.GetVertexAttribute<Vector3>(val5.sprite, (VertexAttribute)0);
											NativeSlice<Vector4> vertexAttribute3 = SpriteDataAccessExtensions.GetVertexAttribute<Vector4>(val5.sprite, (VertexAttribute)2);
											NativeSlice<BoneWeight> vertexAttribute4 = SpriteDataAccessExtensions.GetVertexAttribute<BoneWeight>(val5.sprite, (VertexAttribute)12);
											for (int m = 0; m < vertexCount; m++)
											{
												val8[m] = vertexAttribute[m];
												val9[m] = vertexAttribute2[m];
												val10[m] = vertexAttribute3[m];
												val11[m] = vertexAttribute4[m];
											}
											SpriteDataAccessExtensions.SetIndices(val7, SpriteDataAccessExtensions.GetIndices(val5.sprite));
											SpriteDataAccessExtensions.SetVertexCount(val7, SpriteDataAccessExtensions.GetVertexCount(val5.sprite));
											SpriteDataAccessExtensions.SetVertexAttribute<Vector2>(val7, (VertexAttribute)4, val8);
											SpriteDataAccessExtensions.SetVertexAttribute<Vector3>(val7, (VertexAttribute)0, val9);
											SpriteDataAccessExtensions.SetVertexAttribute<Vector4>(val7, (VertexAttribute)2, val10);
											SpriteDataAccessExtensions.SetVertexAttribute<BoneWeight>(val7, (VertexAttribute)12, val11);
											val8.Dispose();
											val9.Dispose();
											val10.Dispose();
											val11.Dispose();
											SpriteDataAccessExtensions.SetBones(val7, SpriteDataAccessExtensions.GetBones(val5.sprite));
											SpriteDataAccessExtensions.SetBindPoses(val7, SpriteDataAccessExtensions.GetBindPoses(val5.sprite));
											val5.sprite = val7;
										}
									}
								}
								catch
								{
									LogError("Unable to retexture gameObject " + val3.NewGameObjectID + " for unknown reason! Please let Meds know.");
								}
							}
							else if (!Utility.IsNullOrWhiteSpace(val3.SpriteToUse))
							{
								LogError("Could not find gameObject retexture sprite: " + val3.SpriteToUse);
							}
							medsGOs[val3.NewGameObjectID] = gO;
							num++;
						}
						else
						{
							LogError("Could not find base gameObject with ID: " + val3.BaseGameObjectID);
						}
					}
					catch (Exception ex3)
					{
						LogError("Error loading custom " + sFolderName + " GameObject " + fileInfo3.Name + ": " + ex3.Message);
					}
				}
				if (num > 0)
				{
					LogInfo("Loaded " + num + " gameObject retextures from " + sFolderName);
				}
			}
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "keyNote")))
			{
				int num = 0;
				LogInfo("Loading keynotes from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "keyNote")).GetFiles("*.json");
				FileInfo[] array5 = files;
				foreach (FileInfo fileInfo4 in array5)
				{
					LogInfo("Loading " + sFolderName + " keynote: " + fileInfo4.Name);
					try
					{
						KeyNotesData val12 = DataTextConvert.ToData(JsonUtility.FromJson<KeyNotesDataText>(File.ReadAllText(fileInfo4.ToString())));
						medsKeyNotesDataSource[val12.Id] = Object.Instantiate<KeyNotesData>(val12);
						num++;
					}
					catch (Exception ex4)
					{
						LogError("Error loading custom " + sFolderName + " keynote " + fileInfo4.Name + ": " + ex4.Message);
					}
				}
				Globals.Instance.KeyNotes = medsKeyNotesDataSource;
				if (num > 0)
				{
					LogInfo("Loaded " + num + " keynotes from " + sFolderName);
				}
			}
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "auraCurse")))
			{
				int num = 0;
				LogInfo("Loading auraCurses from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "auraCurse")).GetFiles("*.json");
				FileInfo[] array6 = files;
				foreach (FileInfo fileInfo5 in array6)
				{
					LogInfo("Loading " + sFolderName + " auraCurse: " + fileInfo5.Name);
					try
					{
						AuraCurseData val13 = DataTextConvert.ToData(JsonUtility.FromJson<AuraCurseDataText>(File.ReadAllText(fileInfo5.ToString())));
						val13.Init();
						medsAurasCursesSource[val13.Id] = Object.Instantiate<AuraCurseData>(val13);
						if (!medsACIndex.Contains(val13.Id.ToLower()))
						{
							medsACIndex.Add(val13.Id.ToLower());
						}
						num++;
					}
					catch (Exception ex5)
					{
						LogError("Error loading custom " + sFolderName + " auraCurse " + fileInfo5.Name + ": " + ex5.Message);
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_AurasCursesSource").SetValue((object)medsAurasCursesSource);
				Traverse.Create((object)Globals.Instance).Field("_AurasCursesIndex").SetValue((object)medsACIndex);
				Traverse.Create((object)Globals.Instance).Field("_AurasCurses").SetValue((object)medsAurasCursesSource);
				if (num > 0)
				{
					LogInfo("Loaded " + num + " auraCurses from " + sFolderName);
				}
			}
			medsCardsNeedingItems = new Dictionary<string, string>();
			medsCardsNeedingItemEnchants = new Dictionary<string, string>();
			medsSecondRunImport = new Dictionary<string, string[]>();
			medsSecondRunImport2 = new Dictionary<string, string>();
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "card")))
			{
				int num = 0;
				LogInfo("Loading cards from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "card")).GetFiles("*.json");
				Dictionary<string, CardData> dictionary = new Dictionary<string, CardData>();
				FileInfo[] array7 = files;
				foreach (FileInfo fileInfo6 in array7)
				{
					LogInfo("Loading " + sFolderName + " card: " + fileInfo6.Name);
					try
					{
						CardData val14 = DataTextConvert.ToData(JsonUtility.FromJson<CardDataText>(File.ReadAllText(fileInfo6.ToString())));
						if (!medsCustomUnlocks.Contains(val14.Id))
						{
							medsCustomUnlocks.Add(val14.Id);
						}
						medsCardsSource[val14.Id] = Object.Instantiate<CardData>(val14);
						num++;
					}
					catch (Exception ex6)
					{
						LogError("Error loading custom " + sFolderName + " card " + fileInfo6.Name + ": " + ex6.Message);
					}
				}
				SortedDictionary<string, CardData> dictionary2 = new SortedDictionary<string, CardData>(medsCardsSource);
				medsCardsSource = new Dictionary<string, CardData>(dictionary2);
				LogInfo("Loading custom card component for " + sFolderName + ": AddCardList...");
				foreach (string key2 in medsSecondRunImport.Keys)
				{
					try
					{
						medsCardsSource[key2].AddCardList = (CardData[])(object)new CardData[medsSecondRunImport[key2].Length];
						for (int num5 = 0; num5 < medsSecondRunImport[key2].Length; num5++)
						{
							if (medsCardsSource.ContainsKey(medsSecondRunImport[key2][num5]))
							{
								medsCardsSource[key2].AddCardList[num5] = medsCardsSource[medsSecondRunImport[key2][num5]];
							}
							else
							{
								medsCardsSource[key2].AddCardList[num5] = null;
							}
						}
					}
					catch (Exception ex7)
					{
						LogError("Error loading AddCardList: " + ex7.Message);
					}
				}
				LogInfo("Loading custom card component for " + sFolderName + ": UpgradesToRare...");
				foreach (string key3 in medsSecondRunImport2.Keys)
				{
					try
					{
						if (medsCardsSource.ContainsKey(medsSecondRunImport2[key3]))
						{
							medsCardsSource[key3].UpgradesToRare = medsCardsSource[medsSecondRunImport2[key3]];
						}
					}
					catch (Exception ex8)
					{
						LogError("Error loading UpgradesToRare: " + ex8.Message);
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_CardsSource").SetValue((object)medsCardsSource);
				if (num > 0)
				{
					LogInfo("Loaded " + num + " cards from " + sFolderName);
				}
			}
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "tierReward")))
			{
				int num = 0;
				LogInfo("Loading tierRewards from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "tierReward")).GetFiles("*.json");
				FileInfo[] array8 = files;
				foreach (FileInfo fileInfo7 in array8)
				{
					LogInfo("Loading " + sFolderName + " tierReward: " + fileInfo7.Name);
					try
					{
						TierRewardData val15 = DataTextConvert.ToData(JsonUtility.FromJson<TierRewardDataText>(File.ReadAllText(fileInfo7.ToString())));
						medsTierRewardDataSource[val15.TierNum] = Object.Instantiate<TierRewardData>(val15);
						num++;
					}
					catch (Exception ex9)
					{
						LogError("Error loading custom " + sFolderName + " tierReward " + fileInfo7.Name + ": " + ex9.Message);
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_TierRewardDataSource").SetValue((object)medsTierRewardDataSource);
				if (num > 0)
				{
					LogInfo("Loaded " + num + " tierRewards from " + sFolderName);
				}
			}
			medsSecondRunImport = new Dictionary<string, string[]>();
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "NPC")))
			{
				int num = 0;
				LogInfo("Loading NPCs from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "NPC")).GetFiles("*.json");
				FileInfo[] array9 = files;
				foreach (FileInfo fileInfo8 in array9)
				{
					try
					{
						LogInfo("Loading " + sFolderName + " NPC: " + fileInfo8.Name);
						NPCData val16 = DataTextConvert.ToData(JsonUtility.FromJson<NPCDataText>(File.ReadAllText(fileInfo8.ToString())));
						medsNPCsSource[val16.Id] = Object.Instantiate<NPCData>(val16);
						sortedDictionary[val16.Id] = medsNPCsSource[val16.Id].NPCName;
						if (medsSecondRunImport.ContainsKey(val16.Id))
						{
							medsNPCsSource[val16.Id].BaseMonster = ((!Utility.IsNullOrWhiteSpace(medsSecondRunImport[val16.Id][0]) && medsNPCsSource.ContainsKey(medsSecondRunImport[val16.Id][0])) ? medsNPCsSource[medsSecondRunImport[val16.Id][0]] : null);
							medsNPCsSource[val16.Id].HellModeMob = ((!Utility.IsNullOrWhiteSpace(medsSecondRunImport[val16.Id][1]) && medsNPCsSource.ContainsKey(medsSecondRunImport[val16.Id][1])) ? medsNPCsSource[medsSecondRunImport[val16.Id][1]] : null);
							medsNPCsSource[val16.Id].NgPlusMob = ((!Utility.IsNullOrWhiteSpace(medsSecondRunImport[val16.Id][2]) && medsNPCsSource.ContainsKey(medsSecondRunImport[val16.Id][2])) ? medsNPCsSource[medsSecondRunImport[val16.Id][2]] : null);
							medsNPCsSource[val16.Id].UpgradedMob = ((!Utility.IsNullOrWhiteSpace(medsSecondRunImport[val16.Id][3]) && medsNPCsSource.ContainsKey(medsSecondRunImport[val16.Id][3])) ? medsNPCsSource[medsSecondRunImport[val16.Id][3]] : null);
						}
						medsNPCs[val16.Id] = Object.Instantiate<NPCData>(medsNPCsSource[val16.Id]);
						string text2 = Texts.Instance.GetText(val16.Id + "_name", "monsters");
						if (text2 != "")
						{
							medsNPCs[val16.Id].NPCName = text2;
						}
						if (medsNPCsSource[val16.Id].IsNamed && medsNPCsSource[val16.Id].Difficulty > -1)
						{
							medsNPCsNamed[val16.Id] = Object.Instantiate<NPCData>(medsNPCsSource[val16.Id]);
							string text3 = Texts.Instance.GetText(val16.Id + "_name", "monsters");
							if (text3 != "")
							{
								medsNPCsNamed[val16.Id].NPCName = text3;
							}
						}
						num++;
					}
					catch (Exception ex10)
					{
						LogError("Error loading custom " + sFolderName + " NPC " + fileInfo8.Name + ": " + ex10.Message);
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_NPCsSource").SetValue((object)medsNPCsSource);
				Traverse.Create((object)Globals.Instance).Field("_NPCs").SetValue((object)medsNPCs);
				Traverse.Create((object)Globals.Instance).Field("_NPCsNamed").SetValue((object)medsNPCsNamed);
				if (num > 0)
				{
					LogInfo("Loaded " + num + " NPCs from " + sFolderName);
				}
			}
			LogInfo("Loading custom card component for " + sFolderName + ": Item...");
			foreach (string key4 in medsCardsNeedingItems.Keys)
			{
				try
				{
					ItemData val17 = DataTextConvert.ToData(JsonUtility.FromJson<ItemDataText>(medsCardsNeedingItems[key4]));
					LogDebug("Loading custom item: " + val17.Id);
					medsItemDataSource[val17.Id] = Object.Instantiate<ItemData>(val17);
					medsCardsSource[key4].Item = medsItemDataSource[val17.Id];
				}
				catch (Exception ex11)
				{
					LogError("Error loading custom " + sFolderName + " card item " + key4 + ": " + ex11.Message);
				}
			}
			LogInfo("Loading custom card component for " + sFolderName + ": ItemEnchantment...");
			foreach (string key5 in medsCardsNeedingItemEnchants.Keys)
			{
				try
				{
					ItemData val18 = DataTextConvert.ToData(JsonUtility.FromJson<ItemDataText>(medsCardsNeedingItemEnchants[key5]));
					LogDebug("Loading custom enchantment: " + val18.Id);
					medsItemDataSource[val18.Id] = Object.Instantiate<ItemData>(val18);
					medsCardsSource[key5].ItemEnchantment = medsItemDataSource[val18.Id];
				}
				catch (Exception ex12)
				{
					LogError("Error loading custom " + sFolderName + " card enchantment " + key5 + ": " + ex12.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_ItemDataSource").SetValue((object)medsItemDataSource);
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "trait")))
			{
				int num = 0;
				LogInfo("Loading traits from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "trait")).GetFiles("*.json");
				FileInfo[] array10 = files;
				foreach (FileInfo fileInfo9 in array10)
				{
					try
					{
						LogInfo("Loading " + sFolderName + " trait: " + fileInfo9.Name);
						TraitData val19 = DataTextConvert.ToData(JsonUtility.FromJson<TraitDataText>(File.ReadAllText(fileInfo9.ToString())));
						medsTraitsSource[val19.Id] = Object.Instantiate<TraitData>(val19);
						medsTraitsCopy[val19.Id] = Object.Instantiate<TraitData>(medsTraitsSource[val19.Id]);
						if (!medsCustomTraitsSource.Contains(val19.Id))
						{
							medsCustomTraitsSource.Add(val19.Id);
						}
						num++;
					}
					catch (Exception ex13)
					{
						LogError("Error loading custom " + sFolderName + " trait " + fileInfo9.Name + ": " + ex13.Message);
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_TraitsSource").SetValue((object)medsTraitsSource);
				Traverse.Create((object)Globals.Instance).Field("_Traits").SetValue((object)medsTraitsCopy);
				if (num > 0)
				{
					LogInfo("Loaded " + num + " traits from " + sFolderName);
				}
			}
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "perk")))
			{
				int num = 0;
				LogInfo("Loading perks from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "perk")).GetFiles("*.json");
				FileInfo[] array11 = files;
				foreach (FileInfo fileInfo10 in array11)
				{
					try
					{
						LogInfo("Loading " + sFolderName + " perk: " + fileInfo10.Name);
						PerkData val20 = DataTextConvert.ToData(JsonUtility.FromJson<PerkDataText>(File.ReadAllText(fileInfo10.ToString())));
						medsPerksSource[val20.Id] = Object.Instantiate<PerkData>(val20);
						num++;
					}
					catch (Exception ex14)
					{
						LogError("Error loading custom " + sFolderName + " perk " + fileInfo10.Name + ": " + ex14.Message);
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_PerksSource").SetValue((object)medsPerksSource);
				if (num > 0)
				{
					LogInfo("Loaded " + num + " perks from " + sFolderName);
				}
			}
			medsSecondRunImport2 = new Dictionary<string, string>();
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "pack")))
			{
				int num = 0;
				LogInfo("Loading packs from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "pack")).GetFiles("*.json");
				FileInfo[] array12 = files;
				foreach (FileInfo fileInfo11 in array12)
				{
					try
					{
						LogInfo("Loading " + sFolderName + " pack: " + fileInfo11.Name);
						PackData val21 = DataTextConvert.ToData(JsonUtility.FromJson<PackDataText>(File.ReadAllText(fileInfo11.ToString())));
						medsPackDataSource[val21.PackId] = Object.Instantiate<PackData>(val21);
						num++;
					}
					catch (Exception ex15)
					{
						LogError("Error loading custom " + sFolderName + " pack " + fileInfo11.Name + ": " + ex15.Message);
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_PackDataSource").SetValue((object)medsPackDataSource);
				if (num > 0)
				{
					LogInfo("Loaded " + num + " packs from " + sFolderName);
				}
			}
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "subclass")))
			{
				int num = 0;
				LogInfo("Loading subclasses from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "subclass")).GetFiles("*.json");
				FileInfo[] array13 = files;
				foreach (FileInfo fileInfo12 in array13)
				{
					try
					{
						LogInfo("Loading " + sFolderName + " subclass: " + fileInfo12.Name);
						SubClassData val22 = DataTextConvert.ToData(JsonUtility.FromJson<SubClassDataText>(File.ReadAllText(fileInfo12.ToString())));
						medsSubClassesSource[val22.Id] = Object.Instantiate<SubClassData>(val22);
						medsSubClassCopy[val22.Id] = Object.Instantiate<SubClassData>(medsSubClassesSource[val22.Id]);
						if (medsSubClassCopy[val22.Id].CharacterName.Length < 2)
						{
							medsSubClassCopy[val22.Id].CharacterName = Texts.Instance.GetText(val22.Id + "_name", "class");
						}
						if (medsSubClassCopy[val22.Id].CharacterDescription.Length < 2)
						{
							medsSubClassCopy[val22.Id].CharacterDescription = Texts.Instance.GetText(val22.Id + "_description", "class");
						}
						if (medsSubClassCopy[val22.Id].CharacterDescriptionStrength.Length < 2)
						{
							medsSubClassCopy[val22.Id].CharacterDescriptionStrength = Texts.Instance.GetText(val22.Id + "_strength", "class");
						}
						num++;
					}
					catch (Exception ex16)
					{
						LogError("Error loading custom " + sFolderName + " subclass " + fileInfo12.Name + ": " + ex16.Message);
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_SubClassSource").SetValue((object)medsSubClassesSource);
				Traverse.Create((object)Globals.Instance).Field("_SubClass").SetValue((object)medsSubClassCopy);
				if (num > 0)
				{
					LogInfo("Loaded " + num + " subclasses from " + sFolderName);
				}
				LogDebug("pack-subclass binding commenced...");
				foreach (string key6 in medsSecondRunImport2.Keys)
				{
					string key = medsSecondRunImport2[key6].ToLower().Trim();
					if (medsSubClassesSource.ContainsKey(key) && medsPackDataSource.ContainsKey(key6))
					{
						medsPackDataSource[key6].RequiredClass = medsSubClassesSource[key];
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_PackDataSource").SetValue((object)medsPackDataSource);
			}
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "skin")))
			{
				int num = 0;
				LogInfo("Loading skins from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "skin")).GetFiles("*.json");
				FileInfo[] array14 = files;
				foreach (FileInfo fileInfo13 in array14)
				{
					try
					{
						LogInfo("Loading " + sFolderName + " skin: " + fileInfo13.Name);
						SkinData val23 = DataTextConvert.ToData(JsonUtility.FromJson<SkinDataText>(File.ReadAllText(fileInfo13.ToString())));
						medsSkinsSource[val23.SkinId.ToLower()] = Object.Instantiate<SkinData>(val23);
						num++;
					}
					catch (Exception ex17)
					{
						LogError("Error loading custom " + sFolderName + " skin " + fileInfo13.Name + ": " + ex17.Message);
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_SkinDataSource").SetValue((object)medsSkinsSource);
				if (num > 0)
				{
					LogInfo("Loaded " + num + " skins from " + sFolderName);
				}
			}
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "cardback")))
			{
				int num = 0;
				LogInfo("Loading cardbacks from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "cardback")).GetFiles("*.json");
				FileInfo[] array15 = files;
				foreach (FileInfo fileInfo14 in array15)
				{
					try
					{
						LogInfo("Loading " + sFolderName + " cardback: " + fileInfo14.Name);
						CardbackData val24 = DataTextConvert.ToData(JsonUtility.FromJson<CardbackDataText>(File.ReadAllText(fileInfo14.ToString())));
						medsCardbacksSource[val24.CardbackId.ToLower()] = Object.Instantiate<CardbackData>(val24);
						num++;
					}
					catch (Exception ex18)
					{
						LogError("Error loading custom " + sFolderName + " cardback " + fileInfo14.Name + ": " + ex18.Message);
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_CardbackDataSource").SetValue((object)medsCardbacksSource);
				if (num > 0)
				{
					LogInfo("Loaded " + num + " cardbacks from " + sFolderName);
				}
			}
			medsSecondRunImport = new Dictionary<string, string[]>();
			medsSecondRunImport2 = new Dictionary<string, string>();
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "perkNode")))
			{
				int num = 0;
				LogInfo("Loading perkNodes from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "perkNode")).GetFiles("*.json");
				FileInfo[] array16 = files;
				foreach (FileInfo fileInfo15 in array16)
				{
					try
					{
						LogInfo("Loading " + sFolderName + " perkNode: " + fileInfo15.Name);
						PerkNodeData val25 = DataTextConvert.ToData(JsonUtility.FromJson<PerkNodeDataText>(File.ReadAllText(fileInfo15.ToString())));
						medsPerksNodesSource[val25.Id] = Object.Instantiate<PerkNodeData>(val25);
						num++;
					}
					catch (Exception ex19)
					{
						LogError("Error loading custom " + sFolderName + " perkNode " + fileInfo15.Name + ": " + ex19.Message);
					}
				}
				foreach (string key7 in medsPerksNodesSource.Keys)
				{
					try
					{
						if (medsSecondRunImport.ContainsKey(key7))
						{
							medsPerksNodesSource[key7].PerksConnected = (PerkNodeData[])(object)new PerkNodeData[medsSecondRunImport[key7].Length];
							for (int num15 = 0; num15 < medsSecondRunImport[key7].Length; num15++)
							{
								medsPerksNodesSource[key7].PerksConnected[num15] = (medsPerksNodesSource.ContainsKey(medsSecondRunImport[key7][num15]) ? medsPerksNodesSource[medsSecondRunImport[key7][num15]] : null);
							}
						}
						if (medsSecondRunImport2.ContainsKey(key7))
						{
							medsPerksNodesSource[key7].PerkRequired = (medsPerksNodesSource.ContainsKey(medsSecondRunImport2[key7]) ? medsPerksNodesSource[medsSecondRunImport2[key7]] : null);
						}
					}
					catch (Exception ex20)
					{
						LogError("Error performing late binding of " + sFolderName + " perknodes: " + ex20.Message);
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_PerksNodesSource").SetValue((object)medsPerksNodesSource);
				if (num > 0)
				{
					LogInfo("Loaded " + num + " perkNodes from " + sFolderName);
				}
			}
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "eventRequirement")))
			{
				int num = 0;
				LogInfo("Loading eventRequirements from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "eventRequirement")).GetFiles("*.json");
				FileInfo[] array17 = files;
				foreach (FileInfo fileInfo16 in array17)
				{
					try
					{
						LogInfo("Loading " + sFolderName + " eventRequirement: " + fileInfo16.Name);
						EventRequirementData val26 = DataTextConvert.ToData(JsonUtility.FromJson<EventRequirementDataText>(File.ReadAllText(fileInfo16.ToString())));
						medsEventRequirementDataSource[val26.RequirementId] = Object.Instantiate<EventRequirementData>(val26);
						num++;
					}
					catch (Exception ex21)
					{
						LogError("Error loading custom " + sFolderName + " eventRequirement " + fileInfo16.Name + ": " + ex21.Message);
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_Requirements").SetValue((object)medsEventRequirementDataSource);
				if (num > 0)
				{
					LogInfo("Loaded " + num + " eventRequirements from " + sFolderName);
				}
			}
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "pairsPack")))
			{
				int num = 0;
				LogInfo("Loading pairsPacks from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "pairsPack")).GetFiles("*.json");
				FileInfo[] array18 = files;
				foreach (FileInfo fileInfo17 in array18)
				{
					try
					{
						LogInfo("Loading " + sFolderName + " pairsPack: " + fileInfo17.Name);
						CardPlayerPairsPackData val27 = DataTextConvert.ToData(JsonUtility.FromJson<CardPlayerPairsPackDataText>(File.ReadAllText(fileInfo17.ToString())));
						medsCardPlayerPairsPackDataSource[val27.PackId] = Object.Instantiate<CardPlayerPairsPackData>(val27);
						num++;
					}
					catch (Exception ex22)
					{
						LogError("Error loading custom " + sFolderName + " pairsPack " + fileInfo17.Name + ": " + ex22.Message);
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_CardPlayerPairsPackDataSource").SetValue((object)medsCardPlayerPairsPackDataSource);
				if (num > 0)
				{
					LogInfo("Loaded " + num + " pairsPacks from " + sFolderName);
				}
			}
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "corruptionPack")))
			{
				int num = 0;
				LogInfo("Loading corruptionPacks from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "corruptionPack")).GetFiles("*.json");
				FileInfo[] array19 = files;
				foreach (FileInfo fileInfo18 in array19)
				{
					try
					{
						LogInfo("Loading " + sFolderName + " corruptionPack: " + fileInfo18.Name);
						CorruptionPackData val28 = DataTextConvert.ToData(JsonUtility.FromJson<CorruptionPackDataText>(File.ReadAllText(fileInfo18.ToString())));
						medsCorruptionPackDataSource[val28.PackName] = Object.Instantiate<CorruptionPackData>(val28);
						num++;
					}
					catch (Exception ex23)
					{
						LogError("Error loading custom " + sFolderName + " corruptionPack " + fileInfo18.Name + ": " + ex23.Message);
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_CorruptionPackDataSource").SetValue((object)medsCorruptionPackDataSource);
				if (num > 0)
				{
					LogInfo("Loaded " + num + " corruptionPacks from " + sFolderName);
				}
			}
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "cardPlayerPack")))
			{
				int num = 0;
				LogInfo("Loading cardPlayerPacks from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "cardPlayerPack")).GetFiles("*.json");
				FileInfo[] array20 = files;
				foreach (FileInfo fileInfo19 in array20)
				{
					try
					{
						LogInfo("Loading " + sFolderName + " cardPlayerPack: " + fileInfo19.Name);
						CardPlayerPackData val29 = DataTextConvert.ToData(JsonUtility.FromJson<CardPlayerPackDataText>(File.ReadAllText(fileInfo19.ToString())));
						medsCardPlayerPackDataSource[val29.PackId] = Object.Instantiate<CardPlayerPackData>(val29);
						num++;
					}
					catch (Exception ex24)
					{
						LogError("Error loading custom " + sFolderName + " cardPlayerPack " + fileInfo19.Name + ": " + ex24.Message);
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_CardPlayerPackDataSource").SetValue((object)medsCardPlayerPackDataSource);
				if (num > 0)
				{
					LogInfo("Loaded " + num + " cardPlayerPacks from " + sFolderName);
				}
			}
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "cinematic")))
			{
				int num = 0;
				LogInfo("Loading cinematic from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "cinematic")).GetFiles("*.json");
				FileInfo[] array21 = files;
				foreach (FileInfo fileInfo20 in array21)
				{
					try
					{
						LogInfo("Loading " + sFolderName + " cinematic: " + fileInfo20.Name);
						CinematicData val30 = DataTextConvert.ToData(JsonUtility.FromJson<CinematicDataText>(File.ReadAllText(fileInfo20.ToString())));
						medsCinematicDataSource[val30.CinematicId.ToLower()] = Object.Instantiate<CinematicData>(val30);
						num++;
					}
					catch (Exception ex25)
					{
						LogError("Error loading custom " + sFolderName + " cinematic " + fileInfo20.Name + ": " + ex25.Message);
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_Cinematics").SetValue((object)medsCinematicDataSource);
				if (num > 0)
				{
					LogInfo("Loaded " + num + " cinematics from " + sFolderName);
				}
			}
			medsSecondRunCombatEvent = new Dictionary<string, string>();
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "combatData")))
			{
				int num = 0;
				LogInfo("Loading combatData from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "combatData")).GetFiles("*.json");
				FileInfo[] array22 = files;
				foreach (FileInfo fileInfo21 in array22)
				{
					try
					{
						LogInfo("Loading " + sFolderName + " combat: " + fileInfo21.Name);
						CombatData val31 = DataTextConvert.ToData(JsonUtility.FromJson<CombatDataText>(File.ReadAllText(fileInfo21.ToString())));
						medsCombatDataSource[val31.CombatId] = Object.Instantiate<CombatData>(val31);
						num++;
					}
					catch (Exception ex26)
					{
						LogError("Error loading custom " + sFolderName + " combat " + fileInfo21.Name + ": " + ex26.Message);
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_CombatDataSource").SetValue((object)medsCombatDataSource);
				if (num > 0)
				{
					LogInfo("Loaded " + num + " combatData from " + sFolderName);
				}
			}
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "loot")))
			{
				int num = 0;
				LogInfo("Loading loot from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "loot")).GetFiles("*.json");
				FileInfo[] array23 = files;
				foreach (FileInfo fileInfo22 in array23)
				{
					try
					{
						LogInfo("Loading " + sFolderName + " loot: " + fileInfo22.Name);
						LootData val32 = DataTextConvert.ToData(JsonUtility.FromJson<LootDataText>(File.ReadAllText(fileInfo22.ToString())));
						medsLootDataSource[val32.Id] = Object.Instantiate<LootData>(val32);
						num++;
					}
					catch (Exception ex27)
					{
						LogError("Error loading custom " + sFolderName + " loot " + fileInfo22.Name + ": " + ex27.Message);
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_LootDataSource").SetValue((object)medsLootDataSource);
				if (num > 0)
				{
					LogInfo("Loaded " + num + " loot from " + sFolderName);
				}
			}
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "zone")))
			{
				int num = 0;
				LogInfo("Loading zones from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "zone")).GetFiles("*.json");
				FileInfo[] array24 = files;
				foreach (FileInfo fileInfo23 in array24)
				{
					try
					{
						LogInfo("Loading " + sFolderName + " zone: " + fileInfo23.Name);
						ZoneData val33 = DataTextConvert.ToData(JsonUtility.FromJson<ZoneDataText>(File.ReadAllText(fileInfo23.ToString())));
						medsZoneDataSource[val33.ZoneId.ToLower()] = Object.Instantiate<ZoneData>(val33);
						medsCustomZones[val33.ZoneId.ToLower()] = JsonUtility.FromJson<ZoneDataText>(File.ReadAllText(fileInfo23.ToString()));
						num++;
					}
					catch (Exception ex28)
					{
						LogError("Error loading custom " + sFolderName + " zone " + fileInfo23.Name + ": " + ex28.Message);
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_ZoneDataSource").SetValue((object)medsZoneDataSource);
				if (num > 0)
				{
					LogInfo("Loaded " + num + " zones from " + sFolderName);
				}
			}
			medsSecondRunImport = new Dictionary<string, string[]>();
			medsSecondRunImport2 = new Dictionary<string, string>();
			medsSecondRunNodesConnected = new Dictionary<string, string[]>();
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "node")))
			{
				int num = 0;
				LogInfo("Loading nodes from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "node")).GetFiles("*.json");
				FileInfo[] array25 = files;
				foreach (FileInfo fileInfo24 in array25)
				{
					try
					{
						LogInfo("Loading " + sFolderName + " node: " + fileInfo24.Name);
						NodeData val34 = DataTextConvert.ToData(JsonUtility.FromJson<NodeDataText>(File.ReadAllText(fileInfo24.ToString())));
						string text4 = val34.NodeId.ToLower();
						medsNodeDataSource[text4] = Object.Instantiate<NodeData>(val34);
						((Object)medsNodeDataSource[text4]).name = text4;
						if (!medsNodesByZone.ContainsKey(val34.NodeZone.ZoneId.ToLower()))
						{
							medsNodesByZone[val34.NodeZone.ZoneId.ToLower()] = new List<NodeDataText>();
						}
						if (!medsNodesByZone[val34.NodeZone.ZoneId.ToLower()].Contains(JsonUtility.FromJson<NodeDataText>(File.ReadAllText(fileInfo24.ToString()))))
						{
							medsNodesByZone[val34.NodeZone.ZoneId.ToLower()].Add(JsonUtility.FromJson<NodeDataText>(File.ReadAllText(fileInfo24.ToString())));
						}
						num++;
					}
					catch (Exception ex29)
					{
						LogError("Error loading custom " + sFolderName + " node " + fileInfo24.Name + ": " + ex29.Message);
					}
				}
				LogDebug("Late binding of NodesConnected");
				foreach (KeyValuePair<string, string[]> item in medsSecondRunNodesConnected)
				{
					try
					{
						medsNodeDataSource[item.Key].NodesConnected = (NodeData[])(object)new NodeData[item.Value.Length];
						for (int num25 = 0; num25 < item.Value.Length; num25++)
						{
							medsNodeDataSource[item.Key].NodesConnected[num25] = DataTextConvert.GetNode(item.Value[num25]);
						}
					}
					catch (Exception ex30)
					{
						LogError("Error performing late binding of " + sFolderName + " NodesConnected: " + ex30.Message);
					}
				}
				LogDebug("Late binding of NodesConnectedRequirement");
				foreach (KeyValuePair<string, string[]> item2 in medsSecondRunImport)
				{
					try
					{
						medsNodeDataSource[item2.Key].NodesConnectedRequirement = (NodesConnectedRequirement[])(object)new NodesConnectedRequirement[item2.Value.Length];
						for (int num26 = 0; num26 < item2.Value.Length; num26++)
						{
							medsNodeDataSource[item2.Key].NodesConnectedRequirement[num26] = DataTextConvert.ToData(JsonUtility.FromJson<NodesConnectedRequirementText>(item2.Value[num26]));
						}
					}
					catch (Exception ex31)
					{
						LogError("Error performing late binding of " + sFolderName + " NodesConnectedRequirement: " + ex31.Message);
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_NodeDataSource").SetValue((object)medsNodeDataSource);
				Traverse.Create((object)Globals.Instance).Field("_NodeCombatEventRelation").SetValue((object)medsNodeCombatEventRelation);
				if (num > 0)
				{
					LogInfo("Loaded " + num + " nodes from " + sFolderName);
				}
			}
			medsSecondRunImport = new Dictionary<string, string[]>();
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "event")))
			{
				int num = 0;
				LogInfo("Loading events from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "event")).GetFiles("*.json");
				FileInfo[] array26 = files;
				foreach (FileInfo fileInfo25 in array26)
				{
					try
					{
						LogInfo("Loading " + sFolderName + " event: " + fileInfo25.Name);
						EventData val35 = DataTextConvert.ToData(JsonUtility.FromJson<EventDataText>(File.ReadAllText(fileInfo25.ToString())));
						medsEventDataSource[val35.EventId] = Object.Instantiate<EventData>(val35);
						num++;
					}
					catch (Exception ex32)
					{
						LogError("Error loading custom " + sFolderName + " event " + fileInfo25.Name + ": " + ex32.Message);
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_Events").SetValue((object)medsEventDataSource);
				if (num > 0)
				{
					LogInfo("Loaded " + num + " events from " + sFolderName);
				}
			}
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "eventReply")))
			{
				int num = 0;
				LogInfo("Loading eventReplies from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "eventReply")).GetFiles("*.json");
				FileInfo[] array27 = files;
				foreach (FileInfo fileInfo26 in array27)
				{
					try
					{
						LogInfo("Loading " + sFolderName + " eventReply: " + fileInfo26.Name);
						string text5 = File.ReadAllText(fileInfo26.ToString());
						EventReplyDataText val36 = JsonUtility.FromJson<EventReplyDataText>(text5);
						if (medsSecondRunImport.ContainsKey(val36.medsEvent.ToLower()))
						{
							string[] array28 = medsSecondRunImport[val36.medsEvent.ToLower()];
							Array.Resize(ref array28, array28.Length + 1);
							array28[^1] = text5;
							medsSecondRunImport[val36.medsEvent.ToLower()] = array28;
						}
						else if (medsEventDataSource.ContainsKey(val36.medsEvent.ToLower()))
						{
							medsSecondRunImport[val36.medsEvent.ToLower()] = new string[medsEventDataSource[val36.medsEvent.ToLower()].Replys.Length + 1];
							for (int num29 = 0; num29 < medsEventDataSource[val36.medsEvent.ToLower()].Replys.Length; num29++)
							{
								medsSecondRunImport[val36.medsEvent.ToLower()][num29] = JsonUtility.ToJson((object)DataTextConvert.ToText(medsEventDataSource[val36.medsEvent.ToLower()].Replys[num29], "", -1));
							}
							medsSecondRunImport[val36.medsEvent.ToLower()][medsEventDataSource[val36.medsEvent.ToLower()].Replys.Length] = text5;
						}
						else
						{
							medsSecondRunImport[val36.medsEvent.ToLower()] = new string[1] { text5 };
						}
						num++;
					}
					catch (Exception ex33)
					{
						LogError("Error loading custom " + sFolderName + " eventReplies " + fileInfo26.Name + ": " + ex33.Message);
					}
				}
				if (num > 0)
				{
					LogInfo("Loaded " + num + " eventReplies from " + sFolderName);
				}
			}
			LogDebug("late reply-event bindings");
			foreach (string key8 in medsSecondRunImport.Keys)
			{
				try
				{
					medsEventDataSource[key8].Replys = (EventReplyData[])(object)new EventReplyData[medsSecondRunImport[key8].Length];
					for (int num30 = 0; num30 < medsSecondRunImport[key8].Length; num30++)
					{
						medsEventDataSource[key8].Replys[num30] = DataTextConvert.ToData(JsonUtility.FromJson<EventReplyDataText>(medsSecondRunImport[key8][num30]), key8);
					}
					medsEventDataSource[key8].Init();
				}
				catch (Exception ex34)
				{
					LogError("Error performing " + sFolderName + " reply-event bindings: " + ex34.Message);
				}
			}
			foreach (string key9 in medsSecondRunCombatEvent.Keys)
			{
				try
				{
					medsCombatDataSource[key9].EventData = (medsEventDataSource.ContainsKey(medsSecondRunCombatEvent[key9]) ? medsEventDataSource[medsSecondRunCombatEvent[key9]] : null);
				}
				catch (Exception ex35)
				{
					LogError("Error performing " + sFolderName + " combat-event bindings: " + ex35.Message);
				}
			}
			Traverse.Create((object)Globals.Instance).Field("_NodeDataSource").SetValue((object)medsNodeDataSource);
			Traverse.Create((object)Globals.Instance).Field("_NodeCombatEventRelation").SetValue((object)medsNodeCombatEventRelation);
			Traverse.Create((object)Globals.Instance).Field("_CombatDataSource").SetValue((object)medsCombatDataSource);
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "challengeTrait")))
			{
				int num = 0;
				LogInfo("Loading challengeTraits from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "challengeTrait")).GetFiles("*.json");
				FileInfo[] array29 = files;
				foreach (FileInfo fileInfo27 in array29)
				{
					try
					{
						LogInfo("Loading " + sFolderName + " challengeTrait: " + fileInfo27.Name);
						ChallengeTrait val37 = DataTextConvert.ToData(JsonUtility.FromJson<ChallengeTraitText>(File.ReadAllText(fileInfo27.ToString())));
						medsChallengeTraitsSource[val37.Id.ToLower()] = Object.Instantiate<ChallengeTrait>(val37);
						num++;
					}
					catch (Exception ex36)
					{
						LogError("Error loading custom " + sFolderName + " challengeTrait " + fileInfo27.Name + ": " + ex36.Message);
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_ChallengeTraitsSource").SetValue((object)medsChallengeTraitsSource);
				if (num > 0)
				{
					LogInfo("Loaded " + num + " challengeTraits from " + sFolderName);
				}
			}
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "challengeData")))
			{
				int num = 0;
				LogInfo("Loading challengeData from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "challengeData")).GetFiles("*.json");
				FileInfo[] array30 = files;
				foreach (FileInfo fileInfo28 in array30)
				{
					try
					{
						LogInfo("Loading " + sFolderName + " challengeData: " + fileInfo28.Name);
						ChallengeData val38 = DataTextConvert.ToData(JsonUtility.FromJson<ChallengeDataText>(File.ReadAllText(fileInfo28.ToString())));
						medsChallengeDataSource[val38.Id.ToLower()] = Object.Instantiate<ChallengeData>(val38);
						num++;
					}
					catch (Exception ex37)
					{
						LogError("Error loading custom " + sFolderName + " challengeData " + fileInfo28.Name + ": " + ex37.Message);
					}
				}
				Traverse.Create((object)Globals.Instance).Field("_WeeklyDataSource").SetValue((object)medsChallengeDataSource);
				if (num > 0)
				{
					LogInfo("Loaded " + num + " challengeData from " + sFolderName);
				}
			}
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "roadsTXT")))
			{
				int num = 0;
				LogInfo("Loading roads from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "roadsTXT")).GetFiles("*.txt");
				FileInfo[] array31 = files;
				foreach (FileInfo fileInfo29 in array31)
				{
					LogInfo("Loading " + sFolderName + " road: " + fileInfo29.Name);
					string[] array32 = File.ReadAllLines(fileInfo29.ToString());
					string[] array33 = array32;
					foreach (string text6 in array33)
					{
						if (text6.Length > 2 && text6.Substring(0, 2) == "\\\\")
						{
							continue;
						}
						string[] array34 = text6.Replace(" ", "").Split("|");
						if (array34.Length != 2)
						{
							LogError("malformed road data in file " + fileInfo29.Name + ": " + text6);
							continue;
						}
						if (!medsCustomRoads.ContainsKey(array34[0].ToLower()))
						{
							medsCustomRoads[array34[0].ToLower()] = new List<Vector3>();
						}
						string[] array35 = array34[1].Split("),(");
						foreach (string text7 in array35)
						{
							if (text7.Split(",").Length == 2)
							{
								string text8 = text7.Replace("(", "").Replace(")", "");
								try
								{
									medsCustomRoads[array34[0].ToLower()].Add(new Vector3(float.Parse(text8.Split(",")[0]), float.Parse(text8.Split(",")[1])));
									num++;
								}
								catch (Exception ex38)
								{
									LogError("cannot parse floats in " + sFolderName + " road " + fileInfo29.Name + " " + text8 + ": " + ex38.Message);
								}
							}
						}
					}
				}
				if (num > 0)
				{
					LogInfo("Loaded " + num + " roads from " + sFolderName);
				}
			}
			if (Directory.Exists(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "prestigeDeck")))
			{
				int num = 0;
				LogInfo("Loading prestige decks from " + sFolderName);
				FileInfo[] files = new DirectoryInfo(Path.Combine(Paths.ConfigPath, "Obeliskial_importing", sFolderName, "prestigeDeck")).GetFiles("*.json");
				FileInfo[] array36 = files;
				foreach (FileInfo fileInfo30 in array36)
				{
					try
					{
						LogInfo("Loading " + sFolderName + " prestige deck: " + fileInfo30.Name);
						PrestigeDeck val39 = JsonUtility.FromJson<PrestigeDeck>(File.ReadAllText(fileInfo30.ToString()));
						medsPrestigeDecks[val39.ID.ToLower()] = val39;
						string[] cards = val39.Cards;
						foreach (string text9 in cards)
						{
							Essentials.medsIncludeInBaseSearch(val39.Name, text9, true);
							Essentials.medsIncludeInBaseSearch(val39.ID, text9, true);
							if (!medsCardsSource.ContainsKey(text9))
							{
								continue;
							}
							CardData val40 = medsCardsSource[text9];
							if ((Object)(object)val40 != (Object)null)
							{
								if (!Utility.IsNullOrWhiteSpace(val40.UpgradesTo1))
								{
									Essentials.medsIncludeInBaseSearch(val39.Name, val40.UpgradesTo1, true);
									Essentials.medsIncludeInBaseSearch(val39.ID, val40.UpgradesTo1, true);
								}
								if (!Utility.IsNullOrWhiteSpace(val40.UpgradesTo2))
								{
									Essentials.medsIncludeInBaseSearch(val39.Name, val40.UpgradesTo2, true);
									Essentials.medsIncludeInBaseSearch(val39.ID, val40.UpgradesTo2, true);
								}
								if ((Object)(object)val40.UpgradesToRare != (Object)null)
								{
									Essentials.medsIncludeInBaseSearch(val39.Name, val40.UpgradesToRare.Id, true);
									Essentials.medsIncludeInBaseSearch(val39.ID, val40.UpgradesToRare.Id, true);
								}
							}
						}
						num++;
					}
					catch (Exception ex39)
					{
						LogError("Error loading custom " + sFolderName + " prestige deck " + fileInfo30.Name + ": " + ex39.Message);
					}
				}
				if (num > 0)
				{
					LogInfo("Loaded " + num + " prestige decks from " + sFolderName);
				}
			}
			LogInfo("Finished loading " + sFolderName);
			return true;
		}
	}
	public class DataTextConvert
	{
		public static int ToData<T>(string text)
		{
			if (typeof(T).BaseType == typeof(Enum))
			{
				try
				{
					return (int)Enum.Parse(typeof(T), text, ignoreCase: true);
				}
				catch
				{
					Content.LogError("ToData<T> has captured a value of type " + typeof(T)?.ToString() + " that it cannot parse: " + text);
					return 0;
				}
			}
			Content.LogError("ToData<T> is capturing a type that it isn't set up for!!! " + typeof(T));
			return 0;
		}

		public static AuraCurseData ToData(AuraCurseDataText text)
		{
			//IL_08dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f6: Expected O, but got Unknown
			//IL_08fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0904: Expected O, but got Unknown
			AuraCurseData val = ScriptableObject.CreateInstance<AuraCurseData>();
			val.ACName = text.ACName;
			((Object)val).name = text.ACName;
			val.AuraConsumed = text.AuraConsumed;
			val.AuraDamageIncreasedPercent = text.AuraDamageIncreasedPercent;
			val.AuraDamageIncreasedPercent2 = text.AuraDamageIncreasedPercent2;
			val.AuraDamageIncreasedPercent3 = text.AuraDamageIncreasedPercent3;
			val.AuraDamageIncreasedPercent4 = text.AuraDamageIncreasedPercent4;
			val.AuraDamageIncreasedPercentPerStack = text.AuraDamageIncreasedPercentPerStack;
			val.AuraDamageIncreasedPercentPerStack2 = text.AuraDamageIncreasedPercentPerStack2;
			val.AuraDamageIncreasedPercentPerStack3 = text.AuraDamageIncreasedPercentPerStack3;
			val.AuraDamageIncreasedPercentPerStack4 = text.AuraDamageIncreasedPercentPerStack4;
			val.AuraDamageIncreasedPercentPerStackPerEnergy = text.AuraDamageIncreasedPercentPerStackPerEnergy;
			val.AuraDamageIncreasedPercentPerStackPerEnergy2 = text.AuraDamageIncreasedPercentPerStackPerEnergy2;
			val.AuraDamageIncreasedPercentPerStackPerEnergy3 = text.AuraDamageIncreasedPercentPerStackPerEnergy3;
			val.AuraDamageIncreasedPercentPerStackPerEnergy4 = text.AuraDamageIncreasedPercentPerStackPerEnergy4;
			val.AuraDamageIncreasedPerStack = text.AuraDamageIncreasedPerStack;
			val.AuraDamageIncreasedPerStack2 = text.AuraDamageIncreasedPerStack2;
			val.AuraDamageIncreasedPerStack3 = text.AuraDamageIncreasedPerStack3;
			val.AuraDamageIncreasedPerStack4 = text.AuraDamageIncreasedPerStack4;
			val.AuraDamageIncreasedTotal = text.AuraDamageIncreasedTotal;
			val.AuraDamageIncreasedTotal2 = text.AuraDamageIncreasedTotal2;
			val.AuraDamageIncreasedTotal3 = text.AuraDamageIncreasedTotal3;
			val.AuraDamageIncreasedTotal4 = text.AuraDamageIncreasedTotal4;
			val.AuraDamageType = (DamageType)ToData<DamageType>(text.AuraDamageType);
			val.AuraDamageType2 = (DamageType)ToData<DamageType>(text.AuraDamageType2);
			val.AuraDamageType3 = (DamageType)ToData<DamageType>(text.AuraDamageType3);
			val.AuraDamageType4 = (DamageType)ToData<DamageType>(text.AuraDamageType4);
			val.AuraDamageChargesBasedOnACCharges = (Content.medsAurasCursesSource.ContainsKey(text.AuraDamageChargesBasedOnACCharges) ? Content.medsAurasCursesSource[text.AuraDamageChargesBasedOnACCharges] : null);
			val.ConsumedDamageChargesBasedOnACCharges = (Content.medsAurasCursesSource.ContainsKey(text.ConsumedDamageChargesBasedOnACCharges) ? Content.medsAurasCursesSource[text.ConsumedDamageChargesBasedOnACCharges] : null);
			val.BlockChargesGainedPerStack = text.BlockChargesGainedPerStack;
			val.CardsDrawPerStack = text.CardsDrawPerStack;
			val.CharacterStatAbsolute = text.CharacterStatAbsolute;
			val.CharacterStatAbsoluteValue = text.CharacterStatAbsoluteValue;
			val.CharacterStatAbsoluteValuePerStack = text.CharacterStatAbsoluteValuePerStack;
			val.CharacterStatChargesMultiplierNeededForOne = text.CharacterStatChargesMultiplierNeededForOne;
			val.CharacterStatModified = (CharacterStat)ToData<CharacterStat>(text.CharacterStatModified);
			val.CharacterStatModifiedValue = text.CharacterStatModifiedValue;
			val.CharacterStatModifiedValuePerStack = text.CharacterStatModifiedValuePerStack;
			val.ChargesAuxNeedForOne1 = text.ChargesAuxNeedForOne1;
			val.ChargesAuxNeedForOne2 = text.ChargesAuxNeedForOne2;
			val.ChargesMultiplierDescription = text.ChargesMultiplierDescription;
			val.CombatlogShow = text.CombatlogShow;
			val.ConsumeAll = text.ConsumeAll;
			val.ConsumedAtCast = text.ConsumedAtCast;
			val.ConsumedAtRound = text.ConsumedAtRound;
			val.ConsumedAtRoundBegin = text.ConsumedAtRoundBegin;
			val.ConsumedAtTurn = text.ConsumedAtTurn;
			val.ConsumedAtTurnBegin = text.ConsumedAtTurnBegin;
			val.CursePreventedPerStack = text.CursePreventedPerStack;
			val.DamagePreventedPerStack = text.DamagePreventedPerStack;
			val.DamageReflectedConsumeCharges = text.DamageReflectedConsumeCharges;
			val.DamageReflectedType = (DamageType)ToData<DamageType>(text.DamageReflectedType);
			val.DamageSidesWhenConsumed = text.DamageSidesWhenConsumed;
			val.DamageSidesWhenConsumedPerCharge = text.DamageSidesWhenConsumedPerCharge;
			val.DamageTypeWhenConsumed = (DamageType)ToData<DamageType>(text.DamageTypeWhenConsumed);
			val.DamageWhenConsumed = text.DamageWhenConsumed;
			val.DamageWhenConsumedPerCharge = text.DamageWhenConsumedPerCharge;
			val.Description = text.Description;
			val.DieWhenConsumedAll = text.DieWhenConsumedAll;
			val.DisabledCardTypes = (CardType[])(object)new CardType[text.DisabledCardTypes.Length];
			for (int i = 0; i < text.DisabledCardTypes.Length; i++)
			{
				val.DisabledCardTypes[i] = (CardType)ToData<CardType>(text.DisabledCardTypes[i]);
			}
			val.DoubleDamageIfCursesLessThan = text.DoubleDamageIfCursesLessThan;
			val.EffectTick = text.EffectTick;
			val.EffectTickSides = text.EffectTickSides;
			val.ExplodeAtStacks = text.ExplodeAtStacks;
			val.GainAuraCurseConsumption = (Content.medsAurasCursesSource.ContainsKey(text.GainAuraCurseConsumption) ? Content.medsAurasCursesSource[text.GainAuraCurseConsumption] : null);
			val.GainAuraCurseConsumption2 = (Content.medsAurasCursesSource.ContainsKey(text.GainAuraCurseConsumption2) ? Content.medsAurasCursesSource[text.GainAuraCurseConsumption2] : null);
			val.GainAuraCurseConsumptionPerCharge = text.GainAuraCurseConsumptionPerCharge;
			val.GainAuraCurseConsumptionPerCharge2 = text.GainAuraCurseConsumptionPerCharge2;
			val.GainCharges = text.GainCharges;
			val.GainChargesFromThisAuraCurse = (Content.medsAurasCursesSource.ContainsKey(text.GainChargesFromThisAuraCurse) ? Content.medsAurasCursesSource[text.GainChargesFromThisAuraCurse] : null);
			val.GainChargesFromThisAuraCurse2 = (Content.medsAurasCursesSource.ContainsKey(text.GainChargesFromThisAuraCurse2) ? Content.medsAurasCursesSource[text.GainChargesFromThisAuraCurse2] : null);
			val.HealAttackerConsumeCharges = text.HealAttackerConsumeCharges;
			val.HealAttackerPerStack = text.HealAttackerPerStack;
			val.HealDonePercent