Decompiled source of betterhexofloss v1.0.0

BetterHexOfLoss.dll

Decompiled 17 hours 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 RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;

[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("BetterHexOfLoss")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+a0d9a66ad92dc0a9928a5d1da4710b844398d8c5")]
[assembly: AssemblyProduct("BetterHexOfLoss")]
[assembly: AssemblyTitle("BetterHexOfLoss")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 BetterHexOfLoss
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("kina.BetterHexOfLoss", "BetterHexOfLoss", "1.0.0")]
	public class BetterHexOfLoss : BaseUnityPlugin
	{
		private static readonly int MainTex = Shader.PropertyToID("_MainTex");

		private static readonly int EmTex = Shader.PropertyToID("_EmTex");

		private const string PluginGUID = "kina.BetterHexOfLoss";

		private const string PluginAuthor = "kina";

		private const string PluginName = "BetterHexOfLoss";

		private const string PluginVersion = "1.0.0";

		private static AssetBundle lossBundle;

		public void Awake()
		{
			//IL_0056: 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)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			Log.Init(((BaseUnityPlugin)this).Logger);
			lossBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "lossbundle"));
			Texture val = lossBundle.LoadAsset<Texture>("TexHexRunesDiffuse");
			Sprite pickupIconSprite = lossBundle.LoadAsset<Sprite>("loss");
			GameObject val2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC4/RoamingItemDisable/PickupRoamingItemDisable.prefab").WaitForCompletion();
			MeshRenderer component = ((Component)val2.transform.Find("mdlHexrunes/rune8")).GetComponent<MeshRenderer>();
			Material val3 = Object.Instantiate<Material>(((Renderer)component).material);
			val3.SetTexture(MainTex, val);
			val3.SetTexture(EmTex, val);
			((Renderer)component).material = val3;
			GameObject val4 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC4/RoamingItemDisable/DisplayRoamingItemDisable.prefab").WaitForCompletion();
			ItemDisplay component2 = val4.GetComponent<ItemDisplay>();
			component2.rendererInfos[1].defaultMaterial = val3;
			((Renderer)((Component)val4.transform.Find("mdlHexrunes/rune8")).GetComponent<MeshRenderer>()).material = val3;
			ItemDef val5 = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC4/RoamingItemDisable/RoamingItemDisable.asset").WaitForCompletion();
			val5.pickupIconSpriteReference = null;
			val5.pickupIconSprite = pickupIconSprite;
		}
	}
	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);
		}
	}
}