using System;
using System.Collections;
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 BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using ModdingTales;
using Unity.Mathematics;
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("EnhancedAssetsPlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nth Dimension")]
[assembly: AssemblyProduct("EnhancedAssetsPlugin")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("EnhancedAssetsPlugin")]
[assembly: ComVisible(false)]
[assembly: Guid("c303405d-e66c-4316-9cdb-4e3ca15c6360")]
[assembly: AssemblyFileVersion("2.0.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("2.0.1.0")]
namespace LordAshes;
[BepInPlugin("org.lordashes.plugins.spawnparty", "Spawn Party Plugin", "2.0.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class SpawnPartyPlugin : BaseUnityPlugin
{
public static class PatcheCreaturePresenterOnCreatureAdded
{
public static void Postfix(in object __0)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
LoggingPlugin.LogDebug("CreaturePresenter.OnCreatureAdded Fired");
Generic val = new Generic(_CreatureData, __0);
if (val != null && val.Instance() != null)
{
if (val.Get<string>("Alias") == "Party")
{
LoggingPlugin.LogDebug("Spawned Party Pointer. Replacing with party minis.");
((MonoBehaviour)_self).StartCoroutine(SpawnParty(val.Get("CreatureId")));
}
}
else
{
LoggingPlugin.LogTrace("Null CreatureData. Ignoring");
}
}
}
public static class PatcheCreatureBoardAssetOnCreatureDataChanged
{
public static void Postfix(object __instance, in object __0)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
LoggingPlugin.LogDebug("CreatureBoardAsset.OnCreatureDataChanged Fired");
Generic val = new Generic(_CreatureBoardAsset, __instance);
Generic value = new Generic(_CreatureData, __0);
if (val != null && val.Instance() != null)
{
if (partyMembers.ContainsKey(val.Get("CreatureId")))
{
LoggingPlugin.LogDebug("Updating Stored CreatureData For Creature " + val.Get<string>("CreatureId"));
partyMembers[val.Get("CreatureId")] = value;
}
else
{
LoggingPlugin.LogTrace("Non-Party Member. Ignoring");
}
}
else
{
LoggingPlugin.LogTrace("Null Creature. Ignoring");
}
}
}
public static class Utility
{
public static void PostOnMainPage(BaseUnityPlugin plugin)
{
string text = "Lord Ashes" + ("Lord Ashes".ToUpper().EndsWith("S") ? "'" : "'s");
ModdingUtils.AddPluginToMenuList((BaseUnityPlugin)(object)_self, text);
}
}
[CompilerGenerated]
private sealed class <BaseIndicatorBlink>d__19 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public object[] creatures;
public SpawnPartyPlugin <>4__this;
private object[] <>s__1;
private int <>s__2;
private object <cid>5__3;
private object[] <>s__4;
private int <>s__5;
private object <cid>5__6;
private object[] <>s__7;
private int <>s__8;
private object <cid>5__9;
private object[] <>s__10;
private int <>s__11;
private object <cid>5__12;
private object[] <>s__13;
private int <>s__14;
private object <cid>5__15;
private object[] <>s__16;
private int <>s__17;
private object <cid>5__18;
private object[] <>s__19;
private int <>s__20;
private object <cid>5__21;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <BaseIndicatorBlink>d__19(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>s__1 = null;
<cid>5__3 = null;
<>s__4 = null;
<cid>5__6 = null;
<>s__7 = null;
<cid>5__9 = null;
<>s__10 = null;
<cid>5__12 = null;
<>s__13 = null;
<cid>5__15 = null;
<>s__16 = null;
<cid>5__18 = null;
<>s__19 = null;
<cid>5__21 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Expected O, but got Unknown
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Expected O, but got Unknown
//IL_0218: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Expected O, but got Unknown
//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
//IL_02c1: Expected O, but got Unknown
//IL_0356: Unknown result type (might be due to invalid IL or missing references)
//IL_0360: Expected O, but got Unknown
//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
//IL_03ff: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>s__1 = creatures;
for (<>s__2 = 0; <>s__2 < <>s__1.Length; <>s__2++)
{
<cid>5__3 = <>s__1[<>s__2];
_CreatureManager.Invoke("SetCreatureExplicitHideState", new object[2] { <cid>5__3, false });
<cid>5__3 = null;
}
<>s__1 = null;
<>2__current = (object)new WaitForSeconds(0.25f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>s__4 = creatures;
for (<>s__5 = 0; <>s__5 < <>s__4.Length; <>s__5++)
{
<cid>5__6 = <>s__4[<>s__5];
_CreatureManager.Invoke("SetCreatureExplicitHideState", new object[2] { <cid>5__6, true });
<cid>5__6 = null;
}
<>s__4 = null;
<>2__current = (object)new WaitForSeconds(0.25f);
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
<>s__7 = creatures;
for (<>s__8 = 0; <>s__8 < <>s__7.Length; <>s__8++)
{
<cid>5__9 = <>s__7[<>s__8];
_CreatureManager.Invoke("SetCreatureExplicitHideState", new object[2] { <cid>5__9, false });
<cid>5__9 = null;
}
<>s__7 = null;
<>2__current = (object)new WaitForSeconds(0.25f);
<>1__state = 3;
return true;
case 3:
<>1__state = -1;
<>s__10 = creatures;
for (<>s__11 = 0; <>s__11 < <>s__10.Length; <>s__11++)
{
<cid>5__12 = <>s__10[<>s__11];
_CreatureManager.Invoke("SetCreatureExplicitHideState", new object[2] { <cid>5__12, true });
<cid>5__12 = null;
}
<>s__10 = null;
<>2__current = (object)new WaitForSeconds(0.25f);
<>1__state = 4;
return true;
case 4:
<>1__state = -1;
<>s__13 = creatures;
for (<>s__14 = 0; <>s__14 < <>s__13.Length; <>s__14++)
{
<cid>5__15 = <>s__13[<>s__14];
_CreatureManager.Invoke("SetCreatureExplicitHideState", new object[2] { <cid>5__15, false });
<cid>5__15 = null;
}
<>s__13 = null;
<>2__current = (object)new WaitForSeconds(0.25f);
<>1__state = 5;
return true;
case 5:
<>1__state = -1;
<>s__16 = creatures;
for (<>s__17 = 0; <>s__17 < <>s__16.Length; <>s__17++)
{
<cid>5__18 = <>s__16[<>s__17];
_CreatureManager.Invoke("SetCreatureExplicitHideState", new object[2] { <cid>5__18, true });
<cid>5__18 = null;
}
<>s__16 = null;
<>2__current = (object)new WaitForSeconds(0.25f);
<>1__state = 6;
return true;
case 6:
<>1__state = -1;
<>s__19 = creatures;
for (<>s__20 = 0; <>s__20 < <>s__19.Length; <>s__20++)
{
<cid>5__21 = <>s__19[<>s__20];
_CreatureManager.Invoke("SetCreatureExplicitHideState", new object[2] { <cid>5__21, false });
<cid>5__21 = null;
}
<>s__19 = null;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <SpawnParty>d__20 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public object partyPointerCid;
private object <assetObj>5__1;
private Generic <asset>5__2;
private Transform <asset_transform>5__3;
private float3 <pos>5__4;
private quaternion <rot>5__5;
private Dictionary<object, Generic>.ValueCollection.Enumerator <>s__6;
private Generic <cdv4>5__7;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SpawnParty>d__20(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<assetObj>5__1 = null;
<asset>5__2 = null;
<asset_transform>5__3 = null;
<>s__6 = default(Dictionary<object, Generic>.ValueCollection.Enumerator);
<cdv4>5__7 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Expected O, but got Unknown
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Expected O, but got Unknown
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
//IL_0308: Unknown result type (might be due to invalid IL or missing references)
//IL_030d: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
LoggingPlugin.LogDebug("Spawning Party");
LoggingPlugin.LogDebug("Party Pointed Cid: " + partyPointerCid.ToString());
<assetObj>5__1 = null;
break;
case 1:
<>1__state = -1;
break;
}
while (<assetObj>5__1 == null)
{
try
{
<assetObj>5__1 = _CreaturePresenter.Invoke("TryGetAsset", new object[2] { partyPointerCid, null })[1];
}
catch
{
}
LoggingPlugin.LogTrace("Asset Obj: " + ((<assetObj>5__1 != null) ? <assetObj>5__1.ToString() : "Null"));
if (<assetObj>5__1 == null)
{
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
return true;
}
}
<asset>5__2 = new Generic(_CreatureBoardAsset, <assetObj>5__1);
LoggingPlugin.LogTrace("Party Pointer Reference Obtained To " + <asset>5__2.Get("Name"));
<asset_transform>5__3 = <asset>5__2.Get<Transform>("Transform");
<pos>5__4 = new float3(<asset_transform>5__3.position.x, <asset_transform>5__3.position.y, <asset_transform>5__3.position.z);
<rot>5__5 = new quaternion(Quaternion.identity.x, Quaternion.identity.y, Quaternion.identity.z, Quaternion.identity.w);
LoggingPlugin.LogTrace("Target Transform Reference Obtained To " + <asset>5__2.Get("Name"));
LoggingPlugin.LogDebug("Party Member Count " + partyMembers.Values.Count);
<>s__6 = partyMembers.Values.GetEnumerator();
try
{
while (<>s__6.MoveNext())
{
<cdv4>5__7 = <>s__6.Current;
if (<cdv4>5__7 != null && <cdv4>5__7.Instance() != null)
{
LoggingPlugin.LogDebug("Party Member CreatureId Is: " + <cdv4>5__7.Get("CreatureId"));
_CreatureManager.Invoke("TryCreateAndAddNewCreature", new object[6]
{
<cdv4>5__7.Instance(),
<pos>5__4,
<rot>5__5,
false,
false,
true
});
<pos>5__4 = new float3(<pos>5__4.x + 1f, <pos>5__4.y, <pos>5__4.z);
}
else
{
LoggingPlugin.LogWarning("Party Member Data Is Null");
}
<cdv4>5__7 = null;
}
}
finally
{
((IDisposable)<>s__6).Dispose();
}
<>s__6 = default(Dictionary<object, Generic>.ValueCollection.Enumerator);
LoggingPlugin.LogDebug("Removing Party Pointer Creature " + <asset>5__2.Get("CreatureId"));
_CreatureManager.Invoke("DeleteCreature", new object[3]
{
<asset>5__2.Get("CreatureId"),
null,
false
});
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public const string Name = "Spawn Party Plugin";
public const string Guid = "org.lordashes.plugins.spawnparty";
public const string Version = "2.0.1.0";
public const string Author = "Lord Ashes";
public static KeyboardShortcut setTrigger;
public static SpawnPartyPlugin _self = null;
public static Generic _CreatureGuid = new Generic("CreatureGuid", (object)null);
public static Generic _CreatureData = new Generic("CreatureDataV4", (object)null);
public static Generic _LocalClient = new Generic("LocalClient", (object)null);
public static Generic _CreaturePresenter = new Generic("CreaturePresenter", (object)null);
public static Generic _CreatureManager = new Generic("CreatureManager", (object)null);
public static Generic _CreatureBoardAsset = new Generic("CreatureBoardAsset", (string[])null, (object)null);
public static Dictionary<object, Generic> partyMembers = new Dictionary<object, Generic>();
public static void ApplyPatches()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Expected O, but got Unknown
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Expected O, but got Unknown
LoggingPlugin.LogDebug("Harmony Patching");
Harmony val = new Harmony("org.lordashes.plugins.spawnparty");
LoggingPlugin.LogDebug("Patching CreaturePresenter.OnCreatureAdded");
MethodInfo methodInfo = _CreaturePresenter.Method("OnCreatureAdded");
MethodInfo method = typeof(PatcheCreaturePresenterOnCreatureAdded).GetMethod("Postfix");
val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
LoggingPlugin.LogDebug("Patching CreatureBoardAsset.OnCreatureDataChanged");
MethodInfo methodInfo2 = _CreatureBoardAsset.Method("OnCreatureDataChanged");
MethodInfo method2 = typeof(PatcheCreatureBoardAssetOnCreatureDataChanged).GetMethod("Postfix");
val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
LoggingPlugin.LogDebug("Patching Complete");
}
private void Awake()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: 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)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
_self = this;
LoggingPlugin.SetLogLevel(((BaseUnityPlugin)this).Config.Bind<DiagnosticLevel>("Settings", "Diagnostic Level", (DiagnosticLevel)3, (ConfigDescription)null).Value);
string? assemblyQualifiedName = ((object)this).GetType().AssemblyQualifiedName;
DiagnosticLevel logLevel = LoggingPlugin.GetLogLevel();
LoggingPlugin.LogInfo(assemblyQualifiedName + ": Active. (Diagnostic Mode = " + ((object)(DiagnosticLevel)(ref logLevel)).ToString() + ")");
setTrigger = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger To Save Selected Minis As Party Members", new KeyboardShortcut((KeyCode)277, (KeyCode[])(object)new KeyCode[1] { (KeyCode)305 }), (ConfigDescription)null).Value;
ApplyPatches();
Utility.PostOnMainPage((BaseUnityPlugin)(object)this);
}
private void Update()
{
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Expected O, but got Unknown
if (!((KeyboardShortcut)(ref setTrigger)).IsUp())
{
return;
}
LoggingPlugin.LogDebug("Adding Selected Minis To Party");
partyMembers.Clear();
try
{
object obj = _LocalClient.Invoke("TryGetLassoedCreatureIds", new string[1] { "CreatureGuid[]&" }, new object[1])[1];
foreach (object item in (IEnumerable)obj)
{
LoggingPlugin.LogTrace("Adding Creature " + item?.ToString() + " To The Party");
object obj2 = _CreatureManager.Invoke("TryGetCreatureData", new object[2] { item, null })[1];
Generic.Info(_CreatureData.Type(), obj2);
partyMembers.Add(item, new Generic(_CreatureData, obj2));
}
((MonoBehaviour)_self).StartCoroutine(BaseIndicatorBlink(partyMembers.Keys.ToArray()));
}
catch (Exception ex)
{
LoggingPlugin.LogDebug("Exception Getting Selected Minis: " + ex.Message);
}
}
[IteratorStateMachine(typeof(<BaseIndicatorBlink>d__19))]
private IEnumerator BaseIndicatorBlink(object[] creatures)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <BaseIndicatorBlink>d__19(0)
{
<>4__this = this,
creatures = creatures
};
}
[IteratorStateMachine(typeof(<SpawnParty>d__20))]
private static IEnumerator SpawnParty(object partyPointerCid)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SpawnParty>d__20(0)
{
partyPointerCid = partyPointerCid
};
}
}