using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
using UnityEngine.SceneManagement;
using cakeslice;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Inclinometer Mod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Inclinometer Mod")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("dda37b61-28b6-4e8e-9a39-1f1807261c65")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace KemyNavTools;
public class CompassPhysics : MonoBehaviour
{
private ShipItem shipItem;
private Transform compassCardTransform;
private Transform sightingVaneTransform;
[Header("Physics Smoothness")]
public float cardSmoothness = 2.5f;
public float vaneSmoothness = 5f;
private readonly Vector3 vaneUpRotation = new Vector3(0f, 0f, 0f);
private readonly Vector3 vaneFoldedRotation = new Vector3(270f, 0f, 0f);
private float currentVanePitch = 270f;
private void Start()
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
shipItem = ((Component)this).GetComponent<ShipItem>();
compassCardTransform = ((Component)this).transform.Find("CompassCard");
sightingVaneTransform = ((Component)this).transform.Find("SightingVane");
if ((Object)(object)sightingVaneTransform != (Object)null)
{
sightingVaneTransform.localRotation = Quaternion.Euler(vaneFoldedRotation);
}
}
private void LateUpdate()
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: 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)
//IL_0056: 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_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)shipItem == (Object)null))
{
if ((Object)(object)compassCardTransform != (Object)null)
{
float y = ((Component)this).transform.eulerAngles.y;
Quaternion val = Quaternion.Euler(0f, 0f - y, 0f);
compassCardTransform.localRotation = Quaternion.Slerp(compassCardTransform.localRotation, val, Time.deltaTime * cardSmoothness);
}
if ((Object)(object)sightingVaneTransform != (Object)null)
{
float num = (Object.op_Implicit((Object)(object)((PickupableItem)shipItem).held) ? vaneUpRotation.x : vaneFoldedRotation.x);
currentVanePitch = Mathf.MoveTowardsAngle(currentVanePitch, num, vaneSmoothness * 50f * Time.deltaTime);
sightingVaneTransform.localRotation = Quaternion.Euler(currentVanePitch, 0f, 0f);
}
}
}
}
public static class CompassSetup
{
public static void Configure(GameObject prefab)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)prefab == (Object)null))
{
prefab.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
Rigidbody val = prefab.GetComponent<Rigidbody>() ?? prefab.AddComponent<Rigidbody>();
val.mass = 2f;
val.isKinematic = true;
SaveablePrefab val2 = prefab.GetComponent<SaveablePrefab>() ?? prefab.AddComponent<SaveablePrefab>();
val2.prefabIndex = 831;
ShipItem val3 = prefab.GetComponent<ShipItem>() ?? prefab.AddComponent<ShipItem>();
val3.name = "bearing compass";
val3.value = 250;
val3.mass = 2f;
val3.category = (TransactionCategory)3;
val3.wallAttachment = false;
((PickupableItem)val3).holdDistance = 0.4f;
((PickupableItem)val3).furniturePlaceHeight = 0.05f;
if ((Object)(object)prefab.GetComponent<CompassPhysics>() == (Object)null)
{
prefab.AddComponent<CompassPhysics>();
}
Outline[] componentsInChildren = prefab.GetComponentsInChildren<Outline>(true);
Outline[] array = componentsInChildren;
foreach (Outline val4 in array)
{
Object.DestroyImmediate((Object)(object)val4, true);
}
MeshRenderer component = prefab.GetComponent<MeshRenderer>();
if ((Object)(object)component != (Object)null)
{
typeof(ShipItem).GetField("renderer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(val3, component);
}
}
}
}
public class BinnaclePhysics : MonoBehaviour
{
private Component shipItemComponent;
private Transform gimbalRing1;
private Transform compassBody;
private Transform compassFace;
private Transform inclinometerArm;
[Header("Gimbal Responsiveness")]
public float gimbalSmoothness = 5f;
public float compassSmoothness = 2.5f;
public float inclinometerSmoothness = 18f;
private void Start()
{
shipItemComponent = (Component)(((object)((Component)this).GetComponent<ShipItemLight>()) ?? ((object)((Component)this).GetComponent<ShipItem>()));
inclinometerArm = ((Component)this).transform.Find("InclinometerArm");
gimbalRing1 = ((Component)this).transform.Find("GimbalRing1");
if ((Object)(object)gimbalRing1 != (Object)null)
{
compassBody = gimbalRing1.Find("CompassBody");
if ((Object)(object)compassBody != (Object)null)
{
compassFace = compassBody.Find("CompassFace");
}
}
if ((Object)(object)gimbalRing1 == (Object)null || (Object)(object)compassBody == (Object)null || (Object)(object)compassFace == (Object)null || (Object)(object)inclinometerArm == (Object)null)
{
InclinometerPlugin.DiagLogger.LogError((object)"[NAV SUITE] Binnacle is missing one or more required child transforms in its expanded hierarchy!");
}
}
private void LateUpdate()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: 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_0040: 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)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: 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_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: 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_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0201: Unknown result type (might be due to invalid IL or missing references)
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)shipItemComponent == (Object)null))
{
Vector3 val;
if ((Object)(object)gimbalRing1 != (Object)null)
{
val = Vector3.ProjectOnPlane(Vector3.up, ((Component)this).transform.right);
Vector3 normalized = ((Vector3)(ref val)).normalized;
float num = Vector3.SignedAngle(((Component)this).transform.up, normalized, ((Component)this).transform.right);
Quaternion val2 = Quaternion.Euler(num, 0f, 0f);
gimbalRing1.localRotation = Quaternion.Slerp(gimbalRing1.localRotation, val2, Time.deltaTime * gimbalSmoothness);
}
if ((Object)(object)compassBody != (Object)null)
{
val = Vector3.ProjectOnPlane(Vector3.up, gimbalRing1.forward);
Vector3 normalized2 = ((Vector3)(ref val)).normalized;
float num2 = Vector3.SignedAngle(gimbalRing1.up, normalized2, gimbalRing1.forward);
Quaternion val3 = Quaternion.Euler(0f, 0f, num2);
compassBody.localRotation = Quaternion.Slerp(compassBody.localRotation, val3, Time.deltaTime * gimbalSmoothness);
}
if ((Object)(object)compassFace != (Object)null)
{
float y = compassBody.eulerAngles.y;
Quaternion val4 = Quaternion.Euler(0f, 0f - y, 0f);
compassFace.localRotation = Quaternion.Slerp(compassFace.localRotation, val4, Time.deltaTime * compassSmoothness);
}
if ((Object)(object)inclinometerArm != (Object)null)
{
Vector3 right = ((Component)this).transform.right;
float num3 = Mathf.Atan2(Vector3.Dot(Vector3.up, right), Vector3.Dot(Vector3.up, Vector3.up)) * 57.29578f;
Quaternion val5 = Quaternion.Euler(0f, 0f, 0f - num3);
inclinometerArm.localRotation = Quaternion.Slerp(inclinometerArm.localRotation, val5, Time.deltaTime * inclinometerSmoothness);
}
}
}
}
public static class BinnacleSetup
{
public static void Configure(GameObject prefab)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)prefab == (Object)null))
{
prefab.transform.localScale = new Vector3(1f, 1f, 1f);
Rigidbody val = prefab.GetComponent<Rigidbody>() ?? prefab.AddComponent<Rigidbody>();
val.mass = 15f;
val.isKinematic = true;
SaveablePrefab val2 = prefab.GetComponent<SaveablePrefab>() ?? prefab.AddComponent<SaveablePrefab>();
val2.prefabIndex = 832;
ShipItem val3 = prefab.GetComponent<ShipItem>() ?? prefab.AddComponent<ShipItem>();
val3.name = "binnacle";
val3.value = 500;
val3.mass = 15f;
val3.category = (TransactionCategory)3;
val3.wallAttachment = false;
((PickupableItem)val3).holdDistance = 0.7f;
((PickupableItem)val3).furniturePlaceHeight = 0.5f;
if ((Object)(object)prefab.GetComponent<BinnaclePhysics>() == (Object)null)
{
prefab.AddComponent<BinnaclePhysics>();
}
Outline[] componentsInChildren = prefab.GetComponentsInChildren<Outline>(true);
Outline[] array = componentsInChildren;
foreach (Outline val4 in array)
{
Object.DestroyImmediate((Object)(object)val4, true);
}
MeshRenderer component = prefab.GetComponent<MeshRenderer>();
if ((Object)(object)component != (Object)null)
{
typeof(ShipItem).GetField("renderer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(val3, component);
}
}
}
}
public static class InclinometerSetup
{
public static void Configure(GameObject prefab)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)prefab == (Object)null))
{
prefab.transform.localScale = new Vector3(0.4f, 0.4f, 0.4f);
Rigidbody val = prefab.GetComponent<Rigidbody>() ?? prefab.AddComponent<Rigidbody>();
val.mass = 3f;
val.isKinematic = true;
SaveablePrefab val2 = prefab.GetComponent<SaveablePrefab>() ?? prefab.AddComponent<SaveablePrefab>();
val2.prefabIndex = 830;
ShipItem val3 = prefab.GetComponent<ShipItem>() ?? prefab.AddComponent<ShipItem>();
val3.name = "inclinometer";
val3.value = 180;
val3.mass = 3f;
val3.category = (TransactionCategory)3;
val3.wallAttachment = true;
((PickupableItem)val3).holdDistance = 0.5f;
((PickupableItem)val3).furniturePlaceHeight = 0.05f;
if ((Object)(object)prefab.GetComponent<InclinometerPhysics>() == (Object)null)
{
prefab.AddComponent<InclinometerPhysics>();
}
Outline[] componentsInChildren = prefab.GetComponentsInChildren<Outline>(true);
Outline[] array = componentsInChildren;
foreach (Outline val4 in array)
{
Object.DestroyImmediate((Object)(object)val4, true);
}
MeshRenderer component = prefab.GetComponent<MeshRenderer>();
if ((Object)(object)component != (Object)null)
{
typeof(ShipItem).GetField("renderer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(val3, component);
}
}
}
}
[BepInPlugin("com.larsonlogistics.sailwind.navsuite", "Navigation Suite Mod", "1.0.0")]
public class InclinometerPlugin : BaseUnityPlugin
{
public static ManualLogSource DiagLogger;
public static AssetBundle MainAssetBundle;
private static readonly string assetBundleName = "navigation_suite_assets";
private void Awake()
{
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Expected O, but got Unknown
DiagLogger = ((BaseUnityPlugin)this).Logger;
DiagLogger.LogInfo((object)"[NAV SUITE] Initialization lifecycle activated.");
string location = Assembly.GetExecutingAssembly().Location;
string directoryName = Path.GetDirectoryName(location);
string text = Path.Combine(directoryName, assetBundleName);
if (File.Exists(text))
{
MainAssetBundle = AssetBundle.LoadFromFile(text);
DiagLogger.LogInfo((object)"[NAV SUITE] Asset bundle successfully loaded.");
}
else
{
DiagLogger.LogError((object)("[NAV SUITE] Critical Error: Asset bundle missing at " + text));
}
Harmony val = new Harmony("com.larsonlogistics.sailwind.navsuite");
val.PatchAll();
SceneManager.sceneLoaded += ShopInjection.OnSceneLoaded;
}
private void OnDestroy()
{
if ((Object)(object)MainAssetBundle != (Object)null)
{
MainAssetBundle.Unload(false);
}
}
}
[HarmonyPatch(typeof(GPButtonInventorySlot), "InsertItem")]
public static class InventoryDisplayPatch
{
[HarmonyPostfix]
public static void Postfix(ShipItem item)
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)item == (Object)null))
{
SaveablePrefab component = ((Component)item).GetComponent<SaveablePrefab>();
if (!((Object)(object)component == (Object)null) && (component.prefabIndex == 830 || component.prefabIndex == 831))
{
Transform transform = ((Component)item).transform;
transform.localRotation *= Quaternion.Euler(0f, 180f, 0f);
}
}
}
}
[HarmonyPatch(typeof(PrefabsDirectory), "PopulateShipItems")]
public static class PreloadDirectoryPatch
{
private const int INCLINOMETER_INDEX = 830;
private const int COMPASS_INDEX = 831;
private const int BINNACLE_INDEX = 832;
private static GameObject inclinometerPrefab;
private static GameObject compassPrefab;
private static GameObject binnaclePrefab;
public static GameObject InclinometerPrefabRef => inclinometerPrefab;
public static GameObject CompassPrefabRef => compassPrefab;
public static GameObject BinnaclePrefabRef => binnaclePrefab;
[HarmonyPrefix]
public static void Prefix(PrefabsDirectory __instance)
{
if (__instance.directory == null)
{
return;
}
try
{
if (__instance.directory.Length <= 832)
{
Array.Resize(ref __instance.directory, 842);
}
}
catch (Exception arg)
{
InclinometerPlugin.DiagLogger.LogError((object)$"[NAV SUITE] Prefix array resize failed: {arg}");
}
}
[HarmonyPostfix]
public static void Postfix(PrefabsDirectory __instance)
{
if ((Object)(object)InclinometerPlugin.MainAssetBundle == (Object)null)
{
return;
}
try
{
if ((Object)(object)inclinometerPrefab == (Object)null)
{
inclinometerPrefab = InclinometerPlugin.MainAssetBundle.LoadAsset<GameObject>("Inclinometer");
InclinometerSetup.Configure(inclinometerPrefab);
}
__instance.directory[830] = inclinometerPrefab;
if ((Object)(object)compassPrefab == (Object)null)
{
compassPrefab = InclinometerPlugin.MainAssetBundle.LoadAsset<GameObject>("BearingCompass");
if ((Object)(object)compassPrefab != (Object)null)
{
CompassSetup.Configure(compassPrefab);
}
else
{
InclinometerPlugin.DiagLogger.LogError((object)"[NAV SUITE] Critical Error: BearingCompass prefab not found in bundle!");
}
}
__instance.directory[831] = compassPrefab;
if ((Object)(object)binnaclePrefab == (Object)null)
{
binnaclePrefab = InclinometerPlugin.MainAssetBundle.LoadAsset<GameObject>("Binnacle");
if ((Object)(object)binnaclePrefab != (Object)null)
{
BinnacleSetup.Configure(binnaclePrefab);
}
else
{
InclinometerPlugin.DiagLogger.LogError((object)"[NAV SUITE] Critical Error: Binnacle prefab not found in bundle!");
}
}
__instance.directory[832] = binnaclePrefab;
}
catch (Exception arg)
{
InclinometerPlugin.DiagLogger.LogError((object)$"[NAV SUITE] Postfix directory mapping failed: {arg}");
}
}
}
public static class ShopInjection
{
private static bool spawnedGRC;
private static bool spawnedBinnacleGRC;
private static bool spawnedAestrin;
private static bool spawnedBinnacleAestrin;
private static bool spawnedDragonCliffs;
private static bool spawnedBinnacleDragonCliffs;
public static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Expected O, but got Unknown
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
//IL_030c: Unknown result type (might be due to invalid IL or missing references)
//IL_0320: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Unknown result type (might be due to invalid IL or missing references)
//IL_0271: Unknown result type (might be due to invalid IL or missing references)
//IL_035f: Unknown result type (might be due to invalid IL or missing references)
//IL_0373: Unknown result type (might be due to invalid IL or missing references)
string text = ((Scene)(ref scene)).name.ToLower();
if (text.Contains("main menu"))
{
spawnedGRC = false;
spawnedBinnacleGRC = false;
spawnedAestrin = false;
spawnedBinnacleAestrin = false;
spawnedDragonCliffs = false;
spawnedBinnacleDragonCliffs = false;
return;
}
GameObject val = GameObject.Find("ShopItemSpawnerRunner");
if ((Object)(object)val == (Object)null)
{
val = new GameObject("ShopItemSpawnerRunner");
Object.DontDestroyOnLoad((Object)(object)val);
}
CoroutineRunner coroutineRunner = val.GetComponent<CoroutineRunner>() ?? val.AddComponent<CoroutineRunner>();
if (text.Contains("gold rock"))
{
if (!spawnedGRC)
{
((MonoBehaviour)coroutineRunner).StartCoroutine(DelayedInjectionRoutine("island 1 A (gold rock) scenery", "GRC", new Vector3(1520f, 7.52f, -380.5f), Quaternion.Euler(77.5f, 241f, 0f), 830));
((MonoBehaviour)coroutineRunner).StartCoroutine(DelayedInjectionRoutine("island 1 A (gold rock) scenery", "GRC", new Vector3(1522.568f, 7.52f, -383.791f), Quaternion.Euler(343.5f, 237.5f, 0f), 831));
}
if (!spawnedBinnacleGRC)
{
((MonoBehaviour)coroutineRunner).StartCoroutine(DelayedInjectionRoutine("island 1 A (gold rock) scenery", "GRC_BINNACLE", new Vector3(1521.5f, 5.55f, -378f), Quaternion.Euler(0f, -90f, 0f), 832));
}
}
if (text.Contains("island 15 m (fort)"))
{
if (!spawnedAestrin)
{
((MonoBehaviour)coroutineRunner).StartCoroutine(DelayedInjectionRoutine("island 15 M (Fort) scenery", "FA", new Vector3(-76.904f, 2.87f, 44.645f), Quaternion.Euler(271f, 180f, 0f), 831));
((MonoBehaviour)coroutineRunner).StartCoroutine(DelayedInjectionRoutine("island 15 M (Fort) scenery", "FA", new Vector3(-73.704f, 2.87f, 44.62f), Quaternion.Euler(0f, 180f, 0f), 830));
}
if (!spawnedBinnacleAestrin)
{
((MonoBehaviour)coroutineRunner).StartCoroutine(DelayedInjectionRoutine("island 15 M (Fort) scenery", "FA_BINNACLE", new Vector3(-72.504f, 2.17f, 44.82f), Quaternion.Euler(0f, 135f, 0f), 832));
}
}
if (text.Contains("island 9 e dragon cliffs"))
{
if (!spawnedDragonCliffs)
{
((MonoBehaviour)coroutineRunner).StartCoroutine(DelayedInjectionRoutine("island 9 E (dragon cliffs) scenery", "DC", new Vector3(-91.312f, 5.272f, -541.35f), Quaternion.Euler(89f, 44.6f, 0f), 831));
((MonoBehaviour)coroutineRunner).StartCoroutine(DelayedInjectionRoutine("island 9 E (dragon cliffs) scenery", "DC", new Vector3(-91.329f, 4.762f, -541.365f), Quaternion.Euler(0f, 224.6f, 0f), 830));
}
if (!spawnedBinnacleDragonCliffs)
{
((MonoBehaviour)coroutineRunner).StartCoroutine(DelayedInjectionRoutine("island 9 E (dragon cliffs) scenery", "DC_BINNACLE", new Vector3(-91.729f, 3.662f, -541.765f), Quaternion.Euler(0f, 134.6f, 0f), 832));
}
}
}
private static IEnumerator DelayedInjectionRoutine(string parentSceneryName, string regionKey, Vector3 localPos, Quaternion localRot, int itemIndex)
{
//IL_0015: 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_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
yield return (object)new WaitForSeconds(3f);
GameObject targetPrefab = null;
switch (itemIndex)
{
case 830:
targetPrefab = PreloadDirectoryPatch.InclinometerPrefabRef;
break;
case 831:
targetPrefab = PreloadDirectoryPatch.CompassPrefabRef;
break;
case 832:
targetPrefab = PreloadDirectoryPatch.BinnaclePrefabRef;
break;
}
if ((Object)(object)targetPrefab == (Object)null || (regionKey == "GRC" && spawnedGRC) || (regionKey == "GRC_BINNACLE" && spawnedBinnacleGRC) || (regionKey == "FA" && spawnedAestrin) || (regionKey == "FA_BINNACLE" && spawnedBinnacleAestrin) || (regionKey == "DC" && spawnedDragonCliffs) || (regionKey == "DC_BINNACLE" && spawnedBinnacleDragonCliffs))
{
yield break;
}
GameObject sceneryRoot = GameObject.Find(parentSceneryName);
if ((Object)(object)sceneryRoot == (Object)null)
{
yield break;
}
try
{
string itemLabel = "tool";
switch (itemIndex)
{
case 830:
itemLabel = "inclinometer";
break;
case 831:
itemLabel = "compass";
break;
case 832:
itemLabel = "binnacle";
break;
}
GameObject spawnerNode = new GameObject("shop item spawner (" + itemLabel + " " + regionKey + ")");
spawnerNode.transform.parent = sceneryRoot.transform;
spawnerNode.transform.localPosition = localPos;
spawnerNode.transform.localRotation = localRot;
MeshFilter masterFilter = targetPrefab.GetComponent<MeshFilter>() ?? targetPrefab.GetComponentInChildren<MeshFilter>();
if ((Object)(object)masterFilter != (Object)null)
{
MeshFilter filter = spawnerNode.AddComponent<MeshFilter>();
filter.mesh = masterFilter.mesh;
spawnerNode.AddComponent<MeshRenderer>();
}
ShopItemSpawner nativeSpawner = spawnerNode.AddComponent<ShopItemSpawner>();
nativeSpawner.itemPrefab = targetPrefab;
if (regionKey == "GRC" && itemIndex == 831)
{
spawnedGRC = true;
}
else if (regionKey == "GRC_BINNACLE")
{
spawnedBinnacleGRC = true;
}
else if (regionKey == "FA" && itemIndex == 830)
{
spawnedAestrin = true;
}
else if (regionKey == "FA_BINNACLE")
{
spawnedBinnacleAestrin = true;
}
else if (regionKey == "DC" && itemIndex == 830)
{
spawnedDragonCliffs = true;
}
else if (regionKey == "DC_BINNACLE")
{
spawnedBinnacleDragonCliffs = true;
}
InclinometerPlugin.DiagLogger.LogInfo((object)$"[NAV SUITE] {itemLabel} spawner cleanly deployed at {regionKey}: {localPos}");
}
catch (Exception arg)
{
InclinometerPlugin.DiagLogger.LogError((object)$"[NAV SUITE] Failed injection for {regionKey} ({itemIndex}): {arg}");
}
}
}
public class CoroutineRunner : MonoBehaviour
{
}
public class InclinometerPhysics : MonoBehaviour
{
private ShipItem shipItem;
private Transform indicatorArmTransform;
[Header("Pendulum Smoothness")]
public float swingSmoothness = 18f;
private void Start()
{
shipItem = ((Component)this).GetComponent<ShipItem>();
indicatorArmTransform = ((Component)this).transform.Find("Arm");
if ((Object)(object)indicatorArmTransform == (Object)null)
{
InclinometerPlugin.DiagLogger.LogError((object)"[NAV SUITE] Critical: Couldn't find the 'Arm' child component!");
}
}
private void LateUpdate()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: 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_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: 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_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)shipItem == (Object)null) && !((Object)(object)indicatorArmTransform == (Object)null))
{
Vector3 right = ((Component)this).transform.right;
float num = Mathf.Atan2(Vector3.Dot(Vector3.up, right), Vector3.Dot(Vector3.up, Vector3.up)) * 57.29578f;
Quaternion val = Quaternion.Euler(0f, 0f, 0f - num);
indicatorArmTransform.localRotation = Quaternion.Slerp(indicatorArmTransform.localRotation, val, Time.deltaTime * swingSmoothness);
}
}
}