using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.Json;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using LobbyNetworking;
using Microsoft.CodeAnalysis;
using Mirror;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("RandomStart")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("RandomStart")]
[assembly: AssemblyTitle("RandomStart")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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 AdamMady.RandomSpawnTest
{
internal static class GourdInventory
{
private static readonly HashSet<string> gourds = new HashSet<string>(StringComparer.Ordinal);
internal static void Reset()
{
gourds.Clear();
}
private static bool IsGourd(Prop prop)
{
if (!((Object)(object)((Component)prop).GetComponent<RewardGourd>() != (Object)null))
{
return prop.propGroups?.Contains((PropGroup)19) ?? false;
}
return true;
}
private static void Register(Prop prop)
{
if ((Object)(object)prop != (Object)null && !string.IsNullOrEmpty(prop.savablePropGuid) && IsGourd(prop))
{
gourds.Add(prop.savablePropGuid);
}
}
internal static void Enable()
{
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: 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_0275: 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_0287: Unknown result type (might be due to invalid IL or missing references)
//IL_0293: Unknown result type (might be due to invalid IL or missing references)
//IL_029f: Unknown result type (might be due to invalid IL or missing references)
//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: Unknown result type (might be due to invalid IL or missing references)
SaveManager instance = SaveManager.instance;
SaveData val = ((instance != null) ? instance.currentData : null);
if (((val != null) ? val.inventory : null) == null)
{
throw new InvalidOperationException("Current save inventory unavailable.");
}
Il2CppArrayBase<Prop> val2 = Object.FindObjectsOfType<Prop>(true);
gourds.Clear();
foreach (Prop item in val2)
{
Register(item);
}
if (gourds.Count == 0)
{
throw new InvalidOperationException("Could not identify gourds. Save left unchanged.");
}
Backup(val.filenameUid);
int num = Filter(val.inventory);
int num2 = 0;
foreach (Prop item2 in val2)
{
if ((Object)(object)item2 == (Object)null || !((Component)item2).gameObject.activeInHierarchy)
{
continue;
}
NetworkIdentity component = ((Component)item2).GetComponent<NetworkIdentity>();
if ((Object)(object)component == (Object)null || component.netId == 0 || !NetworkServer.spawned.ContainsKey(component.netId))
{
continue;
}
try
{
if (!item2.isInInventory || IsGourd(item2) || (Object)(object)item2.exclusiveHolder != (Object)null)
{
continue;
}
bool flag = false;
if (PlayerCharacter.allPlayerCharacters != null)
{
Enumerator<PlayerCharacter> enumerator2 = PlayerCharacter.allPlayerCharacters.GetEnumerator();
while (enumerator2.MoveNext())
{
PlayerCharacter current2 = enumerator2.Current;
if ((Object)(object)current2 != (Object)null)
{
PlayerHands hands = current2.hands;
if ((Object)(object)((hands != null) ? hands.heldProp : null) == (Object)(object)item2)
{
flag = true;
break;
}
}
}
}
if (flag)
{
continue;
}
item2.isInInventory = false;
if ((Object)(object)item2.currentHome != (Object)null)
{
item2.ServerSetUnpinned();
}
if ((Object)(object)item2.startHome != (Object)null)
{
item2.ServerSetPinned(item2.startHome);
num2++;
continue;
}
Vector3 defaultStartPosition = item2.defaultStartPosition;
Quaternion rotation = ((Component)item2).transform.rotation;
item2.SetLoose();
((Component)item2).transform.SetPositionAndRotation(defaultStartPosition, rotation);
if ((Object)(object)item2.rb != (Object)null)
{
item2.rb.position = defaultStartPosition;
item2.rb.rotation = rotation;
if (!item2.rb.isKinematic)
{
item2.rb.velocity = Vector3.zero;
item2.rb.angularVelocity = Vector3.zero;
}
}
HouseNetworkTransform houseNetworkTransform = item2.houseNetworkTransform;
if ((Object)(object)houseNetworkTransform != (Object)null)
{
uint num3 = Compression.CompressQuaternion(rotation);
houseNetworkTransform.targetPosition = defaultStartPosition;
houseNetworkTransform.targetRotation = rotation;
houseNetworkTransform.ProcessMove(defaultStartPosition, num3, (ushort)0);
houseNetworkTransform.RpcMove(defaultStartPosition, num3, (ushort)0);
houseNetworkTransform.RpcVelocity(Vector3.zero, Vector3.zero);
houseNetworkTransform.OwnerUpdate(true);
}
num2++;
}
catch (Exception ex)
{
Plugin.Logger.LogWarning((object)("[LOST AND FOUND] Could not reset " + ((Object)item2).name + ": " + ex.GetBaseException().Message));
}
}
Plugin.Logger.LogInfo((object)("[LOST AND FOUND] Gourds only. Known gourd IDs=" + gourds.Count + "; removed inventory entries=" + num + "; items returned=" + num2));
}
private static void Backup(string uid)
{
if (string.IsNullOrEmpty(uid))
{
return;
}
string path = Path.Combine(Application.persistentDataPath, "user_data", "save_games");
if (!Directory.Exists(path))
{
return;
}
string[] files = Directory.GetFiles(path, "*.sav");
foreach (string text in files)
{
if (Path.GetFileNameWithoutExtension(text).EndsWith("_" + uid, StringComparison.Ordinal))
{
string text2 = Path.Combine(Paths.BepInExRootPath, "RandomStart", "SaveBackups");
Directory.CreateDirectory(text2);
File.Copy(text, Path.Combine(text2, Path.GetFileName(text) + "." + DateTime.UtcNow.ToString("yyyyMMdd-HHmmss-fffffff") + ".bak"));
}
}
}
private static int Filter(List<string> list)
{
if (list == null)
{
return 0;
}
int num = 0;
for (int num2 = list.Count - 1; num2 >= 0; num2--)
{
if (!gourds.Contains(list[num2]))
{
list.RemoveAt(num2);
num++;
}
}
return num;
}
internal static void AfterSaveList(List<string> saveList)
{
if (Plugin.Enabled && NetworkServer.active && gourds.Count > 0)
{
Filter(saveList);
}
}
internal static void BeforePropStart(Prop __instance)
{
if (!Plugin.Enabled || !NetworkServer.active || (Object)(object)__instance == (Object)null)
{
return;
}
Register(__instance);
if (IsGourd(__instance) || string.IsNullOrEmpty(__instance.savablePropGuid))
{
return;
}
SaveManager instance = SaveManager.instance;
if (instance != null)
{
SaveData currentData = instance.currentData;
if (currentData != null)
{
currentData.inventory?.Remove(__instance.savablePropGuid);
}
}
}
}
[BepInPlugin("AdamMady.RandomSpawnTest", "Random Start", "0.1.0")]
public sealed class Plugin : BasePlugin
{
internal static bool Enabled;
internal static ManualLogSource Logger;
public override void Load()
{
//IL_0015: 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_0020: Expected O, but got Unknown
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Expected O, but got Unknown
//IL_0099: Expected O, but got Unknown
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Expected O, but got Unknown
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Expected O, but got Unknown
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Expected O, but got Unknown
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Expected O, but got Unknown
Logger = ((BasePlugin)this).Log;
ClassInjector.RegisterTypeInIl2Cpp<SpawnMenu>();
GameObject val = new GameObject("Random Start");
Object.DontDestroyOnLoad((Object)val);
val.AddComponent<SpawnMenu>();
Harmony val2 = new Harmony("AdamMady.RandomSpawnTest");
val2.Patch((MethodBase)AccessTools.Method(typeof(NetworkServer), "AddPlayerForConnection", new Type[2]
{
typeof(NetworkConnectionToClient),
typeof(GameObject)
}, (Type[])null), new HarmonyMethod(typeof(SpawnPatch), "Before", (Type[])null), new HarmonyMethod(typeof(SpawnPatch), "After", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
val2.Patch((MethodBase)AccessTools.Method(typeof(HouseNetworkManager), "OnStartServer", (Type[])null, (Type[])null), new HarmonyMethod(typeof(SpawnPatch), "NewSession", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
val2.Patch((MethodBase)AccessTools.Method(typeof(PropInventory), "FillSaveList", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(GourdInventory), "AfterSaveList", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
val2.Patch((MethodBase)AccessTools.Method(typeof(Prop), "Start", (Type[])null, (Type[])null), new HarmonyMethod(typeof(GourdInventory), "BeforePropStart", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
val2.Patch((MethodBase)AccessTools.Method(typeof(WorldManager), "OnDestroy", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(SpawnPatch), "EndSession", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
((BasePlugin)this).Log.LogInfo((object)"Random Start loaded. F6 opens the host menu. Disabled until Enable is pressed each session.");
}
}
internal static class SpawnPatch
{
private static readonly HashSet<string> joined = new HashSet<string>();
internal static void NewSession()
{
EndSession();
}
internal static void EndSession()
{
joined.Clear();
Plugin.Enabled = false;
GourdInventory.Reset();
if ((Object)(object)SpawnMenu.Instance != (Object)null)
{
SpawnMenu.Instance.Status = "Enable before players join.";
}
}
internal static void Before(NetworkConnectionToClient conn, GameObject player, out string __state)
{
//IL_00a9: 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_00de: 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)
__state = null;
if (!NetworkServer.active || NetworkServer.dontListen || (Object)(object)player == (Object)null || (Object)(object)player.GetComponent<PlayerCharacter>() == (Object)null)
{
return;
}
try
{
string text = ((conn != null) ? conn.address : null);
if (string.IsNullOrEmpty(text))
{
Plugin.Logger.LogWarning((object)"[SPAWN] Missing connection address; keeping native spawn.");
}
else
{
if (joined.Contains(text))
{
return;
}
__state = text;
if (!Plugin.Enabled || (Object)(object)SpawnMenu.Instance == (Object)null)
{
return;
}
if (!SpawnMenu.Instance.Pick(out var target))
{
Plugin.Logger.LogWarning((object)"[SPAWN] No valid ground found inside saved border; keeping native spawn.");
return;
}
player.transform.SetPositionAndRotation(target, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f));
Rigidbody component = player.GetComponent<Rigidbody>();
if ((Object)(object)component != (Object)null)
{
component.position = target;
component.rotation = player.transform.rotation;
}
Plugin.Logger.LogInfo((object)("[SPAWN] Native pre-spawn position=" + ((Vector3)(ref target)).ToString("F2") + " connection=" + ((NetworkConnection)conn).connectionId));
SpawnMenu.Instance.Status = "Assigned next player to " + ((Vector3)(ref target)).ToString("F1");
}
}
catch (Exception ex)
{
Plugin.Logger.LogError((object)("[SPAWN] Keeping native flow: " + ex));
}
}
internal static void After(bool __result, string __state)
{
if (__result && __state != null)
{
joined.Add(__state);
}
}
}
public sealed class SpawnMenu : MonoBehaviour
{
internal static SpawnMenu Instance;
private readonly List<Vector3> border = new List<Vector3>();
private Rect window = new Rect(25f, 100f, 410f, 155f);
private bool visible;
private bool ownsCursor;
private bool oldVisible;
private CursorLockMode oldLock;
internal string Status = "Enable before players join.";
private static bool Host
{
get
{
if (NetworkServer.active && NetworkClient.isConnected && (Object)(object)WorldManager.localPlayerCharacter != (Object)null)
{
return !NetworkServer.dontListen;
}
return false;
}
}
public SpawnMenu(IntPtr pointer)
: base(pointer)
{
}//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)
private void Awake()
{
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("IslandBorder.json");
using StreamReader streamReader = new StreamReader(stream ?? throw new InvalidOperationException("Bundled island border missing."));
float[][] array = JsonSerializer.Deserialize<float[][]>(streamReader.ReadToEnd());
if (array == null || array.Length < 4)
{
throw new InvalidOperationException("Bundled island border invalid.");
}
float[][] array2 = array;
foreach (float[] array3 in array2)
{
if (array3 == null || array3.Length != 3 || !array3.All(float.IsFinite))
{
throw new InvalidOperationException("Invalid island border point.");
}
border.Add(new Vector3(array3[0], array3[1], array3[2]));
}
}
private static bool Typing()
{
if (!ControlsManager.textInputModeActive && !ControlsManager.rebindModeActive)
{
TextChatInput instance = TextChatInput.instance;
if (instance == null || !instance.inputIsOpen)
{
return SignTextInput.IsSignInputActive();
}
}
return true;
}
private void Update()
{
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
if (!Host)
{
visible = false;
}
else if (Application.isFocused && !Typing())
{
if (Input.GetKeyDown((KeyCode)287))
{
visible = !visible;
}
if (visible && Input.GetKeyDown((KeyCode)27))
{
visible = false;
}
}
if (visible)
{
if (!ownsCursor)
{
oldLock = Cursor.lockState;
oldVisible = Cursor.visible;
ownsCursor = true;
}
Cursor.lockState = (CursorLockMode)0;
Cursor.visible = true;
}
else
{
ReleaseCursor();
}
if (!Host && !NetworkServer.active)
{
Plugin.Enabled = false;
}
}
private void ReleaseCursor()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
if (ownsCursor)
{
Cursor.lockState = oldLock;
Cursor.visible = oldVisible;
ownsCursor = false;
}
}
private void OnGUI()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
if (visible && Host)
{
window = GUI.Window(817461, window, WindowFunction.op_Implicit((Action<int>)Draw), "Random Start");
}
}
private void Draw(int id)
{
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
GUI.enabled = !Plugin.Enabled;
if (GUILayout.Button(Plugin.Enabled ? "Enabled" : "Enable (Do this before players join)", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) }))
{
Enable();
}
GUI.enabled = true;
GUILayout.Label("To disable this mod, Rehost", (Il2CppReferenceArray<GUILayoutOption>)null);
GUILayout.Label(Status, (Il2CppReferenceArray<GUILayoutOption>)null);
GUI.DragWindow(new Rect(0f, 0f, 10000f, 22f));
}
private void Enable()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
if (Plugin.Enabled || !Pick(out var target))
{
return;
}
try
{
GourdInventory.Enable();
PlayerCharacter localPlayerCharacter = WorldManager.localPlayerCharacter;
localPlayerCharacter.grease.Teleport(target, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f), false);
if (!localPlayerCharacter.rb.isKinematic)
{
localPlayerCharacter.rb.velocity = Vector3.zero;
localPlayerCharacter.rb.angularVelocity = Vector3.zero;
}
Plugin.Enabled = true;
Status = "Enabled for this session.";
visible = false;
ReleaseCursor();
Plugin.Logger.LogInfo((object)("[SPAWN] Enabled. Host moved to " + ((Vector3)(ref target)).ToString("F2")));
}
catch (Exception ex)
{
Status = "Enable failed. See log.";
Plugin.Logger.LogError((object)ex);
}
}
[HideFromIl2Cpp]
internal bool Pick(out Vector3 target)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_0263: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_0272: Unknown result type (might be due to invalid IL or missing references)
//IL_0277: Unknown result type (might be due to invalid IL or missing references)
//IL_027c: 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_0280: 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_0294: Unknown result type (might be due to invalid IL or missing references)
//IL_0296: 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_02b9: Unknown result type (might be due to invalid IL or missing references)
//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
target = default(Vector3);
if (border.Count < 4)
{
return false;
}
float num = border.Min((Vector3 p) => p.x);
float num2 = border.Max((Vector3 p) => p.x);
float num3 = border.Min((Vector3 p) => p.z);
float num4 = border.Max((Vector3 p) => p.z);
float num5 = border.Max((Vector3 p) => p.y) + 1024f;
float num6 = border.Min((Vector3 p) => p.y) - 1024f;
OceanMinder val = Object.FindObjectOfType<OceanMinder>();
float num7 = (((Object)(object)((val != null) ? val.waterRenderer : null) != (Object)null) ? ((Component)val.waterRenderer).transform.position.y : float.NegativeInfinity);
Physics.SyncTransforms();
Vector3 val2 = default(Vector3);
RaycastHit val3 = default(RaycastHit);
for (int num8 = 0; num8 < 256; num8++)
{
((Vector3)(ref val2))..ctor(Random.Range(num, num2), num5, Random.Range(num3, num4));
if (!Inside(val2) || !Physics.Raycast(val2, Vector3.down, ref val3, num5 - num6, -1, (QueryTriggerInteraction)1))
{
continue;
}
Collider collider = ((RaycastHit)(ref val3)).collider;
if (((RaycastHit)(ref val3)).normal.y < 0.85f || ((RaycastHit)(ref val3)).point.y < num7 + 0.5f || (Object)(object)collider.attachedRigidbody != (Object)null || (Object)(object)((Component)collider).GetComponentInParent<Prop>() != (Object)null || (Object)(object)((Component)collider).GetComponentInParent<PlayerCharacter>() != (Object)null)
{
continue;
}
string text = LayerMask.LayerToName(((Component)collider).gameObject.layer);
string name = ((Object)collider).name;
if (!text.Contains("water", StringComparison.OrdinalIgnoreCase) && !name.Contains("water", StringComparison.OrdinalIgnoreCase) && !name.Contains("ocean", StringComparison.OrdinalIgnoreCase))
{
val2 = ((RaycastHit)(ref val3)).point + Vector3.up * 0.15f;
if (!Physics.CheckCapsule(val2 + Vector3.up * 0.3f, val2 + Vector3.up * 1.35f, 0.28f, -1, (QueryTriggerInteraction)1))
{
target = val2;
return true;
}
}
}
Status = "No safe ground found. Try Enable again.";
return false;
}
private bool Inside(Vector3 p)
{
//IL_001b: 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_0028: 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_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_003d: 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_004e: 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_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: 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)
//IL_0077: 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)
bool flag = false;
int num = 0;
int index = border.Count - 1;
while (num < border.Count)
{
Vector3 val = border[num];
Vector3 val2 = border[index];
if (val.z > p.z != val2.z > p.z && p.x < (val2.x - val.x) * (p.z - val.z) / (val2.z - val.z) + val.x)
{
flag = !flag;
}
index = num++;
}
return flag;
}
private void OnDestroy()
{
ReleaseCursor();
if ((Object)(object)Instance == (Object)(object)this)
{
Instance = null;
}
}
}
}