Decompiled source of Custom Assets Library Plugin v3.5.5
CustomAssetDTO.dll
Decompiled a year agousing System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using Bounce.BlobAssets; using Bounce.TaleSpire.AssetManagement; using Bounce.Unmanaged; using CustomAssetDTO.Sentry; using CustomAssetsKind.DTO; using Newtonsoft.Json; using Spaghet.Compiler; using Spaghet.Runtime; using Unity.Collections; using Unity.Entities; using Unity.Mathematics; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("CustomAssetDTO")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("TaleSpire Modding Community")] [assembly: AssemblyProduct("CustomAssetDTO")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4e4deb5e-97f9-4901-bf67-6748a9c1229a")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.0.0")] [module: UnverifiableCode] namespace CustomAssetDTO.Sentry { public static class Utilities { internal const string Version = "1.2.0.0"; public static JsonSerializerSettings options = new JsonSerializerSettings { Culture = CultureInfo.InvariantCulture }; } } namespace CustomAssetDTO.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { resourceMan = new ResourceManager("CustomAssetDTO.Properties.Resources", typeof(Resources).Assembly); } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal Resources() { } } } namespace CustomAssetsKind.DTO { public sealed class CustomKinds { public string Kind; public string Catagory; public List<CustomData> Entries = new List<CustomData>(); } public sealed class CustomData { public NGuid Id; public string Name; public string Description; public string Group; public DbGroupTag GroupTag; public List<string> Tags; public bool IsGmOnly; public bool IsDeprecated; public AssetLoaderData ModelAsset; public (int, Rect) iconInfo; public string OtherSerializedData; public void ToBRCustomData(BlobBuilder builder, ref Bounce.TaleSpire.AssetManagement.CustomData output) { } } } namespace Bounce.TaleSpire.AssetManagement { public struct CustomKinds { public BlobString Kind; public BlobString Catagory; public BlobArray<CustomData> Entries; } public struct CustomData { public BoardObjectGuid Id; public BlobString Name; public BlobString Description; public BlobString Group; public BlobPtr<Packed> GroupTag; public BlobArray<BlobString> Tags; public bool IsGmOnly; public bool IsDeprecated; public BlobPtr<Packed> ModelAsset; public int IconAtlasIndex; public Rect IconAtlasRegion; public BlobString OtherSerializedData; } public struct CustomPackIndex { public BlobString Name; public BlobArray<CustomKinds> Kinds; public BlobArray<Atlas> Atlases; } } namespace CustomAssetsCompiler.CoreDTO { public sealed class AssetPackContent { public string Name = "Medieval Fantasy"; public List<PlaceableData> Placeable = new List<PlaceableData>(); public List<CreatureData> Creatures = new List<CreatureData>(); public List<Atlas> Atlases = new List<Atlas>(); public List<MusicData> Music = new List<MusicData>(); public List<CustomAssetsKind.DTO.CustomKinds> Custom = new List<CustomAssetsKind.DTO.CustomKinds>(); public string assetPackString; public BlobAssetReference<ContentPackIndexV2> GenerateBlobAssetReference() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) BlobBuilder builder = new BlobBuilder((Allocator)2, 65536); ref ContentPackIndexV2 reference = ref ((BlobBuilder)(ref builder)).ConstructRoot<ContentPackIndexV2>(); BlobBuilderArray<CreatureData> val = ((BlobBuilder)(ref builder)).Allocate<CreatureData>(ref reference.Creatures, Creatures.Count); for (int i = 0; i < val.Length; i++) { Creatures[i].ToBRCreatureData(builder, ref val[i]); } ((BlobBuilder)(ref builder)).Allocate<PlaceableData>(ref reference.Placeables, Placeable.Count); BlobBuilderArray<Atlas> val2 = ((BlobBuilder)(ref builder)).Allocate<Atlas>(ref reference.PlaceableAtlases, Atlases.Count); for (int j = 0; j < val2.Length; j++) { Atlases[j].ToBRAtlasData(builder, ref val2[j]); } ((BlobBuilder)(ref builder)).Construct<MusicData>(ref reference.Music, Music.Select((MusicData c) => c.ToBRMusic(builder)).ToArray()); BlobStringExtensions.AllocateString(ref builder, ref reference.Name, Name); BlobAssetReference<ContentPackIndexV2> result = ((BlobBuilder)(ref builder)).CreateBlobAssetReference<ContentPackIndexV2>((Allocator)4); ((BlobBuilder)(ref builder)).Dispose(); return result; } public BlobAssetReference<CustomPackIndex> GenerateCustomBlobAssetReference() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) BlobBuilder val = default(BlobBuilder); ((BlobBuilder)(ref val))..ctor((Allocator)2, 65536); _ = ref ((BlobBuilder)(ref val)).ConstructRoot<CustomPackIndex>(); BlobAssetReference<CustomPackIndex> result = ((BlobBuilder)(ref val)).CreateBlobAssetReference<CustomPackIndex>((Allocator)4); ((BlobBuilder)(ref val)).Dispose(); return result; } public void FromJson(string path) { CustomAssetsPlugin.Data.Index index = JsonConvert.DeserializeObject<CustomAssetsPlugin.Data.Index>(File.ReadAllText(Path.Combine(path, "index.json")), Utilities.options); if (string.IsNullOrWhiteSpace(index.Name)) { index.Name = "Medieval Fantasy"; } LoadFromIndex(index); } internal static float3 VectorFromList(List<float> data) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) return new float3((data.Count > 0) ? data[0] : 0f, (data.Count > 1) ? data[1] : 0f, (data.Count > 2) ? data[2] : 0f); } internal static quaternion RotationFromList(List<float> data) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) return new quaternion((data.Count > 0) ? data[0] : 0f, (data.Count > 1) ? data[1] : 0f, (data.Count > 2) ? data[2] : 0f, (data.Count > 3) ? data[3] : 0f); } public void LoadFromIndex(CustomAssetsPlugin.Data.Index index) { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_0174: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Expected O, but got Unknown //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Expected O, but got Unknown //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Expected O, but got Unknown //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_05ec: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_05f7: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: Unknown result type (might be due to invalid IL or missing references) //IL_0637: Unknown result type (might be due to invalid IL or missing references) //IL_063c: Unknown result type (might be due to invalid IL or missing references) //IL_0643: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Expected O, but got Unknown //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_0524: Unknown result type (might be due to invalid IL or missing references) //IL_0529: Unknown result type (might be due to invalid IL or missing references) //IL_0537: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_054f: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_0673: Expected O, but got Unknown //IL_0695: Unknown result type (might be due to invalid IL or missing references) //IL_069a: Unknown result type (might be due to invalid IL or missing references) //IL_06a7: Unknown result type (might be due to invalid IL or missing references) //IL_06ac: Unknown result type (might be due to invalid IL or missing references) //IL_06b9: Unknown result type (might be due to invalid IL or missing references) //IL_06be: Unknown result type (might be due to invalid IL or missing references) //IL_06cb: Unknown result type (might be due to invalid IL or missing references) //IL_06d0: Unknown result type (might be due to invalid IL or missing references) //IL_06e5: Unknown result type (might be due to invalid IL or missing references) //IL_06f4: Unknown result type (might be due to invalid IL or missing references) //IL_06f9: Unknown result type (might be due to invalid IL or missing references) //IL_0704: Unknown result type (might be due to invalid IL or missing references) //IL_071a: Unknown result type (might be due to invalid IL or missing references) //IL_0729: Unknown result type (might be due to invalid IL or missing references) //IL_072e: Unknown result type (might be due to invalid IL or missing references) //IL_0757: Unknown result type (might be due to invalid IL or missing references) //IL_0783: Unknown result type (might be due to invalid IL or missing references) //IL_0788: Unknown result type (might be due to invalid IL or missing references) //IL_0794: Unknown result type (might be due to invalid IL or missing references) //IL_07ab: Unknown result type (might be due to invalid IL or missing references) //IL_07b8: Unknown result type (might be due to invalid IL or missing references) //IL_07bd: Unknown result type (might be due to invalid IL or missing references) //IL_07c2: Unknown result type (might be due to invalid IL or missing references) //IL_07c7: Unknown result type (might be due to invalid IL or missing references) //IL_07d4: Unknown result type (might be due to invalid IL or missing references) //IL_07d9: Unknown result type (might be due to invalid IL or missing references) //IL_07de: Unknown result type (might be due to invalid IL or missing references) //IL_07e3: Unknown result type (might be due to invalid IL or missing references) //IL_07fa: Unknown result type (might be due to invalid IL or missing references) //IL_0807: Unknown result type (might be due to invalid IL or missing references) //IL_080c: Unknown result type (might be due to invalid IL or missing references) //IL_0811: Unknown result type (might be due to invalid IL or missing references) //IL_081b: Expected O, but got Unknown //IL_082b: Unknown result type (might be due to invalid IL or missing references) //IL_0830: Unknown result type (might be due to invalid IL or missing references) //IL_083c: Unknown result type (might be due to invalid IL or missing references) //IL_0853: Unknown result type (might be due to invalid IL or missing references) //IL_0860: Unknown result type (might be due to invalid IL or missing references) //IL_0865: Unknown result type (might be due to invalid IL or missing references) //IL_086a: Unknown result type (might be due to invalid IL or missing references) //IL_086f: Unknown result type (might be due to invalid IL or missing references) //IL_087c: Unknown result type (might be due to invalid IL or missing references) //IL_0881: Unknown result type (might be due to invalid IL or missing references) //IL_0886: Unknown result type (might be due to invalid IL or missing references) //IL_088b: Unknown result type (might be due to invalid IL or missing references) //IL_08a2: Unknown result type (might be due to invalid IL or missing references) //IL_08af: Unknown result type (might be due to invalid IL or missing references) //IL_08b4: Unknown result type (might be due to invalid IL or missing references) //IL_08b9: Unknown result type (might be due to invalid IL or missing references) //IL_08c3: Expected O, but got Unknown //IL_0957: Unknown result type (might be due to invalid IL or missing references) //IL_0961: Expected O, but got Unknown assetPackString = index.assetPackId; NGuid assetPackId = default(NGuid); ((NGuid)(ref assetPackId))..ctor(index.assetPackId); Name = index.Name; for (int i = 0; i < index.IconsAtlas.Count; i++) { CustomAssetsPlugin.Data.IconsAtlasesType iconsAtlasesType = index.IconsAtlas[i]; Atlas atlas = new Atlas(); atlas.SizeX = iconsAtlasesType.Width; atlas.SizeY = iconsAtlasesType.Height; atlas.LocalPath = iconsAtlasesType.Path; Atlases.Add(atlas); } foreach (CustomAssetsPlugin.Data.MusicType item in index.Music) { MusicData musicData = new MusicData(); musicData.Id = new NGuid(item.Id); musicData.name = item.Name; musicData.assetName = item.Assets.AssetName; musicData.bundleId = item.Assets.BundleId; musicData.assetPackId = assetPackId; musicData.description = item.Name; musicData.kind = (MusicKind)0; musicData.tags = item.Tags; Music.Add(musicData); } foreach (CustomAssetsPlugin.Data.TileAndPropsType tile in index.Tiles) { PlaceableData placeableData = new PlaceableData(); placeableData.Id = new NGuid(tile.Id); placeableData.assetPackId = assetPackId; placeableData.IsDeprecated = tile.IsDeprecated; placeableData.Description = tile.Name; placeableData.Name = tile.Name; placeableData.Group = tile.GroupTag; placeableData.GroupTag = new DbGroupTag(); placeableData.GroupTag.Order = 0; placeableData.GroupTag.Name = ((tile.Tags.Count > 0) ? tile.Tags[0] : tile.GroupTag); placeableData.Tags = tile.Tags; placeableData.IconAtlasIndex = tile.Icon.AtlasIndex; placeableData.IconAtlasRegion = tile.Icon.Region.ToRegion(); placeableData.IsGmOnly = false; placeableData.Kind = (PlaceableKind)1; placeableData.OrientationOffset = 0; placeableData.TotalVisualBounds = tile.ColliderBoundsBound.ToBounds(); placeableData.ColliderBoundsBound = tile.ColliderBoundsBound.ToBounds(); placeableData.Colliders = new List<Bounds> { tile.ColliderBoundsBound.ToBounds() }; foreach (CustomAssetsPlugin.Data.AssetType asset in tile.Assets) { AssetLoaderData val = new AssetLoaderData { optionalAssetPackIdStr = index.assetPackId }; val.assetName = asset.LoaderData.AssetName; val.position = float3.op_Implicit(VectorFromList(asset.Position)); val.scale = float3.op_Implicit(VectorFromList(asset.Scale)); val.rotation = quaternion.op_Implicit(RotationFromList(asset.Rotation)); val.path = asset.LoaderData.BundleId; placeableData.Assets.Add(val); } Placeable.Add(placeableData); } foreach (CustomAssetsPlugin.Data.TileAndPropsType prop in index.Props) { PlaceableData placeableData2 = new PlaceableData(); placeableData2.Id = new NGuid(prop.Id); placeableData2.assetPackId = assetPackId; placeableData2.IsDeprecated = prop.IsDeprecated; placeableData2.Description = prop.Name; placeableData2.Name = prop.Name; placeableData2.Group = prop.GroupTag; placeableData2.GroupTag = new DbGroupTag(); placeableData2.GroupTag.Order = 0; placeableData2.GroupTag.Name = ((prop.Tags.Count > 0) ? prop.Tags[0] : prop.GroupTag); placeableData2.Tags = prop.Tags; placeableData2.IconAtlasIndex = prop.Icon.AtlasIndex; placeableData2.IconAtlasRegion = prop.Icon.Region.ToRegion(); placeableData2.IsGmOnly = false; placeableData2.Kind = (PlaceableKind)2; placeableData2.OrientationOffset = 0; placeableData2.TotalVisualBounds = prop.ColliderBoundsBound.ToBounds(); placeableData2.ColliderBoundsBound = prop.ColliderBoundsBound.ToBounds(); placeableData2.Colliders = new List<Bounds> { prop.ColliderBoundsBound.ToBounds() }; foreach (CustomAssetsPlugin.Data.AssetType asset2 in prop.Assets) { AssetLoaderData val2 = new AssetLoaderData { optionalAssetPackIdStr = index.assetPackId }; val2.assetName = asset2.LoaderData.AssetName; val2.position = float3.op_Implicit(VectorFromList(asset2.Position)); val2.scale = float3.op_Implicit(VectorFromList(asset2.Scale)); val2.rotation = quaternion.op_Implicit(RotationFromList(asset2.Rotation)); val2.path = asset2.LoaderData.BundleId; placeableData2.Assets.Add(val2); } Placeable.Add(placeableData2); } foreach (CustomAssetsPlugin.Data.CreatureType creature in index.Creatures) { CreatureData creatureData = new CreatureData { id = new NGuid(creature.Id), assetPackId = assetPackId, defaultScale = creature.DefaultScale, isDeprecated = creature.IsDeprecated, isGmOnly = false, group = creature.GroupTag, baseRadius = 0.5f, dbGroupTag = new DbGroupTag { Order = 0, Name = ((creature.Tags.Count > 0) ? creature.Tags[0] : creature.GroupTag) }, name = creature.Name, description = creature.Name, spellPos = VectorFromList(creature.SpellPos), headPos = VectorFromList(creature.HeadPos), hitPos = VectorFromList(creature.HitPos), torchPos = VectorFromList(creature.TorchPos), baseCylinderBounds = new CreatureCylinderBounds(new float3(0f, 0f, 0f), 1f, 0.5f), creatureBounds = default(Bounds), modelCylinderBounds = new CreatureCylinderBounds(new float3(0f, 0f, 0f), 1f, 0.5f), height = 1f, iconInfo = (creature.Icon.AtlasIndex, creature.Icon.Region.ToRegion()), tags = creature.Tags }; if (creature.BaseAsset != null) { creatureData.baseLoaderData = new AssetLoaderData { optionalAssetPackIdStr = index.assetPackId, assetName = creature.BaseAsset.LoaderData.AssetName, position = float3.op_Implicit(VectorFromList(creature.BaseAsset.Position)), scale = float3.op_Implicit(VectorFromList(creature.BaseAsset.Scale)), path = creature.BaseAsset.LoaderData.BundleId, rotation = quaternion.op_Implicit(RotationFromList(creature.BaseAsset.Rotation)) }; } else { creatureData.baseLoaderData = CreatureData.DefaultBase; } creatureData.modelLoaderData = new AssetLoaderData { optionalAssetPackIdStr = index.assetPackId, assetName = creature.MiniAsset.LoaderData.AssetName, position = float3.op_Implicit(VectorFromList(creature.MiniAsset.Position)), scale = float3.op_Implicit(VectorFromList(creature.MiniAsset.Scale)), path = creature.MiniAsset.LoaderData.BundleId, rotation = quaternion.op_Implicit(RotationFromList(creature.MiniAsset.Rotation)) }; Creatures.Add(creatureData); } foreach (CustomAssetsPlugin.Data.CustomKinds item2 in index.Custom) { CustomAssetsKind.DTO.CustomKinds customKinds = new CustomAssetsKind.DTO.CustomKinds(); customKinds.Kind = item2.Kind; customKinds.Catagory = item2.Catagory; customKinds.Entries = new List<CustomAssetsKind.DTO.CustomData>(); foreach (CustomAssetsPlugin.Data.CustomKind entry in item2.Entries) { _ = entry; CustomAssetsKind.DTO.CustomData customData = new CustomAssetsKind.DTO.CustomData(); customData.ModelAsset = new AssetLoaderData(); customKinds.Entries.Add(customData); } Custom.Add(customKinds); } } } public sealed class Atlas { public string LocalPath = ""; public int SizeX = 128; public int SizeY = 128; public BlobArray<Icon> Icons; internal Atlas ToBRAtlas(BlobBuilder builder) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) ref Atlas reference = ref ((BlobBuilder)(ref builder)).ConstructRoot<Atlas>(); BlobStringExtensions.AllocateString(ref builder, ref reference.LocalPath, LocalPath); reference.Size = new int2(SizeX, SizeY); return reference; } internal void ToBRAtlasData(BlobBuilder builder, ref Atlas atlas) { //IL_0035: 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) BlobStringExtensions.AllocateString(ref builder, ref atlas.LocalPath, LocalPath); atlas.Size.x = SizeX; atlas.Size.y = SizeY; BlobExtensions.ConstructFrom<Icon>(builder, ref atlas.Icons, ref Icons); } } public sealed class CreatureData { public static readonly AssetLoaderData NoBase = new AssetLoaderData { optionalAssetPackIdStr = "d71427a1-5535-4fa7-82d7-4ca1e75edbfd", path = "char_base01_1462710208", assetName = "clothBase", position = new Vector3(0f, 0f, 0f), scale = new Vector3(0f, 0f, 0f), rotation = new Quaternion(0f, -0.5735762f, 0f, 0.8191524f) }; public static readonly AssetLoaderData DefaultBase = new AssetLoaderData { optionalAssetPackIdStr = "d71427a1-5535-4fa7-82d7-4ca1e75edbfd", path = "char_base01_1462710208", assetName = "clothBase", position = new Vector3(0f, 0f, 0f), scale = new Vector3(0.6f, 0.6f, 0.6f), rotation = new Quaternion(0f, -0.5735762f, 0f, 0.8191524f) }; public NGuid assetPackId; public NGuid id; public bool isGmOnly; public bool isDeprecated; public string name = ""; public string description = ""; public string group = ""; public DbGroupTag dbGroupTag; public List<string> tags = new List<string>(); public AssetLoaderData baseLoaderData = DefaultBase; public AssetLoaderData modelLoaderData; public CreatureCylinderBounds baseCylinderBounds; public CreatureCylinderBounds modelCylinderBounds; public float3 headPos; public float3 torchPos; public float3 spellPos; public float3 hitPos; public float baseRadius; public float height; public float defaultScale; public Bounds creatureBounds; public (int, Rect) iconInfo; internal void ToBRCreatureData(BlobBuilder builder, ref CreatureData output) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) CreatureData.Construct(builder, ref output, assetPackId, new BoardObjectGuid(id), isGmOnly, isDeprecated, name, description, group, dbGroupTag, tags.ToArray(), baseLoaderData, modelLoaderData, baseCylinderBounds, modelCylinderBounds, headPos, torchPos, spellPos, hitPos, baseRadius, height, defaultScale, creatureBounds, iconInfo); } } public class CustomAssetsPlugin : BaseUnityPlugin { public static class Data { public sealed class LoaderDataType { public string BundleId { get; set; } = ""; public string AssetName { get; set; } = ""; } public sealed class AssetType { public LoaderDataType LoaderData { get; set; } public List<float> Position { get; set; } = new List<float>(); public List<float> Rotation { get; set; } = new List<float>(); public List<float> Scale { get; set; } = new List<float>(); } public sealed class BoundsType { public List<float> m_Center { get; set; } = new List<float>(); public List<float> m_Extent { get; set; } = new List<float>(); public Bounds ToBounds() { //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) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) return new Bounds(float3.op_Implicit(AssetPackContent.VectorFromList(m_Center)), float3.op_Implicit(AssetPackContent.VectorFromList(m_Extent))); } } public sealed class RegionType { public string serializedVersion { get; set; } = ""; public float x { get; set; } public float y { get; set; } public float width { get; set; } = 1f; public float height { get; set; } = 1f; public Rect ToRegion() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return new Rect(x, y, width, height); } } public sealed class IconType { public int AtlasIndex { get; set; } public RegionType Region { get; set; } } public sealed class TileAndPropsType { public string Id { get; set; } = ""; public string Name { get; set; } = ""; public bool IsDeprecated { get; set; } public string GroupTag { get; set; } = ""; public List<string> Tags { get; set; } = new List<string>(); public List<AssetType> Assets { get; set; } = new List<AssetType>(); public bool IsInteractable { get; set; } public BoundsType ColliderBoundsBound { get; set; } public IconType Icon { get; set; } } public sealed class CreatureType : ICloneable { public string Id { get; set; } = ""; public string Name { get; set; } = ""; public bool IsDeprecated { get; set; } public string GroupTag { get; set; } = ""; public List<string> Tags { get; set; } = new List<string>(); public AssetType MiniAsset { get; set; } public AssetType BaseAsset { get; set; } public float DefaultScale { get; set; } public IconType Icon { get; set; } public List<float> HeadPos { get; set; } = new List<float> { 0f, 1f, 0f }; public List<float> TorchPos { get; set; } = new List<float> { 0f, 1f, 0f }; public List<float> SpellPos { get; set; } = new List<float> { 0f, 1f, 0f }; public List<float> HitPos { get; set; } = new List<float> { 0f, 1f, 0f }; public object Clone() { return MemberwiseClone(); } } public sealed class MusicType { public string Id { get; set; } = ""; public string Name { get; set; } = ""; public bool IsDeprecated { get; set; } public string GroupTag { get; set; } = ""; public List<string> Tags { get; set; } = new List<string>(); public LoaderDataType Assets { get; set; } } public sealed class IconsAtlasesType { public int Width = 128; public int Height = 128; public string Path { get; set; } = ""; } public sealed class CustomKinds { public string Kind; public string Catagory; public List<CustomKind> Entries = new List<CustomKind>(); } public sealed class CustomKind { public string Id; public string Name; public string Description; public string Group; public string GroupTag; public List<string> Tags; public bool IsGmOnly; public bool IsDeprecated; public List<AssetType> Asset; public IconType Icon; public string OtherSerializedData; } public sealed class Index { public List<CustomKinds> Custom = new List<CustomKinds>(); public string assetPackId { get; set; } = ""; public string Name { get; set; } = "Medieval Fantasy"; public List<TileAndPropsType> Tiles { get; set; } = new List<TileAndPropsType>(); public List<TileAndPropsType> Props { get; set; } = new List<TileAndPropsType>(); public List<CreatureType> Creatures { get; set; } = new List<CreatureType>(); public List<MusicType> Music { get; set; } = new List<MusicType>(); public List<IconsAtlasesType> IconsAtlas { get; set; } = new List<IconsAtlasesType>(); } } } public sealed class MusicData { public NGuid assetPackId; public NGuid Id; public string name = ""; public string description = ""; public List<string> tags = new List<string>(); public string bundleId = ""; public string assetName = ""; public MusicKind kind; internal MusicData ToBRMusic(BlobBuilder builder) { //IL_0008: 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) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) ref MusicData reference = ref ((BlobBuilder)(ref builder)).ConstructRoot<MusicData>(); MusicData.Construct(builder, ref reference, assetPackId, Id, name, description, tags.ToArray(), bundleId, assetName, kind); return reference; } } public sealed class PlaceableData { public NGuid assetPackId; public NGuid Id; public string Name = ""; public string Description = ""; public string Group = ""; public DbGroupTag GroupTag; public List<string> Tags = new List<string>(); public PlaceableKind Kind = (PlaceableKind)2; public bool IsGmOnly; public bool IsDeprecated; public int OrientationOffset; public List<AssetLoaderData> Assets = new List<AssetLoaderData>(); public List<Bounds> Colliders = new List<Bounds>(); public Bounds ColliderBoundsBound; public Bounds TotalVisualBounds; public int IconAtlasIndex; public Rect IconAtlasRegion; internal void ToBRPlaceableData(BlobBuilder builder, ref PlaceableData placeable) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: 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_0193: Unknown result type (might be due to invalid IL or missing references) placeable.OrientationOffset = OrientationOffset; placeable.Id = new BoardObjectGuid(Id); placeable.IsGmOnly = IsGmOnly; placeable.IsDeprecated = IsDeprecated; BlobStringExtensions.AllocateString(ref builder, ref placeable.Name, Name); BlobStringExtensions.AllocateString(ref builder, ref placeable.Description, Description); BlobStringExtensions.AllocateString(ref builder, ref placeable.Group, Group); placeable.TotalVisualBounds = TotalVisualBounds; placeable.ColliderBoundsBound = ColliderBoundsBound; placeable.ColliderIndex = default(PlaceableCollidersIndex); BlobBuilderArray<Bounds> val = ((BlobBuilder)(ref builder)).Allocate<Bounds>(ref placeable.Colliders, Colliders.Count); for (int i = 0; i < Colliders.Count; i++) { val[i] = Colliders[i]; } if (Tags == null) { placeable.Tags = default(BlobArray<BlobString>); } else { BlobExtensions.ConstructStringArray(builder, ref placeable.Tags, (IReadOnlyList<string>)Tags.ToArray()); } BlobBuilderArray<Packed> val2 = ((BlobBuilder)(ref builder)).Allocate<Packed>(ref placeable.Assets, Assets.Count); for (int j = 0; j < Assets.Count; j++) { Assets[j].Pack(builder, assetPackId, ref val2[j]); } ((BlobBuilder)(ref builder)).Allocate<AssetScriptIndex>(ref placeable.StateMachineTargetScriptIndices, 0); ConstructEmptyScript(builder, ref placeable, anyAssetsHaveScripts: false); placeable.IconAtlasIndex = IconAtlasIndex; placeable.IconAtlasRegion = IconAtlasRegion; placeable.Kind = Kind; ref Packed reference = ref ((BlobBuilder)(ref builder)).Allocate<Packed>(ref placeable.GroupTag); BlobStringExtensions.AllocateString(ref builder, ref reference.Name, GroupTag.Name); reference.Order = GroupTag.Order; } private static void ConstructEmptyScript(BlobBuilder builder, ref PlaceableData placeable, bool anyAssetsHaveScripts) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) ref StateMachineScript reference = ref ((BlobBuilder)(ref builder)).Allocate<StateMachineScript>(ref placeable.StateMachineScript); if (anyAssetsHaveScripts) { CompileResults.ConstructRunAll(builder, ref reference.Compiled); } else { CompileResults.ConstructEmpty(builder, ref reference.Compiled); } ((BlobBuilder)(ref builder)).Allocate<Packed>(ref reference.Menus, 0); } } }
CustomAssetsCompiler.dll
Decompiled a year agousing System; using System.CodeDom.Compiler; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Cryptography; using System.Text; using Bounce.TaleSpire.AssetManagement; using Bounce.Unmanaged; using CustomAssetsCompiler.CoreDTO; using Newtonsoft.Json; using Unity.Entities; using Unity.Entities.Serialization; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("CustomAssetCompiler")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("TaleSpire Modding Community")] [assembly: AssemblyProduct("CustomAssetCompiler")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4e4deb5e-97f9-4901-bf67-6748a9c1229a")] [assembly: AssemblyFileVersion("1.0.3.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.3.0")] namespace CustomAssetsCompiler { public enum LogLevel { None, Low, Medium, High, All } public enum impl { Sync, Thread, Burst } public sealed class CustomAssetCompiler { public static void Generate(string directory, LogLevel logLevel = LogLevel.None) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown AssetPackContent val = new AssetPackContent(); val.FromJson(directory); if (logLevel > LogLevel.None) { Debug.Log((object)("Added " + Path.Combine(directory, "index"))); } WritePack(directory, val); } public static void WritePack(string directory, AssetPackContent content) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown BlobAssetReference<CustomPackIndex> val = content.GenerateCustomBlobAssetReference(); StreamBinaryWriter val2 = new StreamBinaryWriter(Path.Combine(directory, "customIndex"), 65536); StreamBinaryExtensions.WriteUnmanaged<ContentPackHeader>(val2, new ContentPackHeader(1u)); BlobAssetSerializeExtensions.Write<CustomPackIndex>((BinaryWriter)val2, val); } public static NGuid GenerateID(string id) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return new NGuid(Guid.Parse(CreateMD5(id))); } public static string CreateMD5(string input) { if (Guid.TryParse(input, out var _)) { return input; } using MD5 mD = MD5.Create(); byte[] bytes = Encoding.ASCII.GetBytes(input); byte[] array = mD.ComputeHash(bytes); StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < array.Length; i++) { stringBuilder.Append(array[i].ToString("X2")); } return stringBuilder.ToString(); } } public sealed class CustomPlaceableCompiler { public static void Generate(string directory, LogLevel logLevel = LogLevel.None) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown AssetPackContent val = new AssetPackContent(); val.FromJson(directory); if (logLevel > LogLevel.None) { Debug.Log((object)("Added " + Path.Combine(directory, "index"))); } WritePack(directory, val); } public static void WritePack(string directory, AssetPackContent content) { } public static NGuid GenerateID(string id) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return new NGuid(Guid.Parse(CreateMD5(id))); } public static string CreateMD5(string input) { if (Guid.TryParse(input, out var _)) { return input; } using MD5 mD = MD5.Create(); byte[] bytes = Encoding.ASCII.GetBytes(input); byte[] array = mD.ComputeHash(bytes); StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < array.Length; i++) { stringBuilder.Append(array[i].ToString("X2")); } return stringBuilder.ToString(); } } public sealed class TaleWeaverCompiler { public const string Version = "1.0.3.0"; public static void Generate(string directory, LogLevel logLevel = LogLevel.None) { WritePack(directory, logLevel); } public static void Generate(string directory, Index index, LogLevel logLevel = LogLevel.None) { WritePack(directory, index, logLevel); } private static void WritePack(string directory, LogLevel logLevel) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown AssetPackContent val = new AssetPackContent(); val.FromJson(directory); WritePack(directory, val, logLevel); } private static void WritePack(string directory, Index index, LogLevel logLevel = LogLevel.None) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown AssetPackContent val = new AssetPackContent(); val.LoadFromIndex(index); WritePack(directory, val, logLevel); } private static void WritePack(string directory, AssetPackContent content, LogLevel logLevel = LogLevel.None) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown if (logLevel > LogLevel.None) { Debug.Log((object)("Added " + Path.Combine(directory, "index"))); } BlobAssetReference<ContentPackIndexV2> val = content.GenerateBlobAssetReference(); StreamBinaryWriter val2 = new StreamBinaryWriter(Path.Combine(directory, "index"), 65536); StreamBinaryExtensions.WriteUnmanaged<ContentPackHeader>(val2, new ContentPackHeader(2u)); BlobAssetSerializeExtensions.Write<ContentPackIndexV2>((BinaryWriter)val2, val); val2.Dispose(); File.WriteAllText(Path.Combine(directory, "assetpack.id"), content.assetPackString + "," + content.Name); string contents = JsonConvert.SerializeObject((object)content.Creatures.Select((CreatureData c) => ((object)(NGuid)(ref c.id)).ToString()).ToArray()); File.WriteAllText(Path.Combine(directory, "zeus"), contents); } public static NGuid GenerateID(string id) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return new NGuid(Guid.Parse(CreateMD5(id))); } private static string CreateMD5(string input) { if (Guid.TryParse(input, out var _)) { return input; } using MD5 mD = MD5.Create(); byte[] bytes = Encoding.ASCII.GetBytes(input); byte[] array = mD.ComputeHash(bytes); StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < array.Length; i++) { stringBuilder.Append(array[i].ToString("X2")); } return stringBuilder.ToString(); } } } namespace CustomAssetsCompiler.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { resourceMan = new ResourceManager("CustomAssetsCompiler.Properties.Resources", typeof(Resources).Assembly); } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal Resources() { } } }
CustomAssetsLibraryPlugin.dll
Decompiled a year agousing System; using System.Collections.Generic; 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 System.Security.Cryptography; using System.Text; using BepInEx; using BepInEx.Configuration; using Bounce.Singletons; using CustomAssetsCompiler; using CustomAssetsCompiler.CoreDTO; using LordAshes; using Newtonsoft.Json; using TMPro; using Unity.Mathematics; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("CustomAssetsLibraryPlugin")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CustomAssetsLibraryPlugin")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("CustomAssetsLibraryPlugin")] [assembly: ComVisible(false)] [assembly: Guid("c303405d-e66c-4316-9cdb-4e3ca15c6360")] [assembly: AssemblyFileVersion("3.5.5.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("3.5.5.0")] namespace PluginMasters; [BepInPlugin("org.pluginmasters.plugins.customassetslibraryplugin", "Custom Assets Library Plugin", "3.5.5.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class CustomAssetsLibraryPlugin : BaseUnityPlugin { public static class Data { public class SlabInfo { public float3 position { get; set; } public string code { get; set; } = ""; } public class Locations { public readonly string root = "0.0,0.0,0.0,0.0,0.0,0.0"; public string head { get; set; } = "0.0,0.7,0.0,0.0,0.0,0.0"; public string hit { get; set; } = "0.0,0.5,0.0,0.0,0.0,0.0"; public string spell { get; set; } = "0.0,0.5,0.0,0.0,0.0,0.0"; public string torch { get; set; } = "0.0,0.5,0.0,0.0,0.0,0.0"; public string handRight { get; set; } = "0.3,1.25,0.0,0.0,0.0,0.0"; public string handLeft { get; set; } = "-0.3,1.25,0.0,0.0,0.0,0.0"; } public class Collider { public string center { get; set; } = "0.5,0.5,0.5"; public string extent { get; set; } = "0.5,0.5,0.5"; } public class MeshAdjustments { public string size { get; set; } = "1.0,1.0,1.0"; public string rotationOffset { get; set; } = "0.0,0.0,0.0"; public string positionOffset { get; set; } = "0.0,0.0,0.0"; } public class LinkRequest { public string key { get; set; } = ""; public string value { get; set; } = ""; public bool legacy { get; set; } = true; } public class AssetInfo { public string id { get; set; } = ""; public string name { get; set; } = ""; public string prefab { get; set; } = ""; public string kind { get; set; } = "Creature"; public string category { get; set; } = "Creature"; public string header { get; set; } = "Medieval Fantasy"; public string groupName { get; set; } = "Custom Content"; public string description { get; set; } = ""; public string tags { get; set; } = ""; public string author { get; set; } = "Anonymous"; public string version { get; set; } = "Unversioned"; public string comment { get; set; } = ""; public string[] variants { get; set; } = null; public string chainLoad { get; set; } = null; public string anchor { get; set; } = "root"; public float timeToLive { get; set; } = 0f; public float size { get; set; } = 1f; public string code { get; set; } = ""; public string location { get; set; } = ""; public string assetBase { get; set; } = "DEFAULT"; public MeshAdjustments mesh { get; set; } = new MeshAdjustments(); public Collider collider { get; set; } = new Collider(); public Locations locations { get; set; } = new Locations(); public LinkRequest[] linkRequests { get; set; } = new LinkRequest[0]; public bool isDeprecated { get; set; } = false; public AssetInfo Clone() { return new AssetInfo { id = id, name = name, prefab = prefab, kind = kind, category = category, header = header, groupName = groupName, description = description, tags = tags, variants = variants, chainLoad = chainLoad, anchor = anchor, author = author, version = version, comment = comment, timeToLive = timeToLive, size = size, code = code, location = location, assetBase = assetBase, mesh = mesh, collider = collider, locations = locations, linkRequests = linkRequests, isDeprecated = isDeprecated }; } } } public static class Utility { public static bool isBoardLoaded() { return SimpleSingletonBehaviour<CameraController>.HasInstance && SingletonStateMBehaviour<BoardSessionManager, State<BoardSessionManager>>.HasInstance && !BoardSessionManager.IsLoading; } public static bool StrictKeyCheck(KeyboardShortcut check) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (!((KeyboardShortcut)(ref check)).IsUp()) { return false; } KeyCode[] array = new KeyCode[6]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); KeyCode[] array2 = (KeyCode[])(object)array; foreach (KeyCode val in array2) { if (Input.GetKey(val) != ((KeyboardShortcut)(ref check)).Modifiers.Contains(val)) { return false; } } return true; } public static Guid GuidFromString(string input) { using MD5 mD = MD5.Create(); byte[] b = mD.ComputeHash(Encoding.Default.GetBytes(input)); return new Guid(b); } public static GameObject GetBaseLoader(CreatureGuid cid) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) try { CreatureBoardAsset val = null; CreaturePresenter.TryGetAsset(cid, ref val); if ((Object)(object)val != (Object)null) { Transform match = null; StartWith(val, "_base", ref match); Transform match2 = null; Traverse(match, "BaseLoader", ref match2); if ((Object)(object)match2 != (Object)null) { Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Base Loader '" + ((Object)match2.GetChild(0)).name + "' Found")); return ((Component)match2.GetChild(0)).gameObject; } Debug.LogWarning((object)"Custom Assets Library Plugin Integrated Extension: Could Not Find Base Loader"); return null; } return null; } catch { return null; } } public static GameObject GetAssetLoader(CreatureGuid cid) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) try { CreatureBoardAsset val = null; CreaturePresenter.TryGetAsset(cid, ref val); if ((Object)(object)val != (Object)null) { Transform match = null; StartWith(val, "_creatureRoot", ref match); Transform match2 = null; Traverse(match, "AssetLoader", ref match2); if ((Object)(object)match2 != (Object)null) { Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Asset Loader '" + ((Object)match2.GetChild(0)).name + "' Found")); return ((Component)match2.GetChild(0)).gameObject; } Debug.LogWarning((object)"Custom Assets Library Plugin Integrated Extension: Could Not Find Asset Loader"); return null; } return null; } catch { return null; } } public static void StartWith(CreatureBoardAsset asset, string seek, ref Transform match) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown try { Type typeFromHandle = typeof(CreatureBoardAsset); match = null; foreach (FieldInfo runtimeField in typeFromHandle.GetRuntimeFields()) { if (runtimeField.Name == seek) { match = (Transform)runtimeField.GetValue(asset); break; } } } catch { match = null; } } public static void Traverse(Transform root, string seek, ref Transform match) { try { if ((Object)(object)match != (Object)null) { return; } if (((Object)root).name == seek) { match = root; return; } foreach (Transform item in ExtensionMethods.Children(root)) { Traverse(item, seek, ref match); } } catch { } } public static float ParseFloat(string value) { return float.Parse(value, CultureInfo.InvariantCulture); } public static string GetCreatureName(string nameBlock) { if (nameBlock == null) { return "(Unknown)"; } if (!nameBlock.Contains("<size=0>")) { return nameBlock; } return nameBlock.Substring(0, nameBlock.IndexOf("<size=0>")).Trim(); } public static void PostOnMainPage(MemberInfo plugin) { SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode mode) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown try { if (((Scene)(ref scene)).name == "UI") { TextMeshProUGUI uITextByName = GetUITextByName("BETA"); if (Object.op_Implicit((Object)(object)uITextByName)) { ((TMP_Text)uITextByName).text = "INJECTED BUILD - unstable mods"; } } else { TextMeshProUGUI uITextByName2 = GetUITextByName("TextMeshPro Text"); if (Object.op_Implicit((Object)(object)uITextByName2)) { BepInPlugin val = (BepInPlugin)Attribute.GetCustomAttribute(plugin, typeof(BepInPlugin)); if (((TMP_Text)uITextByName2).text.EndsWith("</size>")) { ((TMP_Text)uITextByName2).text = ((TMP_Text)uITextByName2).text + "\n\nMods Currently Installed:\n"; } TextMeshProUGUI val2 = uITextByName2; ((TMP_Text)val2).text = ((TMP_Text)val2).text + "\nPlugin Masters' " + val.Name + " - " + val.Version; } } } catch (Exception ex) { Debug.Log((object)ex); } }; } private static TextMeshProUGUI GetUITextByName(string name) { TextMeshProUGUI[] array = Object.FindObjectsOfType<TextMeshProUGUI>(); for (int i = 0; i < array.Length; i++) { if (((Object)array[i]).name == name) { return array[i]; } } return null; } } public enum DiagnosticMode { none, low, high, ultra } public enum OperationMode { rebuildIndexAlways, rebuildIndexIfMissing, rebuildNever } public Index index = null; public LoaderDataType noBase = new LoaderDataType { BundleId = "", AssetName = "" }; public LoaderDataType defaultBase = new LoaderDataType { BundleId = "char_base01_1462710208", AssetName = "clothBase" }; public Texture2D defaultPortrait = null; public List<string> violations = new List<string>(); public Dictionary<string, string> effects = new Dictionary<string, string>(); private static int atlasIndex = -1; private static LogLevel compilerLogLevel = (LogLevel)1; public const string Name = "Custom Assets Library Plugin"; public const string Guid = "org.pluginmasters.plugins.customassetslibraryplugin"; public const string Version = "3.5.5.0"; public static CustomAssetsLibraryPlugin _self = null; public ConfigEntry<OperationMode> operationMode { get; set; } public ConfigEntry<bool> hideVariants { get; set; } public ConfigEntry<DiagnosticMode> diagnosticMode { get; set; } public ConfigEntry<bool> createJSONIndexFiles { get; set; } public void RegisterAssets() { //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Expected O, but got Unknown if (Diagnostics() >= DiagnosticMode.ultra) { Debug.Log((object)"Custom Asset Library Plugin: Unregistering Previously Registered Packs As Needed"); } foreach (string item in Directory.EnumerateDirectories(Paths.PluginPath)) { if ((!File.Exists(item + "\\index") || OperationsMode() == OperationMode.rebuildIndexAlways) && File.Exists(item + "\\Unregister.Bat")) { if (Diagnostics() >= DiagnosticMode.high) { Debug.Log((object)("Custom Asset Library Plugin: Unregistering Previously Registered AssetPack At " + item)); } Process process = new Process { StartInfo = new ProcessStartInfo { Arguments = "", FileName = item + "\\Unregister.Bat", CreateNoWindow = true, RedirectStandardError = true, RedirectStandardOutput = true, UseShellExecute = false } }; process.Start(); process.WaitForExit(); } } if (Diagnostics() >= DiagnosticMode.ultra) { Debug.Log((object)"Custom Asset Library Plugin: Building Registration Folders And Files Lists"); } defaultPortrait = Image.LoadTexture("DefaultPortrait.png", (CacheType)999); List<string> files = new List<string>(); List<string> folders = new List<string>(); GetPluginAssetBundleFiles(Paths.PluginPath, ref files); GetPluginPacks(Paths.PluginPath, ref folders); for (int i = 0; i < files.Count; i++) { string text = files[i].Substring(Paths.PluginPath.Length + 1); text = text.Substring(text.IndexOf("\\") + 1); if (!text.Contains("\\")) { files.RemoveAt(i); i--; } } if (Diagnostics() >= DiagnosticMode.ultra) { Debug.Log((object)"Custom Asset Library Plugin: Processing Each Asset Pack Folder"); } foreach (string folder in folders) { int num = 0; index = new Index(); string text2 = folder.Trim(); text2 = text2.Substring(0, text2.Length - 1); text2 = text2.Substring(text2.LastIndexOf("/") + 1); index.assetPackId = Utility.GuidFromString(text2).ToString(); if (Diagnostics() >= DiagnosticMode.high) { Debug.Log((object)("Custom Asset Library Plugin: Encountered AssetPackId " + index.assetPackId + " (Based On '" + text2 + "')")); } if (!File.Exists(Paths.PluginPath + "\\" + folder + "index") || OperationsMode() == OperationMode.rebuildIndexAlways) { if (Diagnostics() >= DiagnosticMode.ultra) { Debug.Log((object)("Custom Asset Library Plugin: Scanning Pack '" + text2 + "' At '" + Paths.PluginPath + "\\" + folder + "'")); } foreach (string item2 in files.Where((string f) => f.StartsWith(Paths.PluginPath + "\\" + folder) && f.Contains("CustomData") && Path.GetExtension(f).Replace(".", "").Trim() == "")) { if (Diagnostics() >= DiagnosticMode.ultra) { Debug.Log((object)("Custom Asset Library Plugin: Analyzing Pack '" + text2 + "' File '" + item2 + "'.")); } AssetBundle val = null; Data.AssetInfo assetInfo = null; Texture2D val2 = null; try { val = AssetBundle.Load(item2, (CacheType)999); } catch (Exception ex) { Debug.LogWarning((object)("Custom Asset Library Plugin: File '" + item2 + "' Does Not Seem To Be A Valid Asset Bundle.")); if (Diagnostics() >= DiagnosticMode.ultra) { Debug.LogException(ex); } continue; } string text3 = ""; try { if (Diagnostics() >= DiagnosticMode.ultra) { Debug.Log((object)"Custom Asset Library Plugin: Looking For 'info.txt' File"); } text3 = val.LoadAsset<TextAsset>("info.txt").text; } catch (Exception) { if (Diagnostics() >= DiagnosticMode.high) { Debug.LogWarning((object)("Custom Asset Library Plugin: AssetBundle '" + item2 + "' Does No Seem To Have An Info.Txt File. Using Default.")); } text3 = ""; } try { if (text3 == "") { throw new Exception("No 'info.txt' file. Using default."); } if (Diagnostics() >= DiagnosticMode.ultra) { Debug.Log((object)"Custom Asset Library Plugin: Parsing 'info.txt' File"); } assetInfo = JsonConvert.DeserializeObject<Data.AssetInfo>(text3); } catch (Exception) { if (Diagnostics() >= DiagnosticMode.high) { Debug.Log((object)("Custom Asset Library Plugin: AssetBundle '" + item2 + "' Has Issue With Its Info.Txt File. Using Default.")); } assetInfo = new Data.AssetInfo { name = Path.GetFileNameWithoutExtension(item2), kind = "Creature", category = "Creature", groupName = "Custom Content" }; } ReflectionObjectModifier.ApplyModifiers(assetInfo); try { val2 = val.LoadAsset<Texture2D>("Portrait.png"); } catch (Exception) { if (Diagnostics() >= DiagnosticMode.high) { Debug.Log((object)("Custom Asset Library Plugin: AssetBundle '" + item2 + "' Does Not Have A Portrait.Png File. Using Default.")); } val2 = Image.LoadTexture("DefaultPortrait.png", (CacheType)999); } try { string prefabName = ((assetInfo.prefab != "") ? assetInfo.prefab : Path.GetFileNameWithoutExtension(item2).ToLower()); string[] allAssetNames = val.GetAllAssetNames(); for (int j = 0; j < allAssetNames.Length; j++) { allAssetNames[j] = allAssetNames[j].ToLower(); } try { if (allAssetNames.Where((string s) => s.EndsWith("/" + prefabName.ToLower() + ".prefab")).Count() > 0) { if (Diagnostics() >= DiagnosticMode.ultra) { Debug.Log((object)("Custom Asset Library Plugin: Found Prefab '" + prefabName + "' Matching Asset Bundle File Name")); } } else if (allAssetNames.Where((string s) => s.StartsWith(prefabName.ToLower() + ".prefab") && s.EndsWith(prefabName.ToLower() + ".prefab")).Count() > 0) { if (Diagnostics() >= DiagnosticMode.ultra) { Debug.Log((object)("Custom Asset Library Plugin: Found Prefab '" + prefabName + "' Matching Asset Bundle File Name")); } } else { Debug.LogWarning((object)("Custom Asset Library Plugin: Did Not Find Prefab '" + prefabName + "' In Asset Bundle. Using '" + allAssetNames.Where((string s) => s.ToUpper().EndsWith(".PREFAB")).ElementAt(0) + "'")); violations.Add("Asset Bundle '" + ((Object)val).name + "' Does Not Contain '" + prefabName + "'"); prefabName = allAssetNames.Where((string s) => s.ToUpper().EndsWith(".PREFAB")).ElementAt(0); string[] allAssetNames2 = val.GetAllAssetNames(); foreach (string text4 in allAssetNames2) { Debug.Log((object)("Custom Asset Library Plugin: AssetBundle '" + item2 + "' Contains '" + text4 + "'")); } } } catch (Exception) { Debug.LogWarning((object)("Custom Asset Library Plugin: Did Not Find Any Usabled Prefab In Asset Bundle. Using '" + ((Object)val).name + "'")); violations.Add("Asset Bundle '" + ((Object)val).name + "' Does Not Contain '" + prefabName + "'"); string[] allAssetNames3 = val.GetAllAssetNames(); foreach (string text5 in allAssetNames3) { Debug.Log((object)("Custom Asset Library Plugin: AssetBundle '" + item2 + "' Contains '" + text5 + "'")); } } assetInfo.prefab = prefabName; } catch (Exception ex6) { Debug.LogWarning((object)("Custom Asset Library Plugin: Unable To Read Asset Names From AssetBundle '" + item2 + "'")); Debug.LogException(ex6); } if ((Object)(object)val != (Object)null) { val.Unload(false); } if (assetInfo != null) { assetInfo.id = Utility.GuidFromString(Path.GetFileNameWithoutExtension(item2)).ToString(); assetInfo.location = item2.Substring(Paths.PluginPath.Length + 1); assetInfo.location = assetInfo.location.Substring(assetInfo.location.IndexOf("/") + 1); if (assetInfo.kind == "") { assetInfo.kind = "Creature"; } if (assetInfo.category == "") { assetInfo.category = "Creature"; } RegisterAsset(assetInfo, item2.Replace("/CustomData/", "/Assets/").Replace("\\CustomData\\", "\\Assets\\"), text2, index.assetPackId); CreatePortrait(assetInfo, text2, val2); } num++; } if (index.Creatures.Count + index.Music.Count + index.Props.Count + index.Tiles.Count > 0) { CreateIndexFile(text2, index.assetPackId); } if (Diagnostics() >= DiagnosticMode.ultra) { Debug.Log((object)("Custom Asset Library Plugin: Found " + num + " Assets.")); } Cache.ReloadCache(); } else if (Diagnostics() >= DiagnosticMode.high) { Debug.Log((object)("Custom Asset Library Plugin: Content From Pack '" + folder + "' Is Already Registered.")); } } } public void RegisterAsset(Data.AssetInfo info, string assetFile, string singleFolder, string assetPackId) { //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Expected O, but got Unknown //IL_1335: Unknown result type (might be due to invalid IL or missing references) //IL_133a: Unknown result type (might be due to invalid IL or missing references) //IL_1356: Expected O, but got Unknown //IL_0ce7: Unknown result type (might be due to invalid IL or missing references) //IL_0cee: Expected O, but got Unknown //IL_0bcd: Unknown result type (might be due to invalid IL or missing references) //IL_0bd4: Expected O, but got Unknown //IL_0c97: Unknown result type (might be due to invalid IL or missing references) //IL_0c9c: Unknown result type (might be due to invalid IL or missing references) //IL_0ca5: Unknown result type (might be due to invalid IL or missing references) //IL_0cc2: Expected O, but got Unknown //IL_0ff5: Unknown result type (might be due to invalid IL or missing references) //IL_0ffc: Expected O, but got Unknown //IL_0df6: Unknown result type (might be due to invalid IL or missing references) //IL_0dfb: Unknown result type (might be due to invalid IL or missing references) //IL_0dfc: Unknown result type (might be due to invalid IL or missing references) //IL_0e01: Unknown result type (might be due to invalid IL or missing references) //IL_0e0a: Unknown result type (might be due to invalid IL or missing references) //IL_0e27: Expected O, but got Unknown //IL_0e28: Unknown result type (might be due to invalid IL or missing references) //IL_0e64: Unknown result type (might be due to invalid IL or missing references) //IL_0ea0: Unknown result type (might be due to invalid IL or missing references) //IL_0ee7: Expected O, but got Unknown //IL_0ef9: Unknown result type (might be due to invalid IL or missing references) //IL_0efe: Unknown result type (might be due to invalid IL or missing references) //IL_0f3a: Unknown result type (might be due to invalid IL or missing references) //IL_0f7b: Expected O, but got Unknown //IL_0f7e: Unknown result type (might be due to invalid IL or missing references) //IL_0f83: Unknown result type (might be due to invalid IL or missing references) //IL_0f8f: Unknown result type (might be due to invalid IL or missing references) //IL_0f90: Unknown result type (might be due to invalid IL or missing references) //IL_0f95: Unknown result type (might be due to invalid IL or missing references) //IL_0fa1: Unknown result type (might be due to invalid IL or missing references) //IL_0fad: Unknown result type (might be due to invalid IL or missing references) //IL_0fb9: Unknown result type (might be due to invalid IL or missing references) //IL_0fca: Expected O, but got Unknown //IL_0fd0: Expected O, but got Unknown //IL_110f: Unknown result type (might be due to invalid IL or missing references) //IL_1114: Unknown result type (might be due to invalid IL or missing references) //IL_1115: Unknown result type (might be due to invalid IL or missing references) //IL_111a: Unknown result type (might be due to invalid IL or missing references) //IL_1123: Unknown result type (might be due to invalid IL or missing references) //IL_115a: Expected O, but got Unknown //IL_115b: Unknown result type (might be due to invalid IL or missing references) //IL_1197: Unknown result type (might be due to invalid IL or missing references) //IL_11d3: Unknown result type (might be due to invalid IL or missing references) //IL_121a: Expected O, but got Unknown //IL_122c: Unknown result type (might be due to invalid IL or missing references) //IL_1231: Unknown result type (might be due to invalid IL or missing references) //IL_126d: Unknown result type (might be due to invalid IL or missing references) //IL_12ae: Expected O, but got Unknown //IL_12b1: Unknown result type (might be due to invalid IL or missing references) //IL_12b6: Unknown result type (might be due to invalid IL or missing references) //IL_12c2: Unknown result type (might be due to invalid IL or missing references) //IL_12c3: Unknown result type (might be due to invalid IL or missing references) //IL_12c8: Unknown result type (might be due to invalid IL or missing references) //IL_12d4: Unknown result type (might be due to invalid IL or missing references) //IL_12e0: Unknown result type (might be due to invalid IL or missing references) //IL_12ec: Unknown result type (might be due to invalid IL or missing references) //IL_12fd: Expected O, but got Unknown //IL_1303: Expected O, but got Unknown //IL_066f: Unknown result type (might be due to invalid IL or missing references) //IL_0676: Expected O, but got Unknown //IL_06ad: Unknown result type (might be due to invalid IL or missing references) //IL_06b2: Unknown result type (might be due to invalid IL or missing references) //IL_06c4: Unknown result type (might be due to invalid IL or missing references) //IL_0790: Unknown result type (might be due to invalid IL or missing references) //IL_0797: Expected O, but got Unknown //IL_07a0: Unknown result type (might be due to invalid IL or missing references) //IL_07a5: Unknown result type (might be due to invalid IL or missing references) //IL_07ae: Unknown result type (might be due to invalid IL or missing references) //IL_07cb: Expected O, but got Unknown //IL_0a3c: Unknown result type (might be due to invalid IL or missing references) //IL_0a41: Unknown result type (might be due to invalid IL or missing references) //IL_0a4d: Unknown result type (might be due to invalid IL or missing references) //IL_0a4e: Unknown result type (might be due to invalid IL or missing references) //IL_0a53: Unknown result type (might be due to invalid IL or missing references) //IL_0a5f: Unknown result type (might be due to invalid IL or missing references) //IL_0a6b: Unknown result type (might be due to invalid IL or missing references) //IL_0a77: Unknown result type (might be due to invalid IL or missing references) //IL_0a88: Expected O, but got Unknown //IL_0a8e: Expected O, but got Unknown if (Diagnostics() >= DiagnosticMode.ultra) { Debug.Log((object)("Custom Asset Library Plugin: Registering Asset With Info:\r\n" + JsonConvert.SerializeObject((object)info))); } List<string> list = new List<string>(); if (info.prefab != null && info.prefab != "") { list.Add("*" + info.prefab); } else { list.Add("*" + info.id); } string text = ""; if (info.variants != null && info.variants.Length != 0) { text = Utility.GuidFromString(list.ElementAt(0).Replace("*", "")).ToString() + "|"; string[] variants = info.variants; foreach (string text2 in variants) { text = text + Utility.GuidFromString(text2).ToString() + "|"; list.Add(text2); } } foreach (string item in list) { string text3 = "RegisterAsset"; try { if (Diagnostics() >= DiagnosticMode.low) { Debug.Log((object)("Custom Asset Library Plugin: Registering Asset '" + info.name + " : " + item + " ' (" + info.location + ") In AssetPack " + singleFolder + " (" + assetPackId + ")")); } text3 = "Get Relative Path"; string text4 = info.location.Substring(info.location.IndexOf("\\") + 1); text4 = text4.Substring(text4.IndexOf("\\") + 1); text3 = "Get Rotation"; string[] array = ((!(info.mesh.rotationOffset == "")) ? info.mesh.rotationOffset.Split(new char[1] { ',' }) : new string[3] { "0", "0", "0" }); index.Name = info.header; string[] array2 = info.mesh.positionOffset.Split(new char[1] { ',' }); string[] array3 = info.mesh.rotationOffset.Split(new char[1] { ',' }); string[] array4 = info.collider.center.Split(new char[1] { ',' }); string[] array5 = info.collider.extent.Split(new char[1] { ',' }); string[] array6 = info.mesh.size.Split(new char[1] { ',' }); text3 = "Get Process Type"; switch (info.kind.ToUpper()) { case "AUDIO": case "AURA": case "CREATURE": case "EFFECT": case "FILTER": case "TRANSFORM": case "ENCOUNTER": { atlasIndex++; if (Diagnostics() >= DiagnosticMode.high) { Debug.Log((object)("Custom Asset Library Plugin: Atlas Index = " + atlasIndex)); } text3 = "Generate Asset"; CreatureType val2 = new CreatureType(); text3 = "Generate Asset Id"; val2.Id = Utility.GuidFromString(item.Replace("*", "")).ToString(); text3 = "Generate Asset Name"; val2.Name = info.name; text3 = "Generate Asset Group"; val2.GroupTag = (item.StartsWith("*") ? info.groupName : ".Variant"); text3 = "Generate Asset Tags"; val2.Tags = TrimList((info.tags + ",Header:" + info.header + ",Category:" + info.category + ",Kind:" + info.kind + ",Prefab:" + ((info.prefab != "") ? info.prefab : Path.GetFileNameWithoutExtension(info.location)) + ",Variants:" + text + ",AssetBundle:" + assetFile).Split(new char[1] { ',' }).ToList()); text3 = "Generate Asset Deprecated"; val2.IsDeprecated = (item.StartsWith("*") ? info.isDeprecated : hideVariants.Value); text3 = "Generate Asset Base Loader"; AssetType val3 = new AssetType(); text3 = "Generate Asset Base Loader Data"; val3.LoaderData = (LoaderDataType)((info.assetBase.ToUpper() == "NONE") ? noBase : ((info.assetBase.ToUpper() == "DEFAULT") ? ((object)defaultBase) : ((object)new LoaderDataType { AssetName = Path.GetFileNameWithoutExtension(info.assetBase), BundleId = GetRelativeFolder(Path.GetFileNameWithoutExtension(info.assetBase)) }))); text3 = "Generate Asset Base Loader Scale"; val3.Scale = ((info.assetBase.ToUpper() == "NONE") ? new List<float> { 0f, 0f, 0f } : new List<float> { Utility.ParseFloat(array6[0]), Utility.ParseFloat(array6[1]), Utility.ParseFloat(array6[2]) }); text3 = "Generate Asset Base Loader Add"; val2.BaseAsset = val3; text3 = "Generate Asset Loader"; AssetType val4 = new AssetType(); text3 = "Generate Asset Loader Data"; val4.LoaderData = new LoaderDataType { BundleId = text4, AssetName = item.Replace("*", "") }; text3 = "Generate Asset Loader Scale"; val4.Scale = new List<float> { Utility.ParseFloat(array6[0]), Utility.ParseFloat(array6[1]), Utility.ParseFloat(array6[2]) }; text3 = "Generate Asset Loader Position"; val4.Position = new List<float> { Utility.ParseFloat(array2[0]), Utility.ParseFloat(array2[1]), Utility.ParseFloat(array2[2]) }; text3 = "Generate Asset Loader Rotation"; val4.Rotation = new List<float> { Utility.ParseFloat(array3[0]), Utility.ParseFloat(array3[1]) + 180f, Utility.ParseFloat(array3[2]) }; text3 = "Generate Asset Loader Add"; val2.MiniAsset = val4; text3 = "Generate Asset Default Scale"; val2.DefaultScale = info.size; text3 = "Generate Target Locations"; string[] array7 = info.locations.head.Split(new char[1] { ',' }); val2.HeadPos = new List<float> { Utility.ParseFloat(array7[0]), Utility.ParseFloat(array7[1]), Utility.ParseFloat(array7[2]) }; array7 = info.locations.hit.Split(new char[1] { ',' }); val2.HitPos = new List<float> { Utility.ParseFloat(array7[0]), Utility.ParseFloat(array7[1]), Utility.ParseFloat(array7[2]) }; array7 = info.locations.spell.Split(new char[1] { ',' }); val2.SpellPos = new List<float> { Utility.ParseFloat(array7[0]), Utility.ParseFloat(array7[1]), Utility.ParseFloat(array7[2]) }; array7 = info.locations.torch.Split(new char[1] { ',' }); val2.TorchPos = new List<float> { Utility.ParseFloat(array7[0]), Utility.ParseFloat(array7[1]), Utility.ParseFloat(array7[2]) }; text3 = "Generate Asset Icon"; val2.Icon = new IconType { AtlasIndex = atlasIndex, Region = new RegionType { x = 0f, y = 0f, width = 1f, height = 1f } }; text3 = "Generate Add Asset"; index.Creatures.Add(val2); text3 = "Generate Add To Auras/Effects List"; if ("|AURA|EFFECT|".Contains(info.kind.ToUpper())) { if (!effects.ContainsKey(val2.Id)) { effects.Add(val2.Id, val2.MiniAsset.LoaderData.AssetName + "@" + assetFile); } else if (Diagnostics() >= DiagnosticMode.ultra) { Debug.Log((object)"Custom Asset Library Plugin: Repeated Aura/Effect Entry"); Debug.Log((object)("Custom Asset Library Plugin: Have " + val2.Id + "->" + effects[val2.Id])); Debug.Log((object)("Custom Asset Library Plugin: Next " + val2.Id + "->" + val2.MiniAsset.LoaderData.AssetName + "@" + assetFile)); } } break; } case "MUSIC": { List<MusicType> music = index.Music; MusicType val5 = new MusicType(); val5.Id = Utility.GuidFromString(item.Replace("*", "")).ToString(); val5.Name = info.name; val5.GroupTag = info.groupName; val5.Tags = TrimList((info.tags + ",Header:" + info.header + ",Category:" + info.category + ",Kind:" + info.kind).Split(new char[1] { ',' }).ToList()); val5.IsDeprecated = info.isDeprecated; val5.Assets = new LoaderDataType { BundleId = text4, AssetName = item.Replace("*", "") }; music.Add(val5); break; } case "PROP": { atlasIndex++; List<TileAndPropsType> props = index.Props; TileAndPropsType val = new TileAndPropsType(); val.Id = Utility.GuidFromString(item.Replace("*", "")).ToString(); val.Name = info.name; val.GroupTag = info.groupName; val.Tags = TrimList((info.tags + ",Header:" + info.header + ",Category:" + info.category + ",Kind:" + info.kind + ",Prefab:" + ((info.prefab != "") ? info.prefab : Path.GetFileNameWithoutExtension(info.location)) + ",AssetBundle:" + assetFile).Split(new char[1] { ',' }).ToList()); val.IsDeprecated = info.isDeprecated; val.Assets = new List<AssetType> { new AssetType { LoaderData = new LoaderDataType { BundleId = text4, AssetName = item.Replace("*", "") }, Scale = new List<float> { Utility.ParseFloat(array6[0]), Utility.ParseFloat(array6[1]), Utility.ParseFloat(array6[2]) }, Position = new List<float> { Utility.ParseFloat(array2[0]), Utility.ParseFloat(array2[1]), Utility.ParseFloat(array2[2]) }, Rotation = new List<float> { Utility.ParseFloat(array3[0]), Utility.ParseFloat(array3[1]) + 180f, Utility.ParseFloat(array3[2]) } } }; val.IsInteractable = false; val.ColliderBoundsBound = new BoundsType { m_Center = new List<float> { Utility.ParseFloat(array4[0]), Utility.ParseFloat(array4[1]), Utility.ParseFloat(array4[2]) }, m_Extent = new List<float> { Utility.ParseFloat(array5[0]), Utility.ParseFloat(array5[1]), Utility.ParseFloat(array5[2]) } }; val.Icon = new IconType { AtlasIndex = atlasIndex, Region = new RegionType { x = 0f, y = 0f, width = 1f, height = 1f } }; props.Add(val); break; } case "TILE": case "SLAB": { atlasIndex++; List<TileAndPropsType> tiles = index.Tiles; TileAndPropsType val = new TileAndPropsType(); val.Id = Utility.GuidFromString(item.Replace("*", "")).ToString(); val.Name = item.Replace("*", ""); val.GroupTag = info.groupName; val.Tags = TrimList((info.tags + ",Header:" + info.header + ",Category:" + info.category + ",Kind:" + info.kind + ",Prefab:" + ((info.prefab != "") ? info.prefab : Path.GetFileNameWithoutExtension(info.location)) + ",AssetBundle:" + assetFile).Split(new char[1] { ',' }).ToList()); val.IsDeprecated = info.isDeprecated; val.Assets = new List<AssetType> { new AssetType { LoaderData = new LoaderDataType { BundleId = text4, AssetName = ((info.prefab != "") ? info.prefab : item.Replace("*", "")) }, Scale = new List<float> { Utility.ParseFloat(array6[0]), Utility.ParseFloat(array6[1]), Utility.ParseFloat(array6[2]) }, Position = new List<float> { Utility.ParseFloat(array2[0]), Utility.ParseFloat(array2[1]), Utility.ParseFloat(array2[2]) }, Rotation = new List<float> { Utility.ParseFloat(array3[0]), Utility.ParseFloat(array3[1]) + 180f, Utility.ParseFloat(array3[2]) } } }; val.IsInteractable = false; val.ColliderBoundsBound = new BoundsType { m_Center = new List<float> { Utility.ParseFloat(array4[0]), Utility.ParseFloat(array4[1]), Utility.ParseFloat(array4[2]) }, m_Extent = new List<float> { Utility.ParseFloat(array5[0]), Utility.ParseFloat(array5[1]), Utility.ParseFloat(array5[2]) } }; val.Icon = new IconType { AtlasIndex = atlasIndex, Region = new RegionType { x = 0f, y = 0f, width = 1f, height = 1f } }; tiles.Add(val); break; } } if (info.kind.ToUpper() != "MUSIC") { index.IconsAtlas.Add(new IconsAtlasesType { Path = "Portraits/" + info.id }); } } catch (Exception ex) { Debug.LogError((object)("Custom Asset Library Plugin: " + ex)); Debug.LogError((object)("Custom Asset Library Plugin: While Process Stage " + text3 + " Using " + JsonConvert.SerializeObject((object)info))); } } } public void CreatePortrait(Data.AssetInfo info, string singleFolder, Texture2D portrait) { try { if (!Directory.Exists(Paths.PluginPath + "\\" + singleFolder + "\\Portraits")) { if (Diagnostics() >= DiagnosticMode.high) { Debug.Log((object)("Custom Asset Library Plugin: Creating Portrait Folder (" + Paths.PluginPath + "\\" + singleFolder + "\\Portraits)")); } Directory.CreateDirectory(Paths.PluginPath + "\\" + singleFolder + "\\Portraits"); } File.WriteAllBytes(Paths.PluginPath + "\\" + singleFolder + "\\Portraits\\" + info.id.ToString(), ImageConversion.EncodeToPNG(portrait)); if (Diagnostics() >= DiagnosticMode.high) { Debug.Log((object)("Custom Asset Library Plugin: Created Portrait File For Asset '" + info.name + "' -> " + Paths.PluginPath + "\\" + singleFolder + "\\Portraits\\" + info.id.ToString())); } } catch (Exception) { File.WriteAllBytes(Paths.PluginPath + "\\" + singleFolder + "\\Portraits\\" + info.id.ToString(), ImageConversion.EncodeToPNG(defaultPortrait)); if (Diagnostics() >= DiagnosticMode.high) { Debug.Log((object)("Custom Asset Library Plugin: Created Default Portrait File For Asset '" + info.name + "' -> " + Paths.PluginPath + "\\" + singleFolder + "\\Portraits\\" + info.id.ToString())); } } } public void CreateIndexFile(string singleFolder, string assetPackId, bool writeJsonIndexFile = true) { //IL_036c: Unknown result type (might be due to invalid IL or missing references) try { if (Directory.Exists(Paths.PluginPath + "\\" + singleFolder + "\\CustomData")) { if (Diagnostics() >= DiagnosticMode.high) { Debug.Log((object)"Custom Asset Library Plugin: Registrating Folder (Renaming CustomData Folder To Assets)"); } Directory.Move(Paths.PluginPath + "\\" + singleFolder + "\\CustomData", Paths.PluginPath + "\\" + singleFolder + "\\Assets"); } else if (Diagnostics() >= DiagnosticMode.high) { Debug.Log((object)"Custom Asset Library Plugin: Pack Aready Has Been Renamed From Custom Data To Assets"); } } catch (Exception ex) { Debug.Log((object)("Custom Asset Library Plugin: Failure Renaming CustomData Folder To Assets. The folder '" + singleFolder + "\\CustomData' Or A Sub-Folder Is Probably Open.")); Debug.LogException(ex); } try { File.WriteAllText(Paths.PluginPath + "\\" + singleFolder + "\\Unregister.bat", "@echo off\r\nren \"" + Paths.PluginPath + "\\" + singleFolder + "\\Assets\" CustomData\"\r\ndel /Q \"" + Paths.PluginPath + "\\" + singleFolder + "\\Portraits\\*.*\"\r\nrmdir \"" + Paths.PluginPath + "\\" + singleFolder + "\\Portraits\"\r\ndel /Q \"" + Paths.PluginPath + "\\" + singleFolder + "\\index\"\r\ndel /Q \"" + Paths.PluginPath + "\\" + singleFolder + "\\index.json\"\r\ndel /Q \"" + Paths.PluginPath + "\\" + singleFolder + "\\assetpack.id\"\r\ndel /Q \"" + Paths.PluginPath + "\\" + singleFolder + "\\zeus\"\r\ndel /Q \"" + Paths.PluginPath + "\\" + singleFolder + "\\RegisterForVanilla.bat\"\r\ndel /Q \"" + Paths.PluginPath + "\\" + singleFolder + "\\Unregister.bat\"\r\n"); File.WriteAllText(Paths.PluginPath + "\\" + singleFolder + "\\RegisterForVanilla.bat", "@echo off\r\n@if \"%1\"==\"\" echo Syntax: RegisterForVanilla.bat PathToTaleweaverFolder\r\n@if \"%1\"==\"\" goto Done\r\ncd>RegisterForVanilla.$$$\r\nfor /F \"tokens=*\" %%A in (RegisterForVanilla.$$$) do mklink /D \"%1\\" + assetPackId + "\" \"%%A\"\r\ndel RegisterForVanilla.$$$\r\n\r\n:Done\r\n"); } catch (Exception ex2) { Debug.Log((object)"Custom Asset Library Plugin: Failure To Write Unregister.Bat Or RegisterForVanilla.Bat"); Debug.LogException(ex2); } if (writeJsonIndexFile) { if (CreateJsonReferenceFiles()) { try { if (Diagnostics() >= DiagnosticMode.high) { Debug.Log((object)"Custom Asset Library Plugin: Creating JSON Reference File"); } string contents = JsonConvert.SerializeObject((object)index, (Formatting)1); if (Diagnostics() >= DiagnosticMode.ultra) { Debug.Log((object)("Custom Asset Library Plugin: Writing JSON Reference File (" + Paths.PluginPath + "\\" + singleFolder + "\\Index.Json File)")); } File.WriteAllText(Paths.PluginPath + "\\" + singleFolder + "\\Index.json", contents); } catch (Exception ex3) { Debug.Log((object)"Custom Asset Library Plugin: Failure To Write Index.json File"); Debug.LogException(ex3); } } try { if (Diagnostics() >= DiagnosticMode.high) { Debug.Log((object)("Custom Asset Library Plugin: Writing Binary Index To '" + Paths.PluginPath + "\\" + singleFolder + "'")); } TaleWeaverCompiler.Generate(Paths.PluginPath + "\\" + singleFolder, index, compilerLogLevel); } catch (Exception ex4) { Debug.Log((object)"Custom Asset Library Plugin: Failure To Write Binary Index File"); Debug.LogException(ex4); } } atlasIndex = -1; } public void GetPluginAssetBundleFiles(string path, ref List<string> files) { files.AddRange(Directory.EnumerateFiles(path, "*.")); foreach (string item in Directory.EnumerateDirectories(path)) { GetPluginAssetBundleFiles(item, ref files); } } public void GetPluginPacks(string path, ref List<string> folders) { string[] array = Directory.EnumerateDirectories(path).ToArray(); for (int i = 0; i < array.Length; i++) { array[i] = array[i].Replace("/", "\\"); array[i] = array[i].Substring(path.Length + 1) + "\\"; } folders.AddRange(array); } public string GetRelativeFolder(string assetBundleFileName) { try { string text = File.Find(assetBundleFileName, (CacheType)999)[0]; text = text.Substring(Paths.PluginPath.Length + 1); text = text.Substring(text.IndexOf("/") + 1); text = text.Substring(text.IndexOf("/") + 1); return text.Replace("/", "\\"); } catch { return ""; } } public List<string> TrimList(List<string> list) { List<string> list2 = new List<string>(); foreach (string item in list) { list2.Add(item.Trim()); } return list2; } private void Awake() { _self = this; operationMode = ((BaseUnityPlugin)this).Config.Bind<OperationMode>("Settings", "Registration Mode", OperationMode.rebuildIndexAlways, (ConfigDescription)null); hideVariants = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Hide Variants", true, (ConfigDescription)null); diagnosticMode = ((BaseUnityPlugin)this).Config.Bind<DiagnosticMode>("Troubleshooting", "Diagnostic Mode", DiagnosticMode.high, (ConfigDescription)null); createJSONIndexFiles = ((BaseUnityPlugin)this).Config.Bind<bool>("Troubleshooting", "Create Reference JSON Index Files", false, (ConfigDescription)null); Debug.Log((object)("Custom Asset Library Plugin: " + ((object)this).GetType().AssemblyQualifiedName + " Active. (Diagnostic Mode = " + Diagnostics().ToString() + ")")); ReflectionObjectModifier.LoadModifiers(); if (operationMode.Value != OperationMode.rebuildNever) { RegisterAssets(); } Utility.PostOnMainPage(((object)this).GetType()); } private void Update() { if (!Utility.isBoardLoaded() || violations.Count <= 0) { return; } SystemMessage.DisplayInfoText("Custom Asset Library Plugin:\r\nPrime Directive Violation(s)!\r\nSee Log For Violations List", 10f); Debug.LogWarning((object)"Custom Asset Plugin: List Of Prime Directive Violations:"); foreach (string violation in violations) { Debug.LogWarning((object)("Custom Asset Plugin: -> " + violation)); } violations.Clear(); } public static DiagnosticMode Diagnostics() { return _self.diagnosticMode.Value; } public static OperationMode OperationsMode() { return _self.operationMode.Value; } public static bool CreateJsonReferenceFiles() { return _self.createJSONIndexFiles.Value; } } public static class ReflectionObjectModifier { private static Dictionary<string, List<string>> modifications = new Dictionary<string, List<string>>(); public static void LoadModifiers() { if (File.Exists("CALP.Tweaks.rom")) { if (CustomAssetsLibraryPlugin.Diagnostics() >= CustomAssetsLibraryPlugin.DiagnosticMode.ultra) { Debug.Log((object)"Custom Asset Library Plugin: Tweaks File Found"); } string[] array = File.ReadAllLines("CALP.Tweaks.rom", (CacheType)999); string[] array2 = array; foreach (string text in array2) { if (!text.Trim().StartsWith("#") && !text.Trim().StartsWith("'") && !text.Trim().StartsWith("//") && text.Trim() != "") { string text2 = text.Substring(0, text.IndexOf(":")); string text3 = text.Substring(text.IndexOf(":") + 1); if (!modifications.ContainsKey(text2)) { modifications.Add(text2, new List<string>()); } modifications[text2].Add(text3); if (CustomAssetsLibraryPlugin.Diagnostics() >= CustomAssetsLibraryPlugin.DiagnosticMode.ultra) { Debug.Log((object)("Custom Asset Library Plugin: Modifying Object '" + text2 + "' " + text3)); } } } } else { string[] array3 = File.Catalog(true); foreach (string text4 in array3) { Debug.Log((object)("Custom Asset Library Plugin: " + text4)); } } } public static void ApplyModifiers(CustomAssetsLibraryPlugin.Data.AssetInfo obj) { if (CustomAssetsLibraryPlugin.Diagnostics() >= CustomAssetsLibraryPlugin.DiagnosticMode.ultra) { Debug.Log((object)("Custom Asset Library Plugin: Tweaks: " + JsonConvert.SerializeObject((object)modifications))); } if (modifications.Count <= 0) { return; } if (CustomAssetsLibraryPlugin.Diagnostics() >= CustomAssetsLibraryPlugin.DiagnosticMode.ultra) { Debug.Log((object)("Custom Asset Library Plugin: Tweak: Applying Tweaks For '" + obj.name + "'")); } if (modifications.ContainsKey(obj.name)) { if (CustomAssetsLibraryPlugin.Diagnostics() >= CustomAssetsLibraryPlugin.DiagnosticMode.ultra) { Debug.Log((object)("Custom Asset Library Plugin: Tweak: Applying Tweaks For '" + obj.name + "': '" + JsonConvert.SerializeObject((object)modifications[obj.name]) + "'")); } { foreach (string item in modifications[obj.name]) { string key = item.Substring(0, item.IndexOf("=")); string value = item.Substring(item.IndexOf("=") + 1); Modify(obj, key, value); } return; } } foreach (string key2 in modifications.Keys) { if (CustomAssetsLibraryPlugin.Diagnostics() >= CustomAssetsLibraryPlugin.DiagnosticMode.ultra) { Debug.Log((object)("Custom Asset Library Plugin: Tweak: Found Tweaks For '" + key2 + "' While Looking For '" + obj.name + "'")); } } } public static void Modify(CustomAssetsLibraryPlugin.Data.AssetInfo baseObj, string key, object value) { if (CustomAssetsLibraryPlugin.Diagnostics() >= CustomAssetsLibraryPlugin.DiagnosticMode.ultra) { Debug.Log((object)("Custom Asset Library Plugin: Tweak: Tweaking object '" + baseObj.name + "' property '" + key + "' To '" + value?.ToString() + "'")); } string text = ""; if (key.Contains(".")) { text = key.Substring(key.LastIndexOf(".") + 1); key = key.Substring(0, key.LastIndexOf(".")); } else { text = key; key = ""; } object parent = baseObj; if (key != "") { string[] array = key.Split(new char[1] { '.' }); foreach (string childName in array) { parent = GetObject(parent, childName); } } SetValue(parent, text, value); if (CustomAssetsLibraryPlugin.Diagnostics() >= CustomAssetsLibraryPlugin.DiagnosticMode.ultra) { Debug.Log((object)("Custom Asset Library Plugin: Tweak: Verifying object '" + baseObj.name + "' property '" + text + "' Value: '" + GetObject(parent, text)?.ToString() + "'")); } } public static object GetObject(object parent, string childName) { try { Type type = parent.GetType(); foreach (FieldInfo runtimeField in type.GetRuntimeFields()) { if (runtimeField.Name == childName) { return runtimeField.GetValue(parent); } } foreach (PropertyInfo runtimeProperty in type.GetRuntimeProperties()) { if (runtimeProperty.Name == childName) { return runtimeProperty.GetValue(parent); } } return null; } catch { Debug.Log((object)("Custom Asset Library Plugin: Tweak: Error Getting '" + childName + "' Of '" + parent.ToString() + "'")); return null; } } public static void SetValue(object parent, string prop, object value) { try { Type type = parent.GetType(); foreach (FieldInfo runtimeField in type.GetRuntimeFields()) { if (runtimeField.Name == prop) { runtimeField.SetValue(parent, value); return; } } foreach (PropertyInfo runtimeProperty in type.GetRuntimeProperties()) { if (runtimeProperty.Name == prop) { runtimeProperty.SetValue(parent, value); break; } } } catch { Debug.Log((object)("Custom Asset Library Plugin: Tweak: Error Setting '" + parent.ToString() + "' Property '" + prop + "' To '" + value?.ToString() + "'")); } } }
CustomAssetsLoader.dll
Decompiled a year agousing System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Cryptography; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Bounce.Singletons; using Bounce.Unmanaged; using CustomAssetDTO.Sentry; using CustomAssetsCompiler.CoreDTO; using CustomAssetsLibrary.Patches; using CustomAssetsLoader; using CustomAssetsLoader.Patches; using CustomAssetsLoader.ReflecExt; using HarmonyLib; using ModdingTales; using Newtonsoft.Json; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("CustomAssetLoader")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("TaleSpire Modding Community")] [assembly: AssemblyProduct("CustomAssetLoader")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4e4deb5e-97f9-4901-bf67-6748a9c1229a")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.1.1.0")] namespace CustomAssetsLibrary.Patches { [HarmonyPatch(typeof(AssetLoadManager), "OnInstanceSetup")] public sealed class AssetLoadManagerOnInstanceSetupPatch { private static string dirPlugin = Paths.PluginPath; public static void Postfix() { string[] directories = Directory.GetDirectories(dirPlugin); for (int i = 0; i < directories.Length; i++) { LoadDirectory(directories[i]); } } public static void LoadDirectory(string directory) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Invalid comparison between Unknown and I4 //IL_0070: Unknown result type (might be due to invalid IL or missing references) if (File.Exists(Path.Combine(directory, "assetpack.id"))) { if ((int)CustomAssetLoader.LogLevel != 1) { Debug.Log((object)("Index found in: " + directory)); } string assetPackName; NGuid guidFromDirectory = GetGuidFromDirectory(directory, out assetPackName); SimpleSingletonBehaviour<AssetLoadManager>.Instance.call("LoadInternalAssetPack", guidFromDirectory, directory); AssetLibraryDbCategorySetupDataPatch.registerPacks.Add(guidFromDirectory, assetPackName); if ((int)CustomAssetLoader.LogLevel != 1) { Debug.Log((object)$"Pack {guidFromDirectory} Loaded"); } } } private static NGuid GetGuidFromDirectory(string directory, out string assetPackName) { //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) Index val; if (File.Exists(Path.Combine(directory, "assetpack.id"))) { string[] array = (from s in File.ReadAllText(Path.Combine(directory, "assetpack.id")).Split(',') select s.Replace(",", "")).ToArray(); if (array.Length < 2) { val = JsonConvert.DeserializeObject<Index>(File.ReadAllText(Path.Combine(directory, "index.json")), Utilities.options); File.WriteAllText(Path.Combine(directory, "assetpack.id"), val.assetPackId + "," + val.Name); assetPackName = val.Name; } else { assetPackName = array[1]; } return new NGuid(array[0]); } val = JsonConvert.DeserializeObject<Index>(File.ReadAllText(Path.Combine(directory, "index.json")), Utilities.options); File.WriteAllText(Path.Combine(directory, "assetpack.id"), val.assetPackId + "," + val.Name); assetPackName = val.Name; return new NGuid(val.assetPackId); } internal static NGuid GenerateID(string id) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return new NGuid(Guid.Parse(CreateMD5(id))); } private static string CreateMD5(string input) { if (Guid.TryParse(input, out var _)) { return input; } using MD5 mD = MD5.Create(); byte[] bytes = Encoding.ASCII.GetBytes(input); byte[] array = mD.ComputeHash(bytes); StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < array.Length; i++) { stringBuilder.Append(array[i].ToString("X2")); } return stringBuilder.ToString(); } } } namespace CustomAssetsLoader { [BepInPlugin("org.PM.plugins.CustomAssetLoader", "Custom Asset Loader", "1.1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class CustomAssetLoader : BaseUnityPlugin { public const string Guid = "org.PM.plugins.CustomAssetLoader"; public const string Version = "1.1.1.0"; private const string Name = "Custom Asset Loader"; internal static Harmony harmony; internal static ConfigFile ConfigWriter; internal static ManualLogSource _logger; internal static ConfigEntry<LogLevel> _logLevel { get; set; } internal static ConfigEntry<bool> abExperiment { get; set; } internal static LogLevel LogLevel { get { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) if ((int)_logLevel.Value != 0) { return _logLevel.Value; } return ModdingUtils.LogLevelConfig.Value; } } public static void DoPatching() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 harmony = new Harmony("org.PM.plugins.CustomAssetLoader"); harmony.PatchAll(); if ((int)LogLevel > 1) { _logger.LogInfo((object)"Patched."); } } public static void UnPatch() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 harmony.UnpatchSelf(); if ((int)LogLevel > 1) { _logger.LogInfo((object)"Unpatched."); } } public static void DoConfig(ConfigFile Config) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 ConfigWriter = Config; _logLevel = Config.Bind<LogLevel>("Logging", "Log Level", (LogLevel)0, (ConfigDescription)null); abExperiment = Config.Bind<bool>("UI", "Experimental Asset Browser", false, (ConfigDescription)null); if ((int)LogLevel > 1) { _logger.LogInfo((object)"Config Bound."); } } private void Awake() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 _logger = ((BaseUnityPlugin)this).Logger; DoConfig(((BaseUnityPlugin)this).Config); DoPatching(); if ((int)LogLevel > 1) { _logger.LogInfo((object)"Custom Asset Loader is Active."); } } public static NGuid GenerateID(string id) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return AssetLoadManagerOnInstanceSetupPatch.GenerateID(id); } } } namespace CustomAssetsLoader.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { resourceMan = new ResourceManager("CustomAssetsLoader.Properties.Resources", typeof(Resources).Assembly); } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal Resources() { } } } namespace CustomAssetsLoader.Patches { [HarmonyPatch(typeof(AssetLibraryDbCategory), "SetupData")] internal sealed class AssetBrowserPatch { private static Dictionary<NGuid, string> registerPacks = new Dictionary<NGuid, string>(); public static void Prefix(ref List<AssetCampaignSetting> ___includedSettings) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown foreach (KeyValuePair<NGuid, string> pack in registerPacks) { AssetCampaignSetting item; if (___includedSettings.All((AssetCampaignSetting c) => c.CampaignSettingName != pack.Value)) { item = new AssetCampaignSetting { name = pack.Value }; ___includedSettings.Add(item); } item = ___includedSettings.Single((AssetCampaignSetting c) => c.CampaignSettingName == pack.Value); } } } [HarmonyPatch(typeof(AssetLibraryDbCategory), "SetupData")] internal sealed class AssetLibraryDbCategorySetupDataPatch { internal static Dictionary<NGuid, string> registerPacks = new Dictionary<NGuid, string>(); public static void Prefix(ref List<AssetCampaignSetting> ___includedSettings) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Invalid comparison between Unknown and I4 //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) if (!CustomAssetLoader.abExperiment.Value) { return; } foreach (KeyValuePair<NGuid, string> pack in registerPacks) { if ((int)CustomAssetLoader.LogLevel > 3) { CustomAssetLoader._logger.LogInfo((object)pack); } NGuid key; if (___includedSettings.All((AssetCampaignSetting c) => c.CampaignSettingName != pack.Value)) { AssetCampaignSetting val = ScriptableObject.CreateInstance<AssetCampaignSetting>(); val.SetValue("campaignSettingName", pack.Value); List<string> value = val.GetValue<AssetCampaignSetting, List<string>>("includedPackageIdStrings"); key = pack.Key; value.Add(((object)(NGuid)(ref key)).ToString()); val.IncludedPackageIds.Add(pack.Key); val.IncludeInSearch = true; val.Expanded = true; ___includedSettings.Add(val); if ((int)CustomAssetLoader.LogLevel > 3) { CustomAssetLoader._logger.LogInfo((object)$"Added new settings with {pack.Key} {pack.Value}"); } } else if (!___includedSettings.Single((AssetCampaignSetting c) => c.CampaignSettingName == pack.Value).IncludedPackageIds.Contains(pack.Key)) { AssetCampaignSetting obj = ___includedSettings.Single((AssetCampaignSetting c) => c.CampaignSettingName == pack.Value); List<string> value2 = obj.GetValue<AssetCampaignSetting, List<string>>("includedPackageIdStrings"); key = pack.Key; value2.Add(((object)(NGuid)(ref key)).ToString()); obj.IncludedPackageIds.Add(pack.Key); if ((int)CustomAssetLoader.LogLevel > 3) { CustomAssetLoader._logger.LogInfo((object)$"Added {pack.Key} {pack.Value} to existing settings"); } } } } } [HarmonyPatch(typeof(AssetLibraryDbCategory), "GetFolderGroupCount")] internal sealed class AssetLibraryDbGetFolderGroupCountPatch { public static bool Prefix(ref List<AssetCampaignSetting> ___includedSettings, ref int __result) { if (!CustomAssetLoader.abExperiment.Value) { return true; } __result = ___includedSettings.Count; return false; } } [HarmonyPatch(typeof(AssetLibraryDbCategory), "GetFolderGroupName")] internal sealed class AssetLibraryDbGetFolderGroupNamePatch { public static bool Prefix(ref List<AssetCampaignSetting> ___includedSettings, ref int index, ref string __result) { if (!CustomAssetLoader.abExperiment.Value) { return true; } __result = ___includedSettings[index].CampaignSettingName; return false; } } } namespace CustomAssetsLoader.ReflecExt { public static class SysReflec { public static object call(this object o, string methodName, params object[] args) { MethodInfo method = o.GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); return method?.Invoke(method.IsStatic ? null : o, args); } public static object call<T>(this object o, string methodName, params object[] args) { MethodInfo method = o.GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic, null, new Type[1] { typeof(T) }, null); if (method != null) { return method.Invoke(o, args); } return null; } public static void call<T>(string methodName, params object[] args) { Assembly.GetExecutingAssembly().GetType(typeof(T).Namespace).GetMethod(methodName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic) .Invoke(null, args); } public static I GetValue<T, I>(this T t, string methodName) { return (I)(typeof(T).GetField(methodName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic)?.GetValue(t)); } public static I GetValue<T, I>(string methodName) { return (I)(typeof(T).GetField(methodName, BindingFlags.Static | BindingFlags.NonPublic)?.GetValue(null)); } public static void SetValue(this object o, string methodName, object value) { FieldInfo field = o.GetType().GetField(methodName, BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(o, value); } } public static Action<T1> GetMethod<T1>(this object o, string methodName) { MethodInfo method = o.GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic); if (method != null) { return (Action<T1>)Delegate.CreateDelegate(typeof(Action<T1>), method); } return null; } } }
CustomPlaceablesPatch.dll
Decompiled a year agousing System.CodeDom.Compiler; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using ModdingTales; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("CustomPlaceablePatcher")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("TaleSpire Modding Community")] [assembly: AssemblyProduct("CustomPlaceablePatcher")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4e4deb5e-97f9-4901-bf67-6748a9c1229a")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.1.1.0")] namespace CustomAssetsLoader { [BepInPlugin("org.PM.plugins.CustomPlaceablePatcher", "Custom Asset Loader", "1.1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class CustomPlaceablePatcher : BaseUnityPlugin { public const string Guid = "org.PM.plugins.CustomPlaceablePatcher"; public const string Version = "1.1.1.0"; private const string Name = "Custom Asset Loader"; internal static Harmony harmony; internal static ConfigFile ConfigWriter; internal static ManualLogSource _logger; internal static ConfigEntry<LogLevel> _logLevel { get; set; } internal static ConfigEntry<bool> abExperiment { get; set; } internal static LogLevel LogLevel { get { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) if ((int)_logLevel.Value != 0) { return _logLevel.Value; } return ModdingUtils.LogLevelConfig.Value; } } public static void DoPatching() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 harmony = new Harmony("org.PM.plugins.CustomPlaceablePatcher"); harmony.PatchAll(); if ((int)LogLevel > 1) { _logger.LogInfo((object)"Patched."); } } public static void UnPatch() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 harmony.UnpatchSelf(); if ((int)LogLevel > 1) { _logger.LogInfo((object)"Unpatched."); } } public static void DoConfig(ConfigFile Config) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 ConfigWriter = Config; _logLevel = Config.Bind<LogLevel>("Logging", "Log Level", (LogLevel)0, (ConfigDescription)null); abExperiment = Config.Bind<bool>("UI", "Experimental Asset Browser", false, (ConfigDescription)null); if ((int)LogLevel > 1) { _logger.LogInfo((object)"Config Bound."); } } private void Awake() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 _logger = ((BaseUnityPlugin)this).Logger; DoConfig(((BaseUnityPlugin)this).Config); DoPatching(); if ((int)LogLevel > 1) { _logger.LogInfo((object)"Custom Asset Loader is Active."); } } } } namespace CustomAssetsLoader.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { resourceMan = new ResourceManager("CustomAssetsLoader.Properties.Resources", typeof(Resources).Assembly); } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal Resources() { } } }