Decompiled source of AdventureBackpackSlotForAzuEPI v1.0.1

plugins/PomosAdventureBackpackSlotForAzuEPI/AdventureBackpackSlotForAzuExtendedPlayerInventory.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using AzuExtendedPlayerInventory;
using BepInEx;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("AdventureBackpackSlotForAzuExtendedPlayerInventory")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AdventureBackpackSlotForAzuExtendedPlayerInventory")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2128b3ed-ad48-4233-b441-18706580d628")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace BackpackSlotForAdventureBackpacks
{
	[BepInPlugin("com.yourname.backpackslotforadventurebackpacks", "Backpack Slot for Adventure Backpacks", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class BackpackSlot : BaseUnityPlugin
	{
		private static readonly string[] ValidBackpackNames = new string[8] { "BackpackMeadows", "BackpackBlackForest", "BackpackSwamp", "BackpackMountains", "BackpackPlains", "BackpackMistlands", "CapeSilverBackpack", "CapeIronBackpack" };

		private void Awake()
		{
			if (!API.IsLoaded())
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"AzuExtendedPlayerInventory not loaded; backpack slot will not be added.");
			}
			else if (API.AddSlot("Backpack", (Func<Player, ItemData>)GetBackpackItem, (Func<ItemData, bool>)IsBackpackItem, -1))
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Backpack slot added successfully.");
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Failed to add backpack slot.");
			}
		}

		private ItemData? GetBackpackItem(Humanoid player)
		{
			return ((IEnumerable<ItemData>)player.GetInventory().GetEquippedItems()).FirstOrDefault((Func<ItemData, bool>)((ItemData item) => item != null && (Object)(object)item.m_dropPrefab != (Object)null && ValidBackpackNames.Contains(((Object)item.m_dropPrefab).name)));
		}

		private bool IsBackpackItem(ItemData? item)
		{
			return item != null && (Object)(object)item.m_dropPrefab != (Object)null && ValidBackpackNames.Contains(((Object)item.m_dropPrefab).name);
		}
	}
}