Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of CruiserJumpsHelper v1.1.0
CruiserJumpsHelper.dll
Decompiled 21 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("CruiserJumpsHelper")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CruiserJumpsHelper")] [assembly: AssemblyTitle("CruiserJumpsHelper")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [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 CruiserJumpsHelper { public class CruiserMarkerController : MonoBehaviour { private VehicleController _vc; private Vector3[] _localFootprintCorners; private Vector3[] _localArrowPoints; private string _lastMoonName; private GameObject _shipLineObj; private LineRenderer _shipLine; private GameObject _trajectoryObj; private LineRenderer _trajectoryLine; private bool _inFlight; private float _inFlightStart; private MoonPresets _moonPresets; private readonly List<PresetMarkerVisual> _visuals = new List<PresetMarkerVisual>(); private int _selectedIndex = -1; private bool _renaming; private string _nameInput = ""; private bool _renameFocusPending; private string _toastText; private float _toastTimer; private static readonly Color TrajectoryColor = new Color(1f, 0.6f, 0.1f, 0.85f); private JumpPreset CurrentPreset { get { if (_moonPresets == null || _selectedIndex < 0 || _selectedIndex >= _moonPresets.presets.Count) { return null; } return _moonPresets.presets[_selectedIndex]; } } private void Awake() { _vc = ((Component)this).GetComponent<VehicleController>(); } private void Start() { if (Plugin.ShowShipLineConfig.Value) { SpawnShipLine(); } SpawnTrajectoryLine(); } private void OnDestroy() { foreach (PresetMarkerVisual visual in _visuals) { visual.Destroy(); } _visuals.Clear(); } private string SafeMoonName() { try { return StartOfRound.Instance.currentLevel.PlanetName; } catch { return "UnknownMoon"; } } private static Camera ActiveCamera() { try { return ((Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)StartOfRound.Instance.activeCamera != (Object)null) ? StartOfRound.Instance.activeCamera : Camera.main; } catch { return Camera.main; } } private void ShowToast(string text, float duration = 2.5f) { _toastText = text; _toastTimer = duration; } private void CheckMoonChanged() { string text = SafeMoonName(); if (!(text == _lastMoonName)) { _lastMoonName = text; ComputeFootprintFromWheels(); LoadMoonPresets(text); } } private void LoadMoonPresets(string moon) { _moonPresets = SaveManager.GetMoonReadOnly(moon); RebuildVisuals(); _selectedIndex = ((_moonPresets == null || _moonPresets.presets.Count <= 0) ? (-1) : 0); } private void ComputeFootprintFromWheels() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_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_00c4: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_00f7: 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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_0177: 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_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: 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_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0247: 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_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: 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_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_027d: 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_0285: 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_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: 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_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: 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_02ff: Unknown result type (might be due to invalid IL or missing references) float value = Plugin.FootprintMarginConfig.Value; float num; float num4; float num5; float num6; if ((Object)(object)_vc.FrontLeftWheel != (Object)null && (Object)(object)_vc.FrontRightWheel != (Object)null && (Object)(object)_vc.BackLeftWheel != (Object)null && (Object)(object)_vc.BackRightWheel != (Object)null) { Vector3 val = ((Component)_vc).transform.InverseTransformPoint(((Component)_vc.FrontLeftWheel).transform.position); Vector3 val2 = ((Component)_vc).transform.InverseTransformPoint(((Component)_vc.FrontRightWheel).transform.position); Vector3 val3 = ((Component)_vc).transform.InverseTransformPoint(((Component)_vc.BackLeftWheel).transform.position); Vector3 val4 = ((Component)_vc).transform.InverseTransformPoint(((Component)_vc.BackRightWheel).transform.position); num = (Mathf.Abs(val.x) + Mathf.Abs(val2.x) + Mathf.Abs(val3.x) + Mathf.Abs(val4.x)) / 4f + value; float num2 = (val.z + val2.z) / 2f; float num3 = (val3.z + val4.z) / 2f; num4 = Mathf.Max(num2, num3) + value; num5 = Mathf.Min(num2, num3) - value; num6 = (val.y + val2.y + val3.y + val4.y) / 4f; Plugin.Log.LogInfo((object)$"[CruiserJumpsHelper] Footprint from wheels: width={num * 2f:0.00}m, length={num4 - num5:0.00}m"); } else { num = 1.1f; num4 = 2.1f; num5 = -2.1f; num6 = 0f; Plugin.Log.LogWarning((object)"[CruiserJumpsHelper] Wheel colliders not found, using fallback footprint size."); } _localFootprintCorners = (Vector3[])(object)new Vector3[4] { new Vector3(0f - num, num6, num5), new Vector3(num, num6, num5), new Vector3(num, num6, num4), new Vector3(0f - num, num6, num4) }; bool value2 = Plugin.InvertArrowDirectionConfig.Value; Vector3 val5 = (value2 ? Vector3.back : Vector3.forward); Vector3 val6 = new Vector3(0f, num6, value2 ? num5 : num4); Vector3 val7 = val6 + val5 * 0.6f; Vector3 val8 = val6 - val5 * 0.1f + Vector3.left * (num * 0.4f); Vector3 val9 = val6 - val5 * 0.1f + Vector3.right * (num * 0.4f); _localArrowPoints = (Vector3[])(object)new Vector3[5] { val8, val7, val9, val7, val8 }; } private void RebuildVisuals() { foreach (PresetMarkerVisual visual in _visuals) { visual.Destroy(); } _visuals.Clear(); if (_moonPresets == null) { return; } foreach (JumpPreset preset in _moonPresets.presets) { PresetMarkerVisual presetMarkerVisual = new PresetMarkerVisual(preset); presetMarkerVisual.UpdateGeometry(_localFootprintCorners, _localArrowPoints); presetMarkerVisual.SetConnectorEnabled(Plugin.ShowPresetLinesConfig.Value); _visuals.Add(presetMarkerVisual); } } private void Update() { if ((Object)(object)_vc == (Object)null) { return; } CheckMoonChanged(); HandleRenameConfirmCancel(); if (!_renaming) { HandleHotkeys(); } RefreshAllVisualStates(); UpdateConnectorLines(); if (_toastTimer > 0f) { _toastTimer -= Time.deltaTime; } if ((Object)(object)_shipLine != (Object)null) { UpdateShipLine(); } UpdateFlightState(); UpdateTrajectory(); Camera cam = ActiveCamera(); foreach (PresetMarkerVisual visual in _visuals) { visual.FaceCamera(cam); } } private void FixedUpdate() { if (Plugin.EnableAutoSnapConfig.Value) { ApplyAutoSnap(); } } private void HandleHotkeys() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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) Keyboard current = Keyboard.current; if (current != null) { if (TryGetKey(Plugin.SaveKeyConfig.Value, out var key) && ((ButtonControl)current[key]).wasPressedThisFrame) { SaveIntoCurrentOrNewPreset(); } if (TryGetKey(Plugin.NewPresetKeyConfig.Value, out var key2) && ((ButtonControl)current[key2]).wasPressedThisFrame) { CreateNewPreset(); } if (TryGetKey(Plugin.RenamePresetKeyConfig.Value, out var key3) && ((ButtonControl)current[key3]).wasPressedThisFrame) { BeginRename(); } if (TryGetKey(Plugin.DeletePresetKeyConfig.Value, out var key4) && ((ButtonControl)current[key4]).wasPressedThisFrame) { DeleteSelectedPreset(); } if (TryGetKey(Plugin.NextPresetKeyConfig.Value, out var key5) && ((ButtonControl)current[key5]).wasPressedThisFrame) { CyclePreset(1); } if (TryGetKey(Plugin.PrevPresetKeyConfig.Value, out var key6) && ((ButtonControl)current[key6]).wasPressedThisFrame) { CyclePreset(-1); } if (TryGetKey(Plugin.SnapNowKeyConfig.Value, out var key7) && ((ButtonControl)current[key7]).wasPressedThisFrame) { SnapNow(); } if (TryGetKey(Plugin.ExportPresetKeyConfig.Value, out var key8) && ((ButtonControl)current[key8]).wasPressedThisFrame) { ExportSelectedPreset(); } if (TryGetKey(Plugin.ImportPresetKeyConfig.Value, out var key9) && ((ButtonControl)current[key9]).wasPressedThisFrame) { ImportPresetFromClipboard(); } } } private static bool TryGetKey(string name, out Key key) { return Enum.TryParse<Key>(name, ignoreCase: true, out key); } private void SaveIntoCurrentOrNewPreset() { if (CurrentPreset == null) { CreateNewPreset(); return; } WriteTransformInto(CurrentPreset); SaveManager.Save(); RebuildVisuals(); ShowToast("Updated preset '" + CurrentPreset.presetName + "'"); Plugin.Log.LogInfo((object)("[CruiserJumpsHelper] Updated preset '" + CurrentPreset.presetName + "'.")); } private void CreateNewPreset() { string text = SafeMoonName(); _moonPresets = SaveManager.GetOrCreateMoon(text); JumpPreset jumpPreset = new JumpPreset { presetName = $"Jump {_moonPresets.presets.Count + 1}" }; WriteTransformInto(jumpPreset); _moonPresets.presets.Add(jumpPreset); SaveManager.Save(); RebuildVisuals(); _selectedIndex = _moonPresets.presets.Count - 1; ShowToast("Created preset '" + jumpPreset.presetName + "'"); Plugin.Log.LogInfo((object)("[CruiserJumpsHelper] Created new preset '" + jumpPreset.presetName + "' on moon '" + text + "'.")); } private void DeleteSelectedPreset() { if (_moonPresets != null && CurrentPreset != null) { string presetName = CurrentPreset.presetName; _moonPresets.presets.RemoveAt(_selectedIndex); SaveManager.Save(); RebuildVisuals(); _selectedIndex = ((_moonPresets.presets.Count <= 0) ? (-1) : 0); ShowToast("Deleted preset '" + presetName + "'"); Plugin.Log.LogInfo((object)("[CruiserJumpsHelper] Deleted preset '" + presetName + "'.")); } } private void CyclePreset(int direction) { if (_moonPresets != null && _moonPresets.presets.Count != 0) { int count = _moonPresets.presets.Count; _selectedIndex = ((_selectedIndex + direction) % count + count) % count; Plugin.Log.LogInfo((object)$"[CruiserJumpsHelper] Selected preset: '{CurrentPreset?.presetName}' ({_selectedIndex + 1}/{count})"); } } private void BeginRename() { if (CurrentPreset != null) { _renaming = true; _renameFocusPending = true; _nameInput = CurrentPreset.presetName; } } private void HandleRenameConfirmCancel() { if (!_renaming) { return; } Keyboard current = Keyboard.current; if (current == null) { return; } bool num = ((ButtonControl)current.enterKey).wasPressedThisFrame || ((ButtonControl)current.numpadEnterKey).wasPressedThisFrame; bool wasPressedThisFrame = ((ButtonControl)current.escapeKey).wasPressedThisFrame; if (num) { if (CurrentPreset != null && !string.IsNullOrWhiteSpace(_nameInput)) { CurrentPreset.presetName = _nameInput.Trim(); SaveManager.Save(); RebuildVisuals(); ShowToast("Renamed to '" + CurrentPreset.presetName + "'"); Plugin.Log.LogInfo((object)("[CruiserJumpsHelper] Preset renamed to '" + CurrentPreset.presetName + "'.")); } _renaming = false; } else if (wasPressedThisFrame) { _renaming = false; } } private void WriteTransformInto(JumpPreset preset) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_003b: 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) //IL_0053: 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_006b: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)_vc).transform.position; Quaternion rotation = ((Component)_vc).transform.rotation; preset.posX = position.x; preset.posY = position.y; preset.posZ = position.z; preset.rotX = rotation.x; preset.rotY = rotation.y; preset.rotZ = rotation.z; preset.rotW = rotation.w; } private void SnapNow() { //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) if (CurrentPreset != null && _vc.localPlayerInControl) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(CurrentPreset.posX, CurrentPreset.posY, CurrentPreset.posZ); Quaternion val2 = default(Quaternion); ((Quaternion)(ref val2))..ctor(CurrentPreset.rotX, CurrentPreset.rotY, CurrentPreset.rotZ, CurrentPreset.rotW); if ((Object)(object)_vc.mainRigidbody != (Object)null) { _vc.mainRigidbody.velocity = Vector3.zero; _vc.mainRigidbody.angularVelocity = Vector3.zero; _vc.mainRigidbody.MovePosition(val); _vc.mainRigidbody.MoveRotation(val2); } else { ((Component)_vc).transform.SetPositionAndRotation(val, val2); } ShowToast("Snapped to '" + CurrentPreset.presetName + "'"); Plugin.Log.LogInfo((object)("[CruiserJumpsHelper] Manually snapped to preset '" + CurrentPreset.presetName + "'.")); } } private void ExportSelectedPreset() { if (CurrentPreset == null) { ShowToast("No preset selected to export."); return; } GUIUtility.systemCopyBuffer = JsonUtility.ToJson((object)new SharedPresetPackage { moonName = SafeMoonName(), preset = CurrentPreset }); ShowToast("Copied '" + CurrentPreset.presetName + "' to clipboard - share it with a friend!"); Plugin.Log.LogInfo((object)("[CruiserJumpsHelper] Exported preset '" + CurrentPreset.presetName + "' to clipboard.")); } private void ImportPresetFromClipboard() { string systemCopyBuffer = GUIUtility.systemCopyBuffer; if (string.IsNullOrEmpty(systemCopyBuffer)) { ShowToast("Clipboard is empty."); return; } SharedPresetPackage sharedPresetPackage; try { sharedPresetPackage = JsonUtility.FromJson<SharedPresetPackage>(systemCopyBuffer); } catch { sharedPresetPackage = null; } if (sharedPresetPackage == null || sharedPresetPackage.marker != "CJT_PRESET_V1" || sharedPresetPackage.preset == null || string.IsNullOrEmpty(sharedPresetPackage.moonName)) { ShowToast("Clipboard doesn't contain a valid CruiserJumpsHelper preset."); return; } SaveManager.GetOrCreateMoon(sharedPresetPackage.moonName).presets.Add(sharedPresetPackage.preset); SaveManager.Save(); ShowToast("Imported '" + sharedPresetPackage.preset.presetName + "' for moon '" + sharedPresetPackage.moonName + "'"); Plugin.Log.LogInfo((object)("[CruiserJumpsHelper] Imported preset '" + sharedPresetPackage.preset.presetName + "' for moon '" + sharedPresetPackage.moonName + "'.")); if (sharedPresetPackage.moonName == SafeMoonName()) { _moonPresets = SaveManager.GetMoonReadOnly(sharedPresetPackage.moonName); RebuildVisuals(); _selectedIndex = _moonPresets.presets.Count - 1; } } private void RefreshAllVisualStates() { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); Quaternion val2 = default(Quaternion); for (int i = 0; i < _visuals.Count; i++) { PresetMarkerVisual presetMarkerVisual = _visuals[i]; bool isSelected = i == _selectedIndex; ((Vector3)(ref val))..ctor(presetMarkerVisual.Preset.posX, presetMarkerVisual.Preset.posY, presetMarkerVisual.Preset.posZ); ((Quaternion)(ref val2))..ctor(presetMarkerVisual.Preset.rotX, presetMarkerVisual.Preset.rotY, presetMarkerVisual.Preset.rotZ, presetMarkerVisual.Preset.rotW); float num = Vector3.Distance(((Component)_vc).transform.position, val); float num2 = Quaternion.Angle(((Component)_vc).transform.rotation, val2); bool isAligned = num <= Plugin.PositionToleranceConfig.Value && num2 <= Plugin.RotationToleranceConfig.Value; presetMarkerVisual.SetState(isSelected, isAligned); } } private void UpdateConnectorLines() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) foreach (PresetMarkerVisual visual in _visuals) { visual.SetConnectorEnabled(Plugin.ShowPresetLinesConfig.Value); visual.UpdateConnector(((Component)_vc).transform.position); } } private void ApplyAutoSnap() { //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_00b6: 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_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_011b: 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_0122: 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_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_013b: 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) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) if (CurrentPreset == null || (Object)(object)_vc.mainRigidbody == (Object)null || !_vc.localPlayerInControl) { return; } Vector3 velocity = _vc.mainRigidbody.velocity; if (!(((Vector3)(ref velocity)).magnitude > Plugin.AutoSnapMaxSpeedConfig.Value)) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(CurrentPreset.posX, CurrentPreset.posY, CurrentPreset.posZ); Quaternion val2 = default(Quaternion); ((Quaternion)(ref val2))..ctor(CurrentPreset.rotX, CurrentPreset.rotY, CurrentPreset.rotZ, CurrentPreset.rotW); float num = Vector3.Distance(((Component)_vc).transform.position, val); float num2 = Quaternion.Angle(((Component)_vc).transform.rotation, val2); if (num <= Plugin.SnapPositionRangeConfig.Value && num2 <= Plugin.SnapRotationRangeConfig.Value) { float num3 = Mathf.Clamp01(Plugin.SnapSpeedConfig.Value * Time.fixedDeltaTime); Vector3 val3 = Vector3.Lerp(((Component)_vc).transform.position, val, num3); Quaternion val4 = Quaternion.Slerp(((Component)_vc).transform.rotation, val2, num3); _vc.mainRigidbody.MovePosition(val3); _vc.mainRigidbody.MoveRotation(val4); } } } private void SpawnShipLine() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) _shipLineObj = new GameObject("CruiserJumpsHelper_ShipLine"); _shipLine = _shipLineObj.AddComponent<LineRenderer>(); ConfigureLine(_shipLine, 2, 0.04f, new Color(1f, 1f, 1f, 0.35f)); } private void UpdateShipLine() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) ((Renderer)_shipLine).enabled = Plugin.ShowShipLineConfig.Value; if (((Renderer)_shipLine).enabled) { Transform val = null; try { val = StartOfRound.Instance.middleOfShipNode; } catch { } if ((Object)(object)val == (Object)null) { ((Renderer)_shipLine).enabled = false; return; } _shipLine.SetPosition(0, ((Component)_vc).transform.position); _shipLine.SetPosition(1, val.position); } } private static void ConfigureLine(LineRenderer line, int points, float width, Color color) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) line.positionCount = points; line.useWorldSpace = true; line.widthMultiplier = width; ((Renderer)line).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)line).receiveShadows = false; Shader val = Shader.Find("HDRP/Unlit") ?? Shader.Find("Universal Render Pipeline/Unlit") ?? Shader.Find("Sprites/Default") ?? Shader.Find("Unlit/Color"); ((Renderer)line).material = new Material(val); line.startColor = color; line.endColor = color; } private void UpdateFlightState() { if (!((Object)(object)_vc.mainRigidbody == (Object)null)) { bool flag = ((Object)(object)_vc.FrontLeftWheel != (Object)null && _vc.FrontLeftWheel.isGrounded) || ((Object)(object)_vc.FrontRightWheel != (Object)null && _vc.FrontRightWheel.isGrounded) || ((Object)(object)_vc.BackLeftWheel != (Object)null && _vc.BackLeftWheel.isGrounded) || ((Object)(object)_vc.BackRightWheel != (Object)null && _vc.BackRightWheel.isGrounded); if (_inFlight && flag && Time.time - _inFlightStart > 0.3f) { _inFlight = false; } } } public void OnJumpTriggered() { _inFlight = true; _inFlightStart = Time.time; } private void SpawnTrajectoryLine() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) _trajectoryObj = new GameObject("CruiserJumpsHelper_Trajectory"); _trajectoryLine = _trajectoryObj.AddComponent<LineRenderer>(); ConfigureLine(_trajectoryLine, 2, 0.06f, TrajectoryColor); ((Renderer)_trajectoryLine).enabled = false; } private void UpdateTrajectory() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00e0: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_00ca: 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) if (!Plugin.ShowTrajectoryConfig.Value || !_inFlight || (Object)(object)_vc.mainRigidbody == (Object)null) { ((Renderer)_trajectoryLine).enabled = false; return; } float num = Plugin.TrajectoryMaxTimeConfig.Value / 60f; Vector3 gravity = Physics.gravity; Vector3 val = ((Component)_vc).transform.position; Vector3 val2 = _vc.mainRigidbody.velocity; List<Vector3> list = new List<Vector3> { val }; RaycastHit val5 = default(RaycastHit); for (int i = 1; i <= 60; i++) { Vector3 val3 = val2 + gravity * num; Vector3 val4 = val + val2 * num + 0.5f * gravity * num * num; if (Physics.Linecast(val, val4, ref val5)) { list.Add(((RaycastHit)(ref val5)).point); val = ((RaycastHit)(ref val5)).point; break; } list.Add(val4); val = val4; val2 = val3; } ((Renderer)_trajectoryLine).enabled = true; _trajectoryLine.positionCount = list.Count; _trajectoryLine.SetPositions(list.ToArray()); } private void OnGUI() { if (_renaming) { DrawRenamePopup(); } if (Plugin.ShowSteeringHintConfig.Value && CurrentPreset != null && _vc.localPlayerInControl) { DrawSteeringHint(); } if (Plugin.ShowPresetListConfig.Value && _moonPresets != null && _moonPresets.presets.Count > 0 && _vc.localPlayerInControl) { DrawPresetList(); } if (_toastTimer > 0f && !string.IsNullOrEmpty(_toastText)) { DrawToast(); } } private void DrawRenamePopup() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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) Rect val = default(Rect); ((Rect)(ref val))..ctor((float)(Screen.width - 340) / 2f, (float)(Screen.height - 90) / 2f, 340f, 90f); GUI.Box(val, "Rename jump preset"); GUI.SetNextControlName("CJT_RenameField"); _nameInput = GUI.TextField(new Rect(((Rect)(ref val)).x + 10f, ((Rect)(ref val)).y + 30f, 320f, 24f), _nameInput); if (_renameFocusPending) { GUI.FocusControl("CJT_RenameField"); _renameFocusPending = false; } GUI.Label(new Rect(((Rect)(ref val)).x + 10f, ((Rect)(ref val)).y + 58f, 320f, 24f), "Enter = save, Esc = cancel"); } private void DrawSteeringHint() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) Quaternion val = default(Quaternion); ((Quaternion)(ref val))..ctor(CurrentPreset.rotX, CurrentPreset.rotY, CurrentPreset.rotZ, CurrentPreset.rotW); float y = ((Component)_vc).transform.eulerAngles.y; float y2 = ((Quaternion)(ref val)).eulerAngles.y; float num = Mathf.DeltaAngle(y, y2); string arg = ((num > 0.5f) ? "RIGHT" : ((num < -0.5f) ? "LEFT" : "straight")); string text = ((Mathf.Abs(num) < 0.5f) ? "Heading matches target" : $"Turn {arg} ({Mathf.Abs(num):0}°)"); GUIStyle val2 = new GUIStyle(GUI.skin.label) { fontSize = 20, alignment = (TextAnchor)1 }; val2.normal.textColor = ((Mathf.Abs(num) < 0.5f) ? Color.green : Color.yellow); GUI.Label(new Rect((float)Screen.width / 2f - 200f, 20f, 400f, 30f), text, val2); } private void DrawPresetList() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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) int num = 22 * _moonPresets.presets.Count + 30; Rect val = default(Rect); ((Rect)(ref val))..ctor(20f, (float)Screen.height / 2f - (float)num / 2f, 220f, (float)num); GUI.Box(val, "Jumps on " + _moonPresets.moonName); for (int i = 0; i < _moonPresets.presets.Count; i++) { GUIStyle val2 = new GUIStyle(GUI.skin.label); val2.normal.textColor = ((i == _selectedIndex) ? Color.yellow : Color.white); string presetName = _moonPresets.presets[i].presetName; GUI.Label(new Rect(((Rect)(ref val)).x + 10f, ((Rect)(ref val)).y + 26f + (float)(i * 22), 200f, 22f), presetName, val2); } } private void DrawToast() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_001f: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = new GUIStyle(GUI.skin.box) { fontSize = 16, alignment = (TextAnchor)4 }; float num = Mathf.Clamp(_toastText.Length * 9 + 40, 200, 600); GUI.Box(new Rect((float)Screen.width / 2f - num / 2f, (float)(Screen.height - 80), num, 34f), _toastText, val); } } [Serializable] public class JumpPreset { public string presetName = "Jump"; public float posX; public float posY; public float posZ; public float rotX; public float rotY; public float rotZ; public float rotW; } [Serializable] public class MoonPresets { public string moonName; public List<JumpPreset> presets = new List<JumpPreset>(); } [Serializable] public class SaveFile { public List<MoonPresets> moons = new List<MoonPresets>(); } [Serializable] public class SharedPresetPackage { public const string Marker = "CJT_PRESET_V1"; public string marker = "CJT_PRESET_V1"; public string moonName; public JumpPreset preset; } [HarmonyPatch(typeof(VehicleController))] internal static class VehicleControllerPatches { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void Awake_Postfix(VehicleController __instance) { if ((Object)(object)((Component)__instance).GetComponent<CruiserMarkerController>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<CruiserMarkerController>(); } } [HarmonyPatch("DoTurboBoost")] [HarmonyPostfix] private static void DoTurboBoost_Postfix(VehicleController __instance, CallbackContext context) { if (((CallbackContext)(ref context)).performed) { ((Component)__instance).GetComponent<CruiserMarkerController>()?.OnJumpTriggered(); } } } [BepInPlugin("justrat.cruiserjumpshelper", "Cruiser Jump's Helper", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string PluginGuid = "justrat.cruiserjumpshelper"; public const string PluginName = "Cruiser Jump's Helper"; public const string PluginVersion = "1.0.0"; internal static ManualLogSource Log; internal static ConfigEntry<string> SaveKeyConfig; internal static ConfigEntry<string> NewPresetKeyConfig; internal static ConfigEntry<string> RenamePresetKeyConfig; internal static ConfigEntry<string> DeletePresetKeyConfig; internal static ConfigEntry<string> NextPresetKeyConfig; internal static ConfigEntry<string> PrevPresetKeyConfig; internal static ConfigEntry<string> SnapNowKeyConfig; internal static ConfigEntry<string> ExportPresetKeyConfig; internal static ConfigEntry<string> ImportPresetKeyConfig; internal static ConfigEntry<float> PositionToleranceConfig; internal static ConfigEntry<float> RotationToleranceConfig; internal static ConfigEntry<float> FootprintMarginConfig; internal static ConfigEntry<bool> ShowShipLineConfig; internal static ConfigEntry<bool> ShowPresetLinesConfig; internal static ConfigEntry<bool> ShowSteeringHintConfig; internal static ConfigEntry<bool> ShowPresetListConfig; internal static ConfigEntry<bool> InvertArrowDirectionConfig; internal static ConfigEntry<bool> EnableAutoSnapConfig; internal static ConfigEntry<float> SnapPositionRangeConfig; internal static ConfigEntry<float> SnapRotationRangeConfig; internal static ConfigEntry<float> SnapSpeedConfig; internal static ConfigEntry<float> AutoSnapMaxSpeedConfig; internal static ConfigEntry<bool> ShowTrajectoryConfig; internal static ConfigEntry<float> TrajectoryMaxTimeConfig; private void Awake() { //IL_0354: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; SaveKeyConfig = ((BaseUnityPlugin)this).Config.Bind<string>("Keybinds", "SaveMarkerKey", "F6", "Update the currently selected preset with the cruiser's current position."); NewPresetKeyConfig = ((BaseUnityPlugin)this).Config.Bind<string>("Keybinds", "NewPresetKey", "F9", "Create a new preset on this moon using the cruiser's current position."); RenamePresetKeyConfig = ((BaseUnityPlugin)this).Config.Bind<string>("Keybinds", "RenamePresetKey", "F10", "Rename the currently selected preset (opens an on-screen text field)."); DeletePresetKeyConfig = ((BaseUnityPlugin)this).Config.Bind<string>("Keybinds", "DeletePresetKey", "F11", "Delete the currently selected preset."); NextPresetKeyConfig = ((BaseUnityPlugin)this).Config.Bind<string>("Keybinds", "NextPresetKey", "RightBracket", "Select the next preset on this moon."); PrevPresetKeyConfig = ((BaseUnityPlugin)this).Config.Bind<string>("Keybinds", "PrevPresetKey", "LeftBracket", "Select the previous preset on this moon."); SnapNowKeyConfig = ((BaseUnityPlugin)this).Config.Bind<string>("Keybinds", "SnapNowKey", "Home", "Instantly snap the cruiser to the selected preset's exact position/rotation (clears velocity)."); ExportPresetKeyConfig = ((BaseUnityPlugin)this).Config.Bind<string>("Keybinds", "ExportPresetKey", "PageUp", "Copy the selected preset to the clipboard so it can be shared with another player."); ImportPresetKeyConfig = ((BaseUnityPlugin)this).Config.Bind<string>("Keybinds", "ImportPresetKey", "PageDown", "Import a preset from the clipboard (as copied by another player using ExportPresetKey)."); PositionToleranceConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Tolerances", "PositionTolerance", 0.35f, "Maximum position deviation (meters) considered a 'perfect' match (marker turns red)."); RotationToleranceConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Tolerances", "RotationTolerance", 2f, "Maximum rotation deviation (degrees) considered a 'perfect' match (marker turns red)."); FootprintMarginConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Visuals", "FootprintMargin", 0.4f, "Extra meters added around the wheel-to-wheel rectangle so the outline better matches the cruiser's visual body/bumpers."); ShowShipLineConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Visuals", "ShowShipLine", true, "Draw a line from the cruiser to the ship."); ShowPresetLinesConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Visuals", "ShowPresetLines", true, "Draw a line from the cruiser to every saved preset on this moon."); ShowSteeringHintConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Visuals", "ShowSteeringHint", true, "Show an on-screen hint with how many degrees to turn the wheel to match the selected preset's rotation."); ShowPresetListConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Visuals", "ShowPresetList", true, "Show an on-screen list of presets on this moon while driving."); InvertArrowDirectionConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Visuals", "InvertArrowDirection", false, "Flip the forward-facing arrow drawn on top of each marker, in case it points backwards for your game version."); EnableAutoSnapConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("AutoSnap", "EnableAutoSnap", false, "When enabled, the cruiser will be gently pulled into perfect alignment once it's close enough (and nearly stationary) near the selected preset."); SnapPositionRangeConfig = ((BaseUnityPlugin)this).Config.Bind<float>("AutoSnap", "SnapPositionRange", 2.5f, "Distance (meters) within which auto-snap starts pulling the cruiser toward the preset."); SnapRotationRangeConfig = ((BaseUnityPlugin)this).Config.Bind<float>("AutoSnap", "SnapRotationRange", 25f, "Rotation difference (degrees) within which auto-snap starts correcting the cruiser's heading."); SnapSpeedConfig = ((BaseUnityPlugin)this).Config.Bind<float>("AutoSnap", "SnapSpeed", 3f, "How quickly auto-snap corrects position/rotation (higher = snappier, lower = smoother)."); AutoSnapMaxSpeedConfig = ((BaseUnityPlugin)this).Config.Bind<float>("AutoSnap", "AutoSnapMaxSpeed", 1.5f, "Auto-snap only engages while the cruiser's speed (m/s) is below this value, to avoid fighting active driving."); ShowTrajectoryConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Trajectory", "ShowTrajectory", true, "While airborne after a jump, draw a predicted landing trajectory line based on current velocity."); TrajectoryMaxTimeConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Trajectory", "TrajectoryMaxTime", 4f, "Maximum seconds to simulate forward when predicting the landing trajectory."); new Harmony("justrat.cruiserjumpshelper").PatchAll(); Log.LogInfo((object)"Cruiser Jump's Helper v1.0.0 loaded."); } } public class PresetMarkerVisual { public readonly JumpPreset Preset; private readonly GameObject _root; private readonly LineRenderer _rectLine; private readonly LineRenderer _arrowLine; private readonly LineRenderer _connectorLine; private readonly TextMesh _label; private static readonly Color IdleColor = new Color(0.15f, 0.55f, 1f, 0.9f); private static readonly Color AlignedColor = new Color(1f, 0.15f, 0.15f, 0.95f); private static readonly Color SelectedIdleColor = new Color(1f, 0.85f, 0.2f, 0.9f); private static readonly Color ConnectorColor = new Color(1f, 1f, 1f, 0.25f); public PresetMarkerVisual(JumpPreset preset) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00ce: Expected O, but got Unknown //IL_0141: 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) Preset = preset; _root = new GameObject("CruiserJumpsHelper_Marker_" + preset.presetName); _rectLine = CreateLine(_root.transform, "Rectangle", loop: true, 4, 0.08f); _arrowLine = CreateLine(_root.transform, "Arrow", loop: false, 5, 0.06f); _connectorLine = CreateLine(_root.transform, "Connector", loop: false, 2, 0.035f); ((Renderer)_connectorLine).material.color = ConnectorColor; _connectorLine.startColor = ConnectorColor; _connectorLine.endColor = ConnectorColor; GameObject val = new GameObject("Label"); val.transform.SetParent(_root.transform, false); _label = val.AddComponent<TextMesh>(); if ((Object)(object)val.GetComponent<MeshRenderer>() == (Object)null) { val.AddComponent<MeshRenderer>(); } _label.characterSize = 0.12f; _label.fontSize = 48; _label.anchor = (TextAnchor)7; _label.alignment = (TextAlignment)1; _label.color = Color.white; _label.text = preset.presetName; SetColor(IdleColor); } private static LineRenderer CreateLine(Transform parent, string name, bool loop, int points, float width) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(parent, false); LineRenderer obj = val.AddComponent<LineRenderer>(); obj.loop = loop; obj.positionCount = points; obj.useWorldSpace = true; obj.widthMultiplier = width; obj.numCapVertices = 2; obj.numCornerVertices = 2; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)obj).receiveShadows = false; Shader val2 = Shader.Find("HDRP/Unlit") ?? Shader.Find("Universal Render Pipeline/Unlit") ?? Shader.Find("Sprites/Default") ?? Shader.Find("Unlit/Color"); ((Renderer)obj).material = new Material(val2); return obj; } public void UpdateGeometry(Vector3[] localFootprintCorners, Vector3[] localArrowPoints) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_0101: 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) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(Preset.posX, Preset.posY, Preset.posZ); Quaternion val2 = default(Quaternion); ((Quaternion)(ref val2))..ctor(Preset.rotX, Preset.rotY, Preset.rotZ, Preset.rotW); _root.transform.SetPositionAndRotation(val, val2); for (int i = 0; i < localFootprintCorners.Length; i++) { _rectLine.SetPosition(i, _root.transform.TransformPoint(localFootprintCorners[i])); } for (int j = 0; j < localArrowPoints.Length; j++) { _arrowLine.SetPosition(j, _root.transform.TransformPoint(localArrowPoints[j])); } Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(0f, 1.6f, 0f); ((Component)_label).transform.position = _root.transform.TransformPoint(val3); } public void FaceCamera(Camera cam) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)cam == (Object)null)) { ((Component)_label).transform.rotation = ((Component)cam).transform.rotation; } } public void SetVisible(bool visible) { _root.SetActive(visible); } public void SetConnectorEnabled(bool enabled) { ((Renderer)_connectorLine).enabled = enabled; } public void UpdateConnector(Vector3 fromWorldPos) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (((Renderer)_connectorLine).enabled) { _connectorLine.SetPosition(0, fromWorldPos); _connectorLine.SetPosition(1, _root.transform.position); } } public void SetColor(Color c) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) ApplyColor(_rectLine, c); ApplyColor(_arrowLine, c); } public void SetState(bool isSelected, bool isAligned) { //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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_0060: Unknown result type (might be due to invalid IL or missing references) Color color = (isAligned ? AlignedColor : (isSelected ? SelectedIdleColor : IdleColor)); SetColor(color); string text = (isAligned ? " [IN POSITION]" : (isSelected ? " [selected]" : "")); _label.text = Preset.presetName + text; _label.color = (Color)(isAligned ? new Color(0.6f, 1f, 0.6f) : Color.white); } private static void ApplyColor(LineRenderer line, Color c) { //IL_0001: 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_0016: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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) line.startColor = c; line.endColor = c; Material material = ((Renderer)line).material; material.color = c; if (material.HasProperty("_EmissiveColor")) { material.SetColor("_EmissiveColor", c * 2f); } if (material.HasProperty("_EmissionColor")) { material.SetColor("_EmissionColor", c * 2f); } } public void Destroy() { Object.Destroy((Object)(object)_root); } } public static class SaveManager { private static SaveFile _cache; private static string FilePath => Path.Combine(Paths.PluginPath, "CruiserJumpsHelper_Data", "markers.json"); public static SaveFile Load() { if (_cache != null) { return _cache; } try { string directoryName = Path.GetDirectoryName(FilePath); if (!string.IsNullOrEmpty(directoryName) && !Directory.Exists(directoryName)) { Directory.CreateDirectory(directoryName); } if (File.Exists(FilePath)) { _cache = JsonUtility.FromJson<SaveFile>(File.ReadAllText(FilePath)) ?? new SaveFile(); } else { _cache = new SaveFile(); } } catch (Exception arg) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogError((object)$"[CruiserJumpsHelper] Failed to load markers.json: {arg}"); } _cache = new SaveFile(); } return _cache; } public static void Save() { try { string contents = JsonUtility.ToJson((object)(_cache ?? new SaveFile()), true); string directoryName = Path.GetDirectoryName(FilePath); if (!string.IsNullOrEmpty(directoryName) && !Directory.Exists(directoryName)) { Directory.CreateDirectory(directoryName); } File.WriteAllText(FilePath, contents); } catch (Exception arg) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogError((object)$"[CruiserJumpsHelper] Failed to save markers.json: {arg}"); } } } public static MoonPresets GetOrCreateMoon(string moonName) { SaveFile saveFile = Load(); MoonPresets moonPresets = saveFile.moons.Find((MoonPresets m) => m.moonName == moonName); if (moonPresets == null) { moonPresets = new MoonPresets { moonName = moonName }; saveFile.moons.Add(moonPresets); } return moonPresets; } public static MoonPresets GetMoonReadOnly(string moonName) { return Load().moons.Find((MoonPresets m) => m.moonName == moonName); } } }