using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
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 LethalNetworkAPI;
using Microsoft.CodeAnalysis;
using ProblematicPilotry.Configuration;
using ProblematicPilotry.Main;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("windblownleaves.problematicpilotry")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.2.3.0")]
[assembly: AssemblyInformationalVersion("1.2.3")]
[assembly: AssemblyProduct("ProblematicPilotry")]
[assembly: AssemblyTitle("windblownleaves.problematicpilotry")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.3.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace ProblematicPilotry
{
[BepInPlugin("windblownleaves.problematicpilotry", "ProblematicPilotry", "1.2.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class ProblematicPilotry : BaseUnityPlugin
{
[PublicNetworkVariable]
public LethalNetworkVariable<Vector3[]> networkDropshipTransform = new LethalNetworkVariable<Vector3[]>("networkDropshipTransform")
{
Value = (Vector3[])(object)new Vector3[2]
};
[PublicNetworkVariable]
public LethalNetworkVariable<Vector3[]> networkLandingShipTransform = new LethalNetworkVariable<Vector3[]>("networkLandingShipTransform")
{
Value = (Vector3[])(object)new Vector3[2]
};
public static ProblematicPilotry Instance { get; private set; }
internal static ManualLogSource Logger { get; private set; }
internal static Harmony? Harmony { get; set; }
internal static ProblematicPilotryConfig BoundConfig { get; private set; }
private void Awake()
{
BoundConfig = new ProblematicPilotryConfig(((BaseUnityPlugin)this).Config);
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
Patch();
Logger.LogInfo((object)"windblownleaves.problematicpilotry v1.2.3 has loaded!");
}
internal static void Patch()
{
//IL_000d: 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)
//IL_0018: Expected O, but got Unknown
if (Harmony == null)
{
Harmony = new Harmony("windblownleaves.problematicpilotry");
}
Logger.LogDebug((object)"Patching...");
Harmony.PatchAll();
Logger.LogDebug((object)"Finished patching!");
}
internal static void Unpatch()
{
Logger.LogDebug((object)"Unpatching...");
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
Logger.LogDebug((object)"Finished unpatching!");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "windblownleaves.problematicpilotry";
public const string PLUGIN_NAME = "ProblematicPilotry";
public const string PLUGIN_VERSION = "1.2.3";
}
}
namespace ProblematicPilotry.Patches
{
[HarmonyPatch(typeof(ItemDropship))]
public class DropshipLocationPatch
{
private static GameObject capsule;
private static Vector3 capsulePoint;
private static Vector3 capsuleRotation;
private static Vector3 originalCapsulePoint;
private static Vector3 originalCapsuleRotation;
private static bool networkEventsRegistered;
private static LayerMask raycastMask;
[HarmonyPostfix]
[HarmonyPatch(typeof(RoundManager), "FinishGeneratingNewLevelClientRpc")]
private static void SetupDropshipSystem()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
capsule = ((Component)((Component)Object.FindObjectOfType<ItemDropship>()).transform.parent).gameObject;
originalCapsulePoint = capsule.transform.position + new Vector3(0f, -1.5f, 0f);
originalCapsuleRotation = capsule.transform.localEulerAngles;
RegisterNetworkEvents();
}
[HarmonyPostfix]
[HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")]
private static void UnsubscribeFromEvent()
{
UnregisterNetworkEvents();
}
[HarmonyPostfix]
[HarmonyPatch(typeof(GameNetworkManager), "Disconnect")]
private static void UnsubscribeDisconnect()
{
UnregisterNetworkEvents();
}
[HarmonyPatch("LandShipOnServer")]
[HarmonyPrefix]
private static void MoveItemDropshipPatch()
{
RunPositionFindingLoop();
}
[HarmonyPatch("LandShipClientRpc")]
[HarmonyPostfix]
private static void AdjustItemDropshipTimerPatch(ref float ___shipTimer)
{
___shipTimer = -ProblematicPilotryConfig.dropshipExtraSeconds.Value;
}
[HarmonyPatch("OpenShipClientRpc")]
[HarmonyPrefix]
private static void SetLeaveTimerPatch(ref float ___shipTimer)
{
if (ProblematicPilotryConfig.dropshipLeaveAfterSeconds.Value >= 0 && ___shipTimer < 30f - (float)ProblematicPilotryConfig.dropshipLeaveAfterSeconds.Value)
{
___shipTimer = 30f - (float)ProblematicPilotryConfig.dropshipLeaveAfterSeconds.Value;
}
}
private static void RegisterNetworkEvents()
{
if (!networkEventsRegistered)
{
ProblematicPilotry.Instance.networkDropshipTransform.OnValueChanged += UpdateTransform;
networkEventsRegistered = true;
}
}
private static void UnregisterNetworkEvents()
{
if (networkEventsRegistered)
{
ProblematicPilotry.Instance.networkDropshipTransform.OnValueChanged -= UpdateTransform;
networkEventsRegistered = false;
}
}
private static void RunPositionFindingLoop()
{
//IL_0086: 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_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: 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_0094: 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_00bd: 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_00b5: 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_00fb: 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_00ec: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: 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_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: 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)
if (Random.Range(0f, 1f) > ProblematicPilotryConfig.dropshipChance.Value || (!ProblematicPilotryConfig.dropshipBlacklistIsWhitelist.Value && Common.IsOnBlacklist(StartOfRound.Instance.currentLevel.PlanetName, Common.ShipType.Dropship)) || (ProblematicPilotryConfig.dropshipBlacklistIsWhitelist.Value && !Common.IsOnBlacklist(StartOfRound.Instance.currentLevel.PlanetName, Common.ShipType.Dropship)))
{
Common.SetNetworkTransform(originalCapsulePoint, originalCapsuleRotation, Common.ShipType.Dropship);
return;
}
int num = 0;
Vector3 zero = Vector3.zero;
Vector3 val;
do
{
val = Common.FindRandomPositionOnNavmesh(Common.ShipType.Dropship);
if (val != Vector3.zero && ProblematicPilotryConfig.dropshipVerifyPath.Value)
{
val = Common.CheckNavmeshPathToEntrance(val);
}
if (val != Vector3.zero)
{
((Vector3)(ref zero))..ctor(-90f, (float)Random.Range(0, 359), 0f);
val = Common.ProbeLandingSpot(val, zero, Common.ShipType.Dropship);
}
num++;
}
while (val == Vector3.zero && num < ProblematicPilotryConfig.dropshipIterations.Value);
if (num >= ProblematicPilotryConfig.dropshipIterations.Value)
{
val = originalCapsulePoint;
zero = originalCapsuleRotation;
}
Common.SetNetworkTransform(val, zero, Common.ShipType.Dropship);
}
public static void UpdateTransform(Vector3[] transform)
{
//IL_0008: 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)
Common.MoveGameObject(capsule, transform[0], transform[1]);
}
}
[HarmonyPatch]
public class LandingShipPatch
{
private static List<GameObject> landingShipObjectsToMove = new List<GameObject>();
private static List<GameObject> levelObjectsToMove = new List<GameObject>();
private static bool networkEventsRegistered = false;
private static bool firstLanding = true;
internal static bool IsHost => NetworkManager.Singleton.IsHost;
[HarmonyPrefix]
[HarmonyPatch(typeof(StartOfRound), "StartGame")]
private static void ServerLaunchPatch()
{
AddShipObjects();
Common.SetUpStart();
}
[HarmonyPrefix]
[HarmonyPatch(typeof(StartOfRound), "OnPlayerConnectedClientRpc")]
private static void ClientConnectedRpcPatch()
{
AddShipObjects();
}
[HarmonyPrefix]
[HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")]
private static void GenerateFloorPatch()
{
AddLevelObjects();
RegisterNetworkEvents();
}
[HarmonyPostfix]
[HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")]
private static void GeneratedFloorDonePatch()
{
if (IsHost)
{
Common.SetUpLevel();
RunPositionFindingLoop();
}
}
private static void AddShipObjects()
{
//IL_0033: 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_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
landingShipObjectsToMove.Clear();
GameObject val = GameObject.Find("Environment");
landingShipObjectsToMove.Add(val);
if (firstLanding)
{
Common.originalShipPosition = val.transform.position + new Vector3(21f, -9.5f, 2.5f);
firstLanding = false;
}
}
private static void AddLevelObjects()
{
levelObjectsToMove.Clear();
levelObjectsToMove.Add(GameObject.Find("NavMeshColliders"));
levelObjectsToMove.Add(GameObject.Find("shipWindTrigger"));
levelObjectsToMove.Add(GameObject.Find("shipWindTrigger2"));
ScanNodeProperties[] array = Object.FindObjectsOfType<ScanNodeProperties>();
ScanNodeProperties[] array2 = array;
foreach (ScanNodeProperties val in array2)
{
if (val.headerText == "Ship")
{
levelObjectsToMove.Add(((Component)val).gameObject);
}
}
}
private static void RunPositionFindingLoop()
{
//IL_0086: 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_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: 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_0094: 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_00bd: 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_00b5: 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_00f6: 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_00ec: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: 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_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: 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)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
if (Random.Range(0f, 1f) > ProblematicPilotryConfig.landingShipChance.Value || (!ProblematicPilotryConfig.landingShipBlacklistIsWhitelist.Value && Common.IsOnBlacklist(StartOfRound.Instance.currentLevel.PlanetName, Common.ShipType.LandingShip)) || (ProblematicPilotryConfig.landingShipBlacklistIsWhitelist.Value && !Common.IsOnBlacklist(StartOfRound.Instance.currentLevel.PlanetName, Common.ShipType.LandingShip)))
{
Common.SetNetworkTransform(Common.originalShipPosition, Vector3.zero, Common.ShipType.LandingShip);
return;
}
int num = 0;
Vector3 zero = Vector3.zero;
Vector3 val;
do
{
val = Common.FindRandomPositionOnNavmesh(Common.ShipType.LandingShip);
if (val != Vector3.zero && ProblematicPilotryConfig.landingShipVerifyPath.Value)
{
val = Common.CheckNavmeshPathToEntrance(val);
}
if (val != Vector3.zero)
{
((Vector3)(ref zero))..ctor(0f, (float)Random.Range(0, 359), 0f);
val = Common.ProbeLandingSpot(val, zero, Common.ShipType.LandingShip);
}
if (val != Vector3.zero)
{
val = DoPathRaycasts(val, zero);
}
num++;
}
while (val == Vector3.zero && num < ProblematicPilotryConfig.landingShipIterations.Value);
if (num >= ProblematicPilotryConfig.landingShipIterations.Value)
{
val = Common.originalShipPosition;
zero = Vector3.zero;
}
Common.SetNetworkTransform(val, zero, Common.ShipType.LandingShip);
}
private static void MoveLandingShip(Vector3 landingPoint, Vector3 rotation)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: 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_0055: Unknown result type (might be due to invalid IL or missing references)
foreach (GameObject item in landingShipObjectsToMove)
{
Common.MoveGameObject(item, landingPoint, rotation);
}
foreach (GameObject item2 in levelObjectsToMove)
{
Common.MoveGameObject(item2, landingPoint, rotation);
}
}
private static Vector3 DoPathRaycasts(Vector3 position, Vector3 rotation)
{
//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)
//IL_0007: 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_0020: 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_002a: 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)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0051: 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_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: 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_0095: 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)
//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_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_00b8: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: 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)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
Quaternion val = Quaternion.Euler(rotation);
Vector3[] array = (Vector3[])(object)new Vector3[4]
{
val * new Vector3(0f, 2f, 0f) + position,
val * new Vector3(30f, 20f, 0f) + position,
val * new Vector3(60f, 40f, 0f) + position,
val * new Vector3(90f, 60f, 0f) + position
};
RaycastHit val2 = default(RaycastHit);
for (int i = 0; i < array.Length; i++)
{
if (Physics.Raycast(array[i], val * Vector3.right, ref val2, 40f, LayerMask.op_Implicit(Common.raycastMask)))
{
return Vector3.zero;
}
}
return position;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")]
private static void UnsubscribeFromEvent()
{
//IL_0012: 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)
UnregisterNetworkEvents();
levelObjectsToMove.Clear();
MoveLandingShip(Common.originalShipPosition, Vector3.zero);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(GameNetworkManager), "Disconnect")]
private static void UnsubscribeDisconnect()
{
UnregisterNetworkEvents();
}
private static void RegisterNetworkEvents()
{
if (!networkEventsRegistered)
{
ProblematicPilotry.Instance.networkLandingShipTransform.OnValueChanged += UpdateTransform;
networkEventsRegistered = true;
}
}
private static void UnregisterNetworkEvents()
{
if (networkEventsRegistered)
{
ProblematicPilotry.Instance.networkLandingShipTransform.OnValueChanged -= UpdateTransform;
networkEventsRegistered = false;
}
}
public static void UpdateTransform(Vector3[] transform)
{
//IL_0011: 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_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
Vector3 landingPoint = ProblematicPilotry.Instance.networkLandingShipTransform.Value[0];
Vector3 rotation = ProblematicPilotry.Instance.networkLandingShipTransform.Value[1];
MoveLandingShip(landingPoint, rotation);
}
}
}
namespace ProblematicPilotry.Configuration
{
[Serializable]
public class ProblematicPilotryConfig
{
public static ConfigEntry<float> dropshipChance;
public static ConfigEntry<int> dropshipExtraSeconds;
public static ConfigEntry<int> dropshipLeaveAfterSeconds;
public static ConfigEntry<int> dropshipIterations;
public static ConfigEntry<int> dropshipRandomDistance;
public static ConfigEntry<bool> dropshipVerifyPath;
public static ConfigEntry<string> dropshipBlacklist;
public static ConfigEntry<bool> dropshipBlacklistIsWhitelist;
public static ConfigEntry<float> landingShipChance;
public static ConfigEntry<int> landingShipIterations;
public static ConfigEntry<int> landingShipRandomDistance;
public static ConfigEntry<bool> landingShipVerifyPath;
public static ConfigEntry<string> landingShipBlacklist;
public static ConfigEntry<bool> landingShipBlacklistIsWhitelist;
public ProblematicPilotryConfig(ConfigFile cfg)
{
cfg.SaveOnConfigSet = false;
dropshipChance = cfg.Bind<float>("Dropship", "Probability", 1f, "The probability the dropship will land in a different location than normal. Goes from 0.0 (0%) to 1.0 (100%).");
dropshipExtraSeconds = cfg.Bind<int>("Dropship", "ExtraSeconds", 30, "Extra seconds added to the dropship's stay timer to make up for more difficult-to-reach spots. Setting 30 here will roughly double (30 default + 30 extra) the timer.");
dropshipLeaveAfterSeconds = cfg.Bind<int>("Dropship", "LeaveAfterSeconds", 10, "After being opened, how many more seconds should the dropship stay? This helps if you have ExtraSeconds set to a high value, as in the vanilla game, opening the dropship does not affect its timer. Set to -1 to disable this feature.");
dropshipIterations = cfg.Bind<int>("Dropship", "MaximumIterations", 100, "The maximum number of times the algorithm tries to find a valid dropship location before the vanilla location is used. This is to prevent lag/lockup in case the system can't find a valid location.");
dropshipRandomDistance = cfg.Bind<int>("Dropship", "NavMeshCheckDistance", 50, "The mod functions by 'looking' around maps' AI nodes, which are distributed across the level. Setting this higher effectively means more random and distant locations, but setting it too high may cause failure to find a viable position.");
dropshipVerifyPath = cfg.Bind<bool>("Dropship", "VerifyPath", true, "Whether or not to verify that a path is available from the landing spot to the playable level. This ensures your items don't land in a bad place, but may add overhead and possibly incompatibility.");
dropshipBlacklist = cfg.Bind<string>("Dropship", "Blacklist", "gordion", "Comma-separated level names to exclude from being randomised. These should be the full names, as setting 'exp' would blacklist both 'experimentation' and a hypothetical moon called 'exponent'. Use 'vanilla' to include all vanilla moons.");
dropshipBlacklistIsWhitelist = cfg.Bind<bool>("Dropship", "BlacklistIsWhitelist", false, "Whether to treat the blacklist as a whitelist; use this if you only want the randomisation to happen on certain moons.");
landingShipChance = cfg.Bind<float>("LandingShip", "Probability", 1f, "The probability the landing ship will land in a different location than normal. Goes from 0.0 (0%) to 1.0 (100%).");
landingShipIterations = cfg.Bind<int>("LandingShip", "AllowedIterations", 1000, "The maximum number of times the algorithm tries to find a valid landing ship location before the vanilla location is used. This is to prevent lag/lockup in case the system can't find a valid location.");
landingShipRandomDistance = cfg.Bind<int>("LandingShip", "RandomDistance", 50, "The mod functions by 'looking' around maps' AI nodes, which are distributed across the level. Setting this higher effectively means more random and distant locations, but setting it too high may cause failure to find a viable position.");
landingShipVerifyPath = cfg.Bind<bool>("LandingShip", "VerifyPath", true, "Whether or not to verify that a path is available from the landing spot to the playable level. This ensures you don't land in a bad place, but may add overhead and possibly incompatibility.");
landingShipBlacklist = cfg.Bind<string>("LandingShip", "Blacklist", "gordion", "Comma-separated level names to exclude from being randomised. These should be the full names, as setting 'exp' would blacklist both 'experimentation' and a hypothetical moon called 'exponent'. Use 'vanilla' to include all vanilla moons.");
landingShipBlacklistIsWhitelist = cfg.Bind<bool>("LandingShip", "BlacklistIsWhitelist", false, "Whether to treat the blacklist as a whitelist; use this if you only want the randomisation to happen on certain moons.");
ClearOrphanedEntries(cfg);
cfg.Save();
cfg.SaveOnConfigSet = true;
}
private static void ClearOrphanedEntries(ConfigFile cfg)
{
PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries");
Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(cfg);
dictionary.Clear();
}
}
}
namespace ProblematicPilotry.Main
{
internal class Common
{
public enum ShipType
{
Dropship,
LandingShip
}
private static GameObject[] aiNodes;
public static Vector3 originalShipPosition;
private static string[] landingShipBlacklistMoons;
private static string[] dropshipBlacklistMoons;
public static LayerMask raycastMask;
public static Vector3 GetRotatedOffsetValueForObject(GameObject gameObject, Quaternion rotation)
{
//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_01bd: 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_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: 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_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
Vector3 zero = default(Vector3);
switch (((Object)gameObject).name)
{
case "ItemShipAnimContainer":
((Vector3)(ref zero))..ctor(0f, 0f, 1.5f);
break;
case "Environment":
((Vector3)(ref zero))..ctor(-21f, 9.5f, -2.5f);
break;
case "NavMeshColliders":
((Vector3)(ref zero))..ctor(-21f, 9.5f, -2.5f);
break;
case "shipWindTrigger":
((Vector3)(ref zero))..ctor(-7.832856f, 3.7589f, -0.09962082f);
break;
case "shipWindTrigger2":
((Vector3)(ref zero))..ctor(-10.78345f, 3.7589f, -0.09962071f);
break;
case "ShipScanNode":
zero = Vector3.zero;
break;
case "ScanNode (1)":
zero = Vector3.zero;
break;
default:
LogError("Couldn't find offset data for object: " + ((Object)gameObject).name + ". This may lead to placement errors.");
zero = Vector3.zero;
break;
}
return rotation * zero;
}
public static Vector3 FindRandomPositionOnNavmesh(ShipType shipType)
{
//IL_002f: 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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: 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_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_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)
//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_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_0082: 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_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)
GameObject val = aiNodes[Random.Range(0, aiNodes.Length)];
Vector3 val2;
float num;
switch (shipType)
{
case ShipType.Dropship:
val2 = val.transform.position + Random.insideUnitSphere * (float)ProblematicPilotryConfig.dropshipRandomDistance.Value;
num = ProblematicPilotryConfig.dropshipRandomDistance.Value;
break;
case ShipType.LandingShip:
val2 = val.transform.position + Random.insideUnitSphere * (float)ProblematicPilotryConfig.landingShipRandomDistance.Value;
num = ProblematicPilotryConfig.landingShipRandomDistance.Value;
break;
default:
LogError("Can't find RandomDistance config setting for ship type " + shipType);
val2 = Vector3.zero;
num = 0f;
break;
}
int num2 = 1 << NavMesh.GetAreaFromName("Walkable");
NavMeshHit val3 = default(NavMeshHit);
if (NavMesh.SamplePosition(val2, ref val3, num, num2))
{
return ((NavMeshHit)(ref val3)).position;
}
return Vector3.zero;
}
public static void SetUpStart()
{
//IL_001e: 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)
string[] array = new string[2] { "Default", "Room" };
raycastMask = LayerMask.op_Implicit(LayerMask.GetMask(array));
landingShipBlacklistMoons = ParseBlacklist(ProblematicPilotryConfig.landingShipBlacklist.Value);
dropshipBlacklistMoons = ParseBlacklist(ProblematicPilotryConfig.dropshipBlacklist.Value);
}
public static void SetUpLevel()
{
aiNodes = GameObject.FindGameObjectsWithTag("OutsideAINode");
}
public static Vector3 CheckNavmeshPathToEntrance(Vector3 position)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: 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_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Invalid comparison between Unknown and I4
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
NavMeshPath val = new NavMeshPath();
int num = 1 << NavMesh.GetAreaFromName("Walkable");
NavMeshHit val2 = default(NavMeshHit);
NavMeshHit val3 = default(NavMeshHit);
if (NavMesh.SamplePosition(originalShipPosition, ref val2, 5f, num) && NavMesh.SamplePosition(position, ref val3, 5f, num) && NavMesh.CalculatePath(((NavMeshHit)(ref val2)).position, ((NavMeshHit)(ref val3)).position, num, val))
{
if ((int)val.status == 0)
{
return position;
}
return Vector3.zero;
}
return Vector3.zero;
}
public static Vector3 ProbeLandingSpot(Vector3 position, Vector3 rotation, ShipType shipType)
{
//IL_009c: 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_00a3: 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_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_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: 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_00f3: 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_008e: 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_0094: 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_00e9: 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)
Vector3 zero = default(Vector3);
Vector3 zero2 = default(Vector3);
switch (shipType)
{
case ShipType.Dropship:
((Vector3)(ref zero))..ctor(0f, 3.5f, 3.5f);
((Vector3)(ref zero2))..ctor(2f, 2.5f, 2f);
break;
case ShipType.LandingShip:
((Vector3)(ref zero))..ctor(-1.5f, 4.75f, 0f);
((Vector3)(ref zero2))..ctor(11f, 2.75f, 4f);
break;
default:
LogError("Can't find probe info for ShipType" + shipType);
zero = Vector3.zero;
zero2 = Vector3.zero;
break;
}
Quaternion val = Quaternion.Euler(rotation);
Collider[] array = Physics.OverlapBox(position + zero, zero2, val, LayerMask.op_Implicit(raycastMask), (QueryTriggerInteraction)1);
if (array.Length != 0)
{
Collider[] array2 = array;
foreach (Collider val2 in array2)
{
}
return Vector3.zero;
}
return position;
}
public static void MoveGameObject(GameObject gameObject, Vector3 landingPoint, Vector3 rotation)
{
//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)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: 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_0011: 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_0027: Unknown result type (might be due to invalid IL or missing references)
Quaternion rotation2 = Quaternion.Euler(rotation);
gameObject.transform.position = landingPoint + GetRotatedOffsetValueForObject(gameObject, rotation2);
gameObject.transform.rotation = rotation2;
}
public static void SetNetworkTransform(Vector3 position, Vector3 rotation, ShipType shipType)
{
//IL_0022: 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_002a: 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)
//IL_004a: 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)
//IL_0052: 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)
switch (shipType)
{
case ShipType.Dropship:
ProblematicPilotry.Instance.networkDropshipTransform.Value = (Vector3[])(object)new Vector3[2] { position, rotation };
break;
case ShipType.LandingShip:
ProblematicPilotry.Instance.networkLandingShipTransform.Value = (Vector3[])(object)new Vector3[2] { position, rotation };
break;
default:
LogError("Can't find network variable for ShipType" + shipType);
break;
}
}
public static bool IsOnBlacklist(string moonName, ShipType shipType)
{
string[] array;
switch (shipType)
{
case ShipType.Dropship:
array = dropshipBlacklistMoons;
break;
case ShipType.LandingShip:
array = landingShipBlacklistMoons;
break;
default:
LogError("Can't find blacklist for ShipType" + shipType);
array = new string[0];
break;
}
string[] array2 = array;
foreach (string text in array2)
{
if (moonName.ToLower().Contains(text.ToLower()))
{
return true;
}
}
return false;
}
public static string[] ParseBlacklist(string input)
{
string[] collection = new string[11]
{
"experimentation", "assurance", "vow", "march", "adamance", "rend", "dine", "offense", "titan", "artifice",
"embrion"
};
List<string> list = (from moon in input.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries)
select moon.Trim()).ToList();
if (list.Contains("vanilla"))
{
list.Remove("vanilla");
list.AddRange(collection);
}
return list.ToArray();
}
public static void LogError(object data)
{
ProblematicPilotry.Logger.LogError(data);
}
public static void LogInfo(object data)
{
ProblematicPilotry.Logger.LogInfo(data);
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}