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.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("MissingPieces")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MissingPieces")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("2.2.2")]
[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("2.2.2.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;
}
}
}
public class CustomInteract : MonoBehaviour, Hoverable, Interactable
{
public string Name = "";
public string DefaultInteract = "";
public string AlternateInteract = "";
public Container Container;
public Sign Sign;
public void Awake()
{
if ((Object)(object)Container == (Object)null)
{
Container = ((Component)this).GetComponent<Container>();
}
if ((Object)(object)Sign == (Object)null)
{
Sign = ((Component)this).GetComponent<Sign>();
}
}
public bool Interact(Humanoid user, bool hold, bool alt)
{
if (alt)
{
return Sign.Interact(user, hold, alt);
}
return Container.Interact(user, hold, alt);
}
public string GetHoverText()
{
return Localization.instance.Localize(Name + "\n[<color=yellow><b>$KEY_Use</b></color>] " + DefaultInteract + "\n[<color=yellow><b>Shift $KEY_Use</b></color>] " + AlternateInteract);
}
public string GetHoverName()
{
return Localization.instance.Localize(Name);
}
public bool UseItem(Humanoid user, ItemData item)
{
return false;
}
}
namespace MissingPieces
{
[BepInPlugin("com.Bento.MissingPieces", "MissingPieces", "2.2.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
internal class MissingPiecesPlugin : BaseUnityPlugin
{
[Serializable]
public struct PieceConfiguration
{
public string Prefab;
public PieceConfig Config;
}
public const string PluginGUID = "com.Bento.MissingPieces";
public const string PluginName = "MissingPieces";
public const string PluginVersion = "2.2.2";
public static CustomLocalization Localization = LocalizationManager.Instance.GetLocalization();
public void Awake()
{
AddMissingPieces();
string text = AssetUtils.LoadTextFromResources("Localization.Chinese.json", Assembly.GetExecutingAssembly());
Localization.AddJsonFile("Chinese", text);
Localization.AddJsonFile("Chinese_Trad", text);
text = AssetUtils.LoadTextFromResources("Localization.English.json", Assembly.GetExecutingAssembly());
Localization.AddJsonFile("English", text);
text = AssetUtils.LoadTextFromResources("Localization.French.json", Assembly.GetExecutingAssembly());
Localization.AddJsonFile("French", text);
text = AssetUtils.LoadTextFromResources("Localization.German.json", Assembly.GetExecutingAssembly());
Localization.AddJsonFile("German", text);
text = AssetUtils.LoadTextFromResources("Localization.Polish.json", Assembly.GetExecutingAssembly());
Localization.AddJsonFile("Polish", text);
text = AssetUtils.LoadTextFromResources("Localization.Korean.json", Assembly.GetExecutingAssembly());
Localization.AddJsonFile("Korean", text);
text = AssetUtils.LoadTextFromResources("Localization.Russian.json", Assembly.GetExecutingAssembly());
Localization.AddJsonFile("Russian", text);
text = AssetUtils.LoadTextFromResources("Localization.Ukrainian.json", Assembly.GetExecutingAssembly());
Localization.AddJsonFile("Ukrainian", text);
Logger.LogInfo((object)"Missing Pieces landed!");
}
private List<PieceConfiguration> LoadJsons()
{
string text = AssetUtils.LoadTextFromResources("Configurations.json", Assembly.GetExecutingAssembly());
try
{
return JsonConvert.DeserializeObject<List<PieceConfiguration>>(text);
}
catch
{
Logger.LogError((object)"Issue loading pieces! Contact the mod author.");
}
return new List<PieceConfiguration>();
}
private void AddMissingPieces()
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
AssetBundle val = AssetUtils.LoadAssetBundleFromResources("missing_pieces", Assembly.GetExecutingAssembly());
foreach (PieceConfiguration item in LoadJsons())
{
GameObject val2 = val.LoadAsset<GameObject>(item.Prefab);
PieceManager.Instance.AddPiece(new CustomPiece(val2, true, item.Config));
}
}
}
}