using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
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 Newtonsoft.Json;
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("CoreAssets_CCM")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nth Dimension")]
[assembly: AssemblyProduct("CoreAssets_CCM")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("CoreAssets_CCM")]
[assembly: ComVisible(false)]
[assembly: Guid("c303405d-e66c-4316-9cdb-4e3ca15c6360")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("2.0.0.0")]
namespace LordAshes;
[BepInPlugin("org.lordashes.plugins.coreassets.ccm", "Core Assets Plugin", "2.0.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class CoreAssetsPlugin : BaseUnityPlugin
{
public static class Provider
{
public enum DbContentKind : uint
{
Tile = 1u,
Prop = 2u,
Creature = 4u,
RESERVED_0 = 8u,
Slab = 0x10u
}
private class ContentInfo
{
public string Id { get; set; }
public string Name { get; set; }
public IconData Icon { get; set; }
}
private class IconData
{
public int AtlasIndex { get; set; }
public Region Region { get; set; }
}
private class Region
{
public string serializedVersion { get; set; }
public float x { get; set; }
public float y { get; set; }
public float width { get; set; }
public float height { get; set; }
}
private class IconsAtlas
{
public string Path { get; set; }
}
private class ContentData
{
public string Name { get; set; }
public List<ContentInfo> Creatures { get; set; }
public List<ContentInfo> Props { get; set; }
public List<IconsAtlas> IconsAtlases { get; set; }
}
[CompilerGenerated]
private sealed class <GetNewAssets>d__4 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public ReadOnlyDictionary<string, AssetInfo> existingAssets;
public Func<Dictionary<string, AssetInfo>, string, IEnumerator> callback;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <GetNewAssets>d__4(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
_callback = callback;
<>2__current = (object)new WaitForEndOfFrame();
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
((MonoBehaviour)_self).StartCoroutine(SendCollectedAssetList(existingAssets));
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 <SendCollectedAssetList>d__5 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public ReadOnlyDictionary<string, AssetInfo> existingAssets;
private Dictionary<string, AssetInfo> <assets>5__1;
private Dictionary<string, string> <packNames>5__2;
private IEnumerable <enumerable>5__3;
private IEnumerator <>s__4;
private object <registeredPack>5__5;
private List<object>.Enumerator <>s__6;
private object <entry>5__7;
private string <name>5__8;
private string <kind>5__9;
private string <groupName>5__10;
private string <header>5__11;
private string <id>5__12;
private object <dataPackId>5__13;
private string <tags>5__14;
private IEnumerable <tagList>5__15;
private string <uniqueId>5__16;
private string <uniquePrefab>5__17;
private IEnumerator <>s__18;
private object <tag>5__19;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SendCollectedAssetList>d__5(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
int num = <>1__state;
if (num == -3 || (uint)(num - 3) <= 1u)
{
try
{
}
finally
{
<>m__Finally1();
}
}
<assets>5__1 = null;
<packNames>5__2 = null;
<enumerable>5__3 = null;
<>s__4 = null;
<registeredPack>5__5 = null;
<>s__6 = default(List<object>.Enumerator);
<entry>5__7 = null;
<name>5__8 = null;
<kind>5__9 = null;
<groupName>5__10 = null;
<header>5__11 = null;
<id>5__12 = null;
<dataPackId>5__13 = null;
<tags>5__14 = null;
<tagList>5__15 = null;
<uniqueId>5__16 = null;
<uniquePrefab>5__17 = null;
<>s__18 = null;
<tag>5__19 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Expected O, but got Unknown
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Expected O, but got Unknown
//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
//IL_04bb: Expected O, but got Unknown
//IL_06ba: Unknown result type (might be due to invalid IL or missing references)
//IL_06c1: Expected O, but got Unknown
//IL_041e: Unknown result type (might be due to invalid IL or missing references)
//IL_0428: Expected O, but got Unknown
try
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if (registerNew)
{
LoggingPlugin.LogInfo("Waiting For Core Assets To Be Detected");
_counter = 0;
goto IL_00b4;
}
LoggingPlugin.LogInfo("Skipping Registering Of New Core Assets");
_db.Clear();
goto IL_00e0;
case 1:
<>1__state = -1;
_counter++;
goto IL_00b4;
case 2:
{
<>1__state = -1;
<assets>5__1 = new Dictionary<string, AssetInfo>();
<packNames>5__2 = new Dictionary<string, string>();
object value = Reflection.Execute(m_GetRegisteredPackInfo, (object)null, new object[0], 0);
<enumerable>5__3 = value as IEnumerable;
if (<enumerable>5__3 != null)
{
<>s__4 = <enumerable>5__3.GetEnumerator();
try
{
while (<>s__4.MoveNext())
{
<registeredPack>5__5 = <>s__4.Current;
LoggingPlugin.LogDebug(f_PackId.GetValue(<registeredPack>5__5)?.ToString() + ": " + f_OptionalName.GetValue(<registeredPack>5__5));
<packNames>5__2.Add(f_PackId.GetValue(<registeredPack>5__5).ToString(), f_OptionalName.GetValue(<registeredPack>5__5).ToString());
<registeredPack>5__5 = null;
}
}
finally
{
if (<>s__4 is IDisposable disposable2)
{
disposable2.Dispose();
}
}
<>s__4 = null;
}
<>s__6 = _db.GetEnumerator();
<>1__state = -3;
goto IL_0894;
}
case 3:
<>1__state = -3;
if (<kind>5__9.ToLower().Trim() == "creature" || <kind>5__9.ToLower().Trim() == "prop")
{
<id>5__12 = GetId(<entry>5__7);
if (!existingAssets.ContainsKey(<id>5__12))
{
<>2__current = (object)new WaitForEndOfFrame();
<>1__state = 4;
return true;
}
goto IL_0867;
}
goto IL_086f;
case 4:
{
<>1__state = -3;
if (<entry>5__7 != null)
{
<dataPackId>5__13 = p_DataPackId.GetValue(<entry>5__7);
if (<header>5__11 == "")
{
<header>5__11 = (<packNames>5__2.ContainsKey(<dataPackId>5__13.ToString()) ? <packNames>5__2[<dataPackId>5__13.ToString()] : "CORE");
}
<tags>5__14 = "";
object value = f_Tags.GetValue(<entry>5__7);
<tagList>5__15 = value as IEnumerable;
if (<tagList>5__15 != null)
{
<>s__18 = <tagList>5__15.GetEnumerator();
try
{
while (<>s__18.MoveNext())
{
<tag>5__19 = <>s__18.Current;
<tags>5__14 = <tags>5__14 + <tag>5__19?.ToString() + ",";
<tag>5__19 = null;
}
}
finally
{
if (<>s__18 is IDisposable disposable)
{
disposable.Dispose();
}
}
<>s__18 = null;
if (<tags>5__14.EndsWith(","))
{
<tags>5__14 = <tags>5__14.Substring(0, <tags>5__14.Length - 1);
}
}
<uniqueId>5__16 = MakeUnique(<id>5__12, <assets>5__1.Keys.ToList());
<uniquePrefab>5__17 = MakeUnique(<name>5__8, <assets>5__1.Values.Select((AssetInfo a) => a.name).ToList());
Dictionary<string, AssetInfo> dictionary = <assets>5__1;
string key = <uniqueId>5__16;
AssetInfo val = new AssetInfo();
val.provider = "COREASSETS";
val.pack = (<packNames>5__2.ContainsKey(<dataPackId>5__13.ToString()) ? <packNames>5__2[<dataPackId>5__13.ToString()] : "CORE");
val.prefab = <uniquePrefab>5__17;
val.filename = <id>5__12;
val.kind = <kind>5__9;
val.category = <kind>5__9;
val.header = <header>5__11;
val.name = ToSpaceBasedCamelCase(<name>5__8);
val.description = f_Description.GetValue(<entry>5__7).ToString();
val.author = "BouncyRock";
val.groupName = ToSpaceBasedCamelCase(<groupName>5__10);
val.comment = <dataPackId>5__13.ToString() + "," + f_SourceLocalPackId.GetValue(<dataPackId>5__13).ToString() + "," + f_PackSource.GetValue(<dataPackId>5__13).ToString();
val.tags = <tags>5__14;
val.hasAnimations = false;
val.hasAudio = false;
val.hasBlendshapes = false;
dictionary.Add(key, val);
<dataPackId>5__13 = null;
<tags>5__14 = null;
<tagList>5__15 = null;
<uniqueId>5__16 = null;
<uniquePrefab>5__17 = null;
}
else
{
LoggingPlugin.LogInfo("Null AssetDB Entry");
}
goto IL_0867;
}
IL_088c:
<entry>5__7 = null;
goto IL_0894;
IL_00e0:
LoggingPlugin.LogInfo("Packing Asset Results");
_self.notification = "Registering... [Provider: COREASSETS]";
<>2__current = (object)new WaitForEndOfFrame();
<>1__state = 2;
return true;
IL_0894:
if (<>s__6.MoveNext())
{
<entry>5__7 = <>s__6.Current;
if ((uint)f_Kind.GetValue(<entry>5__7) == 4 || (uint)f_Kind.GetValue(<entry>5__7) == 2)
{
LoggingPlugin.LogDebug("Adding Asset: Group='" + ToSpaceBasedCamelCase(f_GroupName.GetValue(<entry>5__7).ToString()) + "' Name='" + ToSpaceBasedCamelCase(f_Name.GetValue(<entry>5__7).ToString()) + "'");
<name>5__8 = f_Name.GetValue(<entry>5__7).ToString();
<kind>5__9 = f_Kind.GetValue(<entry>5__7).ToString();
<groupName>5__10 = f_GroupName.GetValue(<entry>5__7).ToString();
<header>5__11 = "";
if (<groupName>5__10.ToUpper() == "COMMUNITY")
{
<header>5__11 = "[MOD.IO]";
<groupName>5__10 = "All Assets";
}
if (<groupName>5__10.ToUpper() == "LOCAL")
{
<header>5__11 = "[LOCAL]";
<groupName>5__10 = "All Assets";
}
_self.notification = "Registering... [Provider: COREASSETS, Group: " + <groupName>5__10 + ", Name: " + <name>5__8 + "]";
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 3;
return true;
}
goto IL_088c;
}
<>m__Finally1();
<>s__6 = default(List<object>.Enumerator);
LoggingPlugin.LogInfo("Posting Asset Results");
_self.notification = null;
((MonoBehaviour)_self).StartCoroutine(_callback((from kvp in <assets>5__1
orderby kvp.Value.header, kvp.Value.category, kvp.Value.name
select kvp).ToDictionary((KeyValuePair<string, AssetInfo> kvp) => kvp.Key, (KeyValuePair<string, AssetInfo> kvp) => kvp.Value), "CoreAssets"));
return false;
IL_00b4:
if (_db.Count == 0)
{
LoggingPlugin.LogInfo("Waited " + _counter + " Seconds");
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
return true;
}
goto IL_00e0;
IL_0867:
<id>5__12 = null;
goto IL_086f;
IL_086f:
<name>5__8 = null;
<kind>5__9 = null;
<groupName>5__10 = null;
<header>5__11 = null;
goto IL_088c;
}
}
catch
{
//try-fault
((IDisposable)this).Dispose();
throw;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
private void <>m__Finally1()
{
<>1__state = -1;
((IDisposable)<>s__6).Dispose();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public static int _counter = 5;
public static List<object> _db = new List<object>();
private static Func<Dictionary<string, AssetInfo>, string, IEnumerator> _callback = null;
[IteratorStateMachine(typeof(<GetNewAssets>d__4))]
public static IEnumerator GetNewAssets(ReadOnlyDictionary<string, AssetInfo> existingAssets, Func<Dictionary<string, AssetInfo>, string, IEnumerator> callback)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <GetNewAssets>d__4(0)
{
existingAssets = existingAssets,
callback = callback
};
}
[IteratorStateMachine(typeof(<SendCollectedAssetList>d__5))]
private static IEnumerator SendCollectedAssetList(ReadOnlyDictionary<string, AssetInfo> existingAssets)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SendCollectedAssetList>d__5(0)
{
existingAssets = existingAssets
};
}
public static void SpawnNewAsset(AssetInfo info)
{
LoggingPlugin.LogInfo("Spawning " + ((object)info)?.ToString() + " Based On Stored Guid " + info.prefab);
LoggingPlugin.LogInfo("Closing CCM");
CommonCustomsMenuPlugin._self.Close();
try
{
LoggingPlugin.LogInfo("Getting DM Entry");
object obj = _db.Where((object entry) => GetId(entry) == info.filename).First();
LoggingPlugin.LogInfo((obj != null) ? obj.ToString() : "Null");
LoggingPlugin.LogInfo("Getting InternedContentAddress");
object value = Reflection.Field(Reflection.Type("DbEntry", (string[])null, (string[])null, 0), "DataAddress", (string)null).GetValue(obj);
LoggingPlugin.LogInfo("Getting CreatureDataV4");
object obj2 = Reflection.New(Reflection.Type("CreatureDataV4", (string[])null, (string[])null, 0), new object[1] { value });
LoggingPlugin.LogInfo("Switching To Creature Place Tool");
Reflection.Execute(Reflection.Method(Reflection.Type("CreatureSpawnerBoardTool", (string[])null, (string[])null, 0), "SwitchCreatureTool", (string[])null), (object)null, new object[3] { obj2, false, false }, 0);
}
catch (Exception ex)
{
LoggingPlugin.LogWarning("Unable to find " + info.prefab + " in core assets database");
LoggingPlugin.LogWarning("Details: " + ex.Message);
}
}
public static string GetId(object entry)
{
return p_DataPackId.GetValue(entry).ToString().Replace(":", "") + "-+-" + f_DataAddress.GetValue(entry).ToString().Replace(":", "");
}
public static string ToSpaceBasedCamelCase(string raw)
{
raw = ((raw == null || raw.Trim() == "") ? "content" : raw.ToLower());
string text = raw.Substring(0, 1).ToUpper();
if (raw.Length > 1)
{
for (int i = 1; i < raw.Length; i++)
{
text = ((!(raw.Substring(i - 1, 1) == " ")) ? (text + raw.Substring(i, 1)) : (text + raw.Substring(i, 1).ToUpper()));
}
}
return text;
}
private static Dictionary<string, ContentData> GetCoreAssets()
{
Dictionary<string, ContentData> dictionary = new Dictionary<string, ContentData>();
string[] directories = Directory.GetDirectories(Paths.GameRootPath + "/TaleWeaver/");
foreach (string text in directories)
{
if (text.Contains("-"))
{
string text2 = File.ReadAllText(text + "/index.json", (CacheType)999);
ContentData value = JsonConvert.DeserializeObject<ContentData>(text2);
dictionary.Add(text, value);
}
}
return dictionary;
}
public static string MakeUnique(string entry, List<string> takenEntries)
{
string text = entry;
int num = 0;
while (takenEntries.Contains(text))
{
if (text.IndexOf(".") > -1)
{
text = text.Substring(0, text.LastIndexOf("."));
}
num++;
text = text + "." + num.ToString("00");
}
return text;
}
}
public static class Utility
{
private static PropertyInfo isLoadingProp;
private static PropertyInfo inBoardProp;
public static bool isBoardLoaded()
{
try
{
if (inBoardProp == null)
{
inBoardProp = Reflection.Property(_BoardSessionManager, "InBoard", (string)null);
}
if (isLoadingProp == null)
{
isLoadingProp = Reflection.Property(_BoardSessionManager, "IsLoading", (string)null);
}
bool flag = false;
try
{
flag = (bool)inBoardProp.GetValue(null);
}
catch
{
}
bool flag2 = false;
try
{
flag2 = (bool)isLoadingProp.GetValue(null);
}
catch
{
}
return flag && !flag2;
}
catch (Exception ex)
{
Reflection.CatchFullError(ex);
return false;
}
}
public static float ParseFloat(string value)
{
return float.Parse(value, CultureInfo.InvariantCulture);
}
}
[CompilerGenerated]
private sealed class <GetAssetDBEntries>d__37 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
private object <assetDb>5__1;
private object <blist>5__2;
private int <blistCount>5__3;
private IEnumerable <enumerable>5__4;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <GetAssetDBEntries>d__37(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<assetDb>5__1 = null;
<blist>5__2 = null;
<enumerable>5__4 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Expected O, but got Unknown
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
<blist>5__2 = null;
goto IL_0190;
case 2:
{
<>1__state = -1;
goto IL_0190;
}
IL_0190:
<assetDb>5__1 = null;
break;
}
<assetDb>5__1 = null;
try
{
<assetDb>5__1 = Reflection.Property(_SimpleSingletonBehaviourAssetDb, "Instance", (string)null).GetValue(null);
}
catch
{
}
if (<assetDb>5__1 != null)
{
<blist>5__2 = f_dbEntriesList.GetValue(<assetDb>5__1);
<blistCount>5__3 = (int)Reflection.Property(<blist>5__2.GetType(), "Length", (string)null).GetValue(<blist>5__2);
if (<blistCount>5__3 > 0)
{
<enumerable>5__4 = <blist>5__2 as IEnumerable;
if (<enumerable>5__4 != null)
{
LoggingPlugin.LogDebug("Found " + <blistCount>5__3 + " Core Assets");
Provider._db.AddRange(<enumerable>5__4.Cast<object>());
}
else
{
LoggingPlugin.LogDebug("Blist is not enumerable");
}
return false;
}
LoggingPlugin.LogDebug("AssetDB Is Empty");
<>2__current = (object)new WaitForSeconds(10f);
<>1__state = 1;
return true;
}
LoggingPlugin.LogDebug("unable To Get AssetDB Instance");
<>2__current = (object)new WaitForSeconds(10f);
<>1__state = 2;
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();
}
}
[CompilerGenerated]
private sealed class <WarnAboutLogLevel>d__39 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public CoreAssetsPlugin <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <WarnAboutLogLevel>d__39(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: 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
{
MethodInfo displayInfoText = m_DisplayInfoText;
object[] array = new object[5];
DiagnosticLevel logLevel = LoggingPlugin.GetLogLevel();
array[0] = "Core Assets Plugin: Using '" + ((object)(DiagnosticLevel)(ref logLevel)).ToString() + "' diagnostics.\r\nUse 'Info' for better performance";
array[1] = 10;
array[2] = Type.Missing;
array[3] = Type.Missing;
array[4] = Type.Missing;
Reflection.Execute(displayInfoText, (object)null, array, 0);
Reflection.Execute(m_DisplayInfoText, (object)null, new object[5]
{
"Core Assets Plugin: Use 'Debug' or 'Trace' for\r\ntroubleshooting only.",
10,
Type.Missing,
Type.Missing,
Type.Missing
}, 0);
}
catch
{
goto IL_00c8;
}
return false;
IL_00c8:
<>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 static Type _AssetDb = Reflection.Type("AssetDb", (string[])null, (string[])null, 0);
public static Type _BoardSessionManager = Reflection.Type("BoardSessionManager", (string[])null, (string[])null, 0);
public static Type _DataPackId = Reflection.Type("InternedPackId", (string[])null, (string[])null, 0);
public static Type _DbEntry = Reflection.Type("DbEntry", (string[])null, (string[])null, 0);
public static Type _RegisteredPackInfo = Reflection.Type("RegisteredPackInfo", (string[])null, (string[])null, 0);
public static Type _SimpleSingletonBehaviourAssetDb = Reflection.ClosedType("SimpleSingletonBehaviour`1", "AssetDb", (string[])null, (string[])null);
public static Type _SystemMessage = Reflection.Type("SystemMessage", (string[])null, (string[])null, 0);
public static MethodInfo m_DisplayInfoText = Reflection.Method(_SystemMessage, "DisplayInfoText", (string[])null);
public static MethodInfo m_GetRegisteredPackInfo = Reflection.Method(_AssetDb, "GetRegisteredPackInfo", (string[])null);
public static PropertyInfo p_DataPackId = Reflection.Property(_DbEntry, "DataPackId", (string)null);
public static FieldInfo f_DataAddress = Reflection.Field(_DbEntry, "DataAddress", (string)null);
public static FieldInfo f_Description = Reflection.Field(_DbEntry, "Description", (string)null);
public static FieldInfo f_dbEntriesList = Reflection.Field(_AssetDb, "_dbEntriesList", (string)null);
public static FieldInfo f_GroupName = Reflection.Field(_DbEntry, "GroupName", (string)null);
public static FieldInfo f_Kind = Reflection.Field(_DbEntry, "Kind", (string)null);
public static FieldInfo f_Name = Reflection.Field(_DbEntry, "Name", (string)null);
public static FieldInfo f_OptionalName = Reflection.Field(_RegisteredPackInfo, "OptionalName", (string)null);
public static FieldInfo f_PackId = Reflection.Field(_RegisteredPackInfo, "PackId", (string)null);
public static FieldInfo f_PackSource = Reflection.Field(_DataPackId, "PackSource", (string)null);
public static FieldInfo f_SourceLocalPackId = Reflection.Field(_DataPackId, "SourceLocalPackId", (string)null);
public static FieldInfo f_Tags = Reflection.Field(_DbEntry, "Tags", (string)null);
public const string Name = "Core Assets Plugin";
public const string Guid = "org.lordashes.plugins.coreassets.ccm";
public const string Version = "2.0.0.0";
public const string Author = "Lord Ashes";
public static CoreAssetsPlugin _self = null;
private string notification = null;
public byte[] defaultIcon = ImageConversion.EncodeToPNG(Image.LoadTexture("org.lordashes.plugins.coreassets.ccm.Default.png", (CacheType)999));
public string cacheFolder = CommonCustomsMenuPlugin.GetCacheFolder();
public static ConfigEntry<bool> registerNewConfig;
public static bool registerNew = true;
private Rect registrationMessagePos = Rect.zero;
private GUIStyle registrationMessageStyle = new GUIStyle();
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_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: 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();
LoggingPlugin.LogInfo(assemblyQualifiedName + ": Active. (Diagnostic Mode = " + ((object)(DiagnosticLevel)(ref logLevel)).ToString() + ")");
registerNewConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Register Missing Core Assets", true, (ConfigDescription)null);
registerNew = registerNewConfig.Value;
registerNewConfig.Value = false;
((BaseUnityPlugin)this).Config.Save();
string text = CommonCustomsMenuPlugin.RegisterProviderV2("COREASSETS", "Core Talespire minis", "2.0.0.0", (Func<ReadOnlyDictionary<string, AssetInfo>, Func<Dictionary<string, AssetInfo>, string, IEnumerator>, IEnumerator>)Provider.GetNewAssets, (Action<AssetInfo>)Provider.SpawnNewAsset);
string[] array = text.Split(new char[1] { ',' });
LoggingPlugin.LogDebug("Setting Registration Content");
registrationMessagePos = new Rect((float)int.Parse(array[0]), (float)int.Parse(array[1]), (float)(Screen.width - int.Parse(array[0])), (float)(Screen.height - int.Parse(array[1])));
registrationMessageStyle.fontSize = int.Parse(array[2]);
registrationMessageStyle.fontStyle = (FontStyle)1;
registrationMessageStyle.active.textColor = Color.white;
registrationMessageStyle.normal.textColor = Color.white;
ConstructorInfo constructorInfo = AccessTools.Constructor(_AssetDb, Type.EmptyTypes, false);
if (constructorInfo == null)
{
throw new Exception("AssetDb constructor not found");
}
new Harmony("org.lordashes.plugins.coreassets.ccm").Patch((MethodBase)constructorInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(CoreAssetsPlugin).GetMethod("Postfix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
ModdingUtils.AddPluginToMenuList((BaseUnityPlugin)(object)this, "Lord Ashes'");
}
public static void Postfix(object __instance)
{
LoggingPlugin.LogDebug("Starting Seek Of AssetDb Items");
((MonoBehaviour)_self).StartCoroutine(GetAssetDBEntries());
}
[IteratorStateMachine(typeof(<GetAssetDBEntries>d__37))]
private static IEnumerator GetAssetDBEntries()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <GetAssetDBEntries>d__37(0);
}
private void OnGUI()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
if (notification != null)
{
GUI.Label(registrationMessagePos, notification, registrationMessageStyle);
}
}
[IteratorStateMachine(typeof(<WarnAboutLogLevel>d__39))]
private IEnumerator WarnAboutLogLevel()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <WarnAboutLogLevel>d__39(0)
{
<>4__this = this
};
}
}