Decompiled source of asset extractor v0.9.0

AssetExtractor.dll

Decompiled a month 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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DebugToolkit;
using EntityStates;
using HG;
using HG.GeneralSerializer;
using Microsoft.CodeAnalysis;
using On.EntityStates;
using On.RoR2;
using On.RoR2.Projectile;
using RoR2;
using RoR2.ContentManagement;
using RoR2.ExpansionManagement;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2BepInExPack.GameAssetPathsBetter;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.ResourceProviders;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AssetExtractor")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+2d8462886fbe76bc11a093ffc943412f2f902c4b")]
[assembly: AssemblyProduct("AssetExtractor")]
[assembly: AssemblyTitle("AssetExtractor")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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 AssetExtractor
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("icebro.assetextractor", "assetextractor", "0.9.0")]
	public class AssetExtractor : BaseUnityPlugin
	{
		public const string PluginGUID = "icebro.assetextractor";

		public const string PluginAuthor = "icebro";

		public const string PluginName = "assetextractor";

		public const string PluginVersion = "0.9.0";

		public ConfigEntry<bool> useModnameInFile;

		public ConfigEntry<bool> useModnameInDirectory;

		public ConfigEntry<bool> trygettingprocs;

		public ConfigEntry<bool> logskillprocs;

		public ConfigEntry<bool> labelCopies;

		private Stopwatch timer = new Stopwatch();

		internal static AssetExtractor Instance { get; private set; }

		public void Awake()
		{
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Expected O, but got Unknown
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Expected O, but got Unknown
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Expected O, but got Unknown
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Expected O, but got Unknown
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Expected O, but got Unknown
			Instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			useModnameInFile = ((BaseUnityPlugin)this).Config.Bind<bool>("export options", "use mod name", false, "always modname in file name (useful for conflicts when using single folder; eg ssu chirr and ss2 chirr");
			useModnameInDirectory = ((BaseUnityPlugin)this).Config.Bind<bool>("export options", "use mod dir", true, "export everything in a content pack to its own folder (off for monolithic wiki folder with every skill/item/etc in one file/folder");
			trygettingprocs = ((BaseUnityPlugin)this).Config.Bind<bool>("export options", "try getting skill procs automatically", false, "attempt to automatically get skill procs from entity state configurations (slow, bad and doesnt work half the time../ just get them from log brah !!");
			logskillprocs = ((BaseUnityPlugin)this).Config.Bind<bool>("export options", "log skill procs", true, "log any on hit procs from skills (like 100 leeching seeds but awesome");
			labelCopies = ((BaseUnityPlugin)this).Config.Bind<bool>("export options", "add (copy) to copied textures", true, "adds the prefix (copy) when a texture/sprite already exists instead of overwriting., ,. useful for things like allies with different icons but same names !!!");
			logskillprocs.SettingChanged += delegate
			{
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				//IL_0092: Expected O, but got Unknown
				//IL_009a: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a4: Expected O, but got Unknown
				//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b6: Expected O, but got Unknown
				//IL_00be: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c8: Expected O, but got Unknown
				//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00da: Expected O, but got Unknown
				//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ec: Expected O, but got Unknown
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Expected O, but got Unknown
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Expected O, but got Unknown
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Expected O, but got Unknown
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: Expected O, but got Unknown
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_006a: Expected O, but got Unknown
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_007c: Expected O, but got Unknown
				if (logskillprocs.Value)
				{
					BlastAttack.Fire += new hook_Fire(BlastAttackOnFire);
					ProjectileManager.FireProjectileClient += new hook_FireProjectileClient(ProjectileManagerOnFireProjectileClient);
					GenericBulletBaseState.GenerateBulletAttack += new hook_GenerateBulletAttack(GenericBulletBaseStateOnGenerateBulletAttack);
					BulletAttack.Fire += new hook_Fire(BulletAttackOnFire);
					OverlapAttack.Fire += new hook_Fire(OverlapAttackOnFire);
					GlobalEventManager.OnHitAll += new hook_OnHitAll(GlobalEventManagerOnOnHitAll);
				}
				else
				{
					BlastAttack.Fire -= new hook_Fire(BlastAttackOnFire);
					ProjectileManager.FireProjectileClient -= new hook_FireProjectileClient(ProjectileManagerOnFireProjectileClient);
					GenericBulletBaseState.GenerateBulletAttack -= new hook_GenerateBulletAttack(GenericBulletBaseStateOnGenerateBulletAttack);
					BulletAttack.Fire -= new hook_Fire(BulletAttackOnFire);
					OverlapAttack.Fire -= new hook_Fire(OverlapAttackOnFire);
					GlobalEventManager.OnHitAll -= new hook_OnHitAll(GlobalEventManagerOnOnHitAll);
				}
			};
			if (logskillprocs.Value)
			{
				BlastAttack.Fire += new hook_Fire(BlastAttackOnFire);
				ProjectileManager.FireProjectileClient += new hook_FireProjectileClient(ProjectileManagerOnFireProjectileClient);
				GenericBulletBaseState.GenerateBulletAttack += new hook_GenerateBulletAttack(GenericBulletBaseStateOnGenerateBulletAttack);
				BulletAttack.Fire += new hook_Fire(BulletAttackOnFire);
				OverlapAttack.Fire += new hook_Fire(OverlapAttackOnFire);
				GlobalEventManager.OnHitAll += new hook_OnHitAll(GlobalEventManagerOnOnHitAll);
			}
			static Result BlastAttackOnFire(orig_Fire orig, BlastAttack self)
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				Log.Debug("Firing blast proc " + self.procCoefficient);
				return orig.Invoke(self);
			}
			static void BulletAttackOnFire(orig_Fire orig, BulletAttack self)
			{
				Log.Debug("Firing bullet proc " + self.procCoefficient);
				orig.Invoke(self);
			}
			static BulletAttack GenericBulletBaseStateOnGenerateBulletAttack(orig_GenerateBulletAttack orig, GenericBulletBaseState self, Ray aimRay)
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				Log.Debug("Firing bullet proc " + self.procCoefficient);
				return orig.Invoke(self, aimRay);
			}
			static void GlobalEventManagerOnOnHitAll(orig_OnHitAll orig, GlobalEventManager self, DamageInfo damageInfo, GameObject hitObject)
			{
				Log.Debug("hit by proc " + damageInfo.procCoefficient);
				orig.Invoke(self, damageInfo, hitObject);
			}
			static bool OverlapAttackOnFire(orig_Fire orig, OverlapAttack self, List<HurtBox> hitResults)
			{
				Log.Debug("Firing overlap proc " + self.procCoefficient);
				return orig.Invoke(self, hitResults);
			}
			static void ProjectileManagerOnFireProjectileClient(orig_FireProjectileClient orig, ProjectileManager self, FireProjectileInfo fireProjectileInfo, NetworkClient client, double fireTime)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				Log.Debug("Firing projectile" + (object)fireProjectileInfo.projectilePrefab);
				ProjectileController val = default(ProjectileController);
				if (fireProjectileInfo.projectilePrefab.TryGetComponent<ProjectileController>(ref val))
				{
					Log.Debug("Firing projectile proc " + val.procCoefficient);
				}
				else
				{
					Log.Error("could not get projectile controller out of prefab ! ");
				}
				orig.Invoke(self, fireProjectileInfo, client, fireTime);
			}
		}

		private void Update()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0490: Unknown result type (might be due to invalid IL or missing references)
			//IL_0495: Unknown result type (might be due to invalid IL or missing references)
			//IL_0499: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			if (!Input.GetKeyDown((KeyCode)286))
			{
				return;
			}
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name != "logbook")
			{
				Log.Error("please go to logbook from mainmenu !!!! exports softlock otherwise .,,.");
				return;
			}
			Log.Info("F5 pressed ,,. extracting !!!!");
			long num = 0L;
			long num2 = 0L;
			long num3 = 0L;
			long num4 = 0L;
			long num5 = 0L;
			long num6 = 0L;
			long num7 = 0L;
			long num8 = 0L;
			WikiFormat.WikiTryGetProcs = trygettingprocs.Value;
			Enumerator<ReadOnlyContentPack> enumerator = ContentManager.allLoadedContentPacks.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					ReadOnlyContentPack current = enumerator.Current;
					if (useModnameInDirectory.Value)
					{
						WikiFormat.WikiOutputPath = Path.Combine(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location) ?? throw new InvalidOperationException(), "wiki"), ((ReadOnlyContentPack)(ref current)).identifier);
					}
					else
					{
						WikiFormat.WikiOutputPath = Path.Combine(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location) ?? throw new InvalidOperationException(), "wiki"));
						WikiFormat.WikiAppend = true;
					}
					if (useModnameInFile.Value)
					{
						WikiFormat.WikiModname = "_" + ((ReadOnlyContentPack)(ref current)).identifier;
					}
					else
					{
						WikiFormat.WikiModname = "";
					}
					timer.Start();
					WikiFormat.loredefs = new List<string>();
					AssetEnumerator<SceneDef> enumerator2 = ((ReadOnlyContentPack)(ref current)).sceneDefs.GetEnumerator();
					try
					{
						while (enumerator2.MoveNext())
						{
							SceneDef current2 = enumerator2.Current;
							GameObject val = Addressables.LoadAssetAsync<GameObject>((object)((AssetReference)current2.sceneAddress).AssetGUID).WaitForCompletion();
						}
					}
					finally
					{
						((IDisposable)enumerator2).Dispose();
					}
					WikiFormat.FormatItem(current);
					num += timer.ElapsedMilliseconds;
					timer.Restart();
					WikiFormat.FormatEquipment(current);
					num2 += timer.ElapsedMilliseconds;
					timer.Restart();
					WikiFormat.FormatSurvivor(current);
					num3 += timer.ElapsedMilliseconds;
					timer.Restart();
					WikiFormat.FormatSkill(current);
					num4 += timer.ElapsedMilliseconds;
					timer.Restart();
					WikiFormat.FormatChallenges(current);
					num5 += timer.ElapsedMilliseconds;
					timer.Restart();
					WikiFormat.FormatBodies(current);
					num6 += timer.ElapsedMilliseconds;
					timer.Restart();
					WikiFormat.FormatBuffs(current);
					num7 += timer.ElapsedMilliseconds;
					timer.Restart();
					WikiFormat.FormatStages(current);
					num8 += timer.ElapsedMilliseconds;
					timer.Restart();
					WikiFormat.FormatLore(current);
					WikiFormat.exportExpansions(current);
					WikiFormat.exportArtifacts(current);
					timer.Stop();
					try
					{
						if (Directory.GetFiles(WikiFormat.WikiOutputPath, "*", SearchOption.TopDirectoryOnly).Length == 0)
						{
							Directory.Delete(WikiFormat.WikiOutputPath);
						}
					}
					catch (Exception data)
					{
						Log.Debug(data);
					}
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			Log.Info("Exported items in " + num + "ms");
			Log.Info("Exported equips in " + num2 + "ms");
			Log.Info("Exported survivors in " + num3 + "ms");
			Log.Info("Exported skills in " + num4 + "ms");
			Log.Info("Exported challenges in " + num5 + "ms");
			Log.Info("Exported bodies in " + num6 + "ms");
			Log.Info("Exported buffs in " + num7 + "ms");
			Log.Info("Exported stages in " + num7 + "ms");
			Log.Info("complete !!!! located at: " + Path.Combine(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location))));
			Addressables.LoadSceneAsync((object)RoR2_Base_title.title_unity, (LoadSceneMode)0, true, 100).WaitForCompletion();
		}
	}
	public static class WikiFormat
	{
		[CompilerGenerated]
		private sealed class <waitingCouroutine>d__12 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					return false;
				}
			}

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

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

		private static readonly Dictionary<string, string> FormatInteractableNames = new Dictionary<string, string>
		{
			{ "DuplicatorWild", "3D Printer (Overgrown)" },
			{ "DuplicatorMilitary", "Mili-Tech Printer" },
			{ "DuplicatorLarge", "3D Printer (Green)" },
			{ "Duplicator", "3D Printer (White)" },
			{ "Open Large Chest - Utility", "Large Utility Chest" },
			{ "Large Chest - Healing", "Large Healing Chest" },
			{ "Large Chest - Damage", "Large Damage Chest" },
			{ "TripleShopLarge", "Multishop Terminal (Green)" },
			{ "TripleShopEquipment", "Multishop Terminal (Equipment)" },
			{ "TripleShop", "Multishop Terminal (White)" },
			{ "GoldChest", "Legendary Chest" },
			{ "ShrineHalcyonite", "Halcyonite Shrine" },
			{ "ShrineColossusAccess", "Shrine of Shaping" }
		};

		private const string WIKI_OUTPUT_FOLDER = "wiki";

		private const string WIKI_OUTPUT_ITEM = "Items.txt";

		private const string WIKI_OUTPUT_EQUIPMENT = "Equipments.txt";

		private const string WIKI_OUTPUT_SURVIVORS = "Survivors.txt";

		private const string WIKI_OUTPUT_SKILLS = "Skills.txt";

		private const string WIKI_OUTPUT_CHALLENGES = "Challenges.txt";

		private const string WIKI_OUTPUT_BODIES = "Bodies.txt";

		private const string WIKI_OUTPUT_BUFFS = "Buffs.txt";

		private const string WIKI_OUTPUT_STAGES = "Stages.txt";

		private const string WIKI_OUTPUT_LORE = "Lore.txt";

		public static string WikiOutputPath = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)AssetExtractor.Instance).Info.Location) ?? throw new InvalidOperationException(), "wiki");

		public static string WikiModname = "";

		public static bool WikiTryGetProcs = false;

		public static bool WikiAppend = false;

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

		public static bool loadedScene = false;

		private static readonly Dictionary<string, string> FormatR2ToWiki = new Dictionary<string, string>
		{
			{ "</style>", "}}" },
			{ "<style=cStack>", "{{Stack|" },
			{ "<style=cIsDamage>", "{{Color|d|" },
			{ "<style=cIsHealing>", "{{Color|h|" },
			{ "<style=cIsUtility>", "{{Color|u|" },
			{ "<style=cIsHealth>", "{{Color|hp|" },
			{ "<style=cDeath>", "{{Color|hp|" },
			{ "<style=cIsVoid>", "{{Color|v|" },
			{ "<style=cIsLunar>", "{{Color|lunar|" },
			{ "<style=cHumanObjective>", "{{Color|human|" },
			{ "<style=cShrine>", "{{Color|boss|" }
		};

		public static void exportArtifacts(ReadOnlyContentPack readOnlyContentPack)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			AssetEnumerator<ArtifactDef> enumerator = ((ReadOnlyContentPack)(ref readOnlyContentPack)).artifactDefs.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					ArtifactDef current = enumerator.Current;
					string text = WikiOutputPath + "\\artifacts\\";
					Directory.CreateDirectory(text);
					try
					{
						if ((Object)(object)current.smallIconSelectedSprite != (Object)null)
						{
							Log.Debug("item name is blank ! using toke n");
							exportTexture(current.smallIconSelectedSprite, Path.Combine(text, Language.GetString(current.nameToken) + " Selected.png"));
							exportTexture(current.smallIconDeselectedSprite, Path.Combine(text, Language.GetString(current.nameToken) + " Deselected.png"));
						}
						else
						{
							Log.Debug("artifact icon is nul l!!!!!!!!!!");
						}
					}
					catch (Exception data)
					{
						Log.Debug(data);
						Log.Debug("erm ,,.,. failed to export artiact icon with proper name ,,. trying with tokenm !! " + Language.GetString(current.nameToken));
						exportTexture(current.smallIconSelectedSprite, Path.Combine(text, current.nameToken + " Selected.png"));
						exportTexture(current.smallIconDeselectedSprite, Path.Combine(text, current.nameToken + " Deselected.png"));
					}
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
		}

		public static void FormatBodies(ReadOnlyContentPack readOnlyContentPack)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0407: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Unknown result type (might be due to invalid IL or missing references)
			//IL_0413: Invalid comparison between Unknown and I4
			//IL_042b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_0437: Invalid comparison between Unknown and I4
			//IL_044f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0459: Unknown result type (might be due to invalid IL or missing references)
			//IL_045b: Invalid comparison between Unknown and I4
			//IL_0473: Unknown result type (might be due to invalid IL or missing references)
			//IL_0479: Unknown result type (might be due to invalid IL or missing references)
			//IL_047b: Invalid comparison between Unknown and I4
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			//IL_049d: Unknown result type (might be due to invalid IL or missing references)
			//IL_049f: Invalid comparison between Unknown and I4
			//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c3: Invalid comparison between Unknown and I4
			//IL_04db: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e4: Invalid comparison between Unknown and I4
			//IL_04fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0502: Unknown result type (might be due to invalid IL or missing references)
			//IL_0504: Invalid comparison between Unknown and I4
			//IL_051c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0526: Unknown result type (might be due to invalid IL or missing references)
			//IL_0528: Invalid comparison between Unknown and I4
			//IL_0540: Unknown result type (might be due to invalid IL or missing references)
			//IL_054a: Unknown result type (might be due to invalid IL or missing references)
			//IL_054c: Invalid comparison between Unknown and I4
			//IL_0564: Unknown result type (might be due to invalid IL or missing references)
			//IL_056a: Unknown result type (might be due to invalid IL or missing references)
			//IL_056c: Invalid comparison between Unknown and I4
			//IL_0584: Unknown result type (might be due to invalid IL or missing references)
			//IL_058a: Unknown result type (might be due to invalid IL or missing references)
			//IL_058c: Invalid comparison between Unknown and I4
			//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b0: Invalid comparison between Unknown and I4
			//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d1: Invalid comparison between Unknown and I4
			//IL_05e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f2: Invalid comparison between Unknown and I4
			//IL_060a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0614: Unknown result type (might be due to invalid IL or missing references)
			//IL_0616: Invalid comparison between Unknown and I4
			//IL_06b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c6: Unknown result type (might be due to invalid IL or missing references)
			string text = Path.Combine(WikiOutputPath, "Bodies.txt");
			if (!Directory.Exists(WikiOutputPath))
			{
				Directory.CreateDirectory(WikiOutputPath);
			}
			TextWriter textWriter = new StreamWriter(text, WikiAppend);
			string text2 = "";
			HashSet<DirectorCard> hashSet = new HashSet<DirectorCard>(StringFinder.Instance.GetDirectorCardsFromPartial(text2));
			AssetEnumerator<GameObject> enumerator = ((ReadOnlyContentPack)(ref readOnlyContentPack)).bodyPrefabs.GetEnumerator();
			try
			{
				CharacterBody val = default(CharacterBody);
				ExpansionRequirementComponent val2 = default(ExpansionRequirementComponent);
				CharacterMotor val3 = default(CharacterMotor);
				while (enumerator.MoveNext())
				{
					GameObject bodyprefab = enumerator.Current;
					try
					{
						string text3 = "monsters[\"{0}\"] = {{\n";
						text3 += "\tInternalName = \"{1}\",\n";
						text3 += "\tImage = \"{2}\",\n";
						text3 += "\tBaseHealth = {3},\n";
						text3 += "\tScalingHealth = {4},\n";
						text3 += "\tBaseDamage = {5},\n";
						text3 += "\tScalingDamage = {6},\n";
						text3 += "\tBaseHealthRegen = {7},\n";
						text3 += "\tScalingHealthRegen = {8},\n";
						text3 += "\tBaseSpeed = {9},\n";
						text3 += "\tBaseArmor = {10},\n";
						text3 += "\tMass = {11},\n";
						text3 += "\tLocalizationInternalName = \"{12}\",\n";
						text3 += "\tColor = \"{13}\",\n";
						string text4 = "";
						string text5 = "";
						string text6 = "";
						float num = 1E+14f;
						if (SurvivorCatalog.allSurvivorDefs.Any((SurvivorDef survdef) => (Object)(object)survdef.bodyPrefab == (Object)(object)bodyprefab) || !bodyprefab.TryGetComponent<CharacterBody>(ref val))
						{
							continue;
						}
						if (val.baseNameToken != null)
						{
							text4 = val.GetDisplayName();
							text3 = text3 + "\tName = \"" + Language.GetString(val.baseNameToken) + "\",\n";
							text3 = text3 + "\tLink = \"" + Language.GetString(val.baseNameToken) + "\",\n";
						}
						float baseMaxHealth = val.baseMaxHealth;
						float levelMaxHealth = val.levelMaxHealth;
						float baseDamage = val.baseDamage;
						float levelDamage = val.levelDamage;
						float baseRegen = val.baseRegen;
						float levelRegen = val.levelRegen;
						float baseMoveSpeed = val.baseMoveSpeed;
						float baseArmor = val.baseArmor;
						if (!Language.english.TokenIsRegistered(val.baseNameToken.Replace("_NAME", "_LORE")))
						{
							text3 += "\tNoLogbook = true,\n";
						}
						else
						{
							loredefs.Add("Monsters " + val.baseNameToken + " " + val.baseNameToken.Replace("_NAME", "_LORE"));
						}
						DeathRewards component = ((Component)val).gameObject.GetComponent<DeathRewards>();
						text3 = ((!((Object)(object)component != (Object)null) || !Object.op_Implicit((Object)(object)component.bossDropTable)) ? (text3 + "\tType = \"Normal\",\n") : (text3 + "\tType = \"Boss\",\n"));
						text3 = text3 + "\tExpansion = \"" + ((ReadOnlyContentPack)(ref readOnlyContentPack)).identifier + "\",\n";
						foreach (DirectorCard directorCard in StringFinder.Instance.DirectorCards)
						{
							if (!hashSet.Contains(directorCard) || !((Object)directorCard.spawnCard.prefab.GetComponent<CharacterMaster>().bodyPrefab).name.Equals(((Object)bodyprefab).name))
							{
								continue;
							}
							if (directorCard.cost != 0)
							{
								text3 += $"\tCreditsCost = {directorCard.cost},\n";
							}
							if (directorCard.minimumStageCompletions != 0)
							{
								text3 += $"\tStartingStage = {directorCard.minimumStageCompletions},\n";
							}
							break;
						}
						string text7 = "\tCategory = {{ ";
						if ((val.bodyFlags & 0x2000) > 0)
						{
							text7 += "\"Devotion\", ";
						}
						if ((val.bodyFlags & 0x100) > 0)
						{
							text7 += "\"HasBackstabImmunity\", ";
						}
						if ((val.bodyFlags & 0x80) > 0)
						{
							text7 += "\"HasBackstabPassive\", ";
						}
						if ((val.bodyFlags & 1) > 0)
						{
							text7 += "\"IgnoreFallDamage\", ";
						}
						if ((val.bodyFlags & 0x1000) > 0)
						{
							text7 += "\"IgnoreItemUpdates\", ";
						}
						if ((val.bodyFlags & 0x4000) > 0)
						{
							text7 += "\"IgnoreKnockback\", ";
						}
						if ((val.bodyFlags & 0x10) > 0)
						{
							text7 += "\"ImmuneToExecutes\", ";
						}
						if ((val.bodyFlags & 8) > 0)
						{
							text7 += "\"ImmuneToGoo\", ";
						}
						if ((val.bodyFlags & 0x8000) > 0)
						{
							text7 += "\"ImmuneToLava\", ";
						}
						if ((val.bodyFlags & 0x800) > 0)
						{
							text7 += "\"ImmuneToVoidDeath\", ";
						}
						if ((val.bodyFlags & 4) > 0)
						{
							text7 += "\"Masterless\", ";
						}
						if ((val.bodyFlags & 2) > 0)
						{
							text7 += "\"Mechanical\", ";
						}
						if ((val.bodyFlags & 0x200) > 0)
						{
							text7 += "\"OverheatImmune\", ";
						}
						if ((val.bodyFlags & 0x40) > 0)
						{
							text7 += "\"ResistantToAOE\", ";
						}
						if ((val.bodyFlags & 0x20) > 0)
						{
							text7 += "\"SprintAnyDirection\", ";
						}
						if ((val.bodyFlags & 0x400) > 0)
						{
							text7 += "\"Void\", ";
						}
						if (text7 != "\tCategory = {{ ")
						{
							text3 = text3 + text7.Substring(0, text7.Length - 2) + " }},\n";
						}
						if (val.subtitleNameToken != null)
						{
							string @string = Language.GetString(val.subtitleNameToken);
							if (!@string.EndsWith("SUBTITLE") && @string != "")
							{
								text3 = text3 + "\tBossName = \"" + @string + "\",\n";
							}
						}
						_ = val.bodyColor;
						if (true)
						{
							text6 = ColorUtility.ToHtmlStringRGB(val.bodyColor);
						}
						if (((Component)val).TryGetComponent<ExpansionRequirementComponent>(ref val2) && (Object)(object)val2 != (Object)null)
						{
							acronymHelper(Language.GetString(val2.requiredExpansion.nameToken), forceCaps: false);
						}
						if (val.baseNameToken != null && val.baseNameToken.EndsWith("_NAME"))
						{
							text5 = val.baseNameToken.Remove(val.baseNameToken.Length - 5);
						}
						else if (val.baseNameToken != null)
						{
							text5 = val.baseNameToken;
						}
						if (((Component)val).TryGetComponent<CharacterMotor>(ref val3))
						{
							num = (((int)val3.mass >= 99999999) ? 0f : val3.mass);
						}
						text3 += "\t}}";
						string text8 = Language.GetStringFormatted(text3, new object[14]
						{
							text4,
							((Object)bodyprefab).name,
							text4.Replace(" ", "_") + WikiModname + ".png",
							baseMaxHealth,
							levelMaxHealth,
							baseDamage,
							levelDamage,
							baseRegen,
							levelRegen,
							baseMoveSpeed,
							baseArmor,
							num,
							text5,
							"#" + text6
						});
						foreach (KeyValuePair<string, string> item in FormatR2ToWiki)
						{
							text8 = text8.Replace(item.Key, item.Value);
						}
						textWriter.WriteLine(text8);
						if (!Object.op_Implicit((Object)(object)val.portraitIcon))
						{
							continue;
						}
						string text9 = WikiOutputPath + "\\bodies\\";
						Directory.CreateDirectory(text9);
						try
						{
							if (text4 == "")
							{
								Log.Debug("body name is blank ! using toke n");
								exportTexture(val.portraitIcon, Path.Combine(text9, text5 + WikiModname + ".png"));
							}
							else
							{
								exportTexture(val.portraitIcon, Path.Combine(text9, text4.Replace(" ", "_") + WikiModname + ".png"));
							}
						}
						catch
						{
							Log.Debug("erm ,,.,. failed to export body icon with proper name ,,. trying with tokenm !! " + text4);
							exportTexture(val.portraitIcon, Path.Combine(text9, text5 + WikiModname + ".png"));
						}
					}
					catch (Exception ex)
					{
						Log.Error("Error while exporting body: " + ex);
					}
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			textWriter.Close();
			long length = new FileInfo(text).Length;
			if (length <= 0)
			{
				File.Delete(text);
			}
		}

		public static void FormatBuffs(ReadOnlyContentPack readOnlyContentPack)
		{
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			string text = Path.Combine(WikiOutputPath, "Buffs.txt");
			string text2 = "StatusEffects[\"{0}\"] = {{\n";
			text2 += "\tName = \"{1}\",\n";
			text2 += "\tInternalName = \"{2}\",\n";
			text2 += "\tImage = \"{3}\",\n";
			text2 += "\tEffectShort = \"\",\n";
			text2 += "\tEffect = \"\",\n";
			text2 += "\tSource = {{}},\n";
			text2 += "\tType = \"{4}\",\n";
			text2 += "\tStackable = \"{5}\",\n";
			text2 += "\tDOT = \"{6}\",\n";
			text2 += "\tColor = \"{7}\",\n";
			text2 += "\tHidden = \"{8}\",\n";
			text2 += "\t}}";
			if (!Directory.Exists(WikiOutputPath))
			{
				Directory.CreateDirectory(WikiOutputPath);
			}
			TextWriter textWriter = new StreamWriter(text, WikiAppend);
			AssetEnumerator<BuffDef> enumerator = ((ReadOnlyContentPack)(ref readOnlyContentPack)).buffDefs.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					BuffDef current = enumerator.Current;
					try
					{
						string text3 = "Status ";
						if ((Object)(object)current == (Object)null)
						{
							continue;
						}
						string text4 = (current.isDebuff ? "Debuff" : (current.isElite ? "Affix Buff" : ((!current.isCooldown) ? "Buff" : "Cooldown Buff")));
						string text5 = (current.isDOT ? "True" : "False");
						string text6 = (current.canStack ? "True" : "False");
						string text7 = (current.isHidden ? "True" : "False");
						string text8 = "#" + ColorUtility.ToHtmlStringRGB(current.buffColor);
						string text9 = ((Object)current).name;
						if (text9.StartsWith("bd"))
						{
							string text10 = text9;
							text9 = text10.Substring(2, text10.Length - 2);
						}
						text3 += text9;
						if (Object.op_Implicit((Object)(object)current.iconSprite))
						{
							string text11 = WikiOutputPath + "\\buffs\\";
							Directory.CreateDirectory(text11);
							try
							{
								exportTexture(current.iconSprite, Path.Combine(text11, "Status " + text9.Replace(" ", "_") + WikiModname + ".png"));
							}
							catch (Exception arg)
							{
								Log.Debug($"erm ,,.,. failed to export buff icon {((Object)current).name} ,,. {arg}");
							}
						}
						string text12 = string.Format(text2, text9, text9, text9, text3, text4, text6, text5, text8, text7);
						foreach (KeyValuePair<string, string> item in FormatR2ToWiki)
						{
							text12 = text12.Replace(item.Key, item.Value);
						}
						textWriter.WriteLine(text12);
					}
					catch (Exception ex)
					{
						Log.Error("Error while exporting buff: " + ex);
					}
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			textWriter.Close();
			long length = new FileInfo(text).Length;
			if (length <= 0)
			{
				File.Delete(text);
			}
		}

		public static void FormatChallenges(ReadOnlyContentPack readOnlyContentPack)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: Unknown result type (might be due to invalid IL or missing references)
			string text = Path.Combine(WikiOutputPath, "Challenges.txt");
			string text2 = "challenges[\"{0}\"] = {{\n";
			text2 += "\tType = \"{1}\",\n";
			text2 += "\tUnlock = {{ \"{2}\" }} ,\n";
			text2 += "\tDesc = \"{3}\",\n";
			text2 += "\t}}";
			if (!Directory.Exists(WikiOutputPath))
			{
				Directory.CreateDirectory(WikiOutputPath);
			}
			TextWriter textWriter = new StreamWriter(text, WikiAppend);
			AssetEnumerator<UnlockableDef> enumerator = ((ReadOnlyContentPack)(ref readOnlyContentPack)).unlockableDefs.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					UnlockableDef current = enumerator.Current;
					string text3 = "";
					string text4 = "";
					string text5 = "";
					string text6 = "";
					AchievementDef achievementDefFromUnlockable = AchievementManager.GetAchievementDefFromUnlockable(current.cachedName);
					if (achievementDefFromUnlockable == null)
					{
						continue;
					}
					if (achievementDefFromUnlockable.nameToken != null)
					{
						text3 = Language.GetString(achievementDefFromUnlockable.nameToken);
					}
					if (achievementDefFromUnlockable.unlockableRewardIdentifier != null)
					{
						Enumerator<ItemDef> enumerator2 = ItemCatalog.allItemDefs.GetEnumerator();
						try
						{
							while (enumerator2.MoveNext())
							{
								ItemDef current2 = enumerator2.Current;
								if ((Object)(object)current2.unlockableDef != (Object)(object)current)
								{
									continue;
								}
								text5 = Language.GetString(current2.nameToken);
								text4 = "Items";
								break;
							}
						}
						finally
						{
							((IDisposable)enumerator2).Dispose();
						}
						foreach (SurvivorDef allSurvivorDef in SurvivorCatalog.allSurvivorDefs)
						{
							if (text5 != "")
							{
								break;
							}
							if ((Object)(object)allSurvivorDef.unlockableDef != (Object)(object)current)
							{
								continue;
							}
							text5 = Language.GetString(allSurvivorDef.displayNameToken);
							text4 = "Survivors";
							break;
						}
						EquipmentDef[] equipmentDefs = EquipmentCatalog.equipmentDefs;
						foreach (EquipmentDef val in equipmentDefs)
						{
							if (text5 != "")
							{
								break;
							}
							if (!((Object)(object)val.unlockableDef != (Object)(object)current))
							{
								text5 = Language.GetString(val.nameToken);
								text4 = "Equipment";
								break;
							}
						}
						SkinDef[] allSkinDefs = SkinCatalog.allSkinDefs;
						foreach (SkinDef val2 in allSkinDefs)
						{
							if (text5 != "")
							{
								break;
							}
							if (!((Object)(object)val2.unlockableDef != (Object)(object)current))
							{
								text5 = Language.GetString(val2.nameToken);
								text4 = "Skins";
								break;
							}
						}
						ArtifactDef[] artifactDefs = ArtifactCatalog.artifactDefs;
						foreach (ArtifactDef val3 in artifactDefs)
						{
							if (text5 != "")
							{
								break;
							}
							if (!((Object)(object)val3.unlockableDef != (Object)(object)current))
							{
								text5 = Language.GetString(val3.nameToken);
								text4 = "Artifacts";
								break;
							}
						}
						SkillFamily[] allSkillFamilies = SkillCatalog._allSkillFamilies;
						foreach (SkillFamily val4 in allSkillFamilies)
						{
							if (text5 != "")
							{
								break;
							}
							Variant[] variants = val4.variants;
							foreach (Variant val5 in variants)
							{
								if (!((Object)(object)val5.unlockableDef != (Object)(object)current))
								{
									text5 = Language.GetString(val5.skillDef.skillNameToken);
									text4 = "Skills";
									break;
								}
							}
						}
					}
					if (achievementDefFromUnlockable.descriptionToken != null)
					{
						text6 = Language.GetString(achievementDefFromUnlockable.descriptionToken);
					}
					try
					{
						string text7 = string.Format(text2, text3, text4, text5, text6);
						foreach (KeyValuePair<string, string> item in FormatR2ToWiki)
						{
							text7 = text7.Replace(item.Key, item.Value);
						}
						textWriter.WriteLine(text7);
					}
					catch (Exception ex)
					{
						Log.Error("Error while exporting challenge: " + ex);
					}
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			textWriter.Close();
			long length = new FileInfo(text).Length;
			if (length <= 0)
			{
				File.Delete(text);
			}
		}

		public static void FormatEquipment(ReadOnlyContentPack readOnlyContentPack)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			string text = Path.Combine(WikiOutputPath, "Equipments.txt");
			TextWriter textWriter = new StreamWriter(text, WikiAppend);
			AssetEnumerator<EquipmentDef> enumerator = ((ReadOnlyContentPack)(ref readOnlyContentPack)).equipmentDefs.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					EquipmentDef current = enumerator.Current;
					FormatEquipmentDef(current, textWriter);
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			textWriter.Close();
			long length = new FileInfo(text).Length;
			if (length <= 0)
			{
				File.Delete(text);
			}
			static void FormatEquipmentDef(EquipmentDef def, TextWriter tw)
			{
				try
				{
					string text2 = "equipments[\"{0}\"] = {{\n\tRarity = \"{1}\",\n\tQuote = \"{2}\",\n\tDesc = \"{3}\",\n\tID = {4},\n\tCooldown = {5},\n\tLocalizationInternalName = \"{6}\",\n";
					if (!((Object)(object)def == (Object)null))
					{
						string text3 = "";
						string text4 = (def.isLunar ? "Lunar Equipment" : "Equipment");
						string text5 = "";
						string text6 = "";
						string text7 = "";
						string text8 = "";
						if (def.nameToken != null)
						{
							text3 = Language.GetString(def.nameToken);
							if (Language.english.TokenIsRegistered(def.nameToken.Replace("_NAME", "_LORE")))
							{
								loredefs.Add("Equipment " + def.nameToken + " " + def.nameToken.Replace("_NAME", "_LORE"));
							}
							if (def.nameToken != null && def.nameToken.EndsWith("_NAME"))
							{
								text8 = def.nameToken.Remove(def.nameToken.Length - 5);
							}
							else if (def.nameToken != null)
							{
								text8 = def.nameToken;
							}
							if (text3 == "")
							{
								text3 = def.nameToken;
							}
						}
						if (def.pickupToken != null)
						{
							text5 = Language.GetString(def.pickupToken);
						}
						if (def.descriptionToken != null)
						{
							text6 = Language.GetString(def.descriptionToken);
						}
						if (Object.op_Implicit((Object)(object)def.unlockableDef))
						{
							string text9 = AchievementManager.GetAchievementDefFromUnlockable(def.unlockableDef.cachedName)?.nameToken;
							if (text9 != null)
							{
								text7 = Language.GetString(text9);
							}
							if (text7 != "")
							{
								text2 = text2 + "\tUnlock = \"" + text7 + "\",\n";
							}
						}
						if (Object.op_Implicit((Object)(object)def.requiredExpansion))
						{
							string text10 = acronymHelper(Language.GetString(def.requiredExpansion.nameToken), forceCaps: false);
							text2 = text2 + "\tExpansion = \"" + text10 + "\",\n";
						}
						text2 += "\t}}";
						string text11 = Language.GetStringFormatted(text2, new object[7]
						{
							text3,
							text4,
							text5,
							text6,
							"\"" + ((Object)def).name + "\"",
							def.cooldown,
							text8
						});
						foreach (KeyValuePair<string, string> item in FormatR2ToWiki)
						{
							text11 = text11.Replace(item.Key, item.Value);
						}
						tw.WriteLine(text11);
						if (Object.op_Implicit((Object)(object)def.pickupIconTexture))
						{
							string text12 = WikiOutputPath + "\\equips\\";
							Directory.CreateDirectory(text12);
							try
							{
								if (text3 == "")
								{
									Log.Debug("equip name is blank ! using toke n");
									exportTexture((Texture)(object)def.pickupIconSprite.texture, Path.Combine(text12, text8 + WikiModname + ".png"));
								}
								else
								{
									exportTexture((Texture)(object)def.pickupIconSprite.texture, Path.Combine(text12, text3.Replace(" ", "_") + WikiModname + ".png"));
								}
								return;
							}
							catch
							{
								Log.Debug("erm ,,.,. failed to export equip icon with proper name ,,. trying with tokenm !! " + text3);
								exportTexture((Texture)(object)def.pickupIconSprite.texture, Path.Combine(text12, text8 + WikiModname + ".png"));
								return;
							}
						}
					}
				}
				catch (Exception ex)
				{
					Log.Error("Error while exporting equipment: " + ex);
				}
			}
		}

		public static void exportExpansions(ReadOnlyContentPack readOnlyContentPack)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			AssetEnumerator<ExpansionDef> enumerator = ((ReadOnlyContentPack)(ref readOnlyContentPack)).expansionDefs.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					ExpansionDef current = enumerator.Current;
					string text = WikiOutputPath + "\\expansions\\";
					Directory.CreateDirectory(text);
					try
					{
						if ((Object)(object)current.iconSprite != (Object)null)
						{
							Log.Debug("item name is blank ! using toke n");
							exportTexture(current.iconSprite, Path.Combine(text, Language.GetString(current.nameToken) + ".png"));
						}
						else
						{
							Log.Debug("expansion icon is nul l!!!!!!!!!!");
						}
					}
					catch (Exception data)
					{
						Log.Debug(data);
						Log.Debug("erm ,,.,. failed to export expansion icon with proper name ,,. trying with tokenm !! " + Language.GetString(current.nameToken));
						exportTexture(current.iconSprite, Path.Combine(text, current.nameToken + ".png"));
					}
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
		}

		public static void FormatItem(ReadOnlyContentPack readOnlyContentPack)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			string text = Path.Combine(WikiOutputPath, "Items.txt");
			if (!Directory.Exists(WikiOutputPath))
			{
				Directory.CreateDirectory(WikiOutputPath);
			}
			TextWriter textWriter = new StreamWriter(text, WikiAppend);
			AssetEnumerator<ItemDef> enumerator = ((ReadOnlyContentPack)(ref readOnlyContentPack)).itemDefs.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					ItemDef current = enumerator.Current;
					ItemDefFormat(current, textWriter);
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			textWriter.Close();
			long length = new FileInfo(text).Length;
			if (length <= 0)
			{
				File.Delete(text);
			}
			static void ItemDefFormat(ItemDef def, TextWriter tw)
			{
				//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_010c: Expected I4, but got Unknown
				try
				{
					string text2 = "items[\"{0}\"] = {{\n\tRarity = \"{1}\",\n\tQuote = \"{2}\",\n\tDesc = \"{3}\",\n\tCategory = {{ {4} }},\n\tID = {5},\n\tStats = {{\n\t\t {{\n\t\t\tStat = \"\",\n\t\t\tValue = \"\",\n\t\t\tStack = \"\",\n\t\t\tAdd = \"\"\n\t\t}}\n\t}},\n\tLocalizationInternalName = \"{6}\",\n";
					string text3 = "";
					string text4 = "";
					string text5 = "";
					string text6 = "";
					string text7 = "";
					if (!((Object)(object)def == (Object)null))
					{
						if (def.nameToken != null)
						{
							text3 = Language.GetString(def.nameToken);
							if (Language.english.TokenIsRegistered(def.nameToken.Replace("_NAME", "_LORE")))
							{
								loredefs.Add("Items " + def.nameToken + " " + def.nameToken.Replace("_NAME", "_LORE"));
							}
							if (text3 == "")
							{
								text3 = def.nameToken;
							}
						}
						ItemTier tier = def.tier;
						if (1 == 0)
						{
						}
						string text8 = (int)tier switch
						{
							0 => "Common", 
							1 => "Uncommon", 
							2 => "Legendary", 
							3 => "Lunar", 
							4 => "Boss", 
							6 => "Void", 
							7 => "Void", 
							8 => "Void", 
							9 => "Void", 
							_ => "Untiered", 
						};
						if (1 == 0)
						{
						}
						string text9 = text8;
						if (def.pickupToken != null)
						{
							text4 = Language.GetString(def.pickupToken);
						}
						if (def.descriptionToken != null)
						{
							text5 = Language.GetString(def.descriptionToken);
						}
						for (int i = 0; i < def.tags.Length; i++)
						{
							text6 = text6 + "\"" + Enum.GetName(typeof(ItemTag), def.tags[i]) + "\"";
							if (i < def.tags.Length - 1)
							{
								text6 += ",";
							}
						}
						string text10 = "";
						if (Object.op_Implicit((Object)(object)def.unlockableDef))
						{
							AchievementDef achievementDefFromUnlockable = AchievementManager.GetAchievementDefFromUnlockable(def.unlockableDef.cachedName);
							if (achievementDefFromUnlockable != null && !string.IsNullOrEmpty(achievementDefFromUnlockable.nameToken))
							{
								text10 = Language.GetString(achievementDefFromUnlockable.nameToken);
							}
							if (text10 != "")
							{
								text2 = text2 + "\tUnlock = \"" + text10 + "\",\n";
							}
						}
						if (Object.op_Implicit((Object)(object)def.requiredExpansion))
						{
							string text11 = acronymHelper(Language.GetString(def.requiredExpansion.nameToken), forceCaps: false);
							text2 = text2 + "\tExpansion = \"" + text11 + "\",\n";
						}
						if (def.nameToken != null && def.nameToken.EndsWith("_NAME"))
						{
							text7 = def.nameToken.Remove(def.nameToken.Length - 5);
						}
						else if (def.nameToken != null)
						{
							text7 = def.nameToken;
						}
						text2 += "\t}}";
						string text12 = Language.GetStringFormatted(text2, new object[7]
						{
							text3,
							text9,
							text4,
							text5,
							text6,
							"\"" + ((Object)def).name + "\"",
							text7
						});
						foreach (KeyValuePair<string, string> item in FormatR2ToWiki)
						{
							text12 = text12.Replace(item.Key, item.Value);
						}
						tw.WriteLine(text12);
						if (Object.op_Implicit((Object)(object)def.pickupIconTexture))
						{
							string text13 = WikiOutputPath + "\\items\\";
							Directory.CreateDirectory(text13);
							try
							{
								if (text3 == "")
								{
									Log.Debug("item name is blank ! using toke n");
									exportTexture((Texture)(object)def.pickupIconSprite.texture, Path.Combine(text13, text7 + WikiModname + ".png"));
								}
								else
								{
									exportTexture((Texture)(object)def.pickupIconSprite.texture, Path.Combine(text13, text3.Replace(" ", "_") + WikiModname + ".png"));
								}
								return;
							}
							catch (Exception data)
							{
								Log.Debug(data);
								Log.Debug("erm ,,.,. failed to export equip icon with proper name ,,. trying with tokenm !! " + text3);
								exportTexture((Texture)(object)def.pickupIconSprite.texture, Path.Combine(text13, text7 + WikiModname + ".png"));
								return;
							}
						}
					}
				}
				catch (Exception ex)
				{
					Log.Error("Error while exporting item: " + ex);
				}
			}
		}

		public static void FormatLore(ReadOnlyContentPack readOnlyContentPack)
		{
			string text = Path.Combine(WikiOutputPath, "Lore.txt");
			string text2 = "lore[\"{0}\"] = {{\n";
			text2 += "\tType = \"{1}\",\n";
			text2 += "\tDesc = \"{2}\",\n";
			text2 += "\t}}";
			if (!Directory.Exists(WikiOutputPath))
			{
				Directory.CreateDirectory(WikiOutputPath);
			}
			TextWriter textWriter = new StreamWriter(text, WikiAppend);
			foreach (string loredef in loredefs)
			{
				try
				{
					string[] array = loredef.Split(" ");
					string text3 = string.Format(text2, array[0], Language.GetString(array[1]), Language.GetString(array[2]).Replace("\\", "\\\\").Replace("\n", "\\n")
						.Replace("\r", "\\r")
						.Replace("\t", "\\t")
						.Replace("\"", "\\\""));
					foreach (KeyValuePair<string, string> item in FormatR2ToWiki)
					{
						text3 = text3.Replace(item.Key, item.Value);
					}
					textWriter.WriteLine(text3);
				}
				catch (Exception ex)
				{
					Log.Error("Error while exporting lore: " + ex);
				}
			}
			textWriter.Close();
			long length = new FileInfo(text).Length;
			if (length <= 0)
			{
				File.Delete(text);
			}
		}

		public static void FormatSkill(ReadOnlyContentPack readOnlyContentPack)
		{
			//IL_05f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0606: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0513: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_056f: Unknown result type (might be due to invalid IL or missing references)
			//IL_057d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_045a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0413: Unknown result type (might be due to invalid IL or missing references)
			//IL_0415: Unknown result type (might be due to invalid IL or missing references)
			string text = Path.Combine(WikiOutputPath, "Skills.txt");
			if (!Directory.Exists(WikiOutputPath))
			{
				Directory.CreateDirectory(WikiOutputPath);
			}
			TextWriter textWriter = new StreamWriter(text, WikiAppend);
			AssetEnumerator<SurvivorDef> enumerator = ((ReadOnlyContentPack)(ref readOnlyContentPack)).survivorDefs.GetEnumerator();
			try
			{
				CharacterBody val = default(CharacterBody);
				ProjectileController val7 = default(ProjectileController);
				while (enumerator.MoveNext())
				{
					SurvivorDef current = enumerator.Current;
					try
					{
						if (!current.bodyPrefab.TryGetComponent<CharacterBody>(ref val))
						{
							continue;
						}
						GenericSkill[] components = ((Component)val).GetComponents<GenericSkill>();
						SkillLocator component = ((Component)val).GetComponent<SkillLocator>();
						GenericSkill[] array = components;
						foreach (GenericSkill val2 in array)
						{
							string text2 = "skills[\"{0}\"] = {{\n";
							text2 += "\tName = \"{1}\",\n";
							text2 += "\tDesc = \"{2}\",\n";
							text2 += "\tSurvivor = \"{3}\",\n";
							text2 += "\tType = \"{4}\",\n";
							text2 += "\tCooldown = \"{5}\",\n";
							string text3 = "Passive";
							string text4 = "";
							string text5 = "";
							string text6 = "";
							float num = 0f;
							List<float> list = new List<float>();
							string @string = Language.GetString(current.displayNameToken);
							Variant[] variants = val2.skillFamily.variants;
							foreach (Variant val3 in variants)
							{
								if (val3.skillDef.skillNameToken != null)
								{
									text4 = Language.GetString(val3.skillDef.skillNameToken);
								}
								if ((Object)(object)val2 == (Object)(object)component.primary)
								{
									text3 = "Primary";
								}
								else if ((Object)(object)val2 == (Object)(object)component.secondary)
								{
									text3 = "Secondary";
								}
								else if ((Object)(object)val2 == (Object)(object)component.utility)
								{
									text3 = "Utility";
								}
								else if ((Object)(object)val2 == (Object)(object)component.special)
								{
									text3 = "Special";
								}
								if (val3.skillDef.baseRechargeInterval != 0f)
								{
									num = val3.skillDef.baseRechargeInterval;
								}
								if (val3.skillDef.skillDescriptionToken != null)
								{
									text5 = Language.GetString(val3.skillDef.skillDescriptionToken);
								}
								if ((Object)(object)val3.unlockableDef != (Object)null)
								{
									AchievementDef achievementDefFromUnlockable = AchievementManager.GetAchievementDefFromUnlockable(val3.unlockableDef.cachedName);
									if (achievementDefFromUnlockable != null)
									{
										text6 = Language.GetString(achievementDefFromUnlockable.nameToken);
									}
									text2 = text2 + "\tUnlock = \"" + text6 + "\",\n";
								}
								if (((SerializableEntityStateType)(ref val3.skillDef.activationState)).stateType != null && WikiTryGetProcs)
								{
									try
									{
										EntityState val4 = EntityStateCatalog.InstantiateState(EntityStateCatalog.stateTypeToIndex[((SerializableEntityStateType)(ref val3.skillDef.activationState)).stateType]);
										if (val4 != null)
										{
											Enumerator<ReadOnlyContentPack> enumerator2 = ContentManager.allLoadedContentPacks.GetEnumerator();
											try
											{
												while (enumerator2.MoveNext())
												{
													ReadOnlyContentPack current2 = enumerator2.Current;
													Log.Warning("lookin through ,., " + ((ReadOnlyContentPack)(ref current2)).identifier);
													AssetEnumerator<EntityStateConfiguration> enumerator3 = ((ReadOnlyContentPack)(ref current2)).entityStateConfigurations.GetEnumerator();
													try
													{
														while (enumerator3.MoveNext())
														{
															EntityStateConfiguration current3 = enumerator3.Current;
															if (!((Object)current3).name.Contains(((SerializableEntityStateType)(ref val3.skillDef.activationState)).stateType.ToString()))
															{
																continue;
															}
															Log.Warning("found config ! " + ((Object)current3).name);
															SerializedField[] serializedFields = current3.serializedFieldsCollection.serializedFields;
															foreach (SerializedField val5 in serializedFields)
															{
																if (val5.fieldName.ToLower().Contains("proc"))
																{
																	list.Add(float.Parse(val5.fieldValue.stringValue));
																}
																else if (val5.fieldName.ToLower().Contains("projectile"))
																{
																	if (val5.fieldValue.objectValue != (Object)null)
																	{
																		Object obj = Object.Instantiate(val5.fieldValue.objectValue);
																		GameObject val6 = (GameObject)(object)((obj is GameObject) ? obj : null);
																		if (val6.TryGetComponent<ProjectileController>(ref val7))
																		{
																			list.Add(val7.procCoefficient);
																		}
																		else
																		{
																			Log.Error("could not get projectile controller out of prefab ! ");
																		}
																	}
																}
																else if (val5.fieldName.ToLower().Contains("damage") && list.Count == 0)
																{
																	list.Add(1f);
																	Log.Debug("no proc found ! defaulting to 1 ,., ");
																}
															}
														}
													}
													finally
													{
														((IDisposable)enumerator3).Dispose();
													}
												}
											}
											finally
											{
												((IDisposable)enumerator2).Dispose();
											}
										}
									}
									catch (Exception ex)
									{
										Log.Error("Error while getting proc coefficient: " + ex);
									}
								}
								if (!Object.op_Implicit((Object)(object)val3.skillDef.icon.texture))
								{
									continue;
								}
								string text7 = WikiOutputPath + "\\skills\\";
								Directory.CreateDirectory(text7);
								try
								{
									if (text4 == "")
									{
										Log.Debug("skill name is blank ! using toke n");
										exportTexture(val3.skillDef.icon, Path.Combine(text7, val3.skillDef.skillNameToken + WikiModname + ".png"));
									}
									else
									{
										exportTexture(val3.skillDef.icon, Path.Combine(text7, text4.Replace(" ", "_") + WikiModname + ".png"));
									}
								}
								catch
								{
									Log.Debug("erm ,,.,. failed to export skill icon with proper name ,,. trying with tokenm !! " + text4);
									exportTexture(val3.skillDef.icon, Path.Combine(text7, val3.skillDef.skillNameToken + WikiModname + ".png"));
								}
								string text8 = text2;
								string text9;
								if (list.Count == 0)
								{
									text8 += "\t}},";
									text9 = Language.GetStringFormatted(text8, new object[6] { text4, text4, text5, @string, text3, num });
								}
								else
								{
									text8 += "\tProc = \"{6}\",\n";
									text8 += "\t}},";
									text9 = Language.GetStringFormatted(text8, new object[7] { text4, text4, text5, @string, text3, num, list });
								}
								foreach (KeyValuePair<string, string> item in FormatR2ToWiki)
								{
									text9 = text9.Replace(item.Key, item.Value);
								}
								textWriter.WriteLine(text9);
							}
						}
					}
					catch (Exception ex2)
					{
						Log.Error("Error while exporting skill: " + ex2);
					}
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			textWriter.Close();
			long length = new FileInfo(text).Length;
			if (length <= 0)
			{
				File.Delete(text);
			}
		}

		public static void FormatStages(ReadOnlyContentPack readOnlyContentPack)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1211: Unknown result type (might be due to invalid IL or missing references)
			//IL_1216: Unknown result type (might be due to invalid IL or missing references)
			//IL_128b: Unknown result type (might be due to invalid IL or missing references)
			//IL_128e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1293: Unknown result type (might be due to invalid IL or missing references)
			//IL_1297: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fa3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fa8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_10d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_10df: Unknown result type (might be due to invalid IL or missing references)
			//IL_10e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_10f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_10fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0717: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0844: Unknown result type (might be due to invalid IL or missing references)
			string text = Path.Combine(WikiOutputPath, "Stages.txt");
			if (!Directory.Exists(WikiOutputPath))
			{
				Directory.CreateDirectory(WikiOutputPath);
			}
			TextWriter textWriter = new StreamWriter(text, WikiAppend);
			AssetEnumerator<SceneDef> enumerator = ((ReadOnlyContentPack)(ref readOnlyContentPack)).sceneDefs.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					SceneDef current = enumerator.Current;
					try
					{
						if (current.nameToken == "")
						{
							continue;
						}
						SceneInstance val = Addressables.LoadSceneAsync((object)((AssetReference)current.sceneAddress).AssetGUID, (LoadSceneMode)0, true, 100).WaitForCompletion();
						Addressables.UnloadSceneAsync(val, true).WaitForCompletion();
						SceneInstance val2 = Addressables.LoadSceneAsync((object)((AssetReference)current.sceneAddress).AssetGUID, (LoadSceneMode)0, true, 100).WaitForCompletion();
						GameObject val3 = GameObject.Find("SceneInfo");
						string text2 = "Environments[\"{0}\"] = {{\n";
						text2 += "\tName = \"{1}\",\n";
						text2 += "\tInternalName = \"{2}\",\n";
						text2 += "\tImage = \"{3}\",\n";
						text2 += "\tSubName = \"{4}\",\n";
						text2 += "\tStage = \"{5}\",\n";
						text2 += "\tSoundtrack = \"{6}\",\n";
						text2 += "\tDescription = \"{7}\",\n";
						if ((Object)(object)val3 != (Object)null)
						{
							ClassicStageInfo component = val3.GetComponent<ClassicStageInfo>();
							List<List<string>> list = new List<List<string>>();
							if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.GetInteractableDccsPool))
							{
								text2 += "\tInteractables = {{\n";
								Category[] poolCategories = component.GetInteractableDccsPool.poolCategories;
								foreach (Category val4 in poolCategories)
								{
									PoolEntry[] alwaysIncluded = val4.alwaysIncluded;
									foreach (PoolEntry val5 in alwaysIncluded)
									{
										Category[] categories = val5.dccs.categories;
										foreach (Category val6 in categories)
										{
											DirectorCard[] cards = val6.cards;
											foreach (DirectorCard val7 in cards)
											{
												string text3 = processNameToken(val7.spawnCard.prefab);
												int selectionWeight = val7.selectionWeight;
												string item = text3 + "," + selectionWeight;
												List<string> item2 = new List<string>(1) { item };
												list.Add(item2);
											}
										}
									}
									ConditionalPoolEntry[] includedIfConditionsMet = val4.includedIfConditionsMet;
									foreach (ConditionalPoolEntry val8 in includedIfConditionsMet)
									{
										Category[] categories2 = ((PoolEntry)val8).dccs.categories;
										foreach (Category val9 in categories2)
										{
											DirectorCard[] cards2 = val9.cards;
											foreach (DirectorCard val10 in cards2)
											{
												string text4 = processNameToken(val10.spawnCard.prefab);
												int selectionWeight2 = val10.selectionWeight;
												string item3 = text4 + "," + selectionWeight2 + "," + acronymHelper(Language.GetString(val8.requiredExpansions[0].nameToken), forceCaps: true);
												bool flag = false;
												foreach (List<string> item9 in list)
												{
													foreach (string item10 in item9.ToList())
													{
														if (item10.Split(",")[0].Equals(text4))
														{
															flag = true;
															item9.Add(item3);
														}
													}
												}
												if (!flag)
												{
													List<string> item4 = new List<string>(1) { item3 };
													list.Add(item4);
												}
											}
										}
									}
									foreach (List<string> item11 in list)
									{
										text2 = text2 + "\t\t[\"" + item11[0].Split(",")[0] + "\"] = {{ ";
										for (int num2 = 0; num2 < item11.Count; num2++)
										{
											text2 = ((num2 != 0) ? (text2 + ", [" + item11[num2].Split(",")[2] + "] = {{ Weight = " + item11[num2].Split(",")[1] + " }}") : ((item11[0].Split(",").Length != 2) ? (text2 + "[" + item11[num2].Split(",")[2] + "] = {{ Weight = " + item11[num2].Split(",")[1] + " }}") : (text2 + "[ALL] = {{ Weight = " + item11[num2].Split(",")[1] + " }}")));
										}
										text2 += " }},\n";
									}
								}
								text2 += "\t}},\n";
							}
							else
							{
								Log.Warning("no interactable dccs found for " + current.nameToken);
							}
							List<List<string>> list2 = new List<List<string>>();
							if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.GetMonsterDccsPool))
							{
								text2 += "\tMonsters = {{\n";
								Category[] poolCategories2 = component.GetMonsterDccsPool.poolCategories;
								foreach (Category val11 in poolCategories2)
								{
									if (!(val11.name == "Standard"))
									{
										continue;
									}
									PoolEntry[] alwaysIncluded2 = val11.alwaysIncluded;
									foreach (PoolEntry val12 in alwaysIncluded2)
									{
										Category[] categories3 = val12.dccs.categories;
										foreach (Category val13 in categories3)
										{
											DirectorCard[] cards3 = val13.cards;
											foreach (DirectorCard val14 in cards3)
											{
												string @string = Language.GetString(val14.spawnCard.prefab.GetComponent<CharacterMaster>().bodyPrefab.GetComponent<CharacterBody>().baseNameToken);
												int selectionWeight3 = val14.selectionWeight;
												int minimumStageCompletions = val14.minimumStageCompletions;
												string name = val13.name;
												string item5 = @string + "," + selectionWeight3 + "," + minimumStageCompletions + "," + name;
												List<string> item6 = new List<string>(1) { item5 };
												list2.Add(item6);
											}
										}
									}
									ConditionalPoolEntry[] includedIfConditionsMet2 = val11.includedIfConditionsMet;
									foreach (ConditionalPoolEntry val15 in includedIfConditionsMet2)
									{
										Category[] categories4 = ((PoolEntry)val15).dccs.categories;
										foreach (Category val16 in categories4)
										{
											DirectorCard[] cards4 = val16.cards;
											foreach (DirectorCard val17 in cards4)
											{
												string string2 = Language.GetString(val17.spawnCard.prefab.GetComponent<CharacterMaster>().bodyPrefab.GetComponent<CharacterBody>().baseNameToken);
												int selectionWeight4 = val17.selectionWeight;
												int minimumStageCompletions2 = val17.minimumStageCompletions;
												string name2 = val16.name;
												string item7 = string2 + "," + selectionWeight4 + "," + minimumStageCompletions2 + "," + name2 + "," + acronymHelper(Language.GetString(val15.requiredExpansions[0].nameToken), forceCaps: true);
												bool flag2 = false;
												foreach (List<string> item12 in list2)
												{
													foreach (string item13 in item12.ToList())
													{
														if (item13.Split(",")[0].Equals(string2))
														{
															flag2 = true;
															item12.Add(item7);
														}
													}
												}
												if (!flag2)
												{
													List<string> item8 = new List<string>(1) { item7 };
													list2.Add(item8);
												}
											}
										}
									}
									foreach (List<string> item14 in list2)
									{
										text2 = text2 + "\t\t[\"" + item14[0].Split(",")[0] + "\"] = {{ ";
										for (int num10 = 0; num10 < item14.Count; num10++)
										{
											text2 = ((num10 != 0) ? ((int.Parse(item14[0].Split(",")[2]) <= 0) ? (text2 + "[" + item14[num10].Split(",")[4] + "] = {{ Weight = " + item14[num10].Split(",")[1] + ", Category = \"" + item14[num10].Split(",")[3] + "\" }}") : (text2 + "[" + item14[num10].Split(",")[4] + "] = {{ Weight = " + item14[num10].Split(",")[1] + ", Stage = " + item14[num10].Split(",")[2] + ", Category = \"" + item14[num10].Split(",")[3] + "\" }}")) : ((item14[0].Split(",").Length != 4) ? ((int.Parse(item14[0].Split(",")[2]) <= 0) ? (text2 + "[" + item14[num10].Split(",")[4] + "] = {{ Weight = " + item14[num10].Split(",")[1] + ", Category = \"" + item14[num10].Split(",")[3] + "\" }}") : (text2 + "[" + item14[num10].Split(",")[4] + "] = {{ Weight = " + item14[num10].Split(",")[1] + ", Stage = " + item14[num10].Split(",")[2] + ", Category = \"" + item14[num10].Split(",")[3] + "\" }}")) : ((int.Parse(item14[0].Split(",")[2]) <= 0) ? (text2 + "[ALL] = {{ Weight = " + item14[num10].Split(",")[1] + ", Category = \"" + item14[num10].Split(",")[3] + "\" }}") : (text2 + "[ALL] = {{ Weight = " + item14[num10].Split(",")[1] + ", Stage = " + item14[num10].Split(",")[2] + ", Category = \"" + item14[num10].Split(",")[3] + "\" }}"))));
										}
										text2 += " }},\n";
									}
								}
								text2 += "\t}},\n";
							}
							else
							{
								Log.Warning("no monster dccs found for " + current.nameToken);
							}
							string text5 = "\tFamily = {{ ";
							if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.GetMonsterDccsPool))
							{
								Category[] poolCategories3 = component.GetMonsterDccsPool.poolCategories;
								foreach (Category val18 in poolCategories3)
								{
									if (val18.name != "Standard")
									{
										ConditionalPoolEntry[] includedIfConditionsMet3 = val18.includedIfConditionsMet;
										foreach (ConditionalPoolEntry val19 in includedIfConditionsMet3)
										{
											text5 = text5 + "\"" + ((Object)((PoolEntry)val19).dccs).name.Replace("dccs", "").Replace("FamilySandy", "").Replace("FamilyNature", "")
												.Replace("FamilySnowy", "")
												.Replace("Family", "") + "\", ";
										}
									}
								}
								string text6 = text5;
								text5 = text6.Substring(0, text6.Length - 2);
								text5 += " }}\n";
								if (text5 != "\tFamily = { }}\n")
								{
									text2 += text5;
								}
							}
							Scene scene = ((SceneInstance)(ref val2)).Scene;
							string text7 = "BAZAAR_SEER_" + ((Scene)(ref scene)).name.ToUpper();
							if (Language.english.TokenIsRegistered(text7))
							{
								text2 = text2 + "\tLunarSeer = \"" + Language.GetString(text7).Replace("<style=cWorldEvent>", "").Replace("</style>", "") + "\",\n";
							}
							string text8 = Language.GetString(current.nameToken);
							if (text8.StartsWith("Hidden Realm"))
							{
								text2 += "\tHidden Realm = true,\n";
								text8 = text8.Replace("Hidden Realm: ", "");
							}
							loredefs.Add("Environments " + current.nameToken + " " + current.loreToken);
							if ((Object)(object)component != (Object)null)
							{
								text2 = text2 + "\tInteractableCredits = \"" + component.sceneDirectorInteractibleCredits + "\",\n";
								text2 = text2 + "\tMonsterCredits = \"" + component.sceneDirectorMonsterCredits + "\",\n";
							}
							text2 += "}}";
							try
							{
								string text9 = text8;
								_ = ((SceneInstance)(ref val2)).Scene;
								scene = ((SceneInstance)(ref val2)).Scene;
								if (((Scene)(ref scene)).name != null)
								{
									scene = ((SceneInstance)(ref val2)).Scene;
									text9 = ((Scene)(ref scene)).name;
								}
								else
								{
									Log.Warning("loaded scene is null " + text8);
								}
								string text10 = Language.GetStringFormatted(text2, new object[8]
								{
									text8,
									text8,
									text9,
									text8 + " Logbook Thumbnail.png",
									Language.GetString(current.subtitleToken),
									current.stageOrder,
									current.mainTrack.cachedName,
									"DESCRIPTION TEMP REPLACE ME PRETTY PLEASE !!"
								});
								foreach (KeyValuePair<string, string> item15 in FormatR2ToWiki)
								{
									text10 = text10.Replace(item15.Key, item15.Value);
								}
								textWriter.WriteLine(text10);
							}
							catch (Exception data)
							{
								Log.Error(data);
								Log.Debug(text2);
							}
							Texture val20 = current.previewTexture;
							if ((Object)(object)val20 == (Object)null)
							{
								val20 = Addressables.LoadAssetAsync<Texture>((object)((AssetReference)current.previewTextureReference).AssetGUID).WaitForCompletion();
							}
							string text11 = WikiOutputPath + "\\stages\\";
							Directory.CreateDirectory(text11);
							try
							{
								exportTexture(val20, Path.Combine(text11, text8 + " Logbook Thumbnail" + WikiModname + ".png"));
							}
							catch
							{
								Log.Debug("erm ,,.,. failed to export stage icon ,,. " + text8);
							}
						}
						else
						{
							Log.Warning("uable to f9ind scene info ,., ");
						}
						Addressables.UnloadSceneAsync(val2, true).WaitForCompletion();
						Log.Debug("unlaoded scene !! ");
					}
					catch (Exception ex)
					{
						Log.Error("Error while exporting scene: " + ex);
					}
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			textWriter.Close();
			long length = new FileInfo(text).Length;
			if (length <= 0)
			{
				File.Delete(text);
			}
		}

		public static string processNameToken(GameObject prefab)
		{
			string text = ((Object)prefab).name;
			if ((Object)(object)prefab != (Object)null && (Object)(object)prefab.GetComponent<GenericDisplayNameProvider>() != (Object)null)
			{
				text = ((!Object.op_Implicit((Object)(object)prefab.GetComponent<SummonMasterBehavior>())) ? Language.GetString(prefab.GetComponent<GenericDisplayNameProvider>().displayToken) : Language.GetString(prefab.GetComponent<SummonMasterBehavior>().masterPrefab.GetComponent<CharacterMaster>().bodyPrefab.GetComponent<CharacterBody>().baseNameToken));
			}
			if (text.Contains("Chest - Healing"))
			{
				Log.Debug("found healing chest ~!!! prefab name is " + ((Object)prefab).name);
				text = (((Object)prefab).name.Contains("Utility") ? "Utility Chest" : ((!((Object)prefab).name.Contains("Damage")) ? "Healing Chest" : "Damage Chest"));
			}
			foreach (KeyValuePair<string, string> formatInteractableName in FormatInteractableNames)
			{
				text = text.Replace(formatInteractableName.Key, formatInteractableName.Value);
			}
			return text;
		}

		[IteratorStateMachine(typeof(<waitingCouroutine>d__12))]
		private static IEnumerator waitingCouroutine()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <waitingCouroutine>d__12(0);
		}

		public static void FormatSurvivor(ReadOnlyContentPack readOnlyContentPack)
		{
			//IL_0684: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0633: Unknown result type (might be due to invalid IL or missing references)
			//IL_0605: Unknown result type (might be due to invalid IL or missing references)
			string text = Path.Combine(WikiOutputPath, "Survivors.txt");
			if (!Directory.Exists(WikiOutputPath))
			{
				Directory.CreateDirectory(WikiOutputPath);
			}
			TextWriter textWriter = new StreamWriter(text, WikiAppend);
			AssetEnumerator<SurvivorDef> enumerator = ((ReadOnlyContentPack)(ref readOnlyContentPack)).survivorDefs.GetEnumerator();
			try
			{
				CharacterBody val = default(CharacterBody);
				CharacterMotor val2 = default(CharacterMotor);
				ModelLocator val4 = default(ModelLocator);
				while (enumerator.MoveNext())
				{
					SurvivorDef current = enumerator.Current;
					try
					{
						string text2 = "survivors[\"{0}\"] = {{\n";
						text2 += "\tName = \"{1}\",\n";
						text2 += "\tImage = \"{2}\",\n";
						text2 += "\tBaseHealth = {3},\n";
						text2 += "\tScalingHealth = {4},\n";
						text2 += "\tBaseDamage = {5},\n";
						text2 += "\tScalingDamage = {6},\n";
						text2 += "\tBaseHealthRegen = {7},\n";
						text2 += "\tScalingHealthRegen = {8},\n";
						text2 += "\tBaseSpeed = {9},\n";
						text2 += "\tBaseArmor = {10},\n";
						text2 += "\tDescription = \"{11}\",\n";
						text2 += "\tUmbra = \"{17}\",\n";
						text2 += "\tPhraseEscape = \"{12}\",\n";
						text2 += "\tPhraseVanish = \"{13}\",\n";
						text2 += "\tMass = {14},\n";
						text2 += "\tLocalizationInternalName = \"{15}\",\n";
						text2 += "\tColor = \"{16}\",\n";
						string text3 = "";
						string text4 = "";
						string text5 = "";
						string text6 = "";
						string text7 = "";
						float num = 1E+14f;
						float num2 = 1E+14f;
						float num3 = 1E+14f;
						float num4 = 1E+14f;
						float num5 = 1E+14f;
						float num6 = 1E+14f;
						float num7 = 1E+14f;
						float num8 = 1E+14f;
						float num9 = 1E+14f;
						string text8 = "";
						string text9 = "";
						string text10 = "";
						string text11 = "";
						if (current.displayNameToken != null)
						{
							text3 = Language.GetString(current.displayNameToken);
						}
						if (current.descriptionToken != null)
						{
							text4 = Language.GetString(current.descriptionToken);
						}
						_ = current.primaryColor;
						if (true)
						{
							text7 = ColorUtility.ToHtmlStringRGB(current.primaryColor);
						}
						if ((Object)(object)current.unlockableDef != (Object)null)
						{
							string text12 = AchievementManager.GetAchievementDefFromUnlockable(current.unlockableDef.cachedName)?.nameToken;
							if (text12 != null)
							{
								text5 = Language.GetString(text12);
							}
						}
						if (current.displayNameToken != null && current.displayNameToken.EndsWith("_NAME"))
						{
							text6 = current.displayNameToken.Remove(current.displayNameToken.Length - 5);
						}
						else if (current.displayNameToken != null)
						{
							text6 = current.displayNameToken;
						}
						if (Language.english.TokenIsRegistered(current.displayNameToken.Replace("_NAME", "_LORE")))
						{
							loredefs.Add("Survivor " + current.displayNameToken + " " + current.displayNameToken.Replace("_NAME", "_LORE"));
						}
						if (current.bodyPrefab.TryGetComponent<CharacterBody>(ref val))
						{
							num = val.baseMaxHealth;
							num2 = val.levelMaxHealth;
							num3 = val.baseDamage;
							num4 = val.levelDamage;
							num5 = val.baseRegen;
							num6 = val.levelRegen;
							num7 = val.baseMoveSpeed;
							num8 = val.baseArmor;
						}
						if (current.bodyPrefab.TryGetComponent<CharacterMotor>(ref val2))
						{
							num9 = val2.mass;
						}
						if (current.mainEndingEscapeFailureFlavorToken != null)
						{
							text8 = Language.GetString(current.mainEndingEscapeFailureFlavorToken);
						}
						if (current.outroFlavorToken != null)
						{
							text9 = Language.GetString(current.outroFlavorToken);
						}
						if (val.subtitleNameToken != null)
						{
							text10 = Language.GetString(val.subtitleNameToken);
						}
						if (Object.op_Implicit((Object)(object)current.unlockableDef))
						{
							AchievementDef achievementDefFromUnlockable = AchievementManager.GetAchievementDefFromUnlockable(current.unlockableDef.cachedName);
							text11 = Language.GetString(achievementDefFromUnlockable.nameToken);
							text2 = text2 + "\tUnlock = \"" + text11 + "\",\n";
						}
						if ((Object)(object)current.GetRequiredExpansion() != (Object)null)
						{
							text2 = text2 + "\tExpansion = \"" + acronymHelper(Language.GetString(current.GetRequiredExpansion().nameToken), forceCaps: false) + "\",\n";
						}
						text2 += "\t}}";
						string text13 = Language.GetStringFormatted(text2, new object[18]
						{
							text3,
							text3,
							text3.Replace(" ", "_") + WikiModname + ".png",
							num,
							num2,
							num3,
							num4,
							num5,
							num6,
							num7,
							num8,
							text4,
							text9,
							text8,
							num9,
							text6,
							"#" + text7,
							text10
						});
						foreach (KeyValuePair<string, string> item in FormatR2ToWiki)
						{
							text13 = text13.Replace(item.Key, item.Value);
						}
						textWriter.WriteLine(text13);
						if (!Object.op_Implicit((Object)(object)SurvivorCatalog.GetSurvivorPortrait(current.survivorIndex)))
						{
							continue;
						}
						string text14 = WikiOutputPath + "\\survivors\\";
						Directory.CreateDirectory(text14);
						try
						{
							if (text3 == "")
							{
								Log.Debug("surv name is blank ! using toke n");
								exportTexture(SurvivorCatalog.GetSurvivorPortrait(current.survivorIndex), Path.Combine(text14, text6 + WikiModname + ".png"));
							}
							else
							{
								exportTexture(SurvivorCatalog.GetSurvivorPortrait(current.survivorIndex), Path.Combine(text14, text3.Replace(" ", "_") + WikiModname + ".png"));
							}
						}
						catch
						{
							Log.Debug("erm ,,.,. failed to export surv icon with proper name ,,. trying with tokenm !! " + text3);
							exportTexture(SurvivorCatalog.GetSurvivorPortrait(current.survivorIndex), Path.Combine(text14, text6 + WikiModname + ".png"));
						}
						SkinDef[] allSkinDefs = SkinCatalog.allSkinDefs;
						foreach (SkinDef val3 in allSkinDefs)
						{
							string text15 = WikiOutputPath + "\\skins\\";
							Directory.CreateDirectory(text15);
							if (!current.bodyPrefab.TryGetComponent<ModelLocator>(ref val4) || ((Object)val4.modelTransform).name == null || (Object)(object)val3.rootObject == (Object)null || ((Object)val4.modelTransform).name != ((Object)val3.rootObject).name)
							{
								continue;
							}
							try
							{
								string @string = Language.GetString(val3.nameToken);
								string text16 = ((!(@string == "Default")) ? Language.GetString(val3.nameToken) : ("Default " + text3));
								if (text16 == "" || val3.nameToken == "")
								{
									text16 = ((Object)val3).name;
								}
								exportTexture(val3.icon, Path.Combine(text15, text16.Replace(" ", "_") + WikiModname + ".png"));
							}
							catch
							{
								Log.Debug("erm ,,.,. failed to export skin icon with proper name ,,. trying with tokenm !! " + Language.GetString(val3.nameToken));
								exportTexture(val3.icon, Path.Combine(text15, val3.nameToken + WikiModname + ".png"));
							}
						}
					}
					catch (Exception ex)
					{
						Log.Error("Error while exporting skin: " + ex);
					}
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			textWriter.Close();
			long length = new FileInfo(text).Length;
			if (length <= 0)
			{
				File.Delete(text);
			}
		}

		public static void exportTexture(Texture texture, string path)
		{
			if (File.Exists(path) && AssetExtractor.Instance.labelCopies.Value)
			{
				Log.Debug("file exitst" + path);
				string text = path.Replace(".png", "");
				while (File.Exists(text + ".png"))
				{
					text += " (copy)";
				}
				Log.Debug("writing file " + text);
				File.WriteAllBytes(text + ".png", ImageConversion.EncodeToPNG(makeReadable(texture)));
			}
			else
			{
				File.WriteAllBytes(path, ImageConversion.EncodeToPNG(makeReadable(texture)));
			}
		}

		public static void exportTexture(Sprite sprite, string path)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = makeReadable((Texture)(object)sprite.texture);
			Rect textureRect = sprite.textureRect;
			int num = Mathf.FloorToInt(((Rect)(ref textureRect)).width);
			textureRect = sprite.textureRect;
			Texture2D val2 = new Texture2D(num, Mathf.FloorToInt(((Rect)(ref textureRect)).height));
			textureRect = sprite.textureRect;
			int num2 = Mathf.FloorToInt(((Rect)(ref textureRect)).x);
			textureRect = sprite.textureRect;
			int num3 = Mathf.FloorToInt(((Rect)(ref textureRect)).y);
			textureRect = sprite.textureRect;
			int num4 = Mathf.FloorToInt(((Rect)(ref textureRect)).width);
			textureRect = sprite.textureRect;
			Color[] pixels = val.GetPixels(num2, num3, num4, Mathf.FloorToInt(((Rect)(ref textureRect)).height));
			try
			{
				val2.SetPixels(pixels);
				val2.Apply();
				if (File.Exists(path) && AssetExtractor.Instance.labelCopies.Value)
				{
					Log.Debug("file exitst" + path);
					string text = path.Replace(".png", "");
					while (File.Exists(text + ".png"))
					{
						text += " (copy)";
					}
					Log.Debug("writing file " + text);
					File.WriteAllBytes(text + ".png", ImageConversion.EncodeToPNG(val2));
				}
				else
				{
					File.WriteAllBytes(path, ImageConversion.EncodeToPNG(val2));
				}
			}
			catch (Exception data)
			{
				Log.Error(data);
				Log.Info("exporting png without cropping !!,.., ");
				if (File.Exists(path) && AssetExtractor.Instance.labelCopies.Value)
				{
					Log.Debug("file exitst" + path);
					string text2 = path.Replace(".png", "");
					while (File.Exists(text2 + ".png"))
					{
						text2 += " (copy)";
					}
					Log.Debug("writing file " + text2);
					File.WriteAllBytes(text2 + ".png", ImageConversion.EncodeToPNG(val));
				}
				else
				{
					File.WriteAllBytes(path, ImageConversion.EncodeToPNG(val));
				}
			}
		}

		private static Texture2D makeReadable(Texture texture)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			RenderTexture temporary = RenderTexture.GetTemporary(texture.width, texture.height, 32);
			((Object)temporary).name = "Whatever";
			temporary.enableRandomWrite = true;
			temporary.Create();
			Graphics.Blit(texture, temporary);
			RenderTexture active = RenderTexture.active;
			RenderTexture.active = temporary;
			Texture2D val = new Texture2D(texture.width, texture.height);
			val.ReadPixels(new Rect(0f, 0f, (float)((Texture)temporary).width, (float)((Texture)temporary).height), 0, 0);
			val.Apply();
			RenderTexture.active = active;
			RenderTexture.ReleaseTemporary(temporary);
			return val;
		}

		public static string acronymHelper(string expansion, bool forceCaps)
		{
			string[] array = expansion.Split(" ");
			string text = "";
			string[] array2 = array;
			foreach (string text2 in array2)
			{
				text = ((!forceCaps) ? (text + text2[0]) : (text + text2.ToUpper()[0]));
			}
			return text;
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
}