Decompiled source of artifactofplasmashrimp v1.0.1

ArtifactofPlasmaShrimp.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
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 = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ArtifactofPlasmaShrimp")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ArtifactofPlasmaShrimp")]
[assembly: AssemblyTitle("ArtifactofPlasmaShrimp")]
[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 ArtifactOfPlasmaShrimp
{
	[BepInPlugin("com.scott_jc.artifactofplasmashrimp", "Artifact of Shrimp Fried Rice", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class ArtifactOfPlasmaShrimpPlugin : BaseUnityPlugin
	{
		public static ArtifactDef ArtifactPlasmaShrimp;

		private Run lastRun;

		public void Awake()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			CreateArtifact();
			Run.Start += new hook_Start(OnRunStart);
		}

		private void CreateArtifact()
		{
			ArtifactPlasmaShrimp = ScriptableObject.CreateInstance<ArtifactDef>();
			ArtifactPlasmaShrimp.cachedName = "ARTIFACT_PLASMA_SHRIMP";
			ArtifactPlasmaShrimp.nameToken = "ARTIFACT_PLASMA_SHRIMP_NAME";
			ArtifactPlasmaShrimp.descriptionToken = "ARTIFACT_PLASMA_SHRIMP_DESC";
			string path = Path.Combine(Paths.BepInExRootPath, "plugins", "scottjc-artifactofplasmashrimp");
			string path2 = Path.Combine(path, "plasmaShrimpIcon.png");
			string path3 = Path.Combine(path, "plasmaShrimpdeIcon.png");
			Sprite smallIconSelectedSprite = LoadSprite(path2);
			Sprite smallIconDeselectedSprite = LoadSprite(path3);
			ArtifactPlasmaShrimp.smallIconSelectedSprite = smallIconSelectedSprite;
			ArtifactPlasmaShrimp.smallIconDeselectedSprite = smallIconDeselectedSprite;
			ContentAddition.AddArtifactDef(ArtifactPlasmaShrimp);
			LanguageAPI.Add("ARTIFACT_PLASMA_SHRIMP_NAME", "Artifact of Shrimp Fried Rice");
			LanguageAPI.Add("ARTIFACT_PLASMA_SHRIMP_DESC", "All players start the run with Plasma Shrimp.");
		}

		private Sprite LoadSprite(string path)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			if (!File.Exists(path))
			{
				return null;
			}
			byte[] array = File.ReadAllBytes(path);
			Texture2D val = new Texture2D(2, 2);
			ImageConversion.LoadImage(val, array);
			return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
		}

		private void OnRunStart(orig_Start orig, Run self)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Invalid comparison between Unknown and I4
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (!NetworkServer.active || (Object)(object)lastRun == (Object)(object)self)
			{
				return;
			}
			lastRun = self;
			if ((Object)(object)ArtifactPlasmaShrimp == (Object)null || !RunArtifactManager.instance.IsArtifactEnabled(ArtifactPlasmaShrimp))
			{
				return;
			}
			ItemIndex val = ItemCatalog.FindItemIndex("MissileVoid");
			if ((int)val == -1)
			{
				return;
			}
			foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList)
			{
				if ((Object)(object)((readOnlyInstances != null) ? readOnlyInstances.inventory : null) != (Object)null)
				{
					readOnlyInstances.inventory.GiveItem(val, 1);
				}
			}
		}

		private void OnDestroy()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			Run.Start -= new hook_Start(OnRunStart);
		}
	}
}
namespace ExamplePlugin
{
	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);
		}
	}
}