Decompiled source of DangerousWaters v0.1.1
CaelanorHatchFix.dll
Decompiled 9 hours agousing System; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using UnityEngine; [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace CaelanorHatchFix; [BepInPlugin("com.dixiecapt.sailwind.caelanorhatchfix", "Caelanor Hatch Walk Collider Fix", "1.2.0")] public class CaelanorHatchFixPlugin : BaseUnityPlugin { public const string Guid = "com.dixiecapt.sailwind.caelanorhatchfix"; public const string Name = "Caelanor Hatch Walk Collider Fix"; public const string Version = "1.2.0"; internal static CaelanorHatchFixPlugin Instance; internal static ConfigEntry<bool> Enabled; private void Awake() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown Instance = this; Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Shrink the Caelanor cabin hatch's invisible walk collider so it only covers the actual opening. The authored collider is 1.84m long but the hatch only slides 0.85m, so the excess blocks the companionway even when the hatch is open."); MethodInfo methodInfo = AccessTools.Method(typeof(GPButtonTrapdoor), "Awake", (Type[])null, (Type[])null); if (methodInfo == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"[CaelanorHatchFix] GPButtonTrapdoor.Awake not found."); return; } Harmony val = new Harmony("com.dixiecapt.sailwind.caelanorhatchfix"); MethodInfo methodInfo2 = methodInfo; HarmonyMethod val2 = new HarmonyMethod(typeof(CaelanorHatchFixPlugin), "AwakePostfix", (Type[])null); val.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[CaelanorHatchFix] Patched GPButtonTrapdoor.Awake"); } public static void AwakePostfix(GPButtonTrapdoor __instance) { //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) try { if (!Enabled.Value || (Object)(object)__instance == (Object)null || ((Object)((Component)__instance).gameObject).name != "cabin_hatch") { return; } FieldInfo fieldInfo = AccessTools.Field(typeof(GPButtonTrapdoor), "importedActualBoat"); Transform val = (Transform)((!(fieldInfo != null)) ? null : /*isinst with value type is only supported in some contexts*/); if (!((Object)(object)val == (Object)null) && ((Object)val).name.ToLowerInvariant().Contains("caelanor")) { FieldInfo fieldInfo2 = AccessTools.Field(typeof(GPButtonTrapdoor), "walkCol"); Transform val2 = (Transform)((!(fieldInfo2 != null)) ? null : /*isinst with value type is only supported in some contexts*/); BoxCollider val3 = ((!((Object)(object)val2 != (Object)null)) ? null : ((Component)val2).GetComponent<BoxCollider>()); if ((Object)(object)val3 == (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)"[CaelanorHatchFix] cabin_hatch walk collider not found; skipping."); return; } val3.center = new Vector3(0f, -0.47f, 0.241f); val3.size = new Vector3(1.341f, 1.843f, 0.06f); ((BaseUnityPlugin)Instance).Logger.LogInfo((object)"[CaelanorHatchFix] Slimmed cabin_hatch walk collider to a top plate (walkable from above, clear beneath)."); } } catch (Exception ex) { if ((Object)(object)Instance != (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)("[CaelanorHatchFix] Postfix error: " + ex)); } } } }
CaelanorMastPlatforms.dll
Decompiled 9 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("0.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 CaelanorMastPlatforms { public class MastPlatformGuard : MonoBehaviour { private void OnEnable() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0044: 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_005d: 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) try { Physics.SyncTransforms(); BoxCollider[] componentsInChildren = ((Component)this).GetComponentsInChildren<BoxCollider>(true); foreach (BoxCollider val in componentsInChildren) { Collider[] array = Physics.OverlapBox(((Component)val).transform.position, Vector3.Scale(val.size, ((Component)val).transform.lossyScale) / 2f + new Vector3(0.05f, 0.25f, 0.05f), ((Component)val).transform.rotation); foreach (Collider val2 in array) { if (!((Object)(object)val2 == (Object)(object)val) && (Object)(object)val2.attachedRigidbody != (Object)null) { Physics.IgnoreCollision((Collider)(object)val, val2, true); Debug.Log((object)("[MastPlatforms] plate '" + ((Object)val).name + "' ignoring overlapping item '" + ((Object)val2).name + "'")); } } } } catch (Exception ex) { Debug.LogWarning((object)("[MastPlatforms] guard error: " + ex.Message)); } } } public class MastClimbButton : GoPointerButton { public Transform standOn; public Transform standOnAlt; public Func<bool> preferAlt; public float eyeHeight = 1.65f; public Func<bool> allowed; public override void OnActivate(GoPointer activatingPointer) { //IL_00b8: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_00f1: Unknown result type (might be due to invalid IL or missing references) try { Transform val = (((Object)(object)standOnAlt != (Object)null && preferAlt != null && preferAlt()) ? standOnAlt : standOn); if (!((Object)(object)val == (Object)null) && !((Object)(object)GameState.currentBoat == (Object)null) && (allowed == null || allowed())) { Transform val2 = (((Object)(object)Refs.observerMirror != (Object)null) ? ((Component)Refs.observerMirror).transform : null); if (!((Object)(object)val2 == (Object)null) && !((Object)(object)Refs.ovrController == (Object)null)) { Vector3 val3 = val.position + val.up * eyeHeight; Vector3 val4 = val2.InverseTransformVector(val3 - val2.position); ((Component)Refs.ovrController).transform.Translate(val4, (Space)1); PlayerClimb.ClickRatlines(); Debug.Log((object)("[MastPlatforms] climbed: '" + base.lookText + "'.")); } } } catch (Exception ex) { Debug.LogWarning((object)("[MastPlatforms] climb failed: " + ex.Message)); } } } [BepInPlugin("com.dixiecapt.sailwind.caelanormastplatforms", "Caelanor Mast Platforms", "3.0.0")] public class CaelanorMastPlatformsPlugin : BaseUnityPlugin { private struct Spot { public string label; public float x; public float yTop; public float z; public float sx; public float sz; public float mastX; public bool cross; } public class SheathingScan : MonoBehaviour { private float _t; private void Update() { if (!GameState.playing || (Object)(object)Instance == (Object)null) { return; } _t += Time.deltaTime; if (_t < 6f) { return; } try { int num = 0; List<string> list = new List<string>(); BoatCustomParts[] array = Resources.FindObjectsOfTypeAll<BoatCustomParts>(); foreach (BoatCustomParts val in array) { if (!((Object)(object)val == (Object)null)) { Instance.ScanSheathing(((Component)val).transform); num++; list.Add(((Object)val).name); } } ((BaseUnityPlugin)Instance).Logger.LogInfo((object)("[Scan] sheathing scan done over " + num + " boats with shipyard parts: " + string.Join(", ", list.ToArray()) + ".")); } catch (Exception ex) { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)("[Scan] " + ex.Message)); } Object.Destroy((Object)(object)((Component)this).gameObject); } } private struct StaySlide { public string name; public string deckKey; public string topKey; public float deckX; public float deckZ; public StaySlide(string n, string dk, float x, float z, string tk) { name = n; deckKey = dk; deckX = x; deckZ = z; topKey = tk; } } private struct ShroudLine { public float deckZ; public float deckY; public float topZ; public float topY; public float deckX0; public float deckX1; public float topX; public float deckWalk; } public class FollowActive : MonoBehaviour { public GameObject leader; public bool self; private void LateUpdate() { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown if ((Object)(object)leader == (Object)null) { return; } bool activeInHierarchy = leader.activeInHierarchy; if (self) { Renderer component = ((Component)this).GetComponent<Renderer>(); if ((Object)(object)component != (Object)null && component.enabled != activeInHierarchy) { component.enabled = activeInHierarchy; } Collider component2 = ((Component)this).GetComponent<Collider>(); if ((Object)(object)component2 != (Object)null && component2.enabled != activeInHierarchy) { component2.enabled = activeInHierarchy; } return; } foreach (Transform item in ((Component)this).transform) { Transform val = item; if (((Component)val).gameObject.activeSelf != activeInHierarchy) { ((Component)val).gameObject.SetActive(activeInHierarchy); } } } } internal class PolyMesh { private readonly List<Vector3> _v = new List<Vector3>(); private readonly List<int> _t = new List<int>(); public void AddPrism(List<Vector2> outline, float yTop, float thick) { //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_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_0031: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_013c: 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_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0183: 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_0189: 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_0192: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) int count = outline.Count; if (count < 3) { return; } Vector2 val = Vector2.zero; foreach (Vector2 item in outline) { val += item; } val /= (float)count; int count2 = _v.Count; foreach (Vector2 item2 in outline) { _v.Add(new Vector3(item2.x, yTop, item2.y)); } int count3 = _v.Count; foreach (Vector2 item3 in outline) { _v.Add(new Vector3(item3.x, yTop - thick, item3.y)); } for (int i = 1; i + 1 < count; i++) { Tri(count2, count2 + i, count2 + i + 1, Vector3.up); Tri(count3, count3 + i, count3 + i + 1, Vector3.down); } Vector3 outward = default(Vector3); for (int j = 0; j < count; j++) { int num = (j + 1) % count; Vector2 val2 = (outline[j] + outline[num]) / 2f - val; ((Vector3)(ref outward))..ctor(val2.x, 0f, val2.y); Tri(count2 + j, count3 + j, count2 + num, outward); Tri(count2 + num, count3 + j, count3 + num, outward); } } private void Tri(int a, int b, int c, Vector3 outward) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0036: 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_0041: 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) Vector3 val = Vector3.Cross(_v[b] - _v[a], _v[c] - _v[a]); if (Vector3.Dot(val, outward) >= 0f) { _t.Add(a); _t.Add(b); _t.Add(c); } else { _t.Add(a); _t.Add(c); _t.Add(b); } } public GameObject Build(Transform parent, string name, Color col) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) Mesh val = new Mesh(); if (_v.Count > 65000) { val.indexFormat = (IndexFormat)1; } val.SetVertices(_v); val.SetTriangles(_t, 0); val.RecalculateNormals(); val.RecalculateBounds(); GameObject val2 = new GameObject(name); val2.transform.SetParent(parent, false); val2.AddComponent<MeshFilter>().sharedMesh = val; ((Renderer)val2.AddComponent<MeshRenderer>()).material = Refits.PlainMaterial(col, 0f, 0.25f); return val2; } } internal static CaelanorMastPlatformsPlugin Instance; private ConfigEntry<bool> _enabled; private ConfigEntry<bool> _climbLines; private ConfigEntry<string> _spots; private ConfigEntry<bool> _measure; private ConfigEntry<float> _copperAe; private ConfigEntry<float> _copperCae; private ConfigEntry<float> _copperRiseAe; private ConfigEntry<float> _copperRiseCae; private ConfigEntry<float> _copperRiseLen; private ConfigEntry<float> _copperBowAe; private ConfigEntry<float> _copperBowCae; private ConfigEntry<float> _copperBowLen; private ConfigEntry<float> _copperMetal; private ConfigEntry<float> _copperSmooth; private ConfigEntry<Color> _copperColour; private ConfigEntry<bool> _copperFromSE; private static readonly HashSet<int> _measured = new HashSet<int>(); private const string DefaultSpots = "foretop:6.75,11.84,0,2.4,2.0,0;maintop:-2.40,13.49,0,2.4,2.0,0;forecross:7.15,18.72,0,1.2,0.9,1,6.74;maincross:-2.85,20.46,0,1.2,0.9,1,-2.44;aeforetop:13.70,17.76,0,3.0,3.2,0;aeforecross:14.48,28.85,0,1.4,1.0,1,14.48;aemaintop:-3.03,18.77,0,3.0,3.2,0;aemaincross:-2.66,31.19,0,1.4,1.0,1,-2.66;aemizentop:-13.21,17.65,0,3.0,3.0,0;aemizencross:-12.82,24.73,0,1.2,0.9,1,-12.82"; private const string V3dDefaultSpots = "foretop:6.75,11.84,0,2.4,2.0,0;maintop:-2.40,13.49,0,2.4,2.0,0;forecross:7.15,18.72,0,1.2,0.9,1,6.74;maincross:-2.85,20.46,0,1.2,0.9,1,-2.44;aeforetop:13.70,17.76,0,3.0,3.2,0;aeforecross:14.48,28.85,0,1.4,1.0,1,14.48;aemaintop:-3.03,18.77,0,3.0,3.2,0;aemaincross:-2.66,31.19,0,1.4,1.0,1,-2.66;aemizentop:-13.21,17.65,0,3.0,2.8,0;aemizencross:-12.82,24.73,0,1.2,0.9,1,-12.82"; private const string V3cDefaultSpots = "foretop:6.75,11.84,0,2.4,2.0,0;maintop:-2.40,13.49,0,2.4,2.0,0;forecross:7.15,18.72,0,1.2,0.9,1,6.74;maincross:-2.85,20.46,0,1.2,0.9,1,-2.44;aeforetop:13.70,17.76,0,3.0,3.2,0;aeforecross:14.48,28.85,0,1.4,1.0,1,14.48;aemaintop:-3.03,18.77,0,3.0,2.4,0;aemaincross:-2.66,31.19,0,1.4,1.0,1,-2.66;aemizentop:-13.21,17.65,0,3.0,2.8,0;aemizencross:-12.82,24.73,0,1.2,0.9,1,-12.82"; private const string V3bDefaultSpots = "foretop:6.75,11.84,0,2.4,2.0,0;maintop:-2.40,13.49,0,2.4,2.0,0;forecross:7.15,18.72,0,1.2,0.9,1,6.74;maincross:-2.85,20.46,0,1.2,0.9,1,-2.44;aeforetop:13.70,17.66,0,3.0,2.4,0;aeforecross:14.48,28.85,0,1.4,1.0,1,14.48;aemaintop:-3.03,18.67,0,3.0,2.4,0;aemaincross:-2.66,31.19,0,1.4,1.0,1,-2.66;aemizentop:-13.21,17.55,0,2.6,2.1,0;aemizencross:-12.82,24.73,0,1.2,0.9,1,-12.82"; private const string V3aDefaultSpots = "foretop:6.75,11.84,0,2.4,2.0,0;maintop:-2.40,13.49,0,2.4,2.0,0;forecross:7.15,18.72,0,1.2,0.9,1,6.74;maincross:-2.85,20.46,0,1.2,0.9,1,-2.44"; private const string OldDefaultSpots = "foretop:6.75,11.84,0,1.15,1.05,0;maintop:-2.40,13.49,0,1.15,1.05,0;forecross:7.15,18.72,0,1.0,0.8,1,6.74;maincross:-2.85,20.46,0,1.0,0.8,1,-2.44"; private static readonly HashSet<string> _sailCheckSkipped = new HashSet<string>(); private static readonly HashSet<int> _scanned = new HashSet<int>(); private const string PumpAsset = "Assets/Lilith/old_chronian/CAE_BilgePumps.prefab"; private static readonly Dictionary<string, ShroudLine> Shrouds = new Dictionary<string, ShroudLine> { { "fore", new ShroudLine { deckZ = 3.3f, deckY = 0.3f, topZ = 0.4f, topY = 11.76f, deckX0 = 4.95f, deckX1 = 6.85f, topX = 6.8f, deckWalk = 0.05f } }, { "main", new ShroudLine { deckZ = 3.15f, deckY = 0.3f, topZ = 0.4f, topY = 13.48f, deckX0 = -4.8f, deckX1 = -2.5f, topX = -2.35f, deckWalk = 0.05f } }, { "aefore", new ShroudLine { deckZ = 4.7f, deckY = 1.8f, topZ = 0.47f, topY = 17.61f, deckX0 = 11.15f, deckX1 = 14.5f, topX = 13.7f, deckWalk = 4.6f } }, { "aemain", new ShroudLine { deckZ = 4.8f, deckY = 1.8f, topZ = 0.55f, topY = 18.62f, deckX0 = -6.8f, deckX1 = -2.25f, topX = -3.03f, deckWalk = 4.6f } }, { "aemizen", new ShroudLine { deckZ = 4.1f, deckY = 2.7f, topZ = 0.59f, topY = 17.5f, deckX0 = -15.1f, deckX1 = -13.1f, topX = -13.21f, deckWalk = 4.6f } } }; private static readonly Dictionary<string, Dictionary<int, List<Vector3[]>>> _shroudRopes = new Dictionary<string, Dictionary<int, List<Vector3[]>>>(); private static readonly Dictionary<string, string> _shroudFrom = new Dictionary<string, string>(); private static readonly Dictionary<string, int> _shroudPieces = new Dictionary<string, int>(); private const float Thick = 0.06f; private static readonly Color Plank = new Color(0.42f, 0.32f, 0.22f); private static readonly Color Timber = new Color(0.33f, 0.24f, 0.15f); private static readonly Color Rope = new Color(0.16f, 0.13f, 0.1f); private static readonly Color Iron = new Color(0.12f, 0.12f, 0.13f); private static Transform _walkForZones; internal static ManualLogSource Log => ((Object)(object)Instance != (Object)null) ? ((BaseUnityPlugin)Instance).Logger : null; internal static bool MeasureOn => (Object)(object)Instance != (Object)null && Instance._measure != null && Instance._measure.Value; internal static float CopperRiseLength => ((Object)(object)Instance != (Object)null && Instance._copperRiseLen != null) ? Instance._copperRiseLen.Value : 18f; internal static float CopperBowRiseLength => ((Object)(object)Instance != (Object)null && Instance._copperBowLen != null) ? Instance._copperBowLen.Value : 3f; internal static bool CopperFromSE => (Object)(object)Instance != (Object)null && Instance._copperFromSE != null && Instance._copperFromSE.Value; internal static Color CopperColour => (Color)(((Object)(object)Instance != (Object)null && Instance._copperColour != null) ? Instance._copperColour.Value : new Color(0.77f, 0.51f, 0.34f)); internal static float CopperMetal => ((Object)(object)Instance != (Object)null && Instance._copperMetal != null) ? Instance._copperMetal.Value : 0.9f; internal static float CopperSmooth => ((Object)(object)Instance != (Object)null && Instance._copperSmooth != null) ? Instance._copperSmooth.Value : 0.6f; internal static float CopperLine(bool frigate) { if ((Object)(object)Instance == (Object)null) { return frigate ? 1.25f : 0.28f; } return (frigate ? Instance._copperAe : Instance._copperCae)?.Value ?? (frigate ? 1.25f : 0.28f); } internal static float CopperRise(bool frigate) { if ((Object)(object)Instance == (Object)null) { return frigate ? 1f : 0.09f; } return (frigate ? Instance._copperRiseAe : Instance._copperRiseCae)?.Value ?? (frigate ? 1f : 0.09f); } internal static float CopperBowRise(bool frigate) { if ((Object)(object)Instance == (Object)null) { return frigate ? 0.36f : 0.8f; } return (frigate ? Instance._copperBowAe : Instance._copperBowCae)?.Value ?? (frigate ? 0.36f : 0.8f); } private void Awake() { //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Expected O, but got Unknown //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Expected O, but got Unknown //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Expected O, but got Unknown //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Expected O, but got Unknown //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Expected O, but got Unknown //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Expected O, but got Unknown //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Expected O, but got Unknown //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Expected O, but got Unknown //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Expected O, but got Unknown //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Expected O, but got Unknown //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Expected O, but got Unknown //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Expected O, but got Unknown //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Expected O, but got Unknown Instance = this; _enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Offer lookout platforms (fighting tops and crosstree posts) as purchasable shipyard parts on the Caelanor."); _climbLines = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ClimbLines", true, "Include climbable futtock-shroud lines on the platform edges."); _spots = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Spots", "foretop:6.75,11.84,0,2.4,2.0,0;maintop:-2.40,13.49,0,2.4,2.0,0;forecross:7.15,18.72,0,1.2,0.9,1,6.74;maincross:-2.85,20.46,0,1.2,0.9,1,-2.44;aeforetop:13.70,17.76,0,3.0,3.2,0;aeforecross:14.48,28.85,0,1.4,1.0,1,14.48;aemaintop:-3.03,18.77,0,3.0,3.2,0;aemaincross:-2.66,31.19,0,1.4,1.0,1,-2.66;aemizentop:-13.21,17.65,0,3.0,3.0,0;aemizencross:-12.82,24.73,0,1.2,0.9,1,-12.82", "Platform geometry: label:x,yTop,z,sizeX,sizeZ,isCrosstree separated by ';' (boat-local meters)."); if (_spots.Value == "foretop:6.75,11.84,0,1.15,1.05,0;maintop:-2.40,13.49,0,1.15,1.05,0;forecross:7.15,18.72,0,1.0,0.8,1,6.74;maincross:-2.85,20.46,0,1.0,0.8,1,-2.44" || _spots.Value == "foretop:6.75,11.84,0,2.4,2.0,0;maintop:-2.40,13.49,0,2.4,2.0,0;forecross:7.15,18.72,0,1.2,0.9,1,6.74;maincross:-2.85,20.46,0,1.2,0.9,1,-2.44" || _spots.Value == "foretop:6.75,11.84,0,2.4,2.0,0;maintop:-2.40,13.49,0,2.4,2.0,0;forecross:7.15,18.72,0,1.2,0.9,1,6.74;maincross:-2.85,20.46,0,1.2,0.9,1,-2.44;aeforetop:13.70,17.66,0,3.0,2.4,0;aeforecross:14.48,28.85,0,1.4,1.0,1,14.48;aemaintop:-3.03,18.67,0,3.0,2.4,0;aemaincross:-2.66,31.19,0,1.4,1.0,1,-2.66;aemizentop:-13.21,17.55,0,2.6,2.1,0;aemizencross:-12.82,24.73,0,1.2,0.9,1,-12.82" || _spots.Value == "foretop:6.75,11.84,0,2.4,2.0,0;maintop:-2.40,13.49,0,2.4,2.0,0;forecross:7.15,18.72,0,1.2,0.9,1,6.74;maincross:-2.85,20.46,0,1.2,0.9,1,-2.44;aeforetop:13.70,17.76,0,3.0,3.2,0;aeforecross:14.48,28.85,0,1.4,1.0,1,14.48;aemaintop:-3.03,18.77,0,3.0,2.4,0;aemaincross:-2.66,31.19,0,1.4,1.0,1,-2.66;aemizentop:-13.21,17.65,0,3.0,2.8,0;aemizencross:-12.82,24.73,0,1.2,0.9,1,-12.82" || _spots.Value == "foretop:6.75,11.84,0,2.4,2.0,0;maintop:-2.40,13.49,0,2.4,2.0,0;forecross:7.15,18.72,0,1.2,0.9,1,6.74;maincross:-2.85,20.46,0,1.2,0.9,1,-2.44;aeforetop:13.70,17.76,0,3.0,3.2,0;aeforecross:14.48,28.85,0,1.4,1.0,1,14.48;aemaintop:-3.03,18.77,0,3.0,3.2,0;aemaincross:-2.66,31.19,0,1.4,1.0,1,-2.66;aemizentop:-13.21,17.65,0,3.0,2.8,0;aemizencross:-12.82,24.73,0,1.2,0.9,1,-12.82") { _spots.Value = "foretop:6.75,11.84,0,2.4,2.0,0;maintop:-2.40,13.49,0,2.4,2.0,0;forecross:7.15,18.72,0,1.2,0.9,1,6.74;maincross:-2.85,20.46,0,1.2,0.9,1,-2.44;aeforetop:13.70,17.76,0,3.0,3.2,0;aeforecross:14.48,28.85,0,1.4,1.0,1,14.48;aemaintop:-3.03,18.77,0,3.0,3.2,0;aemaincross:-2.66,31.19,0,1.4,1.0,1,-2.66;aemizentop:-13.21,17.65,0,3.0,3.0,0;aemizencross:-12.82,24.73,0,1.2,0.9,1,-12.82"; } _copperAe = ((BaseUnityPlugin)this).Config.Bind<float>("Refits", "Copper line - Aelasyl (m)", 1.25f, new ConfigDescription("How high the copper sheathing reaches on the Aelasyl, in metres above her model's origin. 1.25 brings it to the lime line at the top of her white band. Applies when she next loads.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>())); _copperCae = ((BaseUnityPlugin)this).Config.Bind<float>("Refits", "Copper line - Caelanor (m)", 0.28f, new ConfigDescription("How high the copper sheathing reaches on the Caelanor, in metres above her model's origin. Her white band sits low: about 0.50 brings the copper to the lime line at its top. Applies when she next loads.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>())); _copperRiseAe = ((BaseUnityPlugin)this).Config.Bind<float>("Refits", "Copper stern rise - Aelasyl (m)", 1f, new ConfigDescription("How much higher the Aelasyl's copper line is at her stern than along her side (negative: lower); the rise is made smoothly over the 'stern rise length'. Applies when she next loads.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 1.5f), Array.Empty<object>())); _copperRiseCae = ((BaseUnityPlugin)this).Config.Bind<float>("Refits", "Copper stern rise - Caelanor (m)", 0.09f, new ConfigDescription("How much higher the Caelanor's copper line is at her stern than along her side; her painted line DIPS toward the stern, so this is negative. Applies when she next loads.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 1.5f), Array.Empty<object>())); _copperBowAe = ((BaseUnityPlugin)this).Config.Bind<float>("Refits", "Copper bow rise - Aelasyl (m)", 0.36f, new ConfigDescription("How much the Aelasyl's copper line climbs onto the stem at her bow, over the 'bow rise length'. Applies on load.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 1.5f), Array.Empty<object>())); _copperBowCae = ((BaseUnityPlugin)this).Config.Bind<float>("Refits", "Copper bow rise - Caelanor (m)", 0.8f, new ConfigDescription("How much the Caelanor's copper line climbs onto the stem at her bow, over the 'bow rise length'. Applies on load.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 1.5f), Array.Empty<object>())); _copperBowLen = ((BaseUnityPlugin)this).Config.Bind<float>("Refits", "Copper bow rise length (m)", 3f, new ConfigDescription("Over how many metres abaft the stem the copper line makes its climb at the bow. Applies on load.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.3f, 10f), Array.Empty<object>())); _copperRiseLen = ((BaseUnityPlugin)this).Config.Bind<float>("Refits", "Copper stern rise length (m)", 18f, new ConfigDescription("Over how many metres forward of the stern the copper line makes its rise. Applies on load.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 25f), Array.Empty<object>())); _copperMetal = ((BaseUnityPlugin)this).Config.Bind<float>("Refits", "Copper metal (0-1)", 0.9f, new ConfigDescription("How metallic the copper sheathing is. 1 is bare metal, 0 is paint. Applies on load.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); _copperSmooth = ((BaseUnityPlugin)this).Config.Bind<float>("Refits", "Copper smoothness (0-1)", 0.6f, new ConfigDescription("How smooth the copper sheathing is: higher catches the sun in a tighter, brighter glint. The brass guns are near the top of the range; 0.5 is a sheet-metal sheen. Applies on load.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); _copperFromSE = ((BaseUnityPlugin)this).Config.Bind<bool>("Refits", "Copper uses the Shipyard Expansion texture", false, "ON: with Shipyard Expansion installed the sheathing wears its copper texture (the brig's), tinted by the colour below - which can only darken it. OFF: a plain copper of the mod's own that takes the colour exactly, lighter if you like. Applies on load."); _copperColour = ((BaseUnityPlugin)this).Config.Bind<Color>("Refits", "Copper colour", new Color(0.77f, 0.51f, 0.34f), "The copper's tint, laid over the sheathing's own surface. The default is an orange copper; redder or browner as you like. Applies on load."); _measure = ((BaseUnityPlugin)this).Config.Bind<bool>("Diagnostics", "Measure masts and shrouds", false, "Once per ship as she loads, write the Caelanor's and the Aelasyl's masts, shroud (ratline) surfaces and click-to-climb buttons to the log, scan every ship's hull materials and test the bowsprit net's walking surface with rays - for designing the fittings. Off for play."); MethodInfo methodInfo = AccessTools.Method(typeof(BoatEmbarkCollider), "Awake", (Type[])null, (Type[])null); if (methodInfo == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"[MastPlatforms] BoatEmbarkCollider.Awake not found."); return; } Harmony val = new Harmony("com.dixiecapt.sailwind.caelanormastplatforms"); val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(CaelanorMastPlatformsPlugin), "EmbarkAwakePostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo2 = AccessTools.Method(typeof(ShipyardSailColChecker), "OnTriggerEnter", (Type[])null, (Type[])null); if (methodInfo2 != null) { val.Patch((MethodBase)methodInfo2, new HarmonyMethod(typeof(CaelanorMastPlatformsPlugin), "SailCheckPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)"[MastPlatforms] ShipyardSailColChecker.OnTriggerEnter not found - our fittings may block sail refits."); } if (_measure.Value) { GameObject val2 = new GameObject("MastPlatforms_SheathingScan"); Object.DontDestroyOnLoad((Object)(object)val2); val2.AddComponent<SheathingScan>(); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"[MastPlatforms] v2: shipyard part registration hooked."); } private List<Spot> ParseSpots() { List<Spot> list = new List<Spot>(); string[] array = (_spots.Value ?? "").Split(new char[1] { ';' }); foreach (string text in array) { string text2 = text.Trim(); if (text2.Length == 0) { continue; } string[] array2 = text2.Split(new char[1] { ':' }); if (array2.Length != 2) { continue; } string[] array3 = array2[1].Split(new char[1] { ',' }); if (array3.Length >= 6) { try { Spot item = default(Spot); item.label = array2[0].Trim(); item.x = float.Parse(array3[0], CultureInfo.InvariantCulture); item.yTop = float.Parse(array3[1], CultureInfo.InvariantCulture); item.z = float.Parse(array3[2], CultureInfo.InvariantCulture); item.sx = float.Parse(array3[3], CultureInfo.InvariantCulture); item.sz = float.Parse(array3[4], CultureInfo.InvariantCulture); item.cross = array3[5].Trim() == "1"; item.mastX = ((array3.Length >= 7) ? float.Parse(array3[6], CultureInfo.InvariantCulture) : item.x); list.Add(item); } catch { } } } return list; } public static bool SailCheckPrefix(Collider other) { try { if ((Object)(object)other == (Object)null) { return true; } Transform val = ((Component)other).transform; while ((Object)(object)val != (Object)null) { string name = ((Object)val).name; if (name.StartsWith("WALK PLATFORMS_") || name.StartsWith("WALK LOWER_RATLINES_") || name == "WALK NETTING" || name == "WALK COPPER" || name.StartsWith("mastplatform_") || name == "gap_shroud_walk" || name.StartsWith("topshroud_") || name.StartsWith("netting_walk_")) { if (_sailCheckSkipped.Add(((Object)other).name) && (Object)(object)Instance != (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)("[MastPlatforms] shipyard sail check: '" + ((Object)other).name + "' (ours) is not an obstruction.")); } return false; } val = val.parent; } } catch { } return true; } public static void EmbarkAwakePostfix(BoatEmbarkCollider __instance) { try { if ((Object)(object)Instance == (Object)null || (Object)(object)__instance == (Object)null) { return; } Transform root = ((Component)__instance).transform.root; if ((Object)(object)root == (Object)null) { return; } if (Instance._measure.Value && (((Object)root).name.StartsWith("BOAT CAELANOR") || ((Object)root).name.StartsWith("BOAT CHRONIAN"))) { Instance.Measure(root, __instance.walkCollider); } if (Instance._measure.Value) { Instance.ScanSheathing(root); } if (!Instance._enabled.Value) { return; } bool flag = ((Object)root).name.StartsWith("BOAT CAELANOR"); bool flag2 = ((Object)root).name.StartsWith("BOAT CHRONIAN"); if (!flag && !flag2) { return; } BoatCustomParts component = ((Component)root).GetComponent<BoatCustomParts>(); Transform walkCollider = __instance.walkCollider; Transform parent = ((Component)__instance).transform.parent; if ((Object)(object)component == (Object)null || (Object)(object)walkCollider == (Object)null || (Object)(object)parent == (Object)null) { return; } if (flag) { if (!((Object)(object)parent.Find("PLATFORMS_fore_none") != (Object)null)) { Instance.RegisterMastPart(component, parent, walkCollider, "fore", "Fore", "Foremast Main", "Foremast Top", "RATLINE_fore"); Instance.RegisterMastPart(component, parent, walkCollider, "main", "Main", "Mainmast Main", "Mainmast Top", "RATLINE_main"); ((BaseUnityPlugin)Instance).Logger.LogInfo((object)("[MastPlatforms] Registered Fore/Main platform shipyard parts on '" + ((Object)root).name + "'.")); Instance.AddStayButtons(parent, walkCollider, new StaySlide[8] { new StaySlide("STAY_jib1", "fore", 8.6f, 0f, null), new StaySlide("STAY_jib2", "fore", 8.6f, 0f, null), new StaySlide("STAY_foreroyal1", "fore", 8.6f, 0f, null), new StaySlide("STAY_foreroyal2", "fore", 8.6f, 0f, null), new StaySlide("STAY_forestay1", "fore", 8.6f, 0f, null), new StaySlide("STAY_forestay2", "fore", 8.6f, 0f, null), new StaySlide("STAY_mainroyal", "fore", 7.2f, 0f, "fore"), new StaySlide("STAY_mainstay", "fore", 7.5f, 0.7f, null) }); Refits.AddNetting(root, parent, walkCollider, component, frigate: false); Refits.AddCopper(root, parent, walkCollider, component, frigate: false); } } else if (!((Object)(object)parent.Find("PLATFORMS_aefore_none") != (Object)null)) { Instance.RegisterMastPart(component, parent, walkCollider, "aefore", "Fore", "Foremast Main", "Foremast Top", "MAST FORE RATLINES"); Instance.RegisterMastPart(component, parent, walkCollider, "aemain", "Main", "Mainmast Main", "Mainmast Top", "MAST MAIN RATLINES"); Instance.RegisterMastPart(component, parent, walkCollider, "aemizen", "Mizen", "Mizzenmast Main", "Mizzenmast Top", "MAST MIZEN RATLINES"); ((BaseUnityPlugin)Instance).Logger.LogInfo((object)("[MastPlatforms] Registered Fore/Main/Mizen platform shipyard parts on '" + ((Object)root).name + "'.")); Instance.AddBilgePump(root, parent, walkCollider, component); Instance.AddStayButtons(parent, walkCollider, new StaySlide[7] { new StaySlide("STAY_jibstay", "aefore", 15.6f, 0f, null), new StaySlide("STAY_foreroyalstay", "aefore", 15.6f, 0f, null), new StaySlide("STAY_forestay", "aefore", 15.6f, 0f, null), new StaySlide("STAY_mainroyalstay", "aefore", 12.6f, 0f, "aefore"), new StaySlide("STAY_mainstay", "aefore", 13f, 0.8f, null), new StaySlide("STAY_mizenroyalstay", "aemain", -4.6f, 0f, "aemain"), new StaySlide("STAY_mizenstay", "aemain", -4.4f, 0.8f, null) }); Refits.AddNetting(root, parent, walkCollider, component, frigate: true); Refits.AddCopper(root, parent, walkCollider, component, frigate: true); Refits.AddDavits(root, parent, walkCollider, component); } } catch (Exception ex) { if ((Object)(object)Instance != (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)("[MastPlatforms] register error: " + ex)); } } } private static string V(Vector3 v) { return "(" + v.x.ToString("F2", CultureInfo.InvariantCulture) + ", " + v.y.ToString("F2", CultureInfo.InvariantCulture) + ", " + v.z.ToString("F2", CultureInfo.InvariantCulture) + ")"; } private static string PathOf(Transform t, Transform stop) { string text = ((Object)t).name; Transform parent = t.parent; while ((Object)(object)parent != (Object)null && (Object)(object)parent != (Object)(object)stop) { text = ((Object)parent).name + "/" + text; parent = parent.parent; } return text; } private void ScanSheathing(Transform root) { //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Unknown result type (might be due to invalid IL or missing references) try { if (!_scanned.Add(((Object)root).GetInstanceID())) { return; } BoatCustomParts component = ((Component)root).GetComponent<BoatCustomParts>(); if ((Object)(object)component == (Object)null || component.availableParts == null) { return; } for (int i = 0; i < component.availableParts.Count; i++) { BoatPart val = component.availableParts[i]; if (val == null || val.partOptions == null) { continue; } for (int j = 0; j < val.partOptions.Count; j++) { BoatPartOption val2 = val.partOptions[j]; if ((Object)(object)val2 == (Object)null) { continue; } string text = (val2.optionName ?? "").ToLowerInvariant(); if (!text.Contains("copper") && !text.Contains("sheath") && !text.Contains("hull") && !text.Contains("paint") && !text.Contains("bottom")) { continue; } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("[Scan] '" + ((Object)root).name + "' part " + i + " (category " + val.category + ", active " + val.activeOption + ") option " + j + " '" + val2.optionName + "': object '" + PathOf(((Component)val2).transform, root) + "' active=" + ((Component)val2).gameObject.activeSelf + ", price " + val2.basePrice + "/" + val2.installCost + ", mass " + val2.mass + ", walk '" + (((Object)(object)val2.walkColObject != (Object)null) ? ((Object)val2.walkColObject).name : "none") + "', childOptions " + ((val2.childOptions != null) ? val2.childOptions.Length : 0) + ", requires " + ((val2.requires != null) ? val2.requires.Count : 0) + ", requiresDisabled " + ((val2.requiresDisabled != null) ? val2.requiresDisabled.Count : 0) + "."); Component[] components = ((Component)val2).GetComponents<Component>(); foreach (Component val3 in components) { if ((Object)(object)val3 != (Object)null && !(val3 is Transform) && !(val3 is BoatPartOption)) { stringBuilder.Append(" [" + ((object)val3).GetType().Name + "]"); } } Renderer[] componentsInChildren = ((Component)val2).GetComponentsInChildren<Renderer>(true); foreach (Renderer val4 in componentsInChildren) { MeshFilter component2 = ((Component)val4).GetComponent<MeshFilter>(); List<string> list = new List<string>(); Material[] sharedMaterials = val4.sharedMaterials; foreach (Material val5 in sharedMaterials) { list.Add(((Object)(object)val5 != (Object)null) ? (((Object)val5).name + " (" + (((Object)(object)val5.shader != (Object)null) ? ((Object)val5.shader).name : "?") + ")") : "null"); } string[] obj = new string[10] { "\n[Scan] renderer '", PathOf(((Component)val4).transform, ((Component)val2).transform), "' mesh '", ((Object)(object)component2 != (Object)null && (Object)(object)component2.sharedMesh != (Object)null) ? (((Object)component2.sharedMesh).name + "', " + component2.sharedMesh.subMeshCount + " submesh(es), " + component2.sharedMesh.vertexCount + " verts") : "none'", ", materials [", string.Join(" | ", list.ToArray()), "], enabled ", val4.enabled.ToString(), ", bounds ", null }; Bounds bounds = val4.bounds; Vector3 size = ((Bounds)(ref bounds)).size; obj[9] = ((Vector3)(ref size)).ToString("F2"); stringBuilder.Append(string.Concat(obj)); } if (val2.childOptions != null) { GameObject[] childOptions = val2.childOptions; foreach (GameObject val6 in childOptions) { if ((Object)(object)val6 != (Object)null) { stringBuilder.Append("\n[Scan] child option '" + PathOf(val6.transform, root) + "' active=" + val6.activeSelf); } } } ((BaseUnityPlugin)this).Logger.LogInfo((object)stringBuilder.ToString()); } } Renderer[] componentsInChildren2 = ((Component)root).GetComponentsInChildren<Renderer>(true); foreach (Renderer val7 in componentsInChildren2) { if (!((Object)(object)val7 == (Object)null) && ((Object)val7).name.ToUpperInvariant().Contains("HULL")) { MeshFilter component3 = ((Component)val7).GetComponent<MeshFilter>(); List<string> list2 = new List<string>(); Material[] sharedMaterials2 = val7.sharedMaterials; foreach (Material val8 in sharedMaterials2) { list2.Add(((Object)(object)val8 != (Object)null) ? (((Object)val8).name + " (" + (((Object)(object)val8.shader != (Object)null) ? ((Object)val8.shader).name : "?") + ")") : "null"); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[Scan] '" + ((Object)root).name + "' hull renderer '" + PathOf(((Component)val7).transform, root) + "' mesh '" + (((Object)(object)component3 != (Object)null && (Object)(object)component3.sharedMesh != (Object)null) ? (((Object)component3.sharedMesh).name + "', " + component3.sharedMesh.subMeshCount + " submesh(es), " + component3.sharedMesh.vertexCount + " verts") : "none'") + ", materials [" + string.Join(" | ", list2.ToArray()) + "].")); } } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[Scan] '" + ((Object)root).name + "': " + ex.Message)); } } private void Measure(Transform root, Transform walk) { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0732: Unknown result type (might be due to invalid IL or missing references) //IL_0737: Unknown result type (might be due to invalid IL or missing references) //IL_07a9: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_09b6: Unknown result type (might be due to invalid IL or missing references) //IL_09bb: Unknown result type (might be due to invalid IL or missing references) //IL_09d2: Unknown result type (might be due to invalid IL or missing references) //IL_09e9: 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_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_04f9: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_0592: Unknown result type (might be due to invalid IL or missing references) //IL_0597: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Unknown result type (might be due to invalid IL or missing references) //IL_05a8: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05b1: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_0ad1: Unknown result type (might be due to invalid IL or missing references) //IL_0ad6: Unknown result type (might be due to invalid IL or missing references) try { if (!_measured.Add(((Object)root).GetInstanceID())) { return; } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[MastPlatforms] MEASURE '" + ((Object)root).name + "' - walk space '" + (((Object)(object)walk != (Object)null) ? ((Object)walk).name : "none") + "'.")); Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { bool flag = (Object)(object)((Component)val).GetComponent<Mast>() != (Object)null; if (!flag && !((Object)val).name.ToUpperInvariant().StartsWith("MAST")) { continue; } Bounds val2 = default(Bounds); bool flag2 = false; Renderer[] componentsInChildren2 = ((Component)val).GetComponentsInChildren<Renderer>(true); foreach (Renderer val3 in componentsInChildren2) { if (!((Object)(object)val3 == (Object)null)) { if (!flag2) { val2 = val3.bounds; flag2 = true; } else { ((Bounds)(ref val2)).Encapsulate(val3.bounds); } } } string text = (flag2 ? (" bounds lo " + V(root.InverseTransformPoint(((Bounds)(ref val2)).min)) + " hi " + V(root.InverseTransformPoint(((Bounds)(ref val2)).max))) : " (no renderer)"); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[MastPlatforms] mast " + (flag ? "[Mast] " : "") + "'" + PathOf(val, root) + "' at " + V(root.InverseTransformPoint(val.position)) + " active=" + ((Component)val).gameObject.activeInHierarchy + text)); } Transform[] array = (Transform[])(object)new Transform[2] { root, walk }; foreach (Transform val4 in array) { if ((Object)(object)val4 == (Object)null) { continue; } Collider[] componentsInChildren3 = ((Component)val4).GetComponentsInChildren<Collider>(true); foreach (Collider val5 in componentsInChildren3) { if ((Object)(object)val5 == (Object)null) { continue; } string text2 = PathOf(((Component)val5).transform, val4).ToUpperInvariant(); if (!((Component)val5).CompareTag("Ratlines") && !text2.Contains("RATLINE") && !text2.Contains("SHROUD")) { continue; } string name = ((object)val5).GetType().Name; string text3 = ""; MeshCollider val6 = (MeshCollider)(object)((val5 is MeshCollider) ? val5 : null); if ((Object)(object)val6 != (Object)null && (Object)(object)val6.sharedMesh != (Object)null && val6.sharedMesh.isReadable) { Vector3[] vertices = val6.sharedMesh.vertices; Vector3 v = Vector3.zero; Vector3 v2 = Vector3.zero; float num = float.MaxValue; float num2 = float.MinValue; float num3 = float.MaxValue; float num4 = float.MinValue; float num5 = float.MaxValue; float num6 = float.MinValue; Vector3[] array2 = vertices; foreach (Vector3 val7 in array2) { Vector3 val8 = val4.InverseTransformPoint(((Component)val5).transform.TransformPoint(val7)); if (val8.y < num) { num = val8.y; v = val8; } if (val8.y > num2) { num2 = val8.y; v2 = val8; } num5 = Mathf.Min(num5, val8.x); num6 = Mathf.Max(num6, val8.x); num3 = Mathf.Min(num3, val8.z); num4 = Mathf.Max(num4, val8.z); } text3 = " lowest " + V(v) + " highest " + V(v2) + " x " + num5.ToString("F2", CultureInfo.InvariantCulture) + ".." + num6.ToString("F2", CultureInfo.InvariantCulture) + " z " + num3.ToString("F2", CultureInfo.InvariantCulture) + ".." + num4.ToString("F2", CultureInfo.InvariantCulture) + " verts " + vertices.Length; } else { Bounds bounds = val5.bounds; text3 = " world-box lo " + V(val4.InverseTransformPoint(((Bounds)(ref bounds)).min)) + " hi " + V(val4.InverseTransformPoint(((Bounds)(ref bounds)).max)); BoxCollider val9 = (BoxCollider)(object)((val5 is BoxCollider) ? val5 : null); if ((Object)(object)val9 != (Object)null) { string[] obj = new string[7] { text3, " box centre ", V(val4.InverseTransformPoint(((Component)val9).transform.TransformPoint(val9.center))), " size ", V(Vector3.Scale(val9.size, ((Component)val9).transform.lossyScale)), " rot ", null }; Quaternion val10 = Quaternion.Inverse(val4.rotation) * ((Component)val9).transform.rotation; obj[6] = V(((Quaternion)(ref val10)).eulerAngles); text3 = string.Concat(obj); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[MastPlatforms] ratlines " + name + " '" + PathOf(((Component)val5).transform, val4) + "' in " + (((Object)(object)val4 == (Object)(object)root) ? "ship" : "walk") + " space, tag=" + ((Component)val5).gameObject.tag + " layer=" + ((Component)val5).gameObject.layer + " trigger=" + val5.isTrigger + " enabled=" + val5.enabled + " active=" + ((Component)val5).gameObject.activeInHierarchy + text3)); } } GPButtonRatlines[] componentsInChildren4 = ((Component)root).GetComponentsInChildren<GPButtonRatlines>(true); foreach (GPButtonRatlines val11 in componentsInChildren4) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("[MastPlatforms] click-to-climb '" + PathOf(((Component)val11).transform, root) + "' at " + V(root.InverseTransformPoint(((Component)val11).transform.position)) + " forward " + val11.forward.ToString("F2", CultureInfo.InvariantCulture) + " up " + val11.up.ToString("F2", CultureInfo.InvariantCulture) + (((Object)(object)val11.hardTeleportPos != (Object)null) ? (" teleports to " + V(root.InverseTransformPoint(val11.hardTeleportPos.position))) : " (climbs in place)") + " layer " + ((Component)val11).gameObject.layer + " tag " + ((Component)val11).gameObject.tag)); } BoatCustomParts component = ((Component)root).GetComponent<BoatCustomParts>(); if ((Object)(object)component != (Object)null) { for (int num7 = 0; num7 < component.availableParts.Count; num7++) { BoatPart val12 = component.availableParts[num7]; if (val12 == null || val12.partOptions == null) { continue; } List<string> list = new List<string>(); foreach (BoatPartOption partOption in val12.partOptions) { list.Add(((Object)(object)partOption != (Object)null) ? partOption.optionName : "null"); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[MastPlatforms] shipyard part " + num7 + " (category " + val12.category + ", active " + val12.activeOption + "): " + string.Join(" | ", list.ToArray()))); } } Transform[] componentsInChildren5 = ((Component)root).GetComponentsInChildren<Transform>(true); foreach (Transform val13 in componentsInChildren5) { if (!((Object)val13).name.StartsWith("CAE_BilgePumps")) { continue; } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[MastPlatforms] bilge pump '" + PathOf(val13, root) + "' at " + V(root.InverseTransformPoint(val13.position)) + " (parent-local " + V(val13.localPosition) + " rot " + V(val13.localEulerAngles) + ")")); Transform[] componentsInChildren6 = ((Component)val13).GetComponentsInChildren<Transform>(true); foreach (Transform val14 in componentsInChildren6) { if ((Object)(object)((Component)val14).GetComponent<BilgePump>() != (Object)null || (Object)(object)((Component)val14).GetComponent<BoatPartOption>() != (Object)null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("[MastPlatforms] '" + PathOf(val14, val13) + "'" + (((Object)(object)((Component)val14).GetComponent<BilgePump>() != (Object)null) ? " [BilgePump]" : "") + (((Object)(object)((Component)val14).GetComponent<BoatPartOption>() != (Object)null) ? (" [option '" + ((Component)val14).GetComponent<BoatPartOption>().optionName + "']") : "") + " at " + V(root.InverseTransformPoint(val14.position)))); } } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[MastPlatforms] MEASURE '" + ((Object)root).name + "' done.")); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[MastPlatforms] measure error: " + ex.Message)); } } internal static void InitOption(BoatPartOption opt) { opt.requires = new List<BoatPartOption>(); opt.requiresDisabled = new List<BoatPartOption>(); opt.childOptions = (GameObject[])(object)new GameObject[0]; } private static BoatPartOption FindOption(BoatCustomParts bcp, string optionName) { foreach (BoatPart availablePart in bcp.availableParts) { foreach (BoatPartOption partOption in availablePart.partOptions) { if ((Object)(object)partOption != (Object)null && partOption.optionName == optionName) { return partOption; } } } return null; } private void AddStayButtons(Transform model, Transform walk, StaySlide[] stays) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Expected O, but got Unknown //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: 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_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: 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_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Expected O, but got Unknown //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: 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) try { if ((Object)(object)model.Find("STAY_SLIDES") != (Object)null) { return; } GameObject val = new GameObject("STAY_SLIDES"); val.transform.SetParent(model, false); int btnLayer = FindButtonLayer(model.root); bool asTrigger = FindButtonTrigger(model.root); int num = 0; for (int i = 0; i < stays.Length; i++) { StaySlide staySlide = stays[i]; Transform val2 = null; Transform[] componentsInChildren = ((Component)model).GetComponentsInChildren<Transform>(true); foreach (Transform val3 in componentsInChildren) { if (((Object)val3).name == staySlide.name) { val2 = val3; break; } } if ((Object)(object)val2 == (Object)null) { continue; } MeshFilter componentInChildren = ((Component)val2).GetComponentInChildren<MeshFilter>(true); if ((Object)(object)componentInChildren == (Object)null || (Object)(object)componentInChildren.sharedMesh == (Object)null) { continue; } Bounds bounds = componentInChildren.sharedMesh.bounds; Vector3 val4 = Vector3.zero; Vector3 val5 = Vector3.zero; float num2 = float.MinValue; float num3 = float.MaxValue; for (int k = 0; k < 8; k++) { Vector3 val6 = ((Bounds)(ref bounds)).center + new Vector3((float)(((k & 1) != 0) ? 1 : (-1)) * ((Bounds)(ref bounds)).extents.x, (float)(((k & 2) != 0) ? 1 : (-1)) * ((Bounds)(ref bounds)).extents.y, (float)(((k & 4) != 0) ? 1 : (-1)) * ((Bounds)(ref bounds)).extents.z); Vector3 val7 = model.InverseTransformPoint(((Component)componentInChildren).transform.TransformPoint(val6)); float num4 = val7.y - val7.x; if (num4 > num2) { num2 = num4; val4 = val7; } if (num4 < num3) { num3 = num4; val5 = val7; } } Vector3 val8 = val4 - val5; if (((Vector3)(ref val8)).magnitude < 2f) { continue; } GameObject val9 = new GameObject("stay_deck_" + staySlide.name); val9.transform.SetParent(val.transform, false); val9.transform.localPosition = new Vector3(staySlide.deckX, DeckAt(walk, staySlide.deckKey, staySlide.deckX, staySlide.deckZ, val5.y + 3f), staySlide.deckZ); Transform val10 = null; Func<bool> preferAlt = null; if (staySlide.topKey != null) { Spot? spot = null; foreach (Spot item in ParseSpots()) { if (item.label == staySlide.topKey + "top") { spot = item; } } if (spot.HasValue) { GameObject val11 = new GameObject("stay_top_" + staySlide.name); val11.transform.SetParent(val.transform, false); val11.transform.localPosition = new Vector3(spot.Value.x - 0.2f, spot.Value.yTop, 0f); val10 = val11.transform; string k2 = staySlide.topKey; preferAlt = delegate { Transform val13 = model.Find("PLATFORMS_" + k2 + "_top"); Transform val14 = model.Find("PLATFORMS_" + k2 + "_full"); return ((Object)(object)val13 != (Object)null && ((Component)val13).gameObject.activeInHierarchy) || ((Object)(object)val14 != (Object)null && ((Component)val14).gameObject.activeInHierarchy); }; } } GameObject val12 = RopeRun(val.transform, "stay_slide", val4, val5, 0.03f, Rope); val12.AddComponent<FollowActive>().leader = ((Component)val2).gameObject; MakeClimbButton(val12, btnLayer, asTrigger, val9.transform, new Vector3(6f, 2f, 6f)); MastClimbButton component = val12.GetComponent<MastClimbButton>(); if ((Object)(object)component != (Object)null && (Object)(object)val10 != (Object)null) { component.standOnAlt = val10; component.preferAlt = preferAlt; } FollowActive component2 = val12.GetComponent<FollowActive>(); if ((Object)(object)component2 != (Object)null) { component2.self = true; } num++; } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[MastPlatforms] stays: " + num + " of " + stays.Length + " made slideable on '" + ((Object)model.root).name + "'.")); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[MastPlatforms] stays: " + ex.Message)); } } private void AddBilgePump(Transform root, Transform model, Transform walk, BoatCustomParts bcp) { //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: 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_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: 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_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Expected O, but got Unknown try { if ((Object)(object)model.Find("AE_BilgePumps") != (Object)null) { return; } BoatDamage component = ((Component)root).GetComponent<BoatDamage>(); if ((Object)(object)component == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"[MastPlatforms] Aelasyl pump: no BoatDamage on her - not fitted."); return; } AssetBundle val = null; foreach (AssetBundle allLoadedAssetBundle in AssetBundle.GetAllLoadedAssetBundles()) { if ((Object)(object)allLoadedAssetBundle != (Object)null && allLoadedAssetBundle.Contains("Assets/Lilith/old_chronian/CAE_BilgePumps.prefab")) { val = allLoadedAssetBundle; break; } } if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"[MastPlatforms] Aelasyl pump: the Old Chronian Fixes bundle with 'Assets/Lilith/old_chronian/CAE_BilgePumps.prefab' is not loaded - is Old Chronian Fixes installed? Not fitted."); return; } GameObject val2 = val.LoadAsset<GameObject>("Assets/Lilith/old_chronian/CAE_BilgePumps.prefab"); if ((Object)(object)val2 == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"[MastPlatforms] Aelasyl pump: prefab not found in the bundle - not fitted."); return; } Spot? spot = null; foreach (Spot item in ParseSpots()) { if (item.label == "aemaintop") { spot = item; } } float num = (spot.HasValue ? spot.Value.mastX : (-3.03f)) - 1.3f; float num2 = 0.9f; float num3 = 4.6f; string text = "assumed"; Vector3 val3 = walk.TransformPoint(new Vector3(num, 40f, num2)); RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val3, -walk.up, ref val4, 60f, 1 << ((Component)walk).gameObject.layer, (QueryTriggerInteraction)1)) { num3 = walk.InverseTransformPoint(((RaycastHit)(ref val4)).point).y; text = "ray onto '" + ((Object)((RaycastHit)(ref val4)).collider).name + "'"; } GameObject val5 = Object.Instantiate<GameObject>(val2); ((Object)val5).name = "AE_BilgePumps"; val5.transform.SetParent(model, false); val5.transform.localPosition = new Vector3(num, num3 - 0.064f, num2); BilgePump componentInChildren = val5.GetComponentInChildren<BilgePump>(true); val5.transform.localRotation = StandUp(val5.transform, model, ((Object)(object)componentInChildren != (Object)null) ? ((Component)componentInChildren).transform : null, out var how); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[MastPlatforms] Aelasyl pump stood up: " + how)); BilgePump componentInChildren2 = val5.GetComponentInChildren<BilgePump>(true); if ((Object)(object)componentInChildren2 != (Object)null) { componentInChildren2.damage = component; } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)"[MastPlatforms] Aelasyl pump: no BilgePump script in the prefab - the handle will not pump."); } List<BoatPartOption> list = new List<BoatPartOption>(val5.GetComponentsInChildren<BoatPartOption>(true)); if (list.Count > 0) { bcp.availableParts.Add(new BoatPart { activeOption = 1, category = 1, partOptions = list }); List<string> list2 = new List<string>(); foreach (BoatPartOption item2 in list) { list2.Add(item2.optionName); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[MastPlatforms] Aelasyl pump fitted at (" + num.ToString("F2", CultureInfo.InvariantCulture) + ", " + num3.ToString("F2", CultureInfo.InvariantCulture) + ", " + num2.ToString("F2", CultureInfo.InvariantCulture) + ") - deck by " + text + "; shipyard options: " + string.Join(" | ", list2.ToArray()) + ".")); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)"[MastPlatforms] Aelasyl pump: the prefab carries no BoatPartOption - fitted but not in the shipyard."); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[MastPlatforms] Aelasyl pump: " + ex.Message)); } } private static Spot OnCap(Transform walk, Spot top, string mastColliderName, out string how) { //IL_00b1: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016d: 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) MeshCollider val = null; MeshCollider[] componentsInChildren = ((Component)walk).GetComponentsInChildren<MeshCollider>(true); foreach (MeshCollider val2 in componentsInChildren) { if ((Object)(object)val2 != (Object)null && ((Object)val2).name == mastColliderName) { val = val2; break; } } if ((Object)(object)val == (Object)null) { how = "no '" + mastColliderName + "' collider in walk space - at the table's height " + top.yTop.ToString("F2", CultureInfo.InvariantCulture) + "."; return top; } Physics.SyncTransforms(); float num = float.MinValue; Vector3 val3 = Vector3.zero; for (float num2 = top.mastX - 1.6f; num2 <= top.mastX + 1.6f; num2 += 0.1f) { for (float num3 = -0.7f; num3 <= 0.7f; num3 += 0.1f) { Vector3 val4 = walk.TransformPoint(new Vector3(num2, top.yTop + 8f, num3)); RaycastHit[] array = Physics.RaycastAll(val4, -walk.up, 14f, 1 << ((Component)walk).gameObject.layer, (QueryTriggerInteraction)1); for (int j = 0; j < array.Length; j++) { RaycastHit val5 = array[j]; if (!((Object)(object)((RaycastHit)(ref val5)).collider != (Object)(object)val)) { Vector3 val6 = walk.InverseTransformPoint(((RaycastHit)(ref val5)).point); if (val6.y > num) { num = val6.y; val3 = val6; } } } } } if (num == float.MinValue || num < top.yTop - 0.5f) { how = "cap not found above the table (" + ((num == float.MinValue) ? "no hit" : ("highest hit y " + num.ToString("F2", CultureInfo.InvariantCulture))) + ") - at the table's height " + top.yTop.ToString("F2", CultureInfo.InvariantCulture) + "."; return top; } float yTop = top.yTop; top.yTop = num + 0.03f; top.mastX = val3.x; top.x = val3.x + 0.4f; top.sx = Mathf.Min(top.sx, 2.7f); how = "on her lower mast cap at (" + val3.x.ToString("F2", CultureInfo.InvariantCulture) + ", " + num.ToString("F2", CultureInfo.InvariantCulture) + ", " + val3.z.ToString("F2", CultureInfo.InvariantCulture) + ") - top at y " + top.yTop.ToString("F2", CultureInfo.InvariantCulture) + " (table said " + yTop.ToString("F2", CultureInfo.InvariantCulture) + "), centred x " + top.x.ToString("F2", CultureInfo.InvariantCulture) + "."; return top; } private static Quaternion StandUp(Transform thing, Transform model, Transform handle, out string how) { //IL_0018: 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) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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_00bf: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: 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_0167: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_0195: 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_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: 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_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) Quaternion[] array = (Quaternion[])(object)new Quaternion[6] { Quaternion.Euler(0f, 0f, 90f), Quaternion.identity, Quaternion.Euler(-90f, 0f, 0f), Quaternion.Euler(90f, 0f, 0f), Quaternion.Euler(0f, 0f, -90f), Quaternion.Euler(180f, 0f, 0f) }; MeshFilter[] componentsInChildren = ((Component)thing).GetComponentsInChildren<MeshFilter>(true); Quaternion val = array[0]; float num = float.MinValue; float num2 = -1f; float num3 = 0f; Vector3 val2 = Vector3.zero; Vector3 val3 = Vector3.zero; Quaternion[] array2 = array; Vector3 val6 = default(Vector3); Vector3 val9 = default(Vector3); for (int i = 0; i < array2.Length; i++) { Quaternion val4 = (thing.localRotation = array2[i]); ((Vector3)(ref val6))..ctor(float.MaxValue, float.MaxValue, float.MaxValue); Vector3 val7 = -val6; MeshFilter[] array3 = componentsInChildren; foreach (MeshFilter val8 in array3) { if (!((Object)(object)val8 == (Object)null) && !((Object)(object)val8.sharedMesh == (Object)null)) { Bounds bounds = val8.sharedMesh.bounds; for (int k = 0; k < 8; k++) { ((Vector3)(ref val9))..ctor(((k & 1) == 0) ? ((Bounds)(ref bounds)).min.x : ((Bounds)(ref bounds)).max.x, ((k & 2) == 0) ? ((Bounds)(ref bounds)).min.y : ((Bounds)(ref bounds)).max.y, ((k & 4) == 0) ? ((Bounds)(ref bounds)).min.z : ((Bounds)(ref bounds)).max.z); Vector3 val10 = model.InverseTransformPoint(((Component)val8).transform.TransformPoint(val9)) - thing.localPosition; val6 = Vector3.Min(val6, val10); val7 = Vector3.Max(val7, val10); } } } if (!(val7.y < val6.y)) { float num4 = val7.y - val6.y; float num5 = (((Object)(object)handle != (Object)null) ? (model.InverseTransformPoint(handle.position).y - thing.localPosition.y) : ((val7.y + val6.y) / 2f)); float num6 = num4 + ((num5 > 0f) ? 10f : 0f) + num5 * 0.01f; if (num6 > num) { num = num6; num2 = num4; val = val4; val2 = val6; val3 = val7; num3 = num5; } } } if (val == Quaternion.Euler(-90f, 0f, 0f)) { val = Quaternion.Euler(0f, 90f, 0f) * val; } string[] obj = new string[15] { "rotation ", null, null, null, null, null, null, null, null, null, null, null, null, null, null }; Vector3 eulerAngles = ((Quaternion)(ref val)).eulerAngles; obj[1] = ((Vector3)(ref eulerAngles)).ToString("F0"); obj[2] = ", "; obj[3] = num2.ToString("F2", CultureInfo.InvariantCulture); obj[4] = " m end to end, foot at "; obj[5] = val2.y.ToString("F2", CultureInfo.InvariantCulture); obj[6] = " m, handle at "; obj[7] = num3.ToString("F2", CultureInfo.InvariantCulture); obj[8] = " m, footprint "; obj[9] = (val3.x - val2.x).ToString("F2", CultureInfo.InvariantCulture); obj[10] = " x "; obj[11] = (val3.z - val2.z).ToString("F2", CultureInfo.InvariantCulture); obj[12] = " m"; obj[13] = ((num2 < 0f) ? " (no mesh read - left as the prefab is)" : ""); obj[14] = "."; how = string.Concat(obj); return val; } private void RegisterMastPart(BoatCustomParts bcp, Transform model, Transform walk, string key, string Cap, string mastMainName, string mastTopName, string ratlineName) { //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Expected O, but got Unknown //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Expected O, but got Unknown //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_0520: Expected O, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Expected O, but got Unknown //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Expected O, but got Unknown //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Expected O, but got Unknown _walkForZones = walk; BoatPartOption val = FindOption(bcp, mastMainName); BoatPartOption val2 = FindOption(bcp, mastTopName); Spot? spot = null; Spot? cross = null; foreach (Spot item in ParseSpots()) { if (item.label == key + "top") { spot = item; } if (item.label == key + "cross") { cross = item; } } if (!spot.HasValue || !cross.HasValue) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[MastPlatforms] spots missing for '" + key + "'.")); return; } if (key == "aemizen") { string how; Spot value = OnCap(walk, spot.Value, "MAST MIZEN MAIN", out how); spot = value; ((BaseUnityPlugin)this).Logger.LogInfo((object)("[MastPlatforms] mizen top: " + how)); } ShroudRopes(model, key, ratlineName, out var _, out var _); GameObject val3 = new GameObject("PLATFORMS_" + key + "_none"); val3.transform.SetParent(model, false); BoatPartOption val4 = val3.AddComponent<BoatPartOption>(); InitOption(val4); val4.optionName = "(No " + Cap + " Platforms)"; val4.basePrice = 0; val4.installCost = 0; val4.mass = 0; val4.walkColObject = val3; GameObject topVis = new GameObject("PLATFORMS_" + key + "_top"); topVis.transform.SetParent(model, false); BuildVisual(topVis.transform, spot.Value); GameObject val5 = new GameObject("WALK PLATFORMS_" + key + "_top"); val5.transform.SetParent(walk, false); val5.layer = ((Component)walk).gameObject.layer; val5.AddComponent<MastPlatformGuard>(); BuildPlates(val5.transform, ((Component)walk).gameObject.layer, spot.Value); try { AddClimbZones(topVis.transform, ((Component)bcp).transform, spot.Value, null); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[MastPlatforms] climb zones (top) failed: " + ex.Message)); } BoatPartOption val6 = topVis.AddComponent<BoatPartOption>(); InitOption(val6); val6.optionName = Cap + " Fighting Top"; val6.basePrice = 140; val6.installCost = 40; val6.mass = 45; val6.walkColObject = val5; if ((Object)(object)val != (Object)null) { val6.requires.Add(val); } GameObject fullVis = new GameObject("PLATFORMS_" + key + "_full"); fullVis.transform.SetParent(model, false); BuildVisual(fullVis.transform, spot.Value); BuildVisual(fullVis.transform, cross.Value); GameObject val7 = new GameObject("WALK PLATFORMS_" + key + "_full"); val7.transform.SetParent(walk, false); val7.layer = ((Component)walk).gameObject.layer; val7.AddComponent<MastPlatformGuard>(); BuildPlates(val7.transform, ((Component)walk).gameObject.layer, spot.Value); BuildPlates(val7.transform, ((Component)walk).gameObject.layer, cross.Value); BuildConnectorPlates(val7.transform, ((Component)walk).gameObject.layer, spot.Value, cross.Value); BuildConnectorVisual(fullVis.transform, spot.Value, cross.Value); try { AddClimbZones(fullVis.transform, ((Component)bcp).transform, spot.Value, cross); } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[MastPlatforms] climb zones (full) failed: " + ex2.Message)); } BoatPartOption val8 = fullVis.AddComponent<BoatPartOption>(); InitOption(val8); val8.optionName = Cap + " Fighting Top + Lookout Post"; val8.basePrice = 220; val8.installCost = 60; val8.mass = 60; val8.walkColObject = val7; if ((Object)(object)val != (Object)null) { val8.requires.Add(val); } if ((Object)(object)val2 != (Object)null) { val8.requires.Add(val2); } BoatPart val9 = new BoatPart(); val9.category = 0; val9.activeOption = 0; val9.partOptions = new List<BoatPartOption> { val4, val6, val8 }; bcp.availableParts.Add(val9); topVis.SetActive(false); val5.SetActive(false); fullVis.SetActive(false); val7.SetActive(false); try { Transform ratlinePart = null; Transform[] componentsInChildren = ((Component)model).GetComponentsInChildren<Transform>(true); foreach (Transform val10 in componentsInChildren) { if (((Object)val10).name == ratlineName) { ratlinePart = val10; break; } } BuildLowerRatlines(model, walk, key, spot.Value, () => topVis.activeInHierarchy || fullVis.activeInHierarchy, ratlinePart, ratlineName); } catch (Exception ex3) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[MastPlatforms] lower ratlines (" + key + ") failed: " + ex3.Message)); } } internal static float DeckAt(Transform walk, string key, float x, float z, float fromY) { //IL_002c: 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_0036: 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_0041: 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_0077: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) float result = 0.05f; if (Shrouds.TryGetValue(key, out var value)) { result = value.deckWalk; } try { Physics.SyncTransforms(); Vector3 val = walk.TransformPoint(new Vector3(x, fromY, z)); float num = float.NaN; RaycastHit[] array = Physics.RaycastAll(val, -walk.up, fromY + 5f, 1 << ((Component)walk).gameObject.layer, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val2 = array[i]; string text = ((Object)((RaycastHit)(ref val2)).collider).name.ToUpperInvariant(); if (!text.Contains("RATLINE") && !text.Contains("SHROUD") && !text.Contains("PLATFORM") && !text.Contains("TOPSHROUD")) { float y = walk.InverseTransformPoint(((RaycastHit)(ref val2)).point).y; if (float.IsNaN(num) || y > num) { num = y; } } } if (!float.IsNaN(num)) { return num; } } catch { } return result; } private void BuildLowerRatlines(Transform model, Transform walk, string key, Spot top, Func<bool> topFitted, Transform ratlinePart, string ratlineName) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_0542: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_0570: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_04db: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_0814: Unknown result type (might be due to invalid IL or missing references) //IL_0819: Unknown result type (might be due to invalid IL or missing references) //IL_081b: Unknown result type (might be due to invalid IL or missing references) //IL_0820: Unknown result type (might be due to invalid IL or missing references) //IL_0838: Unknown result type (might be due to invalid IL or missing references) //IL_083d: Unknown result type (might be due to invalid IL or missing references) //IL_0842: Unknown result type (might be due to invalid IL or missing references) //IL_0847: Unknown result type (might be due to invalid IL or missing references) //IL_0849: Unknown result type (might be due to invalid IL or missing references) //IL_084e: 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_0858: Unknown result type (might be due to invalid IL or missing references) //IL_08d3: Unknown result type (might be due to invalid IL or missing references) //IL_08e3: Unknown result type (might be due to invalid IL or missing references) //IL_0877: 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_088e: Unknown result type (might be due to invalid IL or missing references) //IL_0898: Unknown result type (might be due to invalid IL or missing references) //IL_09a3: Unknown result type (might be due to invalid IL or missing references) //IL_09ae: Unknown result type (might be due to invalid IL or missing references) //IL_09b5: Unknown result type (might be due to invalid IL or missing references) //IL_09ba: Unknown result type (might be due to invalid IL or missing references) //IL_09c0: Unknown result type (might be due to invalid IL or missing references) //IL_09cb: Unknown result type (might be due to invalid IL or missing references) //IL_09d2: Unknown result type (might be due to invalid IL or missing references) //IL_09d7: Unknown result type (might be due to invalid IL or missing references) //IL_09ea: Unknown result type (might be due to invalid IL or missing references) //IL_09f3: Unknown result type (might be due to invalid IL or missing references) //IL_09fa: Unknown result type (might be due to invalid IL or missing references) //IL_0a42: Unknown result type (might be due to invalid IL or missing references) //IL_0a44: Unknown result type (might be due to invalid IL or missing references) //IL_0a4b: Unknown result type (might be due to invalid IL or missing references) //IL_0a0c: Unknown result type (might be due to invalid IL or missing references) //IL_0a0e: Unknown result type (might be due to invalid IL or missing references) //IL_0a18: Unknown result type (might be due to invalid IL or missing references) //IL_0a20: Unknown result type (might be due to invalid IL or missing references) //IL_0a27: Unknown result type (might be due to invalid IL or missing references) //IL_0a30: Unknown result type (might be due to invalid IL or missing references) //IL_0a35: Unknown result type (might be due to invalid IL or missing references) //IL_0ac9: Unknown result type (might be due to invalid IL or missing references) //IL_0ad0: Expected O, but got Unknown //IL_0af8: Unknown result type (might be due to invalid IL or missing references) //IL_0afa: Unknown result type (might be due to invalid IL or missing references) //IL_0afc: Unknown result type (might be due to invalid IL or missing references) //IL_0b01: Unknown result type (might be due to invalid IL or missing references) //IL_0b0a: Unknown result type (might be due to invalid IL or missing references) //IL_0b0c: Unknown result type (might be due to invalid IL or missing references) //IL_0b0e: Unknown result type (might be due to invalid IL or missing references) //IL_0b18: Unknown result type (might be due to invalid IL or missing references) //IL_0b2a: Unknown result type (might be due to invalid IL or missing references) //IL_0b31: Unknown result type (might be due to invalid IL or missing references) //IL_0b36: Unknown result type (might be due to invalid IL or missing references) //IL_0b59: Unknown result type (might be due to invalid IL or missing references) //IL_0a71: Unknown result type (might be due to invalid IL or missing references) //IL_0a78: Expected O, but got Unknown if (!Shrouds.TryGetValue(key, out var value)) { return; } GameObject val = new GameObject("LOWER_RATLINES_" + key); val.transform.SetParent(model, false); if ((Object)(object)ratlinePart != (Object)null) { val.AddComponent<FollowActive>().leader = ((Component)ratlinePart).gameObject; } GameObject val2 = new GameObject("climbtarget_top"); val2.transform.SetParent(val.transform, false); val2.transform.localPosition = new Vector3(top.x - 0.2f, top.yTop, 0f); int btnLayer = FindButtonLayer(model.root); bool asTrigger = FindButtonTrigger(model.root); string fanFrom; int pieces; Dictionary<int, List<Vector3[]>> dictionary = ShroudRopes(model, key, ratlineName, out fanFrom, out pieces); foreach (KeyValuePair<int, List<Vector3[]>> item in dictionary) { List<string> list = new List<string>(); foreach (Vector3[] item2 in item.Value) { list.Add("foot (" + item2[0].x.ToString("F2", CultureInfo.InvariantCulture) + ", " + item2[0].y.ToString("F1", CultureInfo.InvariantCulture) + ", " + item2[0].z.ToString("F2", CultureInfo.InvariantCulture) + ") head (" + item2[1].x.ToString("F2", CultureInfo.InvariantCulture) + ", " + item2[1].y.ToString("F1", CultureInfo.InvariantCulture) + ", " + item2[1].z.ToString("F2", CultureInfo.InvariantCulture) + ")"); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("[MastPlatforms] lower shrouds '" + key + "' " + ((item.Key < 0) ? "port" : "stbd") + ": " + item.Value.Count + " ropes - " + string.Join("; ", list.ToArray()))); } List<float> list2 = new List<float>(); for (float num = top.yTop - 0.55f; num > value.deckY + 0.45f; num -= 0.42f) { list2.Add(num); } int num2 = 0; Dictionary<int, float> dictionary2 = new Dictionary<int, float> { { -1, float.MaxValue }, { 1, float.MaxValue } }; Vector3 a = default(Vector3); Vector3 b = default(Vector3); for (int i = 0; i < list2.Count; i++) { float num3 = list2[i]; float num4 = Mathf.Clamp01((num3 - value.deckY) / (value.topY - value.deckY)); float num5 = Mathf.Lerp(value.deckZ, value.topZ, num4); float num6 = Mathf.Lerp(value.deckX0, value.topX - 0.15f, num4); float num7 = Mathf.Lerp(value.deckX1, value.topX + 0.15f, num4); for (int j = -1; j <= 1; j += 2) { ((Vector3)(ref a))..ctor(num6, num3, (float)j * num5); ((Ve
DangerousWaters.dll
Decompiled 9 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Rendering; 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: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("0.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 DangerousWaters { internal static class BoatCatalog { public class Entry { public GameObject go; public string name; public bool active; public int mastCount; public float distance; public bool isPlayerBoat; public int sceneIndex = -1; } public static bool IsPlayerVessel(Transform candidate, Transform playerBoat) { if ((Object)(object)candidate == (Object)null || (Object)(object)playerBoat == (Object)null) { return false; } if ((Object)(object)candidate == (Object)(object)playerBoat) { return true; } return playerBoat.IsChildOf(candidate) || candidate.IsChildOf(playerBoat); } public static bool IsPlayersOwnBoat(GameObject go) { if ((Object)(object)go == (Object)null) { return false; } if (IsPlayerVessel(go.transform, GameState.currentBoat)) { return true; } if (IsPlayerVessel(go.transform, GameState.lastBoat)) { return true; } if (IsPlayerVessel(go.transform, GameState.lastOwnedBoat)) { return true; } return false; } public static GameObject FindByIndex(int index) { if (index < 0) { return null; } try { if ((Object)(object)SaveLoadManager.instance == (Object)null) { DWLog.Warn("SaveLoadManager not available yet."); return null; } SaveableObject val = SaveLoadManager.instance.GetObject(index); if ((Object)(object)val == (Object)null) { DWLog.Warn("No object registered at boat index " + index + "."); return null; } if (IsPlayersOwnBoat(((Component)val).gameObject)) { DWLog.Warn("Boat index " + index + " (" + ((Object)((Component)val).gameObject).name + ") is YOUR OWN SHIP - refusing to use it as a pirate."); return null; } BoatRefs componentInChildren = ((Component)val).GetComponentInChildren<BoatRefs>(true); if ((Object)(object)componentInChildren == (Object)null) { DWLog.Warn("Index " + index + " (" + ((Object)((Component)val).gameObject).name + ") has no BoatRefs - it may not be a boat."); } DWLog.Info("Boat index " + index + " resolved to '" + ((Object)((Component)val).gameObject).name + "'"); return ((Component)val).gameObject; } catch (Exception ex) { DWLog.Warn("Lookup of boat index " + index + " failed: " + ex.Message); return null; } } public static List<Entry> FindAll() { //IL_0063: 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_00e8: 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) List<Entry> list = new List<Entry>(); Transform currentBoat = GameState.currentBoat; BoatRefs[] array = Resources.FindObjectsOfTypeAll<BoatRefs>(); if (array == null) { return list; } BoatRefs[] array2 = array; foreach (BoatRefs val in array2) { if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).gameObject == (Object)null) { continue; } Scene scene = ((Component)val).gameObject.scene; if (((Scene)(ref scene)).IsValid()) { Entry entry = new Entry(); entry.go = ((Component)val).gameObject; entry.name = ((Object)((Component)val).gameObject).name; entry.active = ((Component)val).gameObject.activeInHierarchy; entry.mastCount = ((val.masts != null) ? val.masts.Length : 0); entry.distance = (((Object)(object)currentBoat == (Object)null) ? (-1f) : Vector3.Distance(((Component)val).transform.position, currentBoat.position)); entry.isPlayerBoat = IsPlayerVessel(((Component)val).transform, currentBoat); SaveableObject val2 = ((Component)val).GetComponent<SaveableObject>(); if ((Object)(object)val2 == (Object)null) { val2 = ((Component)val).GetComponentInParent<SaveableObject>(); } if ((Object)(object)val2 != (Object)null) { entry.sceneIndex = val2.sceneIndex; } list.Add(entry); } } return list; } public static Entry FindPreferred(string preferredCsv) { if (string.IsNullOrEmpty(preferredCsv)) { return null; } List<Entry> list = FindAll(); if (list.Count == 0) { return null; } string[] array = preferredCsv.Split(new char[1] { ',' }); string[] array2 = array; foreach (string text in array2) { string text2 = text.Trim().ToLowerInvariant(); if (text2.Length == 0) { continue; } Entry entry = null; foreach (Entry item in list) { if (!item.isPlayerBoat && item.name.ToLowerInvariant().IndexOf(text2) >= 0 && (entry == null || item.distance > entry.distance)) { entry = item; } } if (entry != null) { DWLog.Info("Preferred hull matched '" + text2 + "' -> " + entry.name); return entry; } } DWLog.Info("No hull matched the preferred list: " + preferredCsv); return null; } public static string DescribeAll() { List<Entry> list = FindAll(); if (list.Count == 0) { return "No boats found in memory at all."; } list.Sort((Entry a, Entry b) => a.distance.CompareTo(b.distance)); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("Found " + list.Count + " boat object(s) in memory."); stringBuilder.AppendLine("The 'index' column is the boat number used by MOVEBOAT."); stringBuilder.AppendLine(" index | distance | active | name"); int num = 0; foreach (Entry item in list) { stringBuilder.AppendLine(string.Format(" {0,5} | {1,8:0} | {2,-6} | {3}{4}", (item.sceneIndex >= 0) ? item.sceneIndex.ToString() : "-", item.distance, item.active ? "yes" : "no", item.name, item.isPlayerBoat ? " <-- YOUR BOAT" : "")); num++; if (num >= 80) { stringBuilder.AppendLine(" ...(truncated)"); break; } } return stringBuilder.ToString(); } } [BepInPlugin("com.roy.dangerouswaters", "Dangerous Waters", "0.1.1")] public class DangerousWatersPlugin : BaseUnityPlugin { public const string PluginGuid = "com.roy.dangerouswaters"; public const string PluginName = "Dangerous Waters"; public const string PluginVersion = "0.1.1"; public static DangerousWatersPlugin Instance; public static ManualLogSource Log; private GameObject _managerObject; public static bool Ready { get; private set; } private void Awake() { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) Instance = this; Log = ((BaseUnityPlugin)this).Logger; try { DWConfig.Init(((BaseUnityPlugin)this).Config); Ready = true; } catch (Exception ex) { Log.LogError((object)("CONFIG FAILED - the mod will not run. " + ex)); Ready = false; return; } Log.LogInfo((object)"=================================================="); Log.LogInfo((object)"Dangerous Waters v0.1.1 loaded successfully."); Log.LogInfo((object)((DWConfig.Diagnostics != null && DWConfig.Diagnostics.Value) ? "Diagnostic instruments ON - seat watch, carry probe, trim reports, lid testimony and slide warnings all running. Expect them to cost frames." : "Diagnostic instruments OFF - nothing of ours ticks for them.")); Log.LogInfo((object)("Force spawn: " + ((object)DWConfig.KeyForceSpawn.Value/*cast due to .constrained prefix*/).ToString())); Log.LogInfo((object)("Status report: " + ((object)DWConfig.KeyReport.Value/*cast due to .constrained prefix*/).ToString())); Log.LogInfo((object)"=================================================="); DWSaveGuard.Apply(); DWServeGuard.Apply(); DWPortPart.Apply(); DWPrefabs.Apply(); DWShop.Apply(); DWCrates.Apply(); DWItemQuiet.Apply(); DWServeGun.Apply(); DWNativeItem.ApplyShipItemGuards(); SceneManager.sceneLoaded += OnSceneLoaded; } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoaded; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { EnsureManager(); } private void Update() { if (Ready && (Object)(object)_managerObject == (Object)null) { EnsureManager(); } } private void EnsureManager() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown if (Ready && !((Object)(object)_managerObject != (Object)null)) { _managerObject = new GameObject("DangerousWatersManager"); _managerObject.AddComponent<EncounterManager>(); Object.DontDestroyOnLoad((Object)(object)_managerObject); Log.LogInfo((object)"Encounter manager created."); } } } internal static class DangerZone { internal enum Kind { Ground, Patrol } internal sealed class Zone { public readonly string Name; public readonly Kind Kind; private readonly float[] _v; public Zone(string name, Kind kind, float[] lonLat) { Name = name; Kind = kind; _v = lonLat; } public bool Contains(float lon, float lat) { bool flag = false; int num = _v.Length / 2; int num2 = 0; int num3 = num - 1; while (num2 < num) { float num4 = _v[2 * num2]; float num5 = _v[2 * num2 + 1]; float num6 = _v[2 * num3]; float num7 = _v[2 * num3 + 1]; if (num5 > lat != num7 > lat && lon < (num6 - num4) * (lat - num5) / (num7 - num5) + num4) { flag = !flag; } num3 = num2++; } return flag; } } private static float _cacheTimer; private static bool _cachedInDanger; private static Port _cachedNearestPort; private static float _cachedDistance; private static Zone _cachedGround; private static Zone _cachedPatrol; private const float CacheSeconds = 3f; private static readonly Zone[] Zones = new Zone[9] { new Zone("Bone Isle", Kind.Ground, new float[12] { -0.2402f, 41.3381f, -0.3005f, 37.7741f, 0.9814f, 37.9809f, 2.2058f, 38.7175f, 2.9802f, 39.7654f, 3.3199f, 41.2879f }), new Zone("Dead Cove", Kind.Ground, new float[22] { 3.1117f, 30.7241f, 3.5801f, 30.2769f, 4.2952f, 30.0893f, 4.9021f, 30.2233f, 5.4245f, 30.6635f, 5.7148f, 31.528f, 5.4501f, 32.3798f, 4.2889f, 32.9859f, 3.6567f, 32.8366f, 3.1947f, 32.4659f, 2.8469f, 31.5376f }), new Zone("Eleann Island", Kind.Ground, new float[22] { -6.4554f, 32.7737f, -6.4751f, 29.1954f, -4.808f, 29.5848f, -3.7006f, 30.4731f, -3.0678f, 31.6535f, -2.873f, 32.7488f, -2.873f, 32.7731f, -3.1085f, 34.0192f, -3.9263f, 35.3043f, -5.0556f, 36.0831f, -6.4386f, 36.3509f }), new Zone("Sen'na", Kind.Ground, new float[16] { 2.591f, 27.6931f, 3.1493f, 27.4289f, 3.6627f, 27.6333f, 3.8755f, 28.1392f, 3.6427f, 28.685f, 3.1617f, 28.8628f, 2.6159f, 28.6202f, 2.4349f, 28.1425f }), new Zone("Dragon Cliffs", Kind.Patrol, new float[18] { 4.267f, 31.3342f, 4.3546f, 31.0585f, 4.7727f, 30.8324f, 5.1582f, 31.0114f, 5.2745f, 31.3446f, 5.1778f, 31.6426f, 4.7662f, 31.8477f, 4.4657f, 31.7353f, 4.308f, 31.528f }), new Zone("Fort Aestrin", Kind.Patrol, new float[20] { -0.0717f, 40.2266f, 0.182f, 39.7772f, 0.6098f, 39.6084f, 1.0484f, 39.743f, 1.2811f, 40.0232f, 1.3035f, 40.6006f, 0.9589f, 40.9698f, 0.6404f, 41.0498f, 0.2111f, 40.9078f, -0.0472f, 40.5435f }), new Zone("Gold Rock City", Kind.Patrol, new float[16] { -5.5615f, 31.0953f, -5.3905f, 30.6231f, -4.8597f, 30.3934f, -4.3876f, 30.5619f, -4.1375f, 31.0927f, -4.2651f, 31.5342f, -4.8342f, 31.8302f, -5.4263f, 31.5444f }), new Zone("New Port", Kind.Patrol, new float[16] { 4.3661f, 31.7877f, 4.7617f, 31.6116f, 5.0577f, 31.7341f, 5.2517f, 32.1093f, 5.1496f, 32.4181f, 4.7566f, 32.6197f, 4.4299f, 32.5125f, 4.2411f, 32.1297f }), new Zone("Oasis", Kind.Patrol, new float[16] { -5.6326f, 32.2874f, -5.105f, 32.0277f, -4.5791f, 32.2221f, -4.3716f, 32.748f, -4.4582f, 33.091f, -5.074f, 33.4651f, -5.5966f, 33.2478f, -5.7926f, 32.7546f }) }; private static readonly string[] CheckNames = new string[5] { "Fort Aestrin", "Oasis", "Gold Rock City", "New Port", "Dragon Cliffs" }; private static readonly float[] CheckLonLat = new float[10] { 0.6402f, 40.3306f, -5.0796f, 32.7437f, -4.8521f, 31.1106f, 4.7427f, 32.1135f, 4.7712f, 31.3399f }; private const double A00 = 0.00011114712745472089; private const double A01 = 8.685949198147633E-09; private const double A10 = -7.189769585571879E-08; private const double A11 = 0.00011120198619762964; private const double A20 = -0.00016078455851615455; private const double A21 = 36.00005563211932; private static bool _frameChecked; private static bool _frameFailed; private static bool UseZones => (DWConfig.UseDrawnZones == null || DWConfig.UseDrawnZones.Value) && !_frameFailed; public static Port LastNearestPort => _cachedNearestPort; public static float LastPortDistance => _cachedDistance; public static Zone LastGround => _cachedGround; public static Zone LastPatrol => _cachedPatrol; internal static void LonLatOf(Vector3 real, out float lon, out float lat) { //IL_0002: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) lon = (float)((double)real.x * 0.00011114712745472089 + (double)real.z * -7.189769585571879E-08 + -0.00016078455851615455); lat = (float)((double)real.x * 8.685949198147633E-09 + (double)real.z * 0.00011120198619762964 + 36.00005563211932); } internal static Vector3 RealPos(Vector3 shifting) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_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_002b: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)FloatingOriginManager.instance != (Object)null) { return FloatingOriginManager.instance.ShiftingPosToRealPos(shifting); } } catch { } return shifting; } internal static Zone GroundAt(float lon, float lat) { for (int i = 0; i < Zones.Length; i++) { if (Zones[i].Kind == Kind.Ground && Zones[i].Contains(lon, lat)) { return Zones[i]; } } return null; } internal static Zone PatrolAt(float lon, float lat) { for (int i = 0; i < Zones.Length; i++) { if (Zones[i].Kind == Kind.Patrol && Zones[i].Contains(lon, lat)) { return Zones[i]; } } return null; } private static void CheckFrame(Port[] ports) { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) if (_frameChecked || ports == null) { return; } int num = 0; int num2 = 0; string text = ""; foreach (Port val in ports) { if ((Object)(object)val == (Object)null) { continue; } string portName; try { portName = val.GetPortName(); } catch { continue; } if (string.IsNullOrEmpty(portName)) { continue; } for (int j = 0; j < CheckNames.Length; j++) { if (portName.ToLowerInvariant().Contains(CheckNames[j].ToLowerInvariant())) { LonLatOf(RealPos(((Component)val).transform.position), out var lon, out var lat); float num3 = lon - CheckLonLat[2 * j]; float num4 = lat - CheckLonLat[2 * j + 1]; float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4) * 8.995f; num++; if (num5 < 1f) { num2++; } text = text + "\n " + portName + " reads " + lon.ToString("0.000") + ", " + lat.ToString("0.000") + " - drawn centre " + CheckLonLat[2 * j].ToString("0.000") + ", " + CheckLonLat[2 * j + 1].ToString("0.000") + " (" + num5.ToString("0.00") + " km off)"; } } } if (num != 0) { _frameChecked = true; if (num2 == num) { DWLog.Info("ZONE CHECK: the drawn grounds and patrols sit on the game's own ports - frame agrees." + text); return; } _frameFailed = true; DWLog.Warn("ZONE CHECK FAILED: " + (num - num2) + " of " + num + " ports are more than 1 km from the drawn centre. The drawn zones are OFF and the old port-reach rule is in force." + text); } } public static bool IsDaylight() { if ((Object)(object)Sun.sun == (Object)null) { return false; } float localTime = Sun.sun.localTime; return localTime > DWConfig.DawnHour.Value && localTime < DWConfig.DuskHour.Value; } public static Port NearestPort(Vector3 position, out float distance) { //IL_003f: 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) distance = float.MaxValue; Port result = null; Port[] ports = Port.ports; if (ports == null) { return null; } CheckFrame(ports); foreach (Port val in ports) { if (!((Object)(object)val == (Object)null)) { float num = Vector3.Distance(position, ((Component)val).transform.position); if (num < distance) { distance = num; result = val; } } } return result; } public static bool InDangerousWaters() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) _cacheTimer -= Time.deltaTime; if (_cacheTimer > 0f) { return _cachedInDanger; } _cacheTimer = 3f; Transform currentBoat = GameState.currentBoat; if ((Object)(object)currentBoat == (Object)null) { _cachedInDanger = false; return false; } float distance; Port val = (_cachedNearestPort = NearestPort(currentBoat.position, out distance)); _cachedDistance = distance; if (UseZones) { LonLatOf(RealPos(currentBoat.position), out var lon, out var lat); _cachedGround = GroundAt(lon, lat); _cachedPatrol = PatrolAt(lon, lat); _cachedInDanger = _cachedGround != null && _cachedPatrol == null; return _cachedInDanger; } _cachedGround = null; _cachedPatrol = null; if ((Object)(object)val == (Object)null) { _cachedInDanger = GameState.distanceToLand > DWConfig.PatrolReachDefault.Value; return _cachedInDanger; } float num = DWConfig.PatrolReachFor(val.region); _cachedInDanger = distance > num; return _cachedInDanger; } private static string ZoneText(Vector3 shifting) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) LonLatOf(RealPos(shifting), out var lon, out var lat); Zone zone = GroundAt(lon, lat); Zone zone2 = PatrolAt(lon, lat); string arg = ((zone == null) ? "open sea, no pirate grounds" : ("the " + zone.Name + " grounds" + ((zone2 != null) ? (", inside the " + zone2.Name + " patrol") : ""))); return $"{lon:0.000}, {lat:0.000} - {arg}"; } public static string Describe() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) Transform currentBoat = GameState.currentBoat; if ((Object)(object)currentBoat == (Object)null) { return "No current boat - are you aboard?"; } float distance; Port val = NearestPort(currentBoat.position, out distance); string text = (((Object)(object)val == (Object)null) ? "none found" : val.GetPortName()); string text2 = (((Object)(object)val == (Object)null) ? "n/a" : ((object)Unsafe.As<PortRegion, PortRegion>(ref val.region)/*cast due to .constrained prefix*/).ToString()); float num = (((Object)(object)val == (Object)null) ? DWConfig.PatrolReachDefault.Value : DWConfig.PatrolReachFor(val.region)); string text3 = (((Object)(object)Sun.sun == (Object)null) ? "?" : Sun.sun.localTime.ToString("0.0")); return string.Format("Nearest port: {0} ({1})\nDistance: {2:0}m Patrol reach (old rule): {3:0}m\nPosition: {4}\nRule: {5}\nIn dangerous waters: {6}\nLocal time: {7} Daylight: {8}\nDistance to land: {9:0}m", text, text2, distance, num, ZoneText(currentBoat.position), UseZones ? "the drawn grounds and patrols" : "beyond the nearest port's reach", InDangerousWaters() ? "YES" : "no", text3, IsDaylight() ? "YES" : "no", GameState.distanceToLand); } public static string ShortStatus() { //IL_0021: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) Transform currentBoat = GameState.currentBoat; if ((Object)(object)currentBoat == (Object)null) { return "Not aboard a boat."; } float distance; Port val = NearestPort(currentBoat.position, out distance); if ((Object)(object)val == (Object)null) { return "No ports found! (distance to land " + GameState.distanceToLand.ToString("0") + "m)"; } if (UseZones) { return string.Format("{0} - {1} - {2}", ZoneText(currentBoat.position), InDangerousWaters() ? "DANGEROUS" : "safe", IsDaylight() ? "daylight" : "night"); } float num = DWConfig.PatrolReachFor(val.region); return string.Format("{0} ({1}) {2:0}m / patrol {3:0}m - {4} - {5}", val.GetPortName(), val.region, distance, num, (distance > num) ? "DANGEROUS" : "patrolled", IsDaylight() ? "daylight" : "night"); } } internal static class DWBetterDrag { internal static string LastDonor = ""; private static bool _looked; private static MethodInfo _setCustom; private static MethodInfo _getDefault; private static string _why = "not looked for yet"; internal static bool Installed() { Look(); return _setCustom != null && _getDefault != null; } private static void Look() { if (_looked) { return; } _looked = true; try { Type type = null; Type type2 = null; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { if (type == null) { type = assemblies[i].GetType("BetterDrag.ShipConfiguration.ShipDragConfigManager", throwOnError: false); } if (type2 == null) { type2 = assemblies[i].GetType("BetterDrag.ShipConfiguration.DefaultShipConfigurations", throwOnError: false); } if (type != null && type2 != null) { break; } } if (type == null || type2 == null) { _why = "Better Drag is not installed"; return; } BindingFlags bindingAttr = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; _setCustom = type.GetMethod("SetCustomPerformance", bindingAttr); _getDefault = type2.GetMethod("GetDefaultPerformanceByName", bindingAttr); if (_setCustom == null || _getDefault == null) { _why = "Better Drag is installed but its shape has changed - " + ((_setCustom == null) ? "SetCustomPerformance" : "GetDefaultPerformanceByName") + " is gone. DW will leave it alone rather than guess."; _setCustom = null; _getDefault = null; } else { _why = "found"; } } catch (Exception ex) { _why = "look failed (" + ex.Message + ")"; } } internal static void Register(Transform ship) { if ((Object)(object)ship == (Object)null || (DWConfig.BetterDragRegister != null && !DWConfig.BetterDragRegister.Value)) { return; } if (!Installed()) { if (_why != "Better Drag is not installed") { DWLog.Warn("Better Drag: " + _why); } return; } string text = ((Object)ship).name.Replace("(Clone)", "").Trim(); string text2 = ((DWConfig.BetterDragDonor != null) ? DWConfig.BetterDragDonor.Value : ""); if (string.IsNullOrEmpty(text2)) { text2 = LastDonor; } text2 = (text2 ?? "").Replace("(Clone)", "").Replace("(live)", "").Replace("(prefab)", "") .Trim(); if (string.IsNullOrEmpty(text2)) { DWLog.Warn("Better Drag: she could be registered, but DW does not know which vanilla hull she was built from, so there is no row to borrow. Name one in [Pirate hull (bundled)] Better Drag - the vanilla hull she sails like."); return; } try { object obj = _getDefault.Invoke(null, new object[1] { text2 }); if (obj == null) { DWLog.Warn("Better Drag: it has no tuned row for '" + text2 + "', so there is nothing to give her. She will use Better Drag's generic defaults."); return; } _setCustom.Invoke(null, new object[2] { text, obj }); DWLog.Info("Better Drag: '" + text + "' registered to sail like '" + text2 + "' - she now gets the same hand-tuned hydrostatics the player's hull gets (" + obj.ToString() + "). Asked of Better Drag, not copied, so his tuning stays his."); } catch (Exception ex) { DWLog.Warn("Better Drag: registering '" + text + "' failed (" + ex.Message + "). She keeps Better Drag's generic defaults; nothing else is affected."); } } internal static void ReportHullReadable(Transform ship) { //IL_0089: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_00b5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ship == (Object)null || (DWConfig.BetterDragRayReport != null && !DWConfig.BetterDragRayReport.Value)) { return; } try { int num = 0; int num2 = 0; Collider[] componentsInChildren = ((Component)ship).GetComponentsInChildren<Collider>(true); for (int i = 0; i < componentsInChildren.Length; i++) { if (!((Object)(object)componentsInChildren[i] == (Object)null)) { if (componentsInChildren[i].isTrigger) { num2++; } else { num++; } } } Vector3 forward = ship.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.001f) { forward = Vector3.forward; } ((Vector3)(ref forward)).Normalize(); float num3 = RayToHer(ship, ship.position + forward * 100f, -forward); float num4 = RayToHer(ship, ship.position - forward * 100f, forward); string text = ((!(num3 < 0f) && !(num4 < 0f)) ? ("her length on that line reads " + (200f - num3 - num4).ToString("0.0") + " m (bow found " + num3.ToString("0.0") + " m in, stern " + num4.ToString("0.0") + " m in)") : ("*** ONE OF THE RAYS NEVER FOUND HER. Better Drag measures every hull this way, so it cannot read her length and will fall back on whatever its model does with nothing - her hull needs solid collider at the " + ((num3 < 0f) ? "BOW" : "STERN") + ". ***")); DWLog.Info("BETTER DRAG READABILITY: '" + ((Object)ship).name + "' carries " + num + " solid collider(s) and " + num2 + " trigger(s); a ray from 100 m ahead and one from 100 m astern - the same two Better Drag casts to find a hull - " + text); } catch (Exception ex) { DWLog.Warn("Better Drag readability: " + ex.Message); } } internal static void KeepHerOut(Transform ship) { if ((Object)(object)ship == (Object)null) { return; } if (DWConfig.BetterDragFloatsHer != null && DWConfig.BetterDragFloatsHer.Value) { DWLog.Info("Better Drag: [Let Better Drag float her too] is ON - her flotation is handed to Better Drag. If she settles by the head or goes under, that switch is the first thing to turn back off."); return; } Look(); try { Type type = null; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { type = assemblies[i].GetType("BetterDrag.Utilities.ModEnableCheck", throwOnError: false); if (type != null) { break; } } if (type == null) { return; } FieldInfo field = type.GetField("DisableForShipList", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field == null || field.FieldType != typeof(string[])) { DWLog.Warn("Better Drag: its leave-alone list is not where it was, so DW cannot take her out of its hands. If she goes under, uninstall Better Drag or tell AugSphere DW asked for a door here."); return; } string text = ((Object)ship).name.Replace("(Clone)", "").Trim(); string[] array = (string[])field.GetValue(null); if (array == null) { array = new string[0]; } for (int j = 0; j < array.Length; j++) { if (string.Equals(array[j], text, StringComparison.OrdinalIgnoreCase)) { return; } } string[] array2 = new string[array.Length + 1]; Array.Copy(array, array2, array.Length); array2[array.Length] = text; field.SetValue(null, array2); DWLog.Info("Better Drag: '" + text + "' added to its own leave-alone list (" + array.Length + " name(s) there before). Your ship keeps every bit of Better Drag; the pirate keeps DW's flotation, which is the one twelve minutes of stock testing proved floats her. Turn [Pirate hull (bundled)] Let Better Drag float her too ON to hand her back."); } catch (Exception ex) { DWLog.Warn("Better Drag: taking her out of its hands failed (" + ex.Message + "). If she goes under, that is why."); } } internal static void WatchHerFloat(Transform ship) { if ((Object)(object)ship == (Object)null || (DWConfig.BetterDragSinkWatch != null && !DWConfig.BetterDragSinkWatch.Value)) { return; } try { if ((Object)(object)((Component)ship).GetComponent<DWSinkWatch>() == (Object)null) { ((Component)ship).gameObject.AddComponent<DWSinkWatch>(); } } catch (Exception ex) { DWLog.Warn("Sink watch: " + ex.Message); } } private static float RayToHer(Transform ship, Vector3 from, Vector3 dir) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) RaycastHit[] array = Physics.RaycastAll(from, dir, 200f); float num = -1f; for (int i = 0; i < array.Length; i++) { Collider collider = ((RaycastHit)(ref array[i])).collider; if (!((Object)(object)collider == (Object)null) && !collider.isTrigger && ((Component)collider).transform.IsChildOf(ship) && (num < 0f || ((RaycastHit)(ref array[i])).distance < num)) { num = ((RaycastHit)(ref array[i])).distance; } } return num; } } internal class DWSinkWatch : MonoBehaviour { private readonly OceanSampler _ocean = new OceanSampler(); private float _next; private float _born; private float _lastY; private bool _haveLast; private bool _cried; private void Start() { _born = Time.time; _next = Time.time + 1f; } private void Update() { //IL_005c: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) if (Time.time < _next) { return; } _next = Time.time + 1f; float num = Time.time - _born; if (num > 60f) { Object.Destroy((Object)(object)this); return; } try { if (_ocean.TryGetHeight(((Component)this).transform.position, out var height)) { float num2 = ((Component)this).transform.position.y - height; float num3 = (_haveLast ? (num2 - _lastY) : 0f); _lastY = num2; _haveLast = true; bool flag = num2 < -1.5f; string text = (flag ? (" *** SHE IS GOING UNDER - her origin is " + (0f - num2).ToString("0.00") + " m BELOW the sea and " + ((num3 < -0.05f) ? ("still falling at " + (0f - num3).ToString("0.00") + " m/s") : "no longer rising") + ". ***") : ""); Rigidbody component = ((Component)this).GetComponent<Rigidbody>(); object obj; if (!((Object)(object)component == (Object)null)) { Vector3 velocity = component.velocity; obj = ", making " + ((Vector3)(ref velocity)).magnitude.ToString("0.0") + " m/s"; } else { obj = ""; } string text2 = (string)obj; DWLog.Info("SINK WATCH [" + num.ToString("00") + "s]: her origin sits " + num2.ToString("+0.00;-0.00") + " m against the sea (" + ((num3 >= 0f) ? "rising " : "falling ") + Mathf.Abs(num3).ToString("0.00") + " m/s)" + text2 + text); if (flag && !_cried) { _cried = true; DWLog.Warn("SINK WATCH: she went under at " + num.ToString("0") + " s old. Everything above this line is her last minute afloat - read it, not the flotation census, which only ever sees her first two seconds."); } } } catch { } } } internal static class DWPaths { internal static string PluginDir { get { try { string directoryName = Path.GetDirectoryName(typeof(DangerousWatersPlugin).Assembly.Location); if (!string.IsNullOrEmpty(directoryName) && Directory.Exists(directoryName)) { return directoryName; } } catch { } return Path.Combine(Paths.PluginPath, "DangerousWaters"); } } } internal static class DWBundle { private const string BundleFileName = "dwpirates"; private static AssetBundle _bundle; private static bool _loadAttempted; private static bool _loggedContents; internal const float StrayMetres = 200f; internal static Transform LastDonorRoot; private static string BundlePath => Path.Combine(DWPaths.PluginDir, "dwpirates"); internal static bool BundleExists { get { try { return File.Exists(BundlePath); } catch { return false; } } } private static AssetBundle GetBundle() { if ((Object)(object)_bundle != (Object)null) { return _bundle; } if (_loadAttempted) { return null; } _loadAttempted = true; string bundlePath = BundlePath; if (!File.Exists(bundlePath)) { DWLog.Warn("BUNDLE MISSING - every gun will be a grey box, the port lids will be planks, the swivel cannot be built and the booth will have nothing to sell. No dwpirates file at: " + bundlePath + " <- the bundle must sit beside the DLL in THAT folder, not in the Desktop staging folder of the same name."); return null; } try { _bundle = AssetBundle.LoadFromFile(bundlePath); } catch (Exception ex) { DWLog.Warn("Bundle: LoadFromFile threw - " + ex.Message); return null; } if ((Object)(object)_bundle == (Object)null) { DWLog.Warn("Bundle: dwpirates exists but loaded as NULL. Almost always means it was built with the wrong Unity version - Sailwind needs 2019.1.10f1."); return null; } LogContentsOnce(); return _bundle; } private static void LogContentsOnce() { if (_loggedContents || (Object)(object)_bundle == (Object)null) { return; } _loggedContents = true; try { string[] allAssetNames = _bundle.GetAllAssetNames(); DWLog.Info("Bundle: dwpirates opened, " + allAssetNames.Length + " asset(s):"); for (int i = 0; i < allAssetNames.Length && i < 40; i++) { DWLog.Info(" " + allAssetNames[i]); } } catch (Exception ex) { DWLog.Warn("Bundle: could not list contents - " + ex.Message); } } internal static GameObject TrySpawn(string wantName, Vector3 position) { //IL_0067: 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) AssetBundle bundle = GetBundle(); if ((Object)(object)bundle == (Object)null) { return null; } if (string.IsNullOrEmpty(wantName)) { return null; } GameObject val = FindPrefab(bundle, wantName); if ((Object)(object)val == (Object)null) { DWLog.Info("Bundle: nothing matching '" + wantName + "' in dwpirates."); return null; } GameObject val2; try { val2 = Object.Instantiate<GameObject>(val, position, Quaternion.identity); } catch (Exception ex) { DWLog.Warn("Bundle: Instantiate threw - " + ex.Message); return null; } if ((Object)(object)val2 == (Object)null) { return null; } int num = RepairShaders(val2); val2.AddComponent<DWBundleHull>(); int num2 = HideShopFurniture(val2); int num3 = HideWaterFx(val2); DWRig.Apply(val2); FloatToSurface(val2); if (DWConfig.BundleHullKinematic != null && DWConfig.BundleHullKinematic.Value) { HoldStill(val2); } else { TameWalkColliders(val2); HaulStraysHome(val2.transform); EnableBuoyancy(val2); } DWLog.Info("Bundle: spawned '" + ((Object)val).name + "' from dwpirates" + ((num > 0) ? (" (" + num + " material(s) re-shadered)") : "") + ((num2 > 0) ? (", " + num2 + " shop fitting(s) hidden") : "") + ((num3 > 0) ? (", " + num3 + " water-fx object(s) hidden") : "")); return val2; } private static int HideWaterFx(GameObject root) { string[] array = new string[11] { "waterobjectinteraction", "waterfoam", "water foam", "splash", "foam", "wake", "ripple", "overflow", "smalldrops", "bigdrops", "damage_water" }; int num = 0; Transform[] componentsInChildren = root.GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if ((Object)(object)val == (Object)null || (Object)(object)val == (Object)(object)root.transform) { continue; } string text = ((Object)val).name.ToLowerInvariant(); bool flag = false; string[] array2 = array; foreach (string value in array2) { if (text.Contains(value)) { flag = true; break; } } if (!flag) { continue; } bool flag2 = false; Renderer[] componentsInChildren2 = ((Component)val).GetComponentsInChildren<Renderer>(true); Renderer[] array3 = componentsInChildren2; foreach (Renderer val2 in array3) { if ((Object)(object)val2 != (Object)null && val2.enabled) { val2.enabled = false; flag2 = true; } } ParticleSystem[] componentsInChildren3 = ((Component)val).GetComponentsInChildren<ParticleSystem>(true); ParticleSystem[] array4 = componentsInChildren3; foreach (ParticleSystem val3 in array4) { if ((Object)(object)val3 != (Object)null) { val3.Stop(true, (ParticleSystemStopBehavior)0); flag2 = true; } } if (flag2) { num++; DWLog.Info(" water-fx hidden: " + ((Object)val).name); } } return num; } private static int HideShopFurniture(GameObject root) { string[] array = new string[2] { "purchase boat ui", "purchase boat button" }; int num = 0; Transform[] componentsInChildren = root.GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if ((Object)(object)val == (Object)null || (Object)(object)val == (Object)(object)root.transform) { continue; } string text = ((Object)val).name.ToLowerInvariant(); string[] array2 = array; foreach (string value in array2) { if (text.Contains(value)) { ((Component)val).gameObject.SetActive(false); num++; break; } } } return num; } private static void FloatToSurface(GameObject root) { //IL_0047: 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_004d: 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_001d: Unknown result type (might be due to invalid IL or missing references) float num = 0f; try { if (OceanSampler.Available && new OceanSampler().TryGetHeight(root.transform.position, out var height)) { num = height; } } catch { num = 0f; } Vector3 position = root.transform.position; float y = position.y; position.y = num + 0.25f; root.transform.position = position; DWLog.Info("Bundle: raised her from y=" + y.ToString("0.0") + " to y=" + position.y.ToString("0.0") + " (sea level " + num.ToString("0.0") + ") - a frozen hull cannot float herself up."); } private static GameObject FindPrefab(AssetBundle bundle, string wantName) { string value = wantName.ToLowerInvariant(); string[] allAssetNames; try { allAssetNames = bundle.GetAllAssetNames(); } catch { return null; } string[] array = allAssetNames; foreach (string text in array) { if (text.EndsWith(".prefab", StringComparison.OrdinalIgnoreCase) && text.ToLowerInvariant().Contains(value)) { return SafeLoad(bundle, text); } } string[] array2 = allAssetNames; foreach (string text2 in array2) { if (text2.EndsWith(".fbx", StringComparison.OrdinalIgnoreCase) && text2.ToLowerInvariant().Contains(value)) { return SafeLoad(bundle, text2); } } string[] array3 = allAssetNames; foreach (string text3 in array3) { string text4 = text3.ToLowerInvariant(); if (!text4.EndsWith(".jpg") && !text4.EndsWith(".jpeg") && !text4.EndsWith(".png") && !text4.EndsWith(".tga") && !text4.EndsWith(".psd") && !text4.EndsWith(".mat") && text4.Contains(value)) { return SafeLoad(bundle, text3); } } return null; } internal static GameObject LoadGunModel(string keyFragment) { AssetBundle bundle = GetBundle(); if ((Object)(object)bundle == (Object)null) { return null; } return FindPrefab(bundle, keyFragment); } internal static Texture2D LoadTexture(string keyFragment) { AssetBundle bundle = GetBundle(); if ((Object)(object)bundle == (Object)null) { return null; } string value = keyFragment.ToLowerInvariant(); try { string[] allAssetNames = bundle.GetAllAssetNames(); foreach (string text in allAssetNames) { if (text.ToLowerInvariant().Contains(value)) { return bundle.LoadAsset<Texture2D>(text); } } } catch (Exception ex) { DWLog.Warn("Bundle: LoadTexture " + keyFragment + " - " + ex.Message); } return null; } private static GameObject SafeLoad(AssetBundle bundle, string assetPath) { try { return bundle.LoadAsset<GameObject>(assetPath); } catch (Exception ex) { DWLog.Warn("Bundle: LoadAsset failed for " + assetPath + " - " + ex.Message); return null; } } internal static int RepairShadersOn(GameObject root) { return RepairShaders(root); } internal static void TintBareMetal(GameObject root) { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00d0: 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) Color color = default(Color); ((Color)(ref color))..ctor(0.16f, 0.16f, 0.18f); Renderer[] componentsInChildren = root.GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).GetComponent<TextMesh>() != (Object)null) { continue; } Material[] materials = val.materials; foreach (Material val2 in materials) { if (!((Object)(object)val2 == (Object)null) && (!val2.HasProperty("_MainTex") || !((Object)(object)val2.mainTexture != (Object)null)) && val2.HasProperty("_Color")) { Color color2 = val2.color; if ((color2.r + color2.g + color2.b) / 3f > 0.45f) { val2.color = color; DWWood.Calm(val2, 0.15f, 0.14f); } } } } } private static int RepairShaders(GameObject root) { int num = 0; Renderer[] componentsInChildren = root.GetComponentsInChildren<Renderer>(true); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { if ((Object)(object)val == (Object)null) { continue; } Material[] sharedMaterials = val.sharedMaterials; if (sharedMaterials == null) { continue; } foreach (Material val2 in sharedMaterials) { if (!((Object)(object)val2 == (Object)null)) { Shader shader = val2.shader; string text = (((Object)(object)shader != (Object)null) ? ((Object)shader).name : null); bool flag = (Object)(object)shader == (Object)null || string.IsNullOrEmpty(text) || text == "Hidden/InternalErrorShader"; Shader val3 = null; if (!flag) { val3 = Shader.Find(text); } if ((Object)(object)val3 == (Object)null) { val3 = Shader.Find("Standard"); } if ((Object)(object)val3 != (Object)null && (Object)(object)val3 != (Object)(object)shader) { val2.shader = val3; num++; } } } } return num; } private static void TameWalkColliders(GameObject root) { try { int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; Transform[] componentsInChildren = root.GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if ((Object)(object)val == (Object)null || !((Object)val).name.ToUpperInvariant().StartsWith("WALK")) { continue; } num++; Collider[] componentsInChildren2 = ((Component)val).GetComponentsInChildren<Collider>(true); foreach (Collider val2 in componentsInChildren2) { if ((Object)(object)val2 == (Object)null) { continue; } MeshCollider val3 = (MeshCollider)(object)((val2 is MeshCollider) ? val2 : null); if ((Object)(object)val3 != (Object)null && !val3.convex) { try { val3.convex = true; num2++; } catch (Exception ex) { num3++; DWLog.Warn("Walk cols: '" + ((Object)val3).name + "' would not cook a convex hull (" + ex.Message + ") - switching that one off instead, since an illegal shape is worse than a gap."); ((Collider)val3).enabled = false; continue; } } if (!val2.enabled) { val2.enabled = true; num4++; } } } if (num == 0) { DWLog.Info("Walk cols: none on this hull - nothing to tame."); return; } DWLog.Info("Walk cols: " + num2 + " non-convex mesh(es) made CONVEX and " + num4 + " collider(s) switched back on across " + num + " walk node(s)" + ((num3 > 0) ? (", " + num3 + " could not cook and stay off") : "") + ". She is a solid ship again: a cannonball can hit her, and PhysX can finally work out an inertia tensor from her own hull."); } catch (Exception ex2) { DWLog.Warn("Walk cols: " + ex2.Message); } } private static void EnableBuoyancy(GameObject root) { //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_0516: Unknown result type (might be due to invalid IL or missing references) //IL_051b: Unknown result type (might be due to invalid IL or missing references) //IL_04ef: Unknown result type (might be due to invalid IL or missing references) //IL_0916: Unknown result type (might be due to invalid IL or missing references) //IL_091b: Unknown result type (might be due to invalid IL or missing references) //IL_0920: Unknown result type (might be due to invalid IL or missing references) //IL_0947: Unknown result type (might be due to invalid IL or missing references) //IL_094c: Unknown result type (might be due to invalid IL or missing references) //IL_0950: Unknown result type (might be due to invalid IL or missing references) //IL_0955: Unknown result type (might be due to invalid IL or missing references) //IL_095c: Unknown result type (might be due to invalid IL or missing references) //IL_0961: Unknown result type (might be due to invalid IL or missing references) //IL_0966: Unknown result type (might be due to invalid IL or missing references) //IL_0a43: Unknown result type (might be due to invalid IL or missing references) //IL_0a48: Unknown result type (might be due to invalid IL or missing references) //IL_0a6d: Unknown result type (might be due to invalid IL or missing references) //IL_0a6f: Unknown result type (might be due to invalid IL or missing references) //IL_0a89: Unknown result type (might be due to invalid IL or missing references) //IL_0a90: Unknown result type (might be due to invalid IL or missing references) //IL_0a95: Unknown result type (might be due to invalid IL or missing references) //IL_0aae: Unknown result type (might be due to invalid IL or missing references) //IL_0aba: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_059e: Unknown result type (might be due to invalid IL or missing references) //IL_062e: Unknown result type (might be due to invalid IL or missing references) //IL_0633: Unknown result type (might be due to invalid IL or missing references) //IL_064e: Unknown result type (might be due to invalid IL or missing references) //IL_0653: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_0814: Unknown result type (might be due to invalid IL or missing references) //IL_0822: 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_0878: Unknown result type (might be due to invalid IL or missing references) //IL_087d: Unknown result type (might be due to invalid IL or missing references) //IL_0897: Unknown result type (might be due to invalid IL or missing references) //IL_089c: Unknown result type (might be due to invalid IL or missing references) //IL_072a: Unknown result type (might be due to invalid IL or missing references) //IL_0733: Unknown result type (might be due to invalid IL or missing references) //IL_07a9: 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_07c8: Unknown result type (might be due to invalid IL or missing references) //IL_07cd: Unknown result type (might be due to invalid IL or missing references) try { Rigidbody val = root.GetComponent<Rigidbody>(); if ((Object)(object)val == (Object)null) { val = root.GetComponentInChildren<Rigidbody>(true); } if ((Object)(object)val == (Object)null) { DWLog.Warn("Buoyancy: no Rigidbody on the bundle hull - freezing her instead."); HoldStill(root); return; } Type type = FindTypeByName("BoatProbes"); if (type == null) { DWLog.Warn("Flotation: Crest's BoatProbes type not found in any loaded assembly - freezing her instead."); HoldStill(root); return; } Component val2 = null; string text = "?"; int num = -1; Object[] array = Resources.FindObjectsOfTypeAll(type); Object[] array2 = array; foreach (Object val3 in array2) { Component val4 = (Component)(object)((val3 is Component) ? val3 : null); if ((Object)(object)val4 == (Object)null || (Object)(object)val4.transform == (Object)(object)root.transform || val4.transform.IsChildOf(root.transform)) { continue; } string text2 = BoatNameOf(val4.transform); if (text2 != null) { bool flag = text2.ToUpperInvariant().Contains("CAELANOR"); bool activeInHierarchy = val4.gameObject.activeInHierarchy; int num2 = (flag ? 2 : 0) + (activeInHierarchy ? 1 : 0); if (num2 > num) { val2 = val4; text = text2 + (activeInHierarchy ? " (live)" : " (prefab)"); num = num2; DWBetterDrag.LastDonor = text2; LastDonorRoot = BoatRootOf(val4.transform); } if (num2 == 3) { break; } } } if ((Object)(object)val2 == (Object)null) { DWLog.Warn("Flotation: no BoatProbes donor in memory - freezing her instead."); HoldStill(root); return; } Component val5 = root.GetComponent(type); if ((Object)(object)val5 == (Object)null) { val5 = root.gameObject.AddComponent(type); } int num3 = CopySafeFields(val2, val5, type); DWLog.Info("Flotation: HER GRID AS COPIED from '" + text + "' (before her Start applies customScale) - " + GridSpread(val5, type) + " The census will print it again afterwards; compare the two."); try { FieldInfo field = type.GetField("customScale", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && field.FieldType == typeof(Vector3)) { Vector3 val6 = (Vector3)field.GetValue(val5); field.SetValue(val5, Vector3.one); DWLog.Warn("Flotation: customScale " + ((Vector3)(ref val6)).ToString("F3") + " -> (1,1,1). The offsets above were copied from a ship that had ALREADY scaled them, and her Start would have scaled them a second time - squeezing her buoyancy into " + (val6.z * 100f).ToString("0") + "% of her length and " + (val6.x * 100f).ToString("0") + "% of her beam. Her grid now comes out of Start the same size as his."); } else { DWLog.Warn("Flotation: no customScale field on this Crest - cannot stop the double scaling. Expect her to cork."); } } catch (Exception ex) { DWLog.Warn("Flotation: customScale could not be neutralised - " + ex.Message); } Bounds val7 = LocalHull(root.transform); Vector3 size = ((Bounds)(ref val7)).size; Rigidbody component = val2.GetComponent<Rigidbody>(); Vector3 val8; if ((Object)(object)component != (Object)null) { float mass = val.mass; Vector3 centerOfMass = val.centerOfMass; Vector3 inertiaTensor = val.inertiaTensor; DWLog.Info("Flotation: HER OWN prefab ballast - mass " + mass.ToString("F1") + ", CoM " + ((Vector3)(ref centerOfMass)).ToString("F4") + ", inertia " + ((Vector3)(ref inertiaTensor)).ToString("F0")); val.ResetInertiaTensor(); bool flag2 = val.inertiaTensor.x <= 1.5f && val.inertiaTensor.y <= 1.5f; val8 = val.inertiaTensor; DWLog.Info("Flotation: HER TENSOR, measured from her own hull once the walk meshes were off - inertia " + ((Vector3)(ref val8)).ToString("F0") + (flag2 ? " *** STILL A PLACEHOLDER - she has no collider PhysX will accept, so the walk meshes were not the whole story. ***" : " (a real figure at last - the placeholder is gone)")); val7 = LocalHull(root.transform); size = ((Bounds)(ref val7)).size; float num4 = Mathf.Min(size.y, Mathf.Max(size.x, size.z) * 0.55f); string[] obj = new string[9] { "Flotation: HER HULL, measured - local centre ", null, null, null, null, null, null, null, null }; val8 = ((Bounds)(ref val7)).center; obj[1] = ((Vector3)(ref val8)).ToString("F2"); obj[2] = ", size "; obj[3] = ((Vector3)(ref size)).ToString("F1"); obj[4] = "m (height used for inertia: "; obj[5] = num4.ToString("F1"); obj[6] = "m, masts cut out). Her origin sits "; string text3; if (!(((Bounds)(ref val7)).center.y >= 0f)) { text3 = (0f - ((Bounds)(ref val7)).center.y).ToString("F1") + "m ABOVE her hull's middle"; } else { val8 = ((Bounds)(ref val7)).center; text3 = val8.y.ToString("F1") + "m BELOW her hull's middle"; } obj[7] = text3; obj[8] = "."; DWLog.Info(string.Concat(obj)); float num5 = ((DWConfig.BundleOwnHullMass != null && DWConfig.BundleOwnHullMass.Value > 0f) ? DWConfig.BundleOwnHullMass.Value : val.mass); float num6 = Mathf.Max(1f, size.x); float num7 = Mathf.Max(1f, num4); float num8 = Mathf.Max(1f, size.z); Vector3 inertiaTensor2 = default(Vector3); ((Vector3)(ref inertiaTensor2))..ctor(num5 / 12f * (num7 * num7 + num8 * num8), num5 / 12f * (num6 * num6 + num8 * num8), num5 / 12f * (num6 * num6 + num7 * num7)); string[] obj2 = new string[12] { "Flotation: THE DONOR '", text, "' carries - mass ", component.mass.ToString("F1"), ", CoM ", null, null, null, null, null, null, null }; val8 = component.centerOfMass; obj2[5] = ((Vector3)(ref val8)).ToString("F4"); obj2[6] = ", inertia "; val8 = component.inertiaTensor; obj2[7] = ((Vector3)(ref val8)).ToString("F0"); obj2[8] = ", drag "; obj2[9] = component.drag.ToString("F3"); obj2[10] = ", angDrag "; obj2[11] = component.angularDrag.ToString("F3"); DWLog.Info(string.Concat(obj2)); bool flag3 = DWConfig.BundleOwnBallast == null || DWConfig.BundleOwnBallast.Value; val.drag = component.drag; val.angularDrag = component.angularDrag; if (flag3) { float num9 = ((DWConfig.BundleOwnHullMass != null) ? DWConfig.BundleOwnHullMass.Value : 0f); if (num9 > 0f) { val.mass = num9; } if (flag2) { val.inertiaTensor = inertiaTensor2; val.inertiaTensorRotation = Quaternion.identity; DWLog.Info("Flotation: HER TENSOR COMPUTED from her own hull and her own mass - inertia " + ((Vector3)(ref inertiaTensor2)).ToString("F0") + " (solid-box estimate; PhysX would not measure one). This is the number that lets her own ballast be switched on at all."); } string[] obj3 = new string[10] { "Flotation: SHE FLOATS AS HERSELF - mass ", val.mass.ToString("F1"), (num9 > 0f) ? " (pinned in config)" : " (her prefab's own)", ", CoM ", null, null, null, null, null, null }; val8 = val.centerOfMass; obj3[4] = ((Vector3)(ref val8)).ToString("F4"); obj3[5] = ", inertia "; val8 = val.inertiaTensor; obj3[6] = ((Vector3)(ref val8)).ToString("F0"); obj3[7] = ". Nothing of the player's ship is in these numbers - only her drag came from '"; obj3[8] = text; obj3[9] = "'."; DWLog.Info(string.Concat(obj3)); } else { val.mass = component.mass; val.centerOfMass = component.centerOfMass; val.inertiaTensor = component.inertiaTensor; val.inertiaTensorRotation = component.inertiaTensorRotation; string[] obj4 = new string[9] { "Flotation: ballast copied FROM '", text, "' - mass ", val.mass.ToString("F1"), ", CoM ", null, null, null, null }; val8 = val.centerOfMass; obj4[5] = ((Vector3)(ref val8)).ToString("F4"); obj4[6] = ", inertia "; val8 = val.inertiaTensor; obj4[7] = ((Vector3)(ref val8)).ToString("F0"); obj4[8] = ". This is a photograph of a LIVE ship including her cargo and guns, and no two spawns will match. Turn [Pirate hull (bundled)] Her own ballast back ON."; DWLog.Warn(string.Concat(obj4)); } } float num10 = ((DWConfig.BundleTrimAft != null) ? DWConfig.BundleTrimAft.Value : 0f); float num11 = ((DWConfig.BundleTrimDown != null) ? DWConfig.BundleTrimDown.Value : 0f); float num12 = ((DWConfig.BundleRideHeight != null) ? DWConfig.BundleRideHeight.Value : 0.35f); string how; Vector3 val9 = -DWRig.BowDirLocal(root.transform, out how); DWLog.Info("Flotation: bow axis via " + how + " -> aft dir " + ((Vector3)(ref val9)).ToString("F2")); Rigidbody obj5 = val; obj5.centerOfMass += val9 * num10 + Vector3.down * num11; if (!Mathf.Approximately(num12, 0f)) { FieldInfo field2 = type.GetField("_forceHeightOffset", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field2 != null && field2.FieldType == typeof(float)) { field2.SetValue(val5, (float)field2.GetValue(val5) + num12); } else { DWLog.Info("Flotation: no _forceHeightOffset on this Crest - ride-height knob inert."); } } string[] obj6 = new string[8] { "Flotation: trim applied - aft ", num10.ToString("0.0"), "m, down ", num11.ToString("0.0"), "m, ride +", num12.ToString("0.00"), "m -> CoM ", null }; val8 = val.centerOfMass; obj6[7] = ((Vector3)(ref val8)).ToString("F2"); DWLog.Info(string.Concat(obj6)); DWTrimLeveller dWTrimLeveller = root.AddComponent<DWTrimLeveller>(); dWTrimLeveller.Init(val, -val9); DWFlotationCensus dWFlotationCensus = root.AddComponent<DWFlotationCensus>(); dWFlotationCensus.Init(val, val5, type, val.centerOfMass, ((Bounds)(ref val7)).center, size); val.isKinematic = false; val.useGravity = true; val.velocity = Vector3.zero; val.angularVelocity = Vector3.zero; DWLog.Info("Flotation: BoatProbes added, " + num3 + " field(s) copied from donor '" + text + "' - she is dynamic now. (Legacy Buoyancy skipped: its Start() NREs against the removed old-ocean system.)"); } catch (Exception ex2) { DWLog.Warn("Buoyancy: failed (" + ex2.Message + ") - freezing her so she stays visible."); HoldStill(root); } } private static Bounds LocalHull(Transform root) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //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) return HullBox(root, talk: true); } internal static int HaulStraysHome(Transform root) { //IL_004e: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_0140: Unknown result type (might be due to invalid IL or missing references) int num = 0; int num2 = 0; float num3 = 0f; string text = ""; try { Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if ((Object)(object)val == (Object)null || (Object)(object)val == (Object)(object)root) { continue; } Vector3 val2 = root.InverseTransformPoint(val.position); float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude <= 200f) { continue; } if ((Object)(object)val.parent != (Object)null && (Object)(object)val.parent != (Object)(object)root) { Vector3 val3 = root.InverseTransformPoint(val.parent.position); if (((Vector3)(ref val3)).magnitude > 200f) { continue; } } if (magnitude > num3) { num3 = magnitude; text = ((Object)val).name; } DWLog.Warn("STRAY ABOARD: '" + ((Object)val).name + "' was " + magnitude.ToString("0") + " m from her keel, at local " + ((Vector3)(ref val2)).ToString("F0") + " - brought home to her origin. Nothing on a ship belongs that far from it, and while it sat out there her whole hull measured that wide to every mod that reads geometry."); val.position = root.position; num++; Renderer[] componentsInChildren2 = ((Component)val).GetComponentsInChildren<Renderer>(true); for (int j = 0; j < componentsInChildren2.Length; j++) { if ((Object)(object)componentsInChildren2[j] != (Object)null && componentsInChildren2[j].enabled) { componentsInChildren2[j].enabled = false; num2++; } } } if (num > 0) { DWLog.Warn("STRAY SWEEP: " + num + " stray(s) brought home (farthest '" + text + "' at " + num3.ToString("0") + " m), " + num2 + " renderer(s) switched off so nothing draws amidships. Her hull can be measured honestly now."); } else { DWLog.Info("Stray sweep: nothing aboard her lies more than " + 200f.ToString("0") + " m from her keel - her geometry is already honest."); } } catch (Exception ex) { DWLog.Warn("Stray sweep: " + ex.Message); } return num; } internal static Bounds HullBox(Transform root, bool talk) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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_019f: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) Bounds result = default(Bounds); ((Bounds)(ref result))..ctor(Vector3.zero, Vector3.zero); bool flag = false; int num = 0; int num2 = 0; float num3 = 0f; string text = ""; bool flag2 = false; Vector3 val3; Vector3 val4 = default(Vector3); for (int i = 0; i < 2; i++) { if (flag) { break; } flag2 = i == 1; Component[] array; if (!flag2) { Component[] componentsInChildren = (Component[])(object)((Component)root).GetComponentsInChildren<Collider>(true); array = componentsInChildren; } else { Component[] componentsInChildren = (Component[])(object)((Component)root).GetComponentsInChildren<Renderer>(true); array = componentsInChildren; } Component[] array2 = array; for (int j = 0; j < array2.Length; j++) { if ((Object)(object)array2[j] == (Object)null) { continue; } Bounds bounds; if (flag2) { Renderer val = (Renderer)array2[j]; if (val is ParticleSystemRenderer) { continue; } bounds = val.bounds; } else { Collider val2 = (Collider)array2[j]; if (val2.isTrigger) { continue; } bounds = val2.bounds; } val3 = ((Bounds)(ref bounds)).size; if (((Vector3)(ref val3)).sqrMagnitude <= 0.0001f) { continue; } val3 = root.InverseTransformPoint(((Bounds)(ref bounds)).center); float magnitude = ((Vector3)(ref val3)).magnitude; if (magnitude > 200f) { num2++; if (magnitude > num3) { num3 = magnitude; text = ((Object)array2[j]).name; } continue; } num++; Vector3 center = ((Bounds)(ref bounds)).center; Vector3 extents = ((Bounds)(ref bounds)).extents; for (int k = 0; k < 8; k++) { ((Vector3)(ref val4))..ctor(center.x + (((k & 1) == 0) ? (0f - extents.x) : extents.x), center.y + (((k & 2) == 0) ? (0f - extents.y) : extents.y), center.z + (((k & 4) == 0) ? (0f - extents.z) : extents.z)); Vector3 val5 = root.InverseTransformPoint(val4); if (!flag) { ((Bounds)(ref result))..ctor(val5, Vector3.zero); flag = true; } else { ((Bounds)(ref result)).Encapsulate(val5); } } } } if (talk) { string[] obj = new string[13] { "Hull measure: ", null, null, null, null, null, null, null, null, null, null, null, null }; val3 = ((Bounds)(ref result)).size; obj[1] = val3.z.ToString("0.0"); obj[2] = " m long, "; val3 = ((Bounds)(ref result)).size; obj[3] = val3.x.ToString("0.0"); obj[4] = " m in the beam, "; val3 = ((Bounds)(ref result)).size; obj[5] = val3.y.ToString("0.0"); obj[6] = " m tall, centred at "; val3 = ((Bounds)(ref result)).center; obj[7] = ((Vector3)(ref val3)).ToString("F2"); obj[8] = " in her own frame, from "; obj[9] = num.ToString(); obj[10] = " "; obj[11] = (flag2 ? "RENDERER(S) - she carries no solid collider, so this is the weaker measurement" : "solid collider(s) - her canvas, spars and rigging are drawn but not collided and are out of it"); obj[12] = ((num2 > 0) ? (". *** " + num2 + " STRAY(S) THROWN OUT - the farthest was '" + text + "' at " + num3.ToString("0") + " m from her keel. Nothing on a ship lies that far from it; this is what used to make her measure 44 km across, and any mod that reads her geometry (Better Drag raycasts it) was being handed that. ***") : (". No strays - every piece of her lies within " + 200f.ToString("0") + " m of her keel.")); DWLog.Info(string.Concat(obj)); } if (!flag) { ((Bounds)(ref result))..ctor(Vector3.zero, new Vector3(6f, 5f, 21f)); } return result; } internal static string GridSpread(Component probes, Type probesType) { //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) try { FieldInfo field = probesType.GetField("_forcePoints", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { return "grid: no _forcePoints field on this Crest."; } if (!(field.GetValue(probes) is Array { Length: not 0 } array)) { return "grid: NONE - no force points at all."; } FieldInfo fieldInfo = null; FieldInfo fieldInfo2 = null; float num = 9999f; float num2 = -9999f; float num3 = 9999f; float num4 = -9999f; float num5 = 9999f; float num6 = -9999f; float num7 = 0f; for (int i = 0; i < array.Length; i++) { object value = array.GetValue(i); if (value != null) { if (fieldInfo == null) { Type type = value.GetType(); fieldInfo = type.GetField("_offsetPosition", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); fieldInfo2 = type.GetField("_weight", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (fieldInfo == null) { break; } Vector3 val = (Vector3)fieldInfo.GetValue(value); if (val.x < num) { num = val.x; } if (val.x > num2) { num2 = val.x; } if (val.y < num3) { num3 = val.y; } if (val.y > num4) { num4 = val.y; } if (val.z < num5) { num5 = val.z; } if (val.z > num6) { num6 = val.z; } if (fieldInfo2 != null) { num7 += (float)fieldInfo2.GetValue(value); } } } return "grid: " + array.Length + " force points, total weight " + num7.ToString("F1") + ", spread fore-and-aft " + (num6 - num5).ToString("F1") + "m (" + num5.ToString("F1") + " to " + num6.ToString("F1") + "), athwartships " + (num2 - num).ToString("F1") + "m, vertical " + (num4 - num3).ToString("F1") + "m."; } catch (Exception ex) { return "grid: unreadable (" + ex.Message + ")"; } } private static string BoatNameOf(Transform t) { Transform val = t; while ((Object)(object)val != (Object)null) { if (((Object)val).name.StartsWith("BOAT", StringComparison.OrdinalIgnoreCase)) { return ((Object)val).name; } val = val.parent; } return null; } private static Transform BoatRootOf(Transform t) { Transform val = t; while ((Object)(object)val != (Object)null) { if (((Object)val).name.StartsWith("BOAT", StringComparison.OrdinalIgnoreCase)) { return val; } val = val.parent; } return null; } private static Type FindTypeByName(string bareName) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { try { Type[] types = assembly.GetTypes(); foreach (Type type in types) { if (type.Name == bareName && typeof(Component).IsAssignableFrom(type)) { return type; } } } catch { } } return null; } private static Array DeepCloneArray(Array src, Type el, string fieldName) { if (src == null || el == null) { return src; } Array array = (Array)src.Clone(); if (el.IsValueType || el == typeof(string)) { return array; } try { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; for (int i = 0; i < array.Length; i++) { object value = array.GetValue(i); if (value == null) { continue; } object obj = Activator.CreateInstance(el); Type type = el; while (type != null && type != typeof(object)) { FieldInfo[] fields = type.GetFields(bindingAttr); foreach (FieldInfo fieldInfo in fields) { if (!typeof(Object).IsAssignableFrom(fieldInfo.FieldType) && (fieldInfo.FieldType.IsValueType || !(fieldInfo.FieldType != typeof(string)))) { try { fieldInfo.SetValue(obj, fieldInfo.GetValue(value)); } catch { } } } type = type.BaseType; } array.SetValue(obj, i); } DWLog.Info("Flotation: deep-copied " + array.Length + " element(s) of '" + fieldName + "' (" + el.Name + ") - the pirate and the player now hold separate objects, not the same ones."); } catch (Exception ex) { DWLog.Warn("Flotation: could NOT deep-copy '" + fieldName + "' (" + el.Name + ") - " + ex.Message + ". That array is still SHARED with the donor, which is the shape of the bug where both ships move together. If the hulls misbehave in step, this line is the reason."); } return array; } internal static int CopySafeFields(Component from, Component to, Type type) { int num = 0; Type type2 = type; while (type2 != null && type2 != typeof(MonoBehaviour) && type2 != typeof(Behaviour) && type2 != typeof(Component)) { FieldInfo[] fields = type2.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { Type fieldType = fieldInfo.FieldType; if (typeof(Object).IsAssignableFrom(fieldType)) { continue; } try { if (fieldType.IsArray) { Type elementType = fieldType.GetElementType(); if (!(elementType != null) || !typeof(Object).IsAssignableFrom(elementType)) { Array src = (Array)fieldInfo.GetValue(from); fieldInfo.SetValue(to, DeepCloneArray(src, elementType, fieldInfo.Name)); num++; } } else if (fieldType.IsValueType || fieldType == typeof(string)) { fieldInfo.SetValue(to, fieldInfo.GetValue(from)); num++; } } catch { } } type2 = type2.BaseType; } return num; } private static void HoldStill(GameObject root) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) Rigidbody[] componentsInChildren = root.GetComponentsInChildren<Rigidbody>(true); Rigidbody[] array = componentsInChildren; foreach (Rigidbody val in array) { if (!((Object)(object)val == (Object)null)) { val.isKinematic = true; val.useGravity = false; val.velocity = Vector3.zero; val.angularVelocity = Vector3.zero; } } } } internal class DWBundleHull : MonoBehaviour { } public class DWCannon : DWGunBase { internal enum Charge { Empty, Powdered, Loaded } private Transform _pivot; private Transform _muzzle; private DWCannonGrabButton _grab; private bool _carried; private const float MaxElevationDeg = 60f; internal const float DeckMountHeight = 0.82f; internal const float DeckPostSink = 0f; private float _mountHeight = 0.82f; private float _postSink = 0f; private const float SwivelSize = 0.5f; private const float SwivelBlast = 0.9f; private float _barrelLength = 1.4f; private static bool _byHotkey; private static readonly Color Iron = new Color(0.26f, 0.27f, 0.29f); private static readonly Color Rope = new Color(0.62f, 0.51f, 0.33f); private GameObject _handle; private bool _needButtons; private float _nextFit; private int _fitTries; private GameObject _barrelObj; public static DWCannon CurrentCarried; internal Charge charge = Charge.Empty; private bool _onItem; private Transform _train; private Transform _bore; private float _boreYaw; private static readonly string[] LayerName = new string[12] { "", "flame", "sparks", "powder grains", "jet smoke", "billow", "haze", "dribble", "splash", "muzzle LIGHT", "sound", "shot" }; protected override DWGunKind Kind => DWGunKind.Swivel(); protected override Transform Muzzle => _muzzle; protected override Transform OwnBoat { get { Transform val = DWGunSaves.BoatRootOf(((Component)this).transform); return ((Object)(object)val != (Object)null) ? val : ((Component)this).transform.root; } } protected override float BarrelLength => _barrelLength; protected override bool Busy => _carried; protected override Transform Pivot => _pivot; protected override float MaxElevation => 60f; protected override float LookHeight => _mountHeight; protected override float MaxTraverse => 180f; internal override bool CanCarry => !_onItem; internal override bool Carried => _carried; public static DWCannon Spawn(Transform boat, Vector3 lookDir) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) Transform val = (((Object)(object)FloatingOriginManager.instance != (Object)null) ? ((Component)FloatingOriginManager.instance).transform : null); Transform val2 = boat; int num = 0; while ((Object)(object)val2.parent != (Object)null && (Object)(object)val2.parent != (Object)(object)val && num++ < 20) { val2 = val2.parent; } GameObject val3 = new GameObject("DW_Cannon"); val3.transform.SetParent(val2, true); Vector3 position = GameState.currentBoat.position; Camera main = Camera.main; if ((Object)(object)main != (Object)null) { Vector3 forward = ((Component)main).transform.forward; forward.y = 0f; ((Vector3)(ref forward)).Normalize(); position = ((Component)main).transform.position + forward * 2.2f; position.y = ((Component)main).transform.position.y - 1.2f; lookDir = forward; } val3.transform.position = position; lookDir.y = 0f; if (((Vector3)(ref lookDir)).sqrMagnitude < 0.01f) { lookDir = val2.forward; } val3.transform.rotation = Quaternion.LookRotation(((Vector3)(ref lookDir)).normalized, Vector3.up); DWCannon dWCannon = val3.AddComponent<DWCannon>(); _byHotkey = true; bool flag = dWCannon.BuildGeometry(); _byHotkey = false; if (!flag) { Object.Destroy((Object)(object)val3); DWLog.Warn("No carronade found - nothing spawned."); DWNotify.Show(SwivelGunAsset.Exists ? "Could not mount the swivel gun." : "No swivel gun saved yet.\nCarve one aboard Le Requin's\nbow guns first.", 6f); return null; } DWLog.Info("Swivel gun placed. Alt+F to carry, F to aim, click to load then fire."); DWNotify.Show("Swivel gun rigged.\nalt+F to move it.", 4f); DWGunSaves.SaveAll(); return dWCannon; } public static DWCannon SpawnAt(Transform boatRoot, Vector3 localPos, Quaternion localRot) { //IL_0002: 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) return SpawnAt(boatRoot, localPos, localRot, 0.82f, 0f); } public static DWCannon SpawnAt(Transform boatRoot, Vector3 localPos, Quaternion localRot, float mountHeight, float postSink) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)boatRoot == (Object)null) { return null; } DWFitting.Report(boatRoot, "before swivel"); GameObject val = new GameObject("DW_Cannon"); val.transform.SetParent(boatRoot, false); val.transform.localPosition = localPos; val.transform.localRotation = localRot; DWCannon dWCannon = val.AddComponent<DWCannon>(); dWCannon._mountHeight = mountHeight; dWCannon._postSink = postSink; if (!dWCannon.BuildGeometry()) { Object.Destroy((Object)(object)val); DWLog.Warn("Could not remount a saved swivel gun - no model available."); return null; } DWFitting.Report(boatRoot, "after swivel"); return dWCannon; } private bool BuildGeometry() { //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Expected O, but got Unknown //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: 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_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: 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_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Expected O, but got Unknown //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) bool flag = _byHotkey && (Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303)); GameObject val = (flag ? null : SwivelGunAsset.Build(((Component)this).transform)); float num; float girth; if ((Object)(object)val != (Object)null) { num = SwivelGunAsset.BarrelLength; girth = SwivelGunAsset.Girth; } else { if (flag) { DWLog.Info("SHIFT held - cutting a fresh swivel gun off Le Requin."); } SwivelGunModel.Reset(); val = SwivelGunModel.CloneVisual(((Component)this).transform); if ((Object)(object)val == (Object)null) { DWLog.Warn("No swivel gun saved yet - stand at Le Requin's bow guns to cut one."); return false; } num = (SwivelGunModel.LastValid ? SwivelGunModel.LastBarrelLength : 1.4f); girth = (SwivelGunModel.LastValid ? SwivelGunModel.LastGirth : 0.4f); MeshFilter component = val.GetComponent<MeshFilter>(); Renderer component2 = val.GetComponent<Renderer>(); if ((Object)(object)component != (Object)null && (Object)(object)component.sharedMesh != (Object)null) { SwivelGunAsset.Save(component.sharedMesh, ((Object)(object)component2 != (Object)null) ? component2.sharedMaterial : null, num, girth); } } _barrelLength = num; MeshFilter componentInChildren = val.GetComponentInChildren<MeshFilter>(); float band = Mathf.Max(0.25f, num * 0.22f); Dictionary<GunParts.Part, Mesh> dictionary = (((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.sharedMesh != (Object)null) ? GunParts.Split(componentInChildren.sharedMesh, band, num) : new Dictionary<GunParts.Part, Mesh>()); Object.Destroy((Object)(object)val); if (dictionary.Count == 0) { DWLog.Warn("Could not split the swivel gun into parts."); return false; } Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(0f, _mountHeight, 0f); Vector3 val3 = val2 - GunParts.Foot; AddPart(dictionary, GunParts.Part.Yoke, ((Component)this).transform, val3); GameObject val4 = new GameObject("DW_CannonPivot"); val4.transform.SetParent(((Component)this).transform, false); val4.transform.localPosition = GunParts.Pivot + val3; _pivot = val4.transform; Vector3 offset = -GunParts.Pivot; _barrelObj = AddPart(dictionary, GunParts.Part.Barrel, _pivot, offset); AddPart(dictionary, GunParts.Part.Handle, _pivot, offset); AddPart(dictionary, GunParts.Part.Grip, _pivot, offset); GameObject val5 = new GameObject("DW_Muzzle"); val5.transform.SetParent(_pivot, false); val5.transform.localPosition = new Vector3(0f, 0f, GunParts.BarrelMaxZ - GunParts.Pivot.z + 0.05f); _muzzle = val5.transform; DWLog.Info("Muzzle placed: barrel tip z=" + GunParts.BarrelMaxZ.ToString("0.00") + ", pivot z=" + GunParts.Pivot.z.ToString("0.00") + ", muzzle local z=" + val5.transform.localPosition.z.ToString("0.00") + " (should sit just past the tip)."); BuildPost(girth, _mountHeight); BuildHandles(num, girth); return true; } private static Material MetalFor(GunParts.Part which) { //IL_0018: 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) return (Material)(which switch { GunParts.Part.Barrel => Polished(), GunParts.Part.Grip => FlatMetal(Rope, 0.06f, 0f), _ => FlatMetal(Iron, 0.35f, 0.85f), }); } private GameObject AddPart(Dictionary<GunParts.Part, Mesh> parts, GunParts.Part which, Transform parent, Vector3 offset) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (!parts.TryGetValue(which, out var value) || (Object)(object)value == (Object)null) { return null; } GameObject val = new GameObject("DW_Gun" + which); val.transform.SetParent(parent, false); val.transform.localPosition = offset; val.AddComponent<MeshFilter>().mesh = value; MeshRenderer val2 = val.AddComponent<MeshRenderer>(); ((Renderer)val2).material = MetalFor(which); return val; } private static Material Polished() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Material val = FlatMetal(DWWood.Brass, 0.72f, 0.85f); ((Object)val).name = "DW_PolishedBrass"; return val; } private static Material FlatMetal(Color c, float smooth, float metal) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) Shader val = Shader.Find("Standard"); Material val2 = (((Object)(object)val != (Object)null) ? new Material(val) : new Material(Shader.Find("Diffuse"))); val2.color = c; if ((Object)(object)val != (Object)null) { val2.SetFloat("_Glossiness", smooth); val2.SetFloat("_Metallic", metal); } return val2; } private static void ShowAltHint(GoPointerButton b) { if ((Object)(object)b == (Object)null) { return; } try { FieldInfo field = ((object)b).GetType().GetField("useAltIcons", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); if (field != null && field.FieldType == typeof(bool)) { field.SetValue(b, true); } } catch { } } private static void MatchGameInteractable(GameObject handle, Collider col) { int num = -1; bool isTrigger = true; GoPointerButton[] array = Object.FindObjectsOfType<GoPointerButton>(); foreach (GoPointerButton val in array) { if (!((Object)(object)val == (Object)null) && !(val is DWCannonGrabButton) && !(val is DWCannonFireButton)) { Collider component = ((Component)val).GetComponent<Collider>(); if (!((Object)(object)component == (Object)null)) { num = ((Component)val).gameObject.layer; isTrigger = component.isTrigger; break; } } } if (num >= 0) { handle.layer = num; col.isTrigger = isTrigger; DWLog.Info("Swivel gun handle matched to the game's interactables: layer " + num + " (" + LayerMask.LayerToName(num) + "), trigger=" + isTrigger); } else { col.isTrigger = true; DWLog.Warn("No game interactable found to copy - handle left as a trigger."); } } private void BuildPost(float girth, float topY) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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) float num = 0f - _postSink; if (topY <= num + 0.15f) { topY = _mountHeight - 0.25f; } GameObject val = GameObject.CreatePrimitive((PrimitiveType)2); ((Object)val).name = "DW_CannonPost"; Object.Destroy((Object)(object)val.GetComponent<Colli