using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Bounce.Singletons;
using Bounce.Unmanaged;
using ModdingTales;
using RadialUI;
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("ExtraCoreStatusesPlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nth Dimension")]
[assembly: AssemblyProduct("ExtraCoreStatusesPlugin")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("ExtraCoreStatusesPlugin")]
[assembly: ComVisible(false)]
[assembly: Guid("c303405d-e66c-4316-9cdb-4e3ca15c6360")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LordAshes;
[BepInPlugin("org.lordashes.plugins.extracodestatuses", "TaleSpireExtraCoreStatusesPlugin", "1.0.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class ExtraCoreStatusesPlugin : BaseUnityPlugin
{
public static class Utility
{
public static bool isBoardLoaded()
{
return SimpleSingletonBehaviour<CameraController>.HasInstance && SingletonStateMBehaviour<BoardSessionManager, State<BoardSessionManager>>.HasInstance && !BoardSessionManager.IsLoading;
}
public static float ParseFloat(string value)
{
return float.Parse(value, CultureInfo.InvariantCulture);
}
public static GameObject FindInHierarchy(GameObject start, string seekName)
{
List<GameObject> results = new List<GameObject>();
bool done = false;
Traverse(start.transform, seekName, null, single: true, ref results, ref done);
return (results.Count > 0) ? results.ElementAt(0) : null;
}
public static GameObject FindInHierarchyViaPartialName(GameObject start, string seekName)
{
List<GameObject> results = new List<GameObject>();
bool done = false;
Traverse(start.transform, seekName, null, single: true, ref results, ref done, partial: true);
return (results.Count > 0) ? results.ElementAt(0) : null;
}
public static GameObject[] FindAllInHierarchy(GameObject start, string seekName)
{
List<GameObject> results = new List<GameObject>();
bool done = false;
Traverse(start.transform, seekName, null, single: false, ref results, ref done);
return results.ToArray();
}
public static GameObject[] FindAllInHierarchyViaPartialName(GameObject start, string seekName)
{
List<GameObject> results = new List<GameObject>();
bool done = false;
Traverse(start.transform, seekName, null, single: false, ref results, ref done, partial: true);
return results.ToArray();
}
public static GameObject FindWithComponentInHierarchy(GameObject start, string seekType)
{
List<GameObject> results = new List<GameObject>();
bool done = false;
Traverse(start.transform, null, seekType, single: true, ref results, ref done);
return (results.Count > 0) ? results.ElementAt(0) : null;
}
public static GameObject[] FindAllWithComponentInHierarchy<T>(GameObject start, string seekType)
{
List<GameObject> results = new List<GameObject>();
bool done = false;
Traverse(start.transform, null, seekType, single: false, ref results, ref done);
return results.ToArray();
}
public static void Traverse(Transform root, string seekName, string seekType, bool single, ref List<GameObject> results, ref bool done, bool partial = false)
{
try
{
if ((seekName == null || seekName == ((Object)((Component)root).gameObject).name || (partial && ((Object)((Component)root).gameObject).name.Contains(seekName))) && (seekType == null || (Object)(object)((Component)root).GetComponent(seekType) != (Object)null))
{
LoggingPlugin.LogTrace("Matched '" + ((Object)((Component)root).gameObject).name + "'");
results.Add(((Component)root).gameObject);
if (single)
{
done = true;
return;
}
}
foreach (Transform item in ExtensionMethods.Children(root))
{
if (!done)
{
Traverse(item, seekName, seekType, single, ref results, ref done, partial);
}
}
}
catch
{
}
}
public static object LookUp(in Dictionary<string, object> dictionary, string key)
{
foreach (KeyValuePair<string, object> item in dictionary)
{
if (item.Key.ToUpper() == key.ToUpper())
{
return item.Value;
}
}
return null;
}
public static void PostOnMainPage(BaseUnityPlugin plugin)
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Expected O, but got Unknown
string text = "Lord Ashes" + ("Lord Ashes".ToUpper().EndsWith("S") ? "'" : "'s");
ModdingUtils.Initialize(plugin, new ManualLogSource("TaleSpireExtraCoreStatusesPlugin"), text, false);
}
}
[CompilerGenerated]
private sealed class <WarnAboutLogLevel>d__8 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public ExtraCoreStatusesPlugin <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <WarnAboutLogLevel>d__8(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
try
{
DiagnosticLevel logLevel = LoggingPlugin.GetLogLevel();
SystemMessage.DisplayInfoText("TaleSpireExtraCoreStatusesPlugin: Using '" + ((object)(DiagnosticLevel)(ref logLevel)).ToString() + "' diagnostics.\r\nUse 'Info' for better performance", 10f, 0f, (Action)null);
SystemMessage.DisplayInfoText("TaleSpireExtraCoreStatusesPlugin: Use 'Debug' or 'Trace' for\r\ntroubleshooting only.", 10f, 0f, (Action)null);
}
catch
{
goto IL_0074;
}
return false;
IL_0074:
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
return true;
}
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 = "TaleSpireExtraCoreStatusesPlugin";
public const string Guid = "org.lordashes.plugins.extracodestatuses";
public const string Version = "1.0.0.0";
public const string Author = "Lord Ashes";
public static ExtraCoreStatusesPlugin _self;
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_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Invalid comparison between Unknown and I4
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Expected O, but got Unknown
_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();
Debug.Log((object)(assemblyQualifiedName + ": Active. (Diagnostic Mode = " + ((object)(DiagnosticLevel)(ref logLevel)).ToString() + ")"));
if ((int)LoggingPlugin.GetLogLevel() >= 4)
{
((MonoBehaviour)this).StartCoroutine(WarnAboutLogLevel());
}
Tuple<string, string>[] array = new Tuple<string, string>[5]
{
new Tuple<string, string>("Frozen", "TLA_PersistentGhost"),
new Tuple<string, string>("Poisoned", "TLA_Poison"),
new Tuple<string, string>("Spin", "TLA_Twirl"),
new Tuple<string, string>("Surprised", "TLA_Surprise"),
new Tuple<string, string>("Wiggle", "TLA_Wiggle")
};
foreach (Tuple<string, string> status in array)
{
RadialUIPlugin.AddCustomButtonStatusEmotesSubmenu("org.lordashes.plugins.extracodestatuses." + status.Item1, new ItemArgs
{
Action = delegate
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
ToggleStatus(new CreatureGuid(RadialUIPlugin.GetLastRadialTargetCreature()), status.Item2);
},
CloseMenuOnActivate = true,
FadeName = false,
Icon = Image.LoadSprite("org.lordashes.plugins.extracodestatuses." + status.Item1 + ".png", (CacheType)999),
Title = status.Item1
}, (Func<NGuid, NGuid, bool>)((NGuid a, NGuid b) => true));
}
Utility.PostOnMainPage((BaseUnityPlugin)(object)this);
}
private void ToggleStatus(CreatureGuid cid, string emoteName)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
LoggingPlugin.LogDebug("Requesting Toggle Of Emote '" + emoteName + "'");
CreatureBoardAsset val = null;
CreaturePresenter.TryGetAsset(cid, ref val);
EmoteCollectionItem val2 = EmoteManager.GetCollection().Emotes.Where((EmoteCollectionItem e) => ((Object)e.Emote).name.Contains(emoteName.ToString()) || e.Emote.DisplayName.Contains(emoteName.ToString())).FirstOrDefault();
if (val2 != null)
{
string[] obj = new string[5] { "Emote '", emoteName, "' has Id '", null, null };
NGuid id = val2.Id;
obj[3] = ((object)(NGuid)(ref id)).ToString();
obj[4] = "'";
LoggingPlugin.LogDebug(string.Concat(obj));
if (val2 != null)
{
if (val.IsPersistantEmoteEnabled(val2.Id))
{
string[] obj2 = new string[5] { "Emote '", emoteName, "' (Id ", null, null };
id = val2.Id;
obj2[3] = ((object)(NGuid)(ref id)).ToString();
obj2[4] = ") is 'on', turning 'off'";
LoggingPlugin.LogDebug(string.Concat(obj2));
CreatureManager.RemovePersistentEmote(cid, val2.Id);
}
else
{
string[] obj3 = new string[5] { "Emote '", emoteName, "' (Id ", null, null };
id = val2.Id;
obj3[3] = ((object)(NGuid)(ref id)).ToString();
obj3[4] = ") is 'off', turning 'on'";
LoggingPlugin.LogDebug(string.Concat(obj3));
CreatureManager.AddPersistentEmote(cid, val2.Id);
}
}
else
{
LoggingPlugin.LogDebug("Unable to find emote '" + emoteName + "'");
}
return;
}
LoggingPlugin.LogDebug("Emote '" + emoteName + "' not found.");
EmoteCollection collection = EmoteManager.GetCollection();
foreach (EmoteCollectionItem emote in collection.Emotes)
{
LoggingPlugin.LogDebug("Available Emote: " + ((Object)emote.Emote).name + " (" + emote.Emote.DisplayName + ")");
}
}
[IteratorStateMachine(typeof(<WarnAboutLogLevel>d__8))]
private IEnumerator WarnAboutLogLevel()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <WarnAboutLogLevel>d__8(0)
{
<>4__this = this
};
}
}