using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Jotunn;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MoreMissingPieces")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MoreMissingPieces")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b7e2a1c4-5f3d-4e2a-8c1a-2e6f4b9d7a23")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace MoreMissingPieces
{
[BepInPlugin("org.bepinex.plugins.MoreMissingPieces", "MoreMissingPieces", "1.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
internal class MoreMissingPiecesPlugin : BaseUnityPlugin
{
[Serializable]
public struct PieceEntry
{
public string Prefab;
public PieceConfig Config;
}
public const string ModGuid = "org.bepinex.plugins.MoreMissingPieces";
public const string ModName = "MoreMissingPieces";
public const string ModVersion = "1.1.0";
public static CustomLocalization CustomLoc => LocalizationManager.Instance.GetLocalization();
private void Awake()
{
RegisterPieces();
string text = AssetUtils.LoadTextFromResources("Localization.English.json", Assembly.GetExecutingAssembly());
CustomLoc.AddJsonFile("English", text);
}
private List<PieceEntry> GetPieceEntries()
{
string text = AssetUtils.LoadTextFromResources("Configurations.json", Assembly.GetExecutingAssembly());
try
{
return JsonConvert.DeserializeObject<List<PieceEntry>>(text);
}
catch (Exception ex)
{
Logger.LogError((object)("Failed to load piece configurations: " + ex.Message));
return new List<PieceEntry>();
}
}
private void RegisterPieces()
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Expected O, but got Unknown
AssetBundle val = AssetUtils.LoadAssetBundleFromResources("vis_pieces", Assembly.GetExecutingAssembly());
List<PieceEntry> pieceEntries = GetPieceEntries();
foreach (PieceEntry item in pieceEntries)
{
GameObject val2 = val.LoadAsset<GameObject>(item.Prefab);
if ((Object)(object)val2 != (Object)null)
{
PieceManager.Instance.AddPiece(new CustomPiece(val2, true, item.Config));
}
else
{
Logger.LogWarning((object)("Prefab '" + item.Prefab + "' not found in asset bundle."));
}
}
}
}
}