Decompiled source of CustomAdventurers v0.0.1

CustomAdventurers.dll

Decompiled 5 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using BepInEx;
using HBS;
using HarmonyLib;
using Necro;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("CustomAdventurers")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CustomAdventurers")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("aa25166e-f88f-4df9-b288-e7e34ccc280a")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CustomAdventurers;

[BepInPlugin("deadjak.necropolis.customadventurers", "Custom Adventurers", "0.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Class1 : BaseUnityPlugin
{
	[HarmonyPatch(typeof(CharacterSelectorCamera), "InitSelectableCharacterIds")]
	private class CharacterSelectorCamera_Patch
	{
		public static bool Prefix(CharacterSelectorCamera __instance)
		{
			Traverse val = Traverse.Create((object)__instance);
			MethodInfo methodInfo = AccessTools.Method(typeof(CharacterIDs), "IsSelectableActor", (Type[])null, (Type[])null);
			List<string> list = new List<string>();
			foreach (KeyValuePair<string, ActorDef> item in (IEnumerable<KeyValuePair<string, ActorDef>>)LazySingletonBehavior<DataManager>.Instance.ActorDefs)
			{
				if ((bool)methodInfo.Invoke(null, new object[1] { item.Value }))
				{
					list.Add(item.Key);
				}
			}
			val.Field("actorIds").SetValue((object)list.ToArray());
			return false;
		}
	}

	private class CharacterIDs
	{
		public static bool IsSelectableActor(ActorDef def)
		{
			return def.tags.Contains("pc");
		}
	}

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("Custom Adventurers");
		val.PatchAll();
	}
}