using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using WildSkies.Gameplay.Building;
using WildSkies.Gameplay.ShipBuilding;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("ResizeMapTable")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Nines (Natives)")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ResizeMapTable")]
[assembly: AssemblyTitle("ResizeMapTable")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace ResizeMapTable
{
[BepInPlugin("ResizeMapTable", "ResizeMapTable", "1.0.0")]
public class Plugin : BasePlugin
{
private class ResizeMapTableSimpleChatCommands
{
public static string Scale(float value)
{
if (value <= 0f)
{
ResizeMapTable_Scale.Value = (float)((ConfigEntryBase)ResizeMapTable_Scale).DefaultValue;
}
else
{
ResizeMapTable_Scale.Value = value;
}
return $"Map table scale now set to {value}.";
}
}
internal static ManualLogSource Log;
internal static Harmony harmonyInstance;
private static ConfigEntry<float> ResizeMapTable_Scale;
public override void Load()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
Log = ((BasePlugin)this).Log;
ManualLogSource log = Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ResizeMapTable");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
}
log.LogInfo(val);
ResizeMapTable_Scale = ((BasePlugin)this).Config.Bind<float>("ResizeMapTable", "Scale", 0.75f, "ResizeMapTable.Scale");
harmonyInstance = Harmony.CreateAndPatchAll(typeof(Plugin), (string)null);
}
public override bool Unload()
{
Harmony obj = harmonyInstance;
if (obj != null)
{
obj.UnpatchSelf();
}
return true;
}
[HarmonyPatch(typeof(ShipFrameBuilder), "UpdateHullObjectDetails")]
[HarmonyPostfix]
public static void ShipFrameBuilder_UpdateHullObjectDetails(ShipFrameBuilder __instance, GameObject shipPartGameObject)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
if (!(shipPartGameObject.GetComponent<BuildableAsset>().Id != "ship.part.table.map.1"))
{
Vector3 localScale = Vector3.one * ResizeMapTable_Scale.Value;
shipPartGameObject.transform.Find("map_table/collision").localScale = localScale;
shipPartGameObject.transform.localScale = localScale;
}
}
[HarmonyPatch(typeof(CraftingToolController), "SetBuildableItemToPlace")]
[HarmonyPrefix]
public static void CraftingToolController_UpdatePlacementStamp(CraftingToolController __instance, BuildableItemDefinition assetData, PlacementStampController placementStamp)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: 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_0066: Unknown result type (might be due to invalid IL or missing references)
if (assetData.ItemId != "ship.part.table.map.1")
{
return;
}
Vector3 localScale = Vector3.one * ResizeMapTable_Scale.Value;
foreach (ClearanceVolume componentsInChild in ((Component)placementStamp).GetComponentsInChildren<ClearanceVolume>())
{
((Component)componentsInChild).gameObject.transform.localScale = localScale;
}
((Component)placementStamp).transform.localScale = localScale;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "ResizeMapTable";
public const string PLUGIN_NAME = "ResizeMapTable";
public const string PLUGIN_VERSION = "1.0.0";
}
}