Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of PartialEclipse8 v1.4.0
plugins/PartialEclipse/PartialEclipse.dll
Decompiled 5 months agousing System; using System.CodeDom.Compiler; 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 Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour.HookGen; using PartialEclipse.Properties; using R2API; using RoR2; using UnityEngine; using UnityEngine.Networking; [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 = "")] [assembly: AssemblyCompany("PartialEclipse")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PartialEclipse")] [assembly: AssemblyTitle("PartialEclipse")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace PartialEclipse { 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); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("RegalTurtle.PartialEclipse", "PartialEclipse", "1.4.0")] public class PartialEclipse : BaseUnityPlugin { public const string PluginGUID = "RegalTurtle.PartialEclipse"; public const string PluginAuthor = "RegalTurtle"; public const string PluginName = "PartialEclipse"; public const string PluginVersion = "1.4.0"; private static readonly HashSet<NetworkUser> votedForEclipse1 = new HashSet<NetworkUser>(); private static readonly HashSet<NetworkUser> votedForEclipse2 = new HashSet<NetworkUser>(); private static readonly HashSet<NetworkUser> votedForEclipse3 = new HashSet<NetworkUser>(); private static readonly HashSet<NetworkUser> votedForEclipse5 = new HashSet<NetworkUser>(); private static readonly HashSet<NetworkUser> votedForEclipse8 = new HashSet<NetworkUser>(); private static readonly MethodInfo startRun = typeof(PreGameController).GetMethod("StartRun", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly MethodInfo onBodyStart = typeof(CharacterMaster).GetMethod("OnBodyStart", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly MethodInfo isBodyInChargingRadius = typeof(HoldoutZoneController).GetMethod("IsBodyInChargingRadius", BindingFlags.Static | BindingFlags.NonPublic); private static readonly MethodInfo doUpdate = typeof(HoldoutZoneController).GetMethod("DoUpdate", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly MethodInfo onCharacterHitGroundServer = typeof(GlobalEventManager).GetMethod("OnCharacterHitGroundServer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly MethodInfo heal = typeof(HealthComponent).GetMethod("Heal", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly MethodInfo damage = typeof(HealthComponent).GetMethod("TakeDamageProcess", BindingFlags.Instance | BindingFlags.NonPublic); internal static PartialEclipse Instance { get; private set; } public static bool EclipseArtifactsInstalled => Chainloader.PluginInfos.ContainsKey("Judgy.EclipseArtifacts"); public static bool RiskOfOptionsInstalled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); private static void OnBodyStart(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); Instruction next; if (EclipseArtifactsInstalled) { if (!val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty") })) { Log.Error("Failed to find Eclipse 1 check, EclipseArtifacts loaded"); return; } next = val.Next.Next.Next.Next.Next.Next.Next; } else { ILLabel val2 = default(ILLabel); if (!val.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty"), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 3), (Instruction x) => ILPatternMatchingExt.MatchBlt(x, ref val2) })) { Log.Error("Failed to find Eclipse 1 check"); return; } next = val.Next.Next.Next.Next; } int index = val.Index; val.Index = index - 1; val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<CharacterMaster, bool>>((Func<CharacterMaster, bool>)((CharacterMaster selfMaster) => votedForEclipse1.Any((NetworkUser el) => (Object)(object)el.master == (Object)(object)selfMaster))); val.Emit(OpCodes.Brtrue_S, next); } private static void IsBodyInChargingRadiusEdit(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 2) })) { Log.Error("Failed to find loading of arg 2 (for Eclipse 2)"); return; } int index = val.Index; val.Index = index + 1; val.Emit(OpCodes.Ldarg_3); val.EmitDelegate<Func<float, CharacterBody, float>>((Func<float, CharacterBody, float>)((float chargingRadiusSq, CharacterBody charBody) => votedForEclipse2.Any((NetworkUser el) => (Object)(object)el.master == (Object)(object)charBody.master) ? (chargingRadiusSq / 4f) : chargingRadiusSq)); } private static void DoUpdateEdit(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val = new ILCursor(il); if (!val.TryGotoNext(new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 2f), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCall<HoldoutZoneController>(x, "get_currentRadius"), (Instruction x) => ILPatternMatchingExt.MatchMul(x) })) { Log.Error("Eclipse 2: Failed to find radius hook"); return; } int index = val.Index; val.Index = index + 1; val.EmitDelegate<Func<float, float>>((Func<float, float>)((float tpMult) => votedForEclipse2.Any((NetworkUser el) => ((NetworkBehaviour)el).hasAuthority) ? 1f : 2f)); } private static void OnCharacterHitGroundServerEdit(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); Instruction next; if (EclipseArtifactsInstalled) { if (!val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty") })) { Log.Error("Failed to find Eclipse 3 check, EclipseArtifacts loaded"); return; } next = val.Next.Next.Next.Next.Next.Next.Next; } else { ILLabel val2 = default(ILLabel); if (!val.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty"), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 5), (Instruction x) => ILPatternMatchingExt.MatchBlt(x, ref val2) })) { Log.Error("Failed to find Eclipse 3 check"); return; } next = val.Next.Next.Next.Next; } int index = val.Index; val.Index = index - 1; val.Emit(OpCodes.Ldarg_1); val.EmitDelegate<Func<CharacterBody, bool>>((Func<CharacterBody, bool>)((CharacterBody selfCharacterBody) => votedForEclipse3.Any((NetworkUser el) => (Object)(object)el.master == (Object)(object)selfCharacterBody.master))); val.Emit(OpCodes.Brtrue_S, next); } private static void Heal(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); Instruction next; if (EclipseArtifactsInstalled) { if (!val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty") })) { Log.Error("Failed to find Eclipse 5 check, EclipseArtifacts loaded"); return; } next = val.Next.Next.Next.Next.Next.Next.Next; } else { ILLabel val2 = default(ILLabel); if (!val.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty"), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 7), (Instruction x) => ILPatternMatchingExt.MatchBlt(x, ref val2) })) { Log.Error("Failed to find Eclipse 5 check"); return; } next = val.Next.Next.Next.Next; } int index = val.Index; val.Index = index - 1; val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<HealthComponent, bool>>((Func<HealthComponent, bool>)((HealthComponent selfHealthComponent) => votedForEclipse5.Any((NetworkUser el) => (Object)(object)el.master == (Object)(object)selfHealthComponent.body.master))); val.Emit(OpCodes.Brtrue_S, next); } public static float NewHalfHealing(HealthComponent that, float healAmount) { if (votedForEclipse5.Any((NetworkUser el) => (Object)(object)el.master == (Object)(object)that.body.master)) { return healAmount / 2f; } return healAmount; } private static void TakeDamageProcess(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); Instruction next; if (EclipseArtifactsInstalled) { if (!val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty") })) { Log.Error("Failed to find Eclipse 8 check, EclipseArtifacts loaded"); return; } next = val.Next.Next.Next.Next.Next.Next.Next; } else { ILLabel val2 = default(ILLabel); if (!val.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Run>(x, "get_selectedDifficulty"), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 10), (Instruction x) => ILPatternMatchingExt.MatchBlt(x, ref val2) })) { Log.Error("Failed to find Eclipse 8 check"); return; } next = val.Next.Next.Next.Next; } int index = val.Index; val.Index = index - 1; val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<HealthComponent, bool>>((Func<HealthComponent, bool>)((HealthComponent selfHealthComponent) => votedForEclipse8.Any((NetworkUser el) => (Object)(object)el.master == (Object)(object)selfHealthComponent.body.master))); val.Emit(OpCodes.Brtrue_S, next); } public static void NewTakeCurse(CharacterMaster master, float damageAmount, HealthComponent that) { if (votedForEclipse8.Any((NetworkUser el) => (Object)(object)el.master == (Object)(object)master)) { float num = damageAmount / that.fullCombinedHealth * 100f; float num2 = 0.4f; int num3 = Mathf.FloorToInt(num * num2); for (int i = 0; i < num3; i++) { that.body.AddBuff(Buffs.PermanentCurse); } } } private static void PreGameControllerStartRun(Action<PreGameController> orig, PreGameController self) { votedForEclipse1.Clear(); votedForEclipse2.Clear(); votedForEclipse3.Clear(); votedForEclipse5.Clear(); votedForEclipse8.Clear(); RuleChoiceDef val = RuleCatalog.FindChoiceDef("Artifacts.PartialEclipse1.On"); RuleChoiceDef val2 = RuleCatalog.FindChoiceDef("Artifacts.PartialEclipse2.On"); RuleChoiceDef val3 = RuleCatalog.FindChoiceDef("Artifacts.PartialEclipse3.On"); RuleChoiceDef val4 = RuleCatalog.FindChoiceDef("Artifacts.PartialEclipse5.On"); RuleChoiceDef val5 = RuleCatalog.FindChoiceDef("Artifacts.PartialEclipse8.On"); foreach (NetworkUser readOnlyInstances in NetworkUser.readOnlyInstancesList) { PreGameRuleVoteController val6 = PreGameRuleVoteController.FindForUser(readOnlyInstances); if (val6.IsChoiceVoted(val)) { votedForEclipse1.Add(readOnlyInstances); } if (val6.IsChoiceVoted(val2)) { votedForEclipse2.Add(readOnlyInstances); } if (val6.IsChoiceVoted(val3)) { votedForEclipse3.Add(readOnlyInstances); } if (val6.IsChoiceVoted(val4)) { votedForEclipse5.Add(readOnlyInstances); } if (val6.IsChoiceVoted(val5)) { votedForEclipse8.Add(readOnlyInstances); } } Console.WriteLine(votedForEclipse8); orig(self); } public void Awake() { Log.Init(((BaseUnityPlugin)this).Logger); new PartialEclipse1Artifact(); new PartialEclipse2Artifact(); new PartialEclipse3Artifact(); new PartialEclipse5Artifact(); new PartialEclipse8Artifact(); } public void Destroy() { HookEndpointManager.Remove((MethodBase)startRun, (Delegate)new Action<Action<PreGameController>, PreGameController>(PreGameControllerStartRun)); HookEndpointManager.Unmodify((MethodBase)onBodyStart, (Delegate)new Action<ILContext>(OnBodyStart)); HookEndpointManager.Unmodify((MethodBase)isBodyInChargingRadius, (Delegate)new Action<ILContext>(IsBodyInChargingRadiusEdit)); HookEndpointManager.Unmodify((MethodBase)doUpdate, (Delegate)new Action<ILContext>(DoUpdateEdit)); HookEndpointManager.Unmodify((MethodBase)onCharacterHitGroundServer, (Delegate)new Action<ILContext>(OnCharacterHitGroundServerEdit)); HookEndpointManager.Unmodify((MethodBase)heal, (Delegate)new Action<ILContext>(Heal)); HookEndpointManager.Unmodify((MethodBase)damage, (Delegate)new Action<ILContext>(TakeDamageProcess)); } public void Start() { HookEndpointManager.Add((MethodBase)startRun, (Delegate)new Action<Action<PreGameController>, PreGameController>(PreGameControllerStartRun)); HookEndpointManager.Modify((MethodBase)onBodyStart, (Delegate)new Action<ILContext>(OnBodyStart)); HookEndpointManager.Modify((MethodBase)isBodyInChargingRadius, (Delegate)new Action<ILContext>(IsBodyInChargingRadiusEdit)); HookEndpointManager.Modify((MethodBase)doUpdate, (Delegate)new Action<ILContext>(DoUpdateEdit)); HookEndpointManager.Modify((MethodBase)onCharacterHitGroundServer, (Delegate)new Action<ILContext>(OnCharacterHitGroundServerEdit)); HookEndpointManager.Modify((MethodBase)heal, (Delegate)new Action<ILContext>(Heal)); HookEndpointManager.Modify((MethodBase)damage, (Delegate)new Action<ILContext>(TakeDamageProcess)); } } internal class PartialEclipse1Artifact { public static ArtifactDef artifact; public PartialEclipse1Artifact() { LanguageAPI.Add("PARTIALECLIPSE_PARTIALECLIPSE1_NAME", "Artifact of Partial Eclipse 1"); LanguageAPI.Add("PARTIALECLIPSE_PARTIALECLIPSE1_DESC", "Applies Eclipse 1 for people who select the artifact."); artifact = ScriptableObject.CreateInstance<ArtifactDef>(); artifact.cachedName = "PartialEclipse1"; artifact.nameToken = "PARTIALECLIPSE_PARTIALECLIPSE1_NAME"; artifact.descriptionToken = "PARTIALECLIPSE_PARTIALECLIPSE1_DESC"; artifact.smallIconSelectedSprite = CreateSpriteNew("E1_selected"); artifact.smallIconDeselectedSprite = CreateSpriteNew("E1_deselected"); ContentAddition.AddArtifactDef(artifact); } public static Sprite CreateSpriteNew(string fileName) { return LoadResourceSprite(fileName); } public static Sprite LoadResourceSprite(string resName) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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; } } internal class PartialEclipse2Artifact { public static ArtifactDef artifact; public PartialEclipse2Artifact() { LanguageAPI.Add("PARTIALECLIPSE_PARTIALECLIPSE2_NAME", "Artifact of Partial Eclipse 2"); LanguageAPI.Add("PARTIALECLIPSE_PARTIALECLIPSE2_DESC", "Applies Eclipse 2 for people who select the artifact."); artifact = ScriptableObject.CreateInstance<ArtifactDef>(); artifact.cachedName = "PartialEclipse2"; artifact.nameToken = "PARTIALECLIPSE_PARTIALECLIPSE2_NAME"; artifact.descriptionToken = "PARTIALECLIPSE_PARTIALECLIPSE2_DESC"; artifact.smallIconSelectedSprite = CreateSpriteNew("E2_selected"); artifact.smallIconDeselectedSprite = CreateSpriteNew("E2_deselected"); ContentAddition.AddArtifactDef(artifact); } public static Sprite CreateSpriteNew(string fileName) { return LoadResourceSprite(fileName); } public static Sprite LoadResourceSprite(string resName) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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; } } internal class PartialEclipse3Artifact { public static ArtifactDef artifact; public PartialEclipse3Artifact() { LanguageAPI.Add("PARTIALECLIPSE_PARTIALECLIPSE3_NAME", "Artifact of Partial Eclipse 3"); LanguageAPI.Add("PARTIALECLIPSE_PARTIALECLIPSE3_DESC", "Applies Eclipse 3 for people who select the artifact."); artifact = ScriptableObject.CreateInstance<ArtifactDef>(); artifact.cachedName = "PartialEclipse3"; artifact.nameToken = "PARTIALECLIPSE_PARTIALECLIPSE3_NAME"; artifact.descriptionToken = "PARTIALECLIPSE_PARTIALECLIPSE3_DESC"; artifact.smallIconSelectedSprite = CreateSpriteNew("E3_selected"); artifact.smallIconDeselectedSprite = CreateSpriteNew("E3_deselected"); ContentAddition.AddArtifactDef(artifact); } public static Sprite CreateSpriteNew(string fileName) { return LoadResourceSprite(fileName); } public static Sprite LoadResourceSprite(string resName) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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; } } internal class PartialEclipse5Artifact { public static ArtifactDef artifact; public PartialEclipse5Artifact() { LanguageAPI.Add("PARTIALECLIPSE_PARTIALECLIPSE5_NAME", "Artifact of Partial Eclipse 5"); LanguageAPI.Add("PARTIALECLIPSE_PARTIALECLIPSE5_DESC", "Applies Eclipse 5 for people who select the artifact."); artifact = ScriptableObject.CreateInstance<ArtifactDef>(); artifact.cachedName = "PartialEclipse5"; artifact.nameToken = "PARTIALECLIPSE_PARTIALECLIPSE5_NAME"; artifact.descriptionToken = "PARTIALECLIPSE_PARTIALECLIPSE5_DESC"; artifact.smallIconSelectedSprite = CreateSpriteNew("E5_selected"); artifact.smallIconDeselectedSprite = CreateSpriteNew("E5_deselected"); ContentAddition.AddArtifactDef(artifact); } public static Sprite CreateSpriteNew(string fileName) { return LoadResourceSprite(fileName); } public static Sprite LoadResourceSprite(string resName) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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; } } internal class PartialEclipse8Artifact { public static ArtifactDef artifact; public PartialEclipse8Artifact() { LanguageAPI.Add("PARTIALECLIPSE_PARTIALECLIPSE8_NAME", "Artifact of Partial Eclipse 8"); LanguageAPI.Add("PARTIALECLIPSE_PARTIALECLIPSE8_DESC", "Applies Eclipse 8 for people who select the artifact."); artifact = ScriptableObject.CreateInstance<ArtifactDef>(); artifact.cachedName = "PartialEclipse8"; artifact.nameToken = "PARTIALECLIPSE_PARTIALECLIPSE8_NAME"; artifact.descriptionToken = "PARTIALECLIPSE_PARTIALECLIPSE8_DESC"; artifact.smallIconSelectedSprite = CreateSpriteNew("E8_selected"); artifact.smallIconDeselectedSprite = CreateSpriteNew("E8_deselected"); ContentAddition.AddArtifactDef(artifact); } public static Sprite CreateSpriteNew(string fileName) { return LoadResourceSprite(fileName); } public static Sprite LoadResourceSprite(string resName) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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; } } } namespace PartialEclipse.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.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) { ResourceManager resourceManager = new ResourceManager("PartialEclipse.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] E1_deselected { get { object @object = ResourceManager.GetObject("E1_deselected", resourceCulture); return (byte[])@object; } } internal static byte[] E1_selected { get { object @object = ResourceManager.GetObject("E1_selected", resourceCulture); return (byte[])@object; } } internal static byte[] E2_deselected { get { object @object = ResourceManager.GetObject("E2_deselected", resourceCulture); return (byte[])@object; } } internal static byte[] E2_selected { get { object @object = ResourceManager.GetObject("E2_selected", resourceCulture); return (byte[])@object; } } internal static byte[] E3_deselected { get { object @object = ResourceManager.GetObject("E3_deselected", resourceCulture); return (byte[])@object; } } internal static byte[] E3_selected { get { object @object = ResourceManager.GetObject("E3_selected", resourceCulture); return (byte[])@object; } } internal static byte[] E5_deselected { get { object @object = ResourceManager.GetObject("E5_deselected", resourceCulture); return (byte[])@object; } } internal static byte[] E5_selected { get { object @object = ResourceManager.GetObject("E5_selected", resourceCulture); return (byte[])@object; } } internal static byte[] E8_deselected { get { object @object = ResourceManager.GetObject("E8_deselected", resourceCulture); return (byte[])@object; } } internal static byte[] E8_selected { get { object @object = ResourceManager.GetObject("E8_selected", resourceCulture); return (byte[])@object; } } internal Resources() { } } }