Decompiled source of ItemDisplayRemoval v1.0.7

ItemDisplayRemoval.dll

Decompiled 6 months 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.Configuration;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RoR2;
using UnityEngine;

[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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("ItemDisplayRemoval")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ItemDisplayRemoval")]
[assembly: AssemblyTitle("ItemDisplayRemoval")]
[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 IDRSRemoval
{
	[BepInPlugin("RiskOfResources.ItemDisplayRemoval", "ItemDisplayRemoval", "1.0.7")]
	public class Main : BaseUnityPlugin
	{
		public const string PluginGUID = "RiskOfResources.ItemDisplayRemoval";

		public const string PluginAuthor = "RiskOfResources";

		public const string PluginName = "ItemDisplayRemoval";

		public const string PluginVersion = "1.0.7";

		public static ConfigEntry<bool> LazarusWings { get; set; }

		public static ConfigEntry<bool> EquipmentDisplay { get; set; }

		public static ConfigEntry<bool> ScavDisplay { get; set; }

		public static ConfigEntry<bool> FriendlyLemDisplay { get; set; }

		public void Awake()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			InitConfig();
			CharacterModel.EnableItemDisplay += new hook_EnableItemDisplay(RemoveItemDisplay);
			CharacterModel.SetEquipmentDisplay += new hook_SetEquipmentDisplay(RemoveEquipmentDisplay);
		}

		public void RemoveItemDisplay(orig_EnableItemDisplay orig, CharacterModel self, ItemIndex itemIndex)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			if ((((Object)ItemCatalog.GetItemDef(itemIndex)).name == "LazarusWings" && LazarusWings.Value) || (((Object)self).name.Contains("Scav") && ScavDisplay.Value) || (FriendlyLemDisplay.Value && ((Object)self.body.master).name.Contains("Devoted")))
			{
				orig.Invoke(self, itemIndex);
			}
			else
			{
				itemIndex = (ItemIndex)999;
			}
			orig.Invoke(self, itemIndex);
		}

		public void RemoveEquipmentDisplay(orig_SetEquipmentDisplay orig, CharacterModel self, EquipmentIndex equipmentIndex)
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody body = PlayerCharacterMasterController._instances[0].body;
			CharacterModel val = ((body != null) ? ((Component)body.modelLocator.modelTransform).GetComponent<CharacterModel>() : null);
			if ((Object)(object)val != (Object)null && (((Object)val).name != ((Object)self).name || (((Object)self).name.Contains("Scav") && ScavDisplay.Value) || EquipmentDisplay.Value))
			{
				orig.Invoke(self, equipmentIndex);
				return;
			}
			equipmentIndex = (EquipmentIndex)999;
			orig.Invoke(self, equipmentIndex);
		}

		public void InitConfig()
		{
			LazarusWings = ((BaseUnityPlugin)this).Config.Bind<bool>("Display Options", "Lazarus Wings", true, "Set whether to display Lazarus Wings from the RiskOfResources Public Gauntlet mod.");
			EquipmentDisplay = ((BaseUnityPlugin)this).Config.Bind<bool>("Display Options", "Display Equipment", false, "Set whether to display Equipments or not. (True = Equipments will be displayed)");
			ScavDisplay = ((BaseUnityPlugin)this).Config.Bind<bool>("Display Options", "Display Scavenger items and Equipment", true, "Set whether to display items and equipments in a Scavenger's inventory. (True = Items and equipments will be displayed on the Scavenger's body)");
			FriendlyLemDisplay = ((BaseUnityPlugin)this).Config.Bind<bool>("Display Options", "Display Devotion Lemurians armour", true, "Set whether to display the armour for ally Lemurians when using Artifact of Devotion");
		}
	}
}