Decompiled source of MarketableProvi v1.0.0

plugins/MarketableProvi/MarketableProvi.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HG.Reflection;
using Microsoft.CodeAnalysis;
using RoR2;
using RoR2.ContentManagement;
using RoR2BepInExPack.GameAssetPaths.Version_1_35_0;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MarketableProvi")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+9bbcb374c9aa0ee8fd530067e6263b4b6b4ccc11")]
[assembly: AssemblyProduct("MarketableProvi")]
[assembly: AssemblyTitle("MarketableProvi")]
[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 MarketableProvi
{
	internal static class Log
	{
		internal static ManualLogSource _logSource;

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

		private static string getLogPrefix(string callerPath, string callerMemberName, int callerLineNumber)
		{
			int num = callerPath.LastIndexOf("MarketableProvi");
			if (num >= 0)
			{
				callerPath = callerPath.Substring(num + "MarketableProvi".Length + 1);
			}
			return $"{callerPath}:{callerLineNumber} ({callerMemberName}) ";
		}

		internal static void Error(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogError((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

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

		internal static void Fatal(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogFatal((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

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

		internal static void Info(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogInfo((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

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

		internal static void Message(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogMessage((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

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

		internal static void Warning(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogWarning((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Warning_NoCallerPrefix(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInPlugin("Nuxlar.MarketableProvi", "MarketableProvi", "1.0.0")]
	public class Main : BaseUnityPlugin
	{
		public const string PluginGUID = "Nuxlar.MarketableProvi";

		public const string PluginAuthor = "Nuxlar";

		public const string PluginName = "MarketableProvi";

		public const string PluginVersion = "1.0.0";

		internal static Main Instance { get; private set; }

		public static string PluginDirectory { get; private set; }

		public void Awake()
		{
			Instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			LoadAssets();
		}

		private static void LoadAssets()
		{
			//IL_004c: 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)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			AssetReferenceT<Sprite> val = new AssetReferenceT<Sprite>(RoR2_DLC3_Parry.texParryIcon_png_df3b5f07);
			AssetReferenceT<Texture2D> val2 = new AssetReferenceT<Texture2D>(RoR2_DLC3_Parry.texParryDiffuse_png);
			AssetReferenceT<Material> obj = new AssetReferenceT<Material>(RoR2_DLC3_Parry.matParry_mat);
			AssetReferenceT<EquipmentDef> val3 = new AssetReferenceT<EquipmentDef>(RoR2_DLC3_Parry.Parry_asset);
			AssetReferenceT<GameObject> val4 = new AssetReferenceT<GameObject>(RoR2_DLC3_Parry.PickupParry_prefab);
			AssetReferenceT<GameObject> val5 = new AssetReferenceT<GameObject>(RoR2_DLC3_Parry.ParryDisplay_prefab);
			Texture2D proviTexture = AssetAsyncReferenceManager<Texture2D>.LoadAsset(val2, (AsyncReferenceHandleUnloadType)2).WaitForCompletion();
			Sprite proviSprite = AssetAsyncReferenceManager<Sprite>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2).WaitForCompletion();
			AsyncOperationHandle<Material> val6 = AssetAsyncReferenceManager<Material>.LoadAsset(obj, (AsyncReferenceHandleUnloadType)2);
			val6.Completed += delegate(AsyncOperationHandle<Material> x)
			{
				x.Result.mainTexture = (Texture)(object)proviTexture;
			};
			AsyncOperationHandle<EquipmentDef> val7 = AssetAsyncReferenceManager<EquipmentDef>.LoadAsset(val3, (AsyncReferenceHandleUnloadType)2);
			val7.Completed += delegate(AsyncOperationHandle<EquipmentDef> x)
			{
				x.Result.pickupIconSprite = proviSprite;
			};
			AsyncOperationHandle<GameObject> val8 = AssetAsyncReferenceManager<GameObject>.LoadAsset(val4, (AsyncReferenceHandleUnloadType)2);
			val8.Completed += delegate(AsyncOperationHandle<GameObject> x)
			{
				((Component)x.Result.transform.Find("mdlParry/Rubble")).gameObject.SetActive(false);
			};
			val8 = AssetAsyncReferenceManager<GameObject>.LoadAsset(val5, (AsyncReferenceHandleUnloadType)2);
			val8.Completed += delegate(AsyncOperationHandle<GameObject> x)
			{
				((Component)x.Result.transform.Find("mdlParry/Rubble")).gameObject.SetActive(false);
			};
		}
	}
}