Decompiled source of EclipseArtifacts v1.2.0

plugins/EclipseArtifacts/EclipseArtifacts.dll

Decompiled 2 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using EclipseArtifacts.Properties;
using EclipseRefurbished;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour.HookGen;
using R2API;
using RoR2;
using RoR2.ContentManagement;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Judgy")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0+b77d12352be398b6e8e206ea0ea3b279a3930ea3")]
[assembly: AssemblyProduct("EclipseArtifacts")]
[assembly: AssemblyTitle("EclipseArtifacts")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.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 EclipseArtifacts
{
	public static class EclipseArtifactsBehavior
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Manipulator <>9__2_0;

			public static Manipulator <>9__2_1;

			public static Manipulator <>9__2_2;

			public static Manipulator <>9__2_3;

			public static Manipulator <>9__2_4;

			public static Manipulator <>9__2_5;

			public static Manipulator <>9__2_6;

			public static Manipulator <>9__2_7;

			public static Manipulator <>9__3_0;

			public static Manipulator <>9__3_1;

			public static Manipulator <>9__3_2;

			public static Manipulator <>9__3_3;

			public static Manipulator <>9__3_4;

			public static Manipulator <>9__3_5;

			public static Manipulator <>9__3_6;

			public static Manipulator <>9__3_7;

			public static Func<Instruction, bool> <>9__4_0;

			public static Func<Instruction, bool> <>9__4_1;

			internal void <EnableHooks>b__2_0(ILContext il)
			{
				ReplaceCall_Run_GetSelectedDifficulty(il);
			}

			internal void <EnableHooks>b__2_1(ILContext il)
			{
				ReplaceCall_Run_GetSelectedDifficulty(il);
			}

			internal void <EnableHooks>b__2_2(ILContext il)
			{
				ReplaceCall_Run_GetSelectedDifficulty(il);
			}

			internal void <EnableHooks>b__2_3(ILContext il)
			{
				ReplaceCall_Run_GetSelectedDifficulty(il);
			}

			internal void <EnableHooks>b__2_4(ILContext il)
			{
				ReplaceCall_Run_GetSelectedDifficulty(il);
			}

			internal void <EnableHooks>b__2_5(ILContext il)
			{
				ReplaceCall_Run_GetSelectedDifficulty(il);
			}

			internal void <EnableHooks>b__2_6(ILContext il)
			{
				ReplaceCall_Run_GetSelectedDifficulty(il);
			}

			internal void <EnableHooks>b__2_7(ILContext il)
			{
				ReplaceCall_Run_GetSelectedDifficulty(il);
			}

			internal void <DisableHooks>b__3_0(ILContext il)
			{
				ReplaceCall_Run_GetSelectedDifficulty(il);
			}

			internal void <DisableHooks>b__3_1(ILContext il)
			{
				ReplaceCall_Run_GetSelectedDifficulty(il);
			}

			internal void <DisableHooks>b__3_2(ILContext il)
			{
				ReplaceCall_Run_GetSelectedDifficulty(il);
			}

			internal void <DisableHooks>b__3_3(ILContext il)
			{
				ReplaceCall_Run_GetSelectedDifficulty(il);
			}

			internal void <DisableHooks>b__3_4(ILContext il)
			{
				ReplaceCall_Run_GetSelectedDifficulty(il);
			}

			internal void <DisableHooks>b__3_5(ILContext il)
			{
				ReplaceCall_Run_GetSelectedDifficulty(il);
			}

			internal void <DisableHooks>b__3_6(ILContext il)
			{
				ReplaceCall_Run_GetSelectedDifficulty(il);
			}

			internal void <DisableHooks>b__3_7(ILContext il)
			{
				ReplaceCall_Run_GetSelectedDifficulty(il);
			}

			internal bool <ReplaceCall_Run_GetSelectedDifficulty>b__4_0(Instruction x)
			{
				return ILPatternMatchingExt.MatchCall<Run>(x, "get_instance");
			}

			internal bool <ReplaceCall_Run_GetSelectedDifficulty>b__4_1(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty");
			}
		}

		private static bool _hooksEnabled;

		public static bool IsArtifactEnabled(int eclipseLevel)
		{
			if ((Object)(object)RunArtifactManager.instance == (Object)null)
			{
				return false;
			}
			ArtifactDef artifactDefFromEclipseLevel = EclipseArtifactsContent.Artifacts.GetArtifactDefFromEclipseLevel(eclipseLevel);
			if ((Object)(object)artifactDefFromEclipseLevel == (Object)null)
			{
				return false;
			}
			return RunArtifactManager.instance.IsArtifactEnabled(artifactDefFromEclipseLevel);
		}

		public static void EnableHooks()
		{
			//IL_001c: 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_0027: Expected O, but got Unknown
			//IL_0040: 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_004b: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Expected O, but got Unknown
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Expected O, but got Unknown
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Expected O, but got Unknown
			if (_hooksEnabled)
			{
				return;
			}
			object obj = <>c.<>9__2_0;
			if (obj == null)
			{
				Manipulator val = delegate(ILContext il)
				{
					ReplaceCall_Run_GetSelectedDifficulty(il);
				};
				<>c.<>9__2_0 = val;
				obj = (object)val;
			}
			CharacterMaster.OnBodyStart += (Manipulator)obj;
			object obj2 = <>c.<>9__2_1;
			if (obj2 == null)
			{
				Manipulator val2 = delegate(ILContext il)
				{
					ReplaceCall_Run_GetSelectedDifficulty(il);
				};
				<>c.<>9__2_1 = val2;
				obj2 = (object)val2;
			}
			HoldoutZoneController.DoUpdate += (Manipulator)obj2;
			object obj3 = <>c.<>9__2_2;
			if (obj3 == null)
			{
				Manipulator val3 = delegate(ILContext il)
				{
					ReplaceCall_Run_GetSelectedDifficulty(il);
				};
				<>c.<>9__2_2 = val3;
				obj3 = (object)val3;
			}
			GlobalEventManager.OnCharacterHitGroundServer += (Manipulator)obj3;
			object obj4 = <>c.<>9__2_3;
			if (obj4 == null)
			{
				Manipulator val4 = delegate(ILContext il)
				{
					ReplaceCall_Run_GetSelectedDifficulty(il);
				};
				<>c.<>9__2_3 = val4;
				obj4 = (object)val4;
			}
			CharacterBody.RecalculateStats += (Manipulator)obj4;
			object obj5 = <>c.<>9__2_4;
			if (obj5 == null)
			{
				Manipulator val5 = delegate(ILContext il)
				{
					ReplaceCall_Run_GetSelectedDifficulty(il);
				};
				<>c.<>9__2_4 = val5;
				obj5 = (object)val5;
			}
			HealthComponent.Heal += (Manipulator)obj5;
			object obj6 = <>c.<>9__2_5;
			if (obj6 == null)
			{
				Manipulator val6 = delegate(ILContext il)
				{
					ReplaceCall_Run_GetSelectedDifficulty(il);
				};
				<>c.<>9__2_5 = val6;
				obj6 = (object)val6;
			}
			DeathRewards.OnKilledServer += (Manipulator)obj6;
			object obj7 = <>c.<>9__2_6;
			if (obj7 == null)
			{
				Manipulator val7 = delegate(ILContext il)
				{
					ReplaceCall_Run_GetSelectedDifficulty(il);
				};
				<>c.<>9__2_6 = val7;
				obj7 = (object)val7;
			}
			CharacterBody.RecalculateStats += (Manipulator)obj7;
			object obj8 = <>c.<>9__2_7;
			if (obj8 == null)
			{
				Manipulator val8 = delegate(ILContext il)
				{
					ReplaceCall_Run_GetSelectedDifficulty(il);
				};
				<>c.<>9__2_7 = val8;
				obj8 = (object)val8;
			}
			HealthComponent.TakeDamageProcess += (Manipulator)obj8;
			if (EclipseRefurbishedCompat.Enabled)
			{
				EclipseRefurbishedCompat.EnableHooks();
			}
			_hooksEnabled = true;
		}

		public static void DisableHooks()
		{
			//IL_001c: 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_0027: Expected O, but got Unknown
			//IL_0040: 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_004b: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Expected O, but got Unknown
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Expected O, but got Unknown
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Expected O, but got Unknown
			if (!_hooksEnabled)
			{
				return;
			}
			object obj = <>c.<>9__3_0;
			if (obj == null)
			{
				Manipulator val = delegate(ILContext il)
				{
					ReplaceCall_Run_GetSelectedDifficulty(il);
				};
				<>c.<>9__3_0 = val;
				obj = (object)val;
			}
			CharacterMaster.OnBodyStart -= (Manipulator)obj;
			object obj2 = <>c.<>9__3_1;
			if (obj2 == null)
			{
				Manipulator val2 = delegate(ILContext il)
				{
					ReplaceCall_Run_GetSelectedDifficulty(il);
				};
				<>c.<>9__3_1 = val2;
				obj2 = (object)val2;
			}
			HoldoutZoneController.DoUpdate -= (Manipulator)obj2;
			object obj3 = <>c.<>9__3_2;
			if (obj3 == null)
			{
				Manipulator val3 = delegate(ILContext il)
				{
					ReplaceCall_Run_GetSelectedDifficulty(il);
				};
				<>c.<>9__3_2 = val3;
				obj3 = (object)val3;
			}
			GlobalEventManager.OnCharacterHitGroundServer -= (Manipulator)obj3;
			object obj4 = <>c.<>9__3_3;
			if (obj4 == null)
			{
				Manipulator val4 = delegate(ILContext il)
				{
					ReplaceCall_Run_GetSelectedDifficulty(il);
				};
				<>c.<>9__3_3 = val4;
				obj4 = (object)val4;
			}
			CharacterBody.RecalculateStats -= (Manipulator)obj4;
			object obj5 = <>c.<>9__3_4;
			if (obj5 == null)
			{
				Manipulator val5 = delegate(ILContext il)
				{
					ReplaceCall_Run_GetSelectedDifficulty(il);
				};
				<>c.<>9__3_4 = val5;
				obj5 = (object)val5;
			}
			HealthComponent.Heal -= (Manipulator)obj5;
			object obj6 = <>c.<>9__3_5;
			if (obj6 == null)
			{
				Manipulator val6 = delegate(ILContext il)
				{
					ReplaceCall_Run_GetSelectedDifficulty(il);
				};
				<>c.<>9__3_5 = val6;
				obj6 = (object)val6;
			}
			DeathRewards.OnKilledServer -= (Manipulator)obj6;
			object obj7 = <>c.<>9__3_6;
			if (obj7 == null)
			{
				Manipulator val7 = delegate(ILContext il)
				{
					ReplaceCall_Run_GetSelectedDifficulty(il);
				};
				<>c.<>9__3_6 = val7;
				obj7 = (object)val7;
			}
			CharacterBody.RecalculateStats -= (Manipulator)obj7;
			object obj8 = <>c.<>9__3_7;
			if (obj8 == null)
			{
				Manipulator val8 = delegate(ILContext il)
				{
					ReplaceCall_Run_GetSelectedDifficulty(il);
				};
				<>c.<>9__3_7 = val8;
				obj8 = (object)val8;
			}
			HealthComponent.TakeDamageProcess -= (Manipulator)obj8;
			if (EclipseRefurbishedCompat.Enabled)
			{
				EclipseRefurbishedCompat.DisableHooks();
			}
			_hooksEnabled = false;
		}

		public static void ReplaceCall_Run_GetSelectedDifficulty(ILContext il, bool overrideDiffWhenAnyArtifactIsEnabled = false)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			bool flag = false;
			do
			{
				int checkedDiff = -1;
				flag = val.TryGotoNext(new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCall<Run>(x, "get_instance"),
					(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty"),
					(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref checkedDiff)
				});
				if (!flag || checkedDiff < 3 || checkedDiff > 10)
				{
					continue;
				}
				int eclipseIndex = checkedDiff - 2;
				IEnumerable<ILLabel> incomingLabels = val.IncomingLabels;
				val.RemoveRange(2);
				val.EmitDelegate<Func<DifficultyIndex>>((Func<DifficultyIndex>)delegate
				{
					//IL_0041: Unknown result type (might be due to invalid IL or missing references)
					for (int i = 1; i <= 8; i++)
					{
						if ((i == eclipseIndex || overrideDiffWhenAnyArtifactIsEnabled) && IsArtifactEnabled(i))
						{
							return (DifficultyIndex)checkedDiff;
						}
					}
					return Run.instance.selectedDifficulty;
				});
				val.Index -= 2;
				foreach (ILLabel item in incomingLabels)
				{
					val.MarkLabel(item);
				}
				val.Index += 2;
			}
			while (flag);
		}
	}
	public class EclipseArtifactsContent : IContentPackProvider
	{
		public static class Artifacts
		{
			public static Dictionary<int, ArtifactDef> artifactDefs = new Dictionary<int, ArtifactDef>();

			public static ArtifactDef GetArtifactDefFromEclipseLevel(int eclipseLevel)
			{
				if (artifactDefs.TryGetValue(eclipseLevel, out var value))
				{
					return value;
				}
				return null;
			}

			public static void Create()
			{
				for (int i = 1; i <= 8; i++)
				{
					ArtifactDef val = ScriptableObject.CreateInstance<ArtifactDef>();
					val.cachedName = GetArtifactCachedNameFromEclipseLevel(i);
					val.nameToken = GetArtifactNameTokenFromEclipseLevel(i);
					val.descriptionToken = GetArtifactDescTokenFromEclipseLevel(i);
					val.smallIconSelectedSprite = GetSelectedSpriteFromEclipseLevel(i);
					val.smallIconDeselectedSprite = GetDeselectedSpriteFromEclipseLevel(i);
					artifactDefs.Add(i, val);
				}
			}

			public static string GetArtifactNameTokenFromEclipseLevel(int eclipseLevel)
			{
				return $"ARTIFACT_INDIVIDUALECLIPSE{eclipseLevel}_NAME";
			}

			public static string GetArtifactDescTokenFromEclipseLevel(int eclipseLevel)
			{
				return $"ARTIFACT_INDIVIDUALECLIPSE{eclipseLevel}_DESC";
			}

			private static string GetArtifactCachedNameFromEclipseLevel(int eclipseLevel)
			{
				return $"ARTIFACT_INDIVIDUALECLIPSE{eclipseLevel}";
			}

			private static Sprite GetSelectedSpriteFromEclipseLevel(int eclipseLevel)
			{
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				Sprite val = EclipseArtifactsPlugin.LoadResourceSprite($"E{eclipseLevel}_selected");
				if ((Object)(object)val != (Object)null)
				{
					return val;
				}
				return Sprite.Create(Texture2D.whiteTexture, new Rect(0f, 0f, 4f, 4f), new Vector2(3f, 3f));
			}

			private static Sprite GetDeselectedSpriteFromEclipseLevel(int eclipseLevel)
			{
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				Sprite val = EclipseArtifactsPlugin.LoadResourceSprite($"E{eclipseLevel}_deselected");
				if ((Object)(object)val != (Object)null)
				{
					return val;
				}
				return Sprite.Create(Texture2D.whiteTexture, new Rect(0f, 0f, 4f, 4f), new Vector2(3f, 3f));
			}
		}

		public ContentPack pack = new ContentPack();

		public string identifier => "EclipseArtifactContent";

		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			Artifacts.Create();
			pack.artifactDefs.Add(new List<ArtifactDef>(Artifacts.artifactDefs.Values).ToArray());
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
		{
			ContentPack.Copy(pack, args.output);
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			args.ReportProgress(1f);
			yield break;
		}
	}
	public static class EclipseArtifactsLanguage
	{
		public static bool TokensRegistered { get; private set; }

		public static void TryRegisterTokens()
		{
			if (TokensRegistered)
			{
				return;
			}
			for (int i = 1; i <= 8; i++)
			{
				if (Language.IsTokenInvalid($"ECLIPSE_{i}_DESCRIPTION"))
				{
					return;
				}
			}
			for (int j = 1; j <= 8; j++)
			{
				RegisterArtifactLanguageData(j);
			}
			TokensRegistered = true;
		}

		private static void RegisterArtifactLanguageData(int eclipseLevel)
		{
			LanguageAPI.Add(EclipseArtifactsContent.Artifacts.GetArtifactNameTokenFromEclipseLevel(eclipseLevel), GetArtifactName(eclipseLevel));
			LanguageAPI.Add(EclipseArtifactsContent.Artifacts.GetArtifactDescTokenFromEclipseLevel(eclipseLevel), GetArtifactDescription(eclipseLevel));
		}

		private static string GetArtifactName(int eclipseLevel)
		{
			return $"Artifact of Eclipse {eclipseLevel}";
		}

		private static string GetArtifactDescription(int eclipseLevel)
		{
			string text = $"ECLIPSE_{eclipseLevel}_DESCRIPTION";
			string prefix = $"<mspace=0.5em>({eclipseLevel})</mspace> ";
			string @string = Language.GetString(text);
			string text2 = @string.Split('\n').FirstOrDefault((string s) => s.StartsWith(prefix));
			if (text2 == null)
			{
				Log.LogError("Error while parsing \"" + text + "\":\n\n" + @string);
				return text;
			}
			string text3 = text2;
			int length = prefix.Length;
			string text4 = text3.Substring(length, text3.Length - length).TrimEnd('\n');
			string text5 = "<style=cStack>>" + text4;
			if (EclipseRefurbishedCompat.Enabled)
			{
				text5 = EclipseRefurbishedCompat.AddDirectorCreditsToDescription(text5);
			}
			return text5;
		}
	}
	[BepInPlugin("Judgy.EclipseArtifacts", "EclipseArtifacts", "1.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class EclipseArtifactsPlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "Judgy.EclipseArtifacts";

		public const string PluginAuthor = "Judgy";

		public const string PluginName = "EclipseArtifacts";

		public const string PluginVersion = "1.1.0";

		public void Awake()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			Log.Init(((BaseUnityPlugin)this).Logger);
			ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
			EclipseArtifactsBehavior.EnableHooks();
			Log.LogInfo("Awake done.");
		}

		public void OnDestroy()
		{
			EclipseArtifactsBehavior.DisableHooks();
		}

		public void Update()
		{
			if (!EclipseArtifactsLanguage.TokensRegistered)
			{
				EclipseArtifactsLanguage.TryRegisterTokens();
			}
		}

		private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
		{
			addContentPackProvider.Invoke((IContentPackProvider)(object)new EclipseArtifactsContent());
		}

		public static Sprite LoadResourceSprite(string resName)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false);
			Sprite result = null;
			try
			{
				byte[] array = (byte[])Resources.ResourceManager.GetObject(resName);
				ImageConversion.LoadImage(val, array, false);
				val.Apply();
				result = Sprite.Create(val, new Rect(0f, 0f, 128f, 128f), new Vector2(64f, 64f));
			}
			catch (Exception ex)
			{
				Debug.LogError((object)ex.ToString());
			}
			return result;
		}
	}
	public class EclipseRefurbishedCompat
	{
		private static bool? _enabled;

		private static bool _hooksEnabled;

		private static string _creditsModifierDesc;

		public static bool Enabled
		{
			get
			{
				bool valueOrDefault = _enabled.GetValueOrDefault();
				if (!_enabled.HasValue)
				{
					valueOrDefault = Chainloader.PluginInfos.ContainsKey("com.Puporongod.EclipseRefurbished");
					_enabled = valueOrDefault;
				}
				return _enabled.Value;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static string AddDirectorCreditsToDescription(string description)
		{
			if (_creditsModifierDesc == null)
			{
				_creditsModifierDesc = Language.GetString("ECLIPSE_1_DESCRIPTION").Split('\n').FirstOrDefault((string s) => s.StartsWith("Director Credits:"))
					.TrimEnd('\n');
			}
			List<string> list = description.Split("\n").ToList();
			list.Add("<style=cStack>>" + _creditsModifierDesc + " (Non-Stacking)</style>");
			return string.Join('\n', list);
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void EnableHooks()
		{
			if (!_hooksEnabled)
			{
				HookEndpointManager.Modify((MethodBase)GetCombatDirectorEnableMethod(), (Delegate)new Action<ILContext>(Modify_CombatDirector_OnEnable));
				HookEndpointManager.Modify((MethodBase)GetATKSpeedMethod(), (Delegate)new Action<ILContext>(Modify_ATKSpeedAndAWUCooldown));
				_hooksEnabled = true;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void DisableHooks()
		{
			if (_hooksEnabled)
			{
				HookEndpointManager.Unmodify((MethodBase)GetCombatDirectorEnableMethod(), (Delegate)new Action<ILContext>(Modify_CombatDirector_OnEnable));
				HookEndpointManager.Unmodify((MethodBase)GetATKSpeedMethod(), (Delegate)new Action<ILContext>(Modify_ATKSpeedAndAWUCooldown));
				_hooksEnabled = false;
			}
		}

		public static void Modify_CombatDirector_OnEnable(ILContext il)
		{
			EclipseArtifactsBehavior.ReplaceCall_Run_GetSelectedDifficulty(il, overrideDiffWhenAnyArtifactIsEnabled: true);
		}

		public static void Modify_ATKSpeedAndAWUCooldown(ILContext il)
		{
			EclipseArtifactsBehavior.ReplaceCall_Run_GetSelectedDifficulty(il);
		}

		private static MethodInfo GetCombatDirectorEnableMethod()
		{
			BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic;
			return typeof(EclipseRefurbished).GetMethod("CombatDirector_OnEnable", bindingAttr);
		}

		private static MethodInfo GetATKSpeedMethod()
		{
			BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic;
			return typeof(EclipseRefurbished).GetMethod("ATKSpeedAndAWUCooldown", bindingAttr);
		}
	}
	internal static class Log
	{
		internal static ManualLogSource _logSource;

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

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

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

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

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

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

		internal static void LogWarning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
}
namespace EclipseArtifacts.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					resourceMan = new ResourceManager("EclipseArtifacts.Properties.Resources", typeof(Resources).Assembly);
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal static byte[] E1_deselected => (byte[])ResourceManager.GetObject("E1_deselected", resourceCulture);

		internal static byte[] E1_selected => (byte[])ResourceManager.GetObject("E1_selected", resourceCulture);

		internal static byte[] E2_deselected => (byte[])ResourceManager.GetObject("E2_deselected", resourceCulture);

		internal static byte[] E2_selected => (byte[])ResourceManager.GetObject("E2_selected", resourceCulture);

		internal static byte[] E3_deselected => (byte[])ResourceManager.GetObject("E3_deselected", resourceCulture);

		internal static byte[] E3_selected => (byte[])ResourceManager.GetObject("E3_selected", resourceCulture);

		internal static byte[] E4_deselected => (byte[])ResourceManager.GetObject("E4_deselected", resourceCulture);

		internal static byte[] E4_selected => (byte[])ResourceManager.GetObject("E4_selected", resourceCulture);

		internal static byte[] E5_deselected => (byte[])ResourceManager.GetObject("E5_deselected", resourceCulture);

		internal static byte[] E5_selected => (byte[])ResourceManager.GetObject("E5_selected", resourceCulture);

		internal static byte[] E6_deselected => (byte[])ResourceManager.GetObject("E6_deselected", resourceCulture);

		internal static byte[] E6_selected => (byte[])ResourceManager.GetObject("E6_selected", resourceCulture);

		internal static byte[] E7_deselected => (byte[])ResourceManager.GetObject("E7_deselected", resourceCulture);

		internal static byte[] E7_selected => (byte[])ResourceManager.GetObject("E7_selected", resourceCulture);

		internal static byte[] E8_deselected => (byte[])ResourceManager.GetObject("E8_deselected", resourceCulture);

		internal static byte[] E8_selected => (byte[])ResourceManager.GetObject("E8_selected", resourceCulture);

		internal Resources()
		{
		}
	}
}