Decompiled source of swuffsRefreshedRenders v1.0.0

SwuffIcons.dll

Decompiled 2 days ago
using System;
using System.Collections.Generic;
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 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("SwuffIcons")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+b6f1c279e5f7622b2ecd914531bc7078b737e4d5")]
[assembly: AssemblyProduct("SwuffIcons")]
[assembly: AssemblyTitle("SwuffIcons")]
[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 SwuffIcons
{
	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("swuff.BetterIcons", "BetterIcons", "1.0.0")]
	public class swuffIcons : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_FinishAsyncLoads <>9__6_0;

			internal void <Awake>b__6_0(orig_FinishAsyncLoads orig, BodyIndex bodyIndex, Texture2D tex)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(bodyIndex, tex);
				GameObject bodyPrefab = BodyCatalog.GetBodyPrefab(bodyIndex);
				CharacterBody val = default(CharacterBody);
				if ((Object)(object)bodyPrefab != (Object)null && bodyPrefab.TryGetComponent<CharacterBody>(ref val) && iconDict.TryGetValue(((Object)bodyPrefab).name, out var value))
				{
					val.portraitIcon = value;
				}
			}
		}

		public const string PluginGUID = "swuff.BetterIcons";

		public const string PluginAuthor = "swuff";

		public const string PluginName = "BetterIcons";

		public const string PluginVersion = "1.0.0";

		public static AssetBundle assetbundle;

		public static Dictionary<string, Texture> iconDict = new Dictionary<string, Texture>();

		public void Awake()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			assetbundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "swuffIcons"));
			SetIcons();
			object obj = <>c.<>9__6_0;
			if (obj == null)
			{
				hook_FinishAsyncLoads val = delegate(orig_FinishAsyncLoads orig, BodyIndex bodyIndex, Texture2D tex)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_000a: Unknown result type (might be due to invalid IL or missing references)
					orig.Invoke(bodyIndex, tex);
					GameObject bodyPrefab = BodyCatalog.GetBodyPrefab(bodyIndex);
					CharacterBody val2 = default(CharacterBody);
					if ((Object)(object)bodyPrefab != (Object)null && bodyPrefab.TryGetComponent<CharacterBody>(ref val2) && iconDict.TryGetValue(((Object)bodyPrefab).name, out var value))
					{
						val2.portraitIcon = value;
					}
				};
				<>c.<>9__6_0 = val;
				obj = (object)val;
			}
			BodyCatalog.FinishAsyncLoads += (hook_FinishAsyncLoads)obj;
		}

		public void SetIcons()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			Texture icon = assetbundle.LoadAsset<Texture>("texIconWispBody");
			GameObject bodyObj = Addressables.LoadAssetAsync<GameObject>((object)"a3fe70c460a83a34991cfd64a74006f0").WaitForCompletion();
			ReplaceIcon(bodyObj, icon);
			Texture icon2 = assetbundle.LoadAsset<Texture>("texIconLemurian");
			GameObject bodyObj2 = Addressables.LoadAssetAsync<GameObject>((object)"7dbddf7b5091ed5498164334ac1d43c7").WaitForCompletion();
			ReplaceIcon(bodyObj2, icon2);
			Texture icon3 = assetbundle.LoadAsset<Texture>("texIconLemurianPolymorph");
			GameObject bodyObj3 = Addressables.LoadAssetAsync<GameObject>((object)"454d6f188cf6019438feb4f8f7619a9c").WaitForCompletion();
			ReplaceIcon(bodyObj3, icon3);
			Texture icon4 = assetbundle.LoadAsset<Texture>("texIconJellyfish4");
			GameObject bodyObj4 = Addressables.LoadAssetAsync<GameObject>((object)"be8bb4202c0e56448bec6bf1d7c889cb").WaitForCompletion();
			ReplaceIcon(bodyObj4, icon4);
			Texture icon5 = assetbundle.LoadAsset<Texture>("texIconVagrant");
			GameObject bodyObj5 = Addressables.LoadAssetAsync<GameObject>((object)"4331e499912b59b47a5e45cc2ea738bb").WaitForCompletion();
			ReplaceIcon(bodyObj5, icon5);
			Texture icon6 = assetbundle.LoadAsset<Texture>("texIconBrother8");
			GameObject bodyObj6 = Addressables.LoadAssetAsync<GameObject>((object)"428a5d7ff6fb5074fb061b82198e65fa").WaitForCompletion();
			ReplaceIcon(bodyObj6, icon6);
			Texture icon7 = assetbundle.LoadAsset<Texture>("texIconImpBody2");
			GameObject bodyObj7 = Addressables.LoadAssetAsync<GameObject>((object)"3e09a3664cb1cef47aad9e234268a20d").WaitForCompletion();
			ReplaceIcon(bodyObj7, icon7);
			Texture icon8 = assetbundle.LoadAsset<Texture>("texIconGreaterWisp");
			GameObject bodyObj8 = Addressables.LoadAssetAsync<GameObject>((object)"367cb012c5eb41c4c8f3aa69262b5c2c").WaitForCompletion();
			ReplaceIcon(bodyObj8, icon8);
			Texture val = assetbundle.LoadAsset<Texture>("texIconClayBody");
			GameObject bodyObj9 = Addressables.LoadAssetAsync<GameObject>((object)"12ec97b2145ad35439544612aed9bab1").WaitForCompletion();
			ReplaceIcon(bodyObj9, val);
			iconDict.Add("MoffeinClayManBody", val);
			Texture icon9 = assetbundle.LoadAsset<Texture>("texIconClayBruiser2");
			GameObject bodyObj10 = Addressables.LoadAssetAsync<GameObject>((object)"a59e219f5c78ea949a7103a148d1ba0e").WaitForCompletion();
			ReplaceIcon(bodyObj10, icon9);
			Texture icon10 = assetbundle.LoadAsset<Texture>("texIconBellBody2");
			GameObject bodyObj11 = Addressables.LoadAssetAsync<GameObject>((object)"be5d36650448cdf4d8670591f2701e7e").WaitForCompletion();
			ReplaceIcon(bodyObj11, icon10);
		}

		public void ReplaceIcon(GameObject bodyObj, Texture icon)
		{
			if ((Object)(object)bodyObj != (Object)null && (Object)(object)icon != (Object)null)
			{
				iconDict.Add(((Object)bodyObj).name, icon);
			}
		}

		public void MakeConfig()
		{
		}
	}
}