Decompiled source of PlannerLite v0.1.3

NGA.PlannerLiteLibs.dll

Decompiled a year ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using FistVR;
using Microsoft.CodeAnalysis;
using Sodalite.Api;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("NGA")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Persistent player progression! Raid, stash loot, and deploy with seemless scene/loadout saving.")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("NGA.PlannerLiteLibs")]
[assembly: AssemblyTitle("BepInEx Plugin Title")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string id = null, string name = null, string version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string id = null, string name = null, string version = null)
		{
		}
	}
}
namespace NGA
{
	public class NpcSpawnMngr : MonoBehaviour
	{
		public List<NpcSpawnPt> managedPts = new List<NpcSpawnPt>();

		private void Start()
		{
		}

		private void Update()
		{
		}

		public void setActiveAll(bool val)
		{
			for (int num = managedPts.Count - 1; num >= 0; num--)
			{
				if ((Object)(object)managedPts[num] == (Object)null)
				{
					managedPts.RemoveAt(num);
					Debug.LogWarning((object)"Removed invalid respawn point.");
				}
				else
				{
					managedPts[num].setActive(val);
				}
			}
		}

		public void registerPoint(NpcSpawnPt point)
		{
			if (!managedPts.Contains(point))
			{
				managedPts.Add(point);
			}
			else
			{
				Debug.LogWarning((object)"This respawn point is already registered.");
			}
		}

		public void deRegisterPoint(NpcSpawnPt point)
		{
			if (managedPts.Contains(point))
			{
				managedPts.Remove(point);
			}
			else
			{
				Debug.LogWarning((object)"This respawn point was not found in the list.");
			}
		}

		protected void OnDestroy()
		{
			for (int num = managedPts.Count - 1; num >= 0; num--)
			{
				if ((Object)(object)managedPts[num] == (Object)null)
				{
					managedPts.RemoveAt(num);
					Debug.LogWarning((object)"Removed invalid respawn point during OnDestroy Respawn.");
				}
				else
				{
					Object.Destroy((Object)(object)((Component)managedPts[num]).gameObject);
				}
			}
		}
	}
	public class NpcSpawnPt : PlacePoint
	{
		private List<Sosig> mySosigs = new List<Sosig>();

		public string tagId = "";

		private int myIFF = 1;

		private SosigOrder myOrders = (SosigOrder)1;

		private SosigEnemyID enemyID = (SosigEnemyID)0;

		private void Start()
		{
		}

		protected override void Update()
		{
			base.Update();
			if (!isRegistered && (Object)(object)pointsMan != (Object)null)
			{
				pointsMan.registerPoint(this);
				isRegistered = true;
			}
		}

		public override void setActive(bool val)
		{
			base.setActive(val);
			if (val)
			{
				spawnMySosig();
			}
		}

		private void spawnMySosig()
		{
			//IL_000c: 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_0021: 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_0036: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_008a: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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_00d6: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
			Sosig val = SosigAPI.Spawn(ManagerSingleton<IM>.Instance.odicSosigObjsByID[enemyID], new SpawnOptions(), ((Component)this).transform.position, ((Component)this).transform.rotation);
			mySosigs.Add(val);
			int iFF = myIFF;
			if (myIFF == -1)
			{
				iFF = Random.Range(8, 32);
			}
			val.SetIFF(iFF);
			val.CurrentOrder = myOrders;
			val.FallbackOrder = myOrders;
			val.SetDominantGuardDirection(((Component)this).transform.rotation * Vector3.forward);
			val.UpdateGuardPoint(((Component)val).transform.position);
			val.UpdateAssaultPoint(((Component)val).transform.position);
			val.SetGuardInvestigateDistanceThreshold(3f);
			val.UpdateIdlePoint(((Component)val).transform.position);
			val.SetDominantGuardDirection(((Component)val).transform.forward);
			val.FallbackOrder = (SosigOrder)0;
		}

		public override Dictionary<string, string> GetFlagDic()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected I4, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected I4, but got Unknown
			Debug.Log((object)"NpcSpawnPt GetFlagDic");
			Dictionary<string, string> flagDic = base.GetFlagDic();
			flagDic.Add("myIFF", myIFF.ToString());
			flagDic.Add("myOrders", ((int)myOrders).ToString());
			flagDic.Add("enemyID", ((int)enemyID).ToString());
			flagDic.Add("tagId", tagId);
			Debug.Log((object)"NpcSpawnPt GetFlagDic END");
			return flagDic;
		}

		public override void ConfigureFromFlagDic(Dictionary<string, string> f)
		{
			//IL_0068: 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)
			Debug.Log((object)"NpcSpawnPt ConfigureFromFlagDic");
			base.ConfigureFromFlagDic(f);
			string key = "myIFF";
			if (f.ContainsKey(key))
			{
				string s = f[key];
				int.TryParse(s, out myIFF);
			}
			key = "myOrders";
			if (f.ContainsKey(key))
			{
				string s = f[key];
				if (int.TryParse(s, out var result))
				{
					myOrders = (SosigOrder)result;
				}
			}
			key = "enemyID";
			if (f.ContainsKey(key))
			{
				string s = f[key];
				if (int.TryParse(s, out var result2))
				{
					enemyID = (SosigEnemyID)result2;
				}
			}
			key = "tagId";
			if (f.ContainsKey(key))
			{
				tagId = f[key];
			}
			Debug.Log((object)"NpcSpawnPt ConfigureFromFlagDic END");
		}

		public int GetMyIFF()
		{
			return myIFF;
		}

		public void SetMyIFF(int value)
		{
			myIFF = value;
		}

		public SosigOrder GetMyOrders()
		{
			//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_000a: Unknown result type (might be due to invalid IL or missing references)
			return myOrders;
		}

		public void SetMyOrders(SosigOrder value)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			myOrders = value;
		}

		public SosigEnemyID GetEnemyID()
		{
			//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_000a: Unknown result type (might be due to invalid IL or missing references)
			return enemyID;
		}

		public void SetEnemyID(SosigEnemyID value)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			enemyID = value;
		}

		private void DestroyNpcs()
		{
			foreach (Sosig mySosig in mySosigs)
			{
				mySosig.ClearSosig();
			}
		}

		protected void OnDestroy()
		{
			if ((Object)(object)pointsMan != (Object)null)
			{
				DestroyNpcs();
				pointsMan.deRegisterPoint(this);
			}
			else
			{
				Debug.LogError((object)"Tried deleting PlayerRespawnPt but found no pointsMan");
			}
		}
	}
	public class PlacePoint : FVRPhysicalObject
	{
		protected bool isOn = false;

		protected string resource_id;

		protected string parent_id;

		protected TabletPointManager pointsMan = null;

		protected bool isRegistered = false;

		private void Start()
		{
		}

		protected virtual void Update()
		{
			if (!string.IsNullOrEmpty(parent_id) && (Object)(object)pointsMan == (Object)null)
			{
				findSetPointMan();
			}
		}

		public virtual void setActive(bool val)
		{
			isOn = val;
			if (isOn)
			{
				hideDuringActive();
			}
		}

		public override Dictionary<string, string> GetFlagDic()
		{
			Dictionary<string, string> flagDic = ((FVRPhysicalObject)this).GetFlagDic();
			flagDic.Add("resource_id", resource_id);
			flagDic.Add("parent_id", parent_id);
			return flagDic;
		}

		public override void ConfigureFromFlagDic(Dictionary<string, string> f)
		{
			Debug.Log((object)"Placepoint GetFlagDic");
			((FVRPhysicalObject)this).ConfigureFromFlagDic(f);
			string empty = string.Empty;
			string empty2 = string.Empty;
			empty = "resource_id";
			if (f.ContainsKey(empty))
			{
				empty2 = f[empty];
				resource_id = empty2;
			}
			empty = "parent_id";
			if (f.ContainsKey(empty))
			{
				empty2 = f[empty];
				Debug.Log((object)("Setting parent to " + empty2));
				parent_id = empty2;
			}
		}

		private void findSetPointMan()
		{
			TabletPointManager[] array = Object.FindObjectsOfType<TabletPointManager>();
			TabletPointManager[] array2 = array;
			foreach (TabletPointManager tabletPointManager in array2)
			{
				if (tabletPointManager.getResourceId() == parent_id)
				{
					pointsMan = tabletPointManager;
					break;
				}
			}
		}

		private void hideDuringActive()
		{
			((Component)((Component)this).transform.Find("Geo")).gameObject.SetActive(false);
		}

		public void setResourceId(string id)
		{
			resource_id = id;
		}

		public string getResourceId()
		{
			return resource_id;
		}

		public void setParentId(string id)
		{
			parent_id = id;
		}

		public string getParentId()
		{
			return parent_id;
		}
	}
	public class PlayerRespawnMngr : MonoBehaviour
	{
		private List<PlayerRespawnPt> managedPts = new List<PlayerRespawnPt>();

		private void Start()
		{
		}

		private void Update()
		{
		}

		public void setActiveAll(bool val)
		{
			for (int num = managedPts.Count - 1; num >= 0; num--)
			{
				if ((Object)(object)managedPts[num] == (Object)null)
				{
					managedPts.RemoveAt(num);
					Debug.LogWarning((object)"Removed invalid respawn point.");
				}
				else
				{
					managedPts[num].setActive(val);
				}
			}
		}

		public void registerPoint(PlayerRespawnPt point)
		{
			if (!managedPts.Contains(point))
			{
				managedPts.Add(point);
			}
			else
			{
				Debug.LogWarning((object)"This respawn point is already registered.");
			}
		}

		public void deRegisterPoint(PlayerRespawnPt point)
		{
			if (managedPts.Contains(point))
			{
				managedPts.Remove(point);
			}
			else
			{
				Debug.LogWarning((object)"This respawn point was not found in the list.");
			}
		}

		protected void OnDestroy()
		{
			for (int num = managedPts.Count - 1; num >= 0; num--)
			{
				if ((Object)(object)managedPts[num] == (Object)null)
				{
					managedPts.RemoveAt(num);
					Debug.LogWarning((object)"Removed invalid respawn point during OnDestroy Respawn.");
				}
				else
				{
					Object.Destroy((Object)(object)((Component)managedPts[num]).gameObject);
				}
			}
		}
	}
	public class PlayerRespawnPt : PlacePoint
	{
		public string tagId = "";

		public bool forceMove = false;

		public bool activeOnStart = false;

		public bool configuredFromDic = false;

		public bool executedAsyncOnStart = false;

		private void Start()
		{
		}

		protected override void Update()
		{
			base.Update();
			if (!isRegistered && (Object)(object)pointsMan != (Object)null)
			{
				pointsMan.registerPoint(this);
				isRegistered = true;
			}
			if (configuredFromDic && !executedAsyncOnStart && activeOnStart)
			{
				executedAsyncOnStart = true;
				setActive(val: true);
			}
		}

		public override void setActive(bool val)
		{
			base.setActive(val);
			if (val)
			{
				becomeRespawnPt();
				if (forceMove)
				{
					forceMovePlayer();
				}
			}
		}

		private void becomeRespawnPt()
		{
			GM.CurrentSceneSettings.DeathResetPoint = ((Component)this).transform;
		}

		public bool getForceMove()
		{
			return forceMove;
		}

		public void setForceMove(bool val)
		{
			forceMove = val;
		}

		public bool getActiveOnStart()
		{
			return activeOnStart;
		}

		public void setActiveOnStart(bool val)
		{
			activeOnStart = val;
		}

		private void forceMovePlayer()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			GM.CurrentMovementManager.TeleportToPoint(GM.CurrentSceneSettings.DeathResetPoint.position, false);
		}

		public override Dictionary<string, string> GetFlagDic()
		{
			Debug.Log((object)"PlayerRespawnPt GetFlagDic");
			Dictionary<string, string> flagDic = base.GetFlagDic();
			flagDic.Add("forceMove", forceMove.ToString());
			flagDic.Add("activeOnStart", activeOnStart.ToString());
			flagDic.Add("tagId", tagId);
			Debug.Log((object)"PlayerRespawnPt GetFlagDic END");
			return flagDic;
		}

		public override void ConfigureFromFlagDic(Dictionary<string, string> f)
		{
			Debug.Log((object)"PlayerRespawnPt ConfigureFromFlagDic");
			base.ConfigureFromFlagDic(f);
			string empty = string.Empty;
			string empty2 = string.Empty;
			empty = "forceMove";
			if (f.ContainsKey(empty))
			{
				empty2 = f[empty];
				bool.TryParse(empty2, out var result);
				forceMove = result;
			}
			empty = "activeOnStart";
			if (f.ContainsKey(empty))
			{
				empty2 = f[empty];
				bool.TryParse(empty2, out var result2);
				activeOnStart = result2;
			}
			empty = "tagId";
			if (f.ContainsKey(empty))
			{
				empty2 = f[empty];
				tagId = empty2;
			}
			configuredFromDic = true;
			Debug.Log((object)"PlayerRespawnPt ConfigureFromFlagDic END");
		}

		protected void OnDestroy()
		{
			if ((Object)(object)pointsMan != (Object)null)
			{
				pointsMan.deRegisterPoint(this);
			}
			else
			{
				Debug.LogError((object)"Tried deleting PlayerRespawnPt but found no pointsMan");
			}
		}
	}
	public class PointPlacerTblt : ToolPanel
	{
		private FVRPhysicalObject selectedObj = null;

		private bool registeredClick = false;

		private RaycastHit m_hit;

		private int selectedSpawnBtnId = 0;

		private PlayerRespawnPt copyEditPlyPt = null;

		private NpcSpawnPt copyEditNpcPt = null;

		private PlayerRespawnPt lastSpawnedPlyPt = null;

		private NpcSpawnPt lastSpawnedNpcPt = null;

		private int enemyIdMult = 1;

		private bool needUiRefresh = false;

		[Header("Point Manager")]
		public TabletPointManager pointsMan = null;

		[Header("UI References")]
		public Transform Canvas;

		private Transform ButtonsSection;

		private Transform EditSection;

		private Transform NpcSpawnEditTab;

		private Transform PlayerSpawnEditTab;

		private void Start()
		{
			if ((Object)(object)pointsMan == (Object)null)
			{
				pointsMan = ((Component)this).gameObject.AddComponent<TabletPointManager>();
			}
			FindUiVariables();
			ShowClearEditScreen();
			SelectNodeType(0);
		}

		private void Update()
		{
			StylusAndEditUpdate();
		}

		private void FindUiVariables()
		{
			if ((Object)(object)Canvas == (Object)null)
			{
				Debug.LogError((object)"Canvas UI no here");
				return;
			}
			string text = "SpawnTypeSect";
			ButtonsSection = Canvas.Find(text);
			string text2 = "EditNodeSect";
			EditSection = Canvas.Find(text2);
			string text3 = "SosigEditTab";
			NpcSpawnEditTab = EditSection.Find(text3);
			string text4 = "PlySpwEditTab";
			PlayerSpawnEditTab = EditSection.Find(text4);
		}

		public void ShowClearEditScreen()
		{
			((Component)NpcSpawnEditTab).gameObject.SetActive(false);
			((Component)PlayerSpawnEditTab).gameObject.SetActive(false);
		}

		public void SelectNodeType(int type)
		{
			((Component)ButtonsSection.Find("BTN_Npc").Find("Highlight")).gameObject.SetActive(false);
			((Component)ButtonsSection.Find("BTN_Respawn").Find("Highlight")).gameObject.SetActive(false);
			((Component)ButtonsSection.Find("BTN_Delete").Find("Highlight")).gameObject.SetActive(false);
			switch (type)
			{
			case 0:
				((Component)ButtonsSection.Find("BTN_Npc").Find("Highlight")).gameObject.SetActive(true);
				break;
			case 1:
				((Component)ButtonsSection.Find("BTN_Respawn").Find("Highlight")).gameObject.SetActive(true);
				break;
			case 2:
				((Component)ButtonsSection.Find("BTN_Delete").Find("Highlight")).gameObject.SetActive(true);
				break;
			default:
				Debug.LogError((object)("Selected node type not supported: " + type));
				return;
			}
			selectedSpawnBtnId = type;
		}

		public void ShowNpcSpwPtEdit()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			if (needUiRefresh)
			{
				ShowClearEditScreen();
				((Component)NpcSpawnEditTab).gameObject.SetActive(true);
				if ((Object)(object)copyEditNpcPt == (Object)null)
				{
					Debug.LogError((object)"Show Player Respawn edit called with null node");
					return;
				}
				Transform val = NpcSpawnEditTab.Find("NpcOrderType");
				((Component)val).GetComponent<Text>().text = "Starting command: " + GetSosigOrderName(copyEditNpcPt.GetMyOrders());
				Transform val2 = NpcSpawnEditTab.Find("NpcEnemyId");
				((Component)val2).GetComponent<Text>().text = "Enemy ID: " + GetEnemyIDName(copyEditNpcPt.GetEnemyID());
				Transform val3 = NpcSpawnEditTab.Find("NpcsIff");
				((Component)val3).GetComponent<Text>().text = "IFF: " + copyEditNpcPt.GetMyIFF();
				Transform val4 = NpcSpawnEditTab.Find("NpcEnemyId").Find("BTN_EnemyIDMult");
				((Component)val4).GetComponent<Text>().text = enemyIdMult.ToString();
				InputField component = ((Component)NpcSpawnEditTab.Find("InputField")).GetComponent<InputField>();
				component.text = copyEditNpcPt.tagId;
				needUiRefresh = false;
			}
		}

		private string GetSosigOrderName(SosigOrder order)
		{
			//IL_000b: 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_0046: Expected I4, but got Unknown
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected I4, but got Unknown
			if (Enum.IsDefined(typeof(SosigOrder), order))
			{
				return ((object)(SosigOrder)(ref order)).ToString() + "(" + (int)order + ")";
			}
			return ((int)order).ToString();
		}

		private string GetEnemyIDName(SosigEnemyID enID)
		{
			//IL_000b: 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_0046: Expected I4, but got Unknown
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected I4, but got Unknown
			if (Enum.IsDefined(typeof(SosigEnemyID), enID))
			{
				return ((object)(SosigEnemyID)(ref enID)).ToString() + "(" + (int)enID + ")";
			}
			return ((int)enID).ToString();
		}

		public void ShowPlySpwPtEdit()
		{
			if (needUiRefresh)
			{
				ShowClearEditScreen();
				((Component)PlayerSpawnEditTab).gameObject.SetActive(true);
				if ((Object)(object)copyEditPlyPt == (Object)null)
				{
					Debug.LogError((object)"Show Player Respawn edit called with null node");
					return;
				}
				Transform val = PlayerSpawnEditTab.Find("BTN_forceMoveV");
				((Component)val).GetComponent<Text>().text = "Force Teleport on Activated: " + copyEditPlyPt.getForceMove();
				Transform val2 = PlayerSpawnEditTab.Find("BTN_activeOnStartV");
				((Component)val2).GetComponent<Text>().text = "Activated on Scene Load: " + copyEditPlyPt.getActiveOnStart();
				InputField component = ((Component)PlayerSpawnEditTab.Find("InputField")).GetComponent<InputField>();
				component.text = copyEditPlyPt.tagId;
				needUiRefresh = false;
			}
		}

		public void BTN_ActiveOnStart()
		{
			copyEditPlyPt.setActiveOnStart(!copyEditPlyPt.getActiveOnStart());
			needUiRefresh = true;
		}

		public void BTN_ForceMove()
		{
			copyEditPlyPt.setForceMove(!copyEditPlyPt.getForceMove());
			needUiRefresh = true;
		}

		public void BTN_DestroyTablet()
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		public void BTN_EnemyIdMultScale()
		{
			int[] array = new int[5] { 1, 10, 100, 1000, 10000 };
			int num = 1;
			int num2 = Array.IndexOf(array, enemyIdMult);
			if (num2 == -1)
			{
				num2 = 0;
			}
			int num3 = (num2 + 1 + array.Length) % array.Length;
			enemyIdMult = array[num3];
			needUiRefresh = true;
		}

		public void BTN_EnemyIdAdd(int sign)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected I4, but got Unknown
			int num = (int)copyEditNpcPt.GetEnemyID();
			copyEditNpcPt.SetEnemyID((SosigEnemyID)(num + sign * enemyIdMult));
			needUiRefresh = true;
		}

		public void BTN_NpcIffAdd(int sign)
		{
			int myIFF = copyEditNpcPt.GetMyIFF();
			copyEditNpcPt.SetMyIFF(myIFF + sign);
			needUiRefresh = true;
		}

		public void BTN_SosigOrderAdd(int sign)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected I4, but got Unknown
			int num = (int)copyEditNpcPt.GetMyOrders();
			copyEditNpcPt.SetMyOrders((SosigOrder)(num + sign));
			needUiRefresh = true;
		}

		public void BTN_SetEnemyName()
		{
			InputField component = ((Component)NpcSpawnEditTab.Find("InputField")).GetComponent<InputField>();
			copyEditNpcPt.tagId = component.text;
			needUiRefresh = true;
		}

		public void BTN_SetPlySpwName()
		{
			InputField component = ((Component)PlayerSpawnEditTab.Find("InputField")).GetComponent<InputField>();
			copyEditPlyPt.tagId = component.text;
			needUiRefresh = true;
		}

		public void SpawnNpcNode(Vector3 pos, Quaternion rot)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			FVRObject val = IM.OD["NGA_NpcSpwNode"];
			GameObject val2 = Object.Instantiate<GameObject>(((AnvilAsset)val).GetGameObject(), pos, rot);
			NpcSpawnPt component = val2.GetComponent<NpcSpawnPt>();
			if ((Object)(object)component != (Object)null)
			{
				CopyFromLastOrDefault(component);
			}
			else
			{
				Debug.LogError((object)"NpcSpawnPt component not found on the spawned GameObject!");
			}
		}

		public void SpawnPlyNode(Vector3 pos, Quaternion rot)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			FVRObject val = IM.OD["NGA_PlyRspNode"];
			GameObject val2 = Object.Instantiate<GameObject>(((AnvilAsset)val).GetGameObject(), pos, rot);
			PlayerRespawnPt component = val2.GetComponent<PlayerRespawnPt>();
			if ((Object)(object)component != (Object)null)
			{
				CopyFromLastOrDefault(component);
			}
			else
			{
				Debug.LogError((object)"PlayerRespawnPt component not found on the spawned GameObject!");
			}
		}

		private void CopyFromLastOrDefault(PlayerRespawnPt prp)
		{
			prp.setParentId(pointsMan.getResourceId());
			prp.setResourceId(new Random().Next(0, 10000).ToString());
			pointsMan.registerPoint(prp);
			if ((Object)(object)lastSpawnedPlyPt != (Object)null)
			{
				prp.setForceMove(lastSpawnedPlyPt.getForceMove());
				prp.setActiveOnStart(lastSpawnedPlyPt.getActiveOnStart());
			}
			else
			{
				prp.setForceMove(val: true);
				prp.setActiveOnStart(val: false);
				lastSpawnedPlyPt = prp;
			}
		}

		private void CopyFromLastOrDefault(NpcSpawnPt prp)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			prp.setParentId(pointsMan.getResourceId());
			prp.setResourceId(new Random().Next(0, 10000).ToString());
			pointsMan.registerPoint(prp);
			if ((Object)(object)lastSpawnedNpcPt != (Object)null)
			{
				prp.SetMyIFF(lastSpawnedNpcPt.GetMyIFF());
				prp.SetMyOrders(lastSpawnedNpcPt.GetMyOrders());
				prp.SetEnemyID(lastSpawnedNpcPt.GetEnemyID());
			}
			else
			{
				prp.SetMyIFF(1);
				prp.SetMyOrders((SosigOrder)1);
				prp.SetEnemyID((SosigEnemyID)100);
				lastSpawnedNpcPt = prp;
			}
		}

		public string GetResourceId()
		{
			return pointsMan.getResourceId();
		}

		public void SetResourceId(string resourceId)
		{
			pointsMan.setResourceId(resourceId);
		}

		public void SetActiveManager(bool isActive)
		{
			pointsMan.setActiveManagers(isActive);
		}

		public override Dictionary<string, string> GetFlagDic()
		{
			Dictionary<string, string> flagDic = ((FVRPhysicalObject)this).GetFlagDic();
			flagDic.Add("resource_id", GetResourceId());
			return flagDic;
		}

		public override void ConfigureFromFlagDic(Dictionary<string, string> f)
		{
			((FVRPhysicalObject)this).ConfigureFromFlagDic(f);
			if ((Object)(object)pointsMan == (Object)null)
			{
				pointsMan = ((Component)this).gameObject.AddComponent<TabletPointManager>();
			}
			string empty = string.Empty;
			string empty2 = string.Empty;
			empty = "resource_id";
			if (f.ContainsKey(empty))
			{
				empty2 = f[empty];
				SetResourceId(empty2);
			}
		}

		public override void StylusClicked(ToolPanelStylus stylus)
		{
			//IL_0007: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			if (Physics.Raycast(stylus.Muzzle.position, stylus.Muzzle.forward, ref m_hit, 20f, LayerMask.op_Implicit(stylus.LM_Env), (QueryTriggerInteraction)2))
			{
				registeredClick = true;
				SM.PlayGlobalUISound((GlobalUISound)1, ((Component)this).transform.position);
			}
			else
			{
				Debug.LogWarning((object)"Clicked stylus against no surface within 20 meters. Doesn't register.");
			}
		}

		public override void SetPointedStylusObject(FVRPhysicalObject p)
		{
			selectedObj = p;
		}

		public override bool CanSelect(FVRPhysicalObject o)
		{
			return ((ToolPanel)this).CanSelect(o);
		}

		public void StylusAndEditUpdate()
		{
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: 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_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			FVRPhysicalObject val = selectedObj;
			bool flag = false;
			if (Object.op_Implicit((Object)(object)val) && val is NpcSpawnPt)
			{
				NpcSpawnPt npcSpawnPt = (NpcSpawnPt)(object)val;
				if ((Object)(object)copyEditNpcPt != (Object)(object)npcSpawnPt)
				{
					needUiRefresh = true;
				}
				copyEditNpcPt = npcSpawnPt;
				ShowNpcSpwPtEdit();
				flag = true;
			}
			else
			{
				copyEditNpcPt = null;
			}
			if (Object.op_Implicit((Object)(object)val) && val is PlayerRespawnPt)
			{
				PlayerRespawnPt playerRespawnPt = (PlayerRespawnPt)(object)val;
				if ((Object)(object)copyEditPlyPt != (Object)(object)playerRespawnPt)
				{
					needUiRefresh = true;
				}
				copyEditPlyPt = playerRespawnPt;
				ShowPlySpwPtEdit();
				flag = true;
			}
			else
			{
				copyEditPlyPt = null;
			}
			if (!flag)
			{
				ShowClearEditScreen();
			}
			if (!registeredClick)
			{
				return;
			}
			registeredClick = false;
			Vector3 point = ((RaycastHit)(ref m_hit)).point;
			Vector3 val2 = point - ((Component)base.Stylus).gameObject.transform.position;
			val2.y = 0f;
			Quaternion rot = Quaternion.LookRotation(val2, Vector3.up);
			switch (selectedSpawnBtnId)
			{
			case 0:
				SpawnNpcNode(point, Quaternion.LookRotation(-val2, Vector3.up));
				break;
			case 1:
				SpawnPlyNode(point, rot);
				break;
			case 2:
				if (val is PlacePoint)
				{
					Object.Destroy((Object)(object)((Component)val).gameObject);
				}
				break;
			default:
				Debug.LogError((object)("Selected node type not supported for spawn: " + selectedSpawnBtnId));
				break;
			}
		}
	}
	public class TabletPointManager : MonoBehaviour
	{
		private string resource_id;

		public PlayerRespawnMngr plyRspMngr;

		public NpcSpawnMngr npcSpnMngr;

		private void Start()
		{
			if (string.IsNullOrEmpty(resource_id))
			{
				resource_id = new Random().Next(0, 10000).ToString();
			}
			if ((Object)(object)plyRspMngr == (Object)null)
			{
				plyRspMngr = ((Component)this).gameObject.AddComponent<PlayerRespawnMngr>();
			}
			if ((Object)(object)npcSpnMngr == (Object)null)
			{
				npcSpnMngr = ((Component)this).gameObject.AddComponent<NpcSpawnMngr>();
			}
		}

		private void Update()
		{
		}

		public string getResourceId()
		{
			return resource_id;
		}

		public void setResourceId(string id)
		{
			resource_id = id;
		}

		public void setActiveManagers(bool val)
		{
			plyRspMngr.setActiveAll(val);
			npcSpnMngr.setActiveAll(val);
		}

		public void registerPoint(PlayerRespawnPt pt)
		{
			plyRspMngr.registerPoint(pt);
		}

		public void deRegisterPoint(PlayerRespawnPt pt)
		{
			plyRspMngr.deRegisterPoint(pt);
		}

		public void registerPoint(NpcSpawnPt pt)
		{
			npcSpnMngr.registerPoint(pt);
		}

		public void deRegisterPoint(NpcSpawnPt pt)
		{
			npcSpnMngr.deRegisterPoint(pt);
		}
	}
}

PlannerLite.dll

Decompiled a year ago
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OtherLoader;
using UnityEngine;
using UnityEngine.UI;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace NGA
{
	public class FGTimeUi : MonoBehaviour
	{
		[SerializeField]
		public Text timeText;

		private void Start()
		{
			((MonoBehaviour)this).InvokeRepeating("UpdateTimeDisplay", 1f, 1f);
		}

		private void UpdateTimeDisplay()
		{
			if ((Object)(object)FGTimeSystem.Instance != (Object)null && (Object)(object)timeText != (Object)null)
			{
				timeText.text = FGTimeSystem.Instance.CurrentTime.ToString("o");
			}
		}

		private void OnDisable()
		{
			((MonoBehaviour)this).CancelInvoke("UpdateTimeDisplay");
		}
	}
	public class FGWristUi : MonoBehaviour
	{
		private int selectedTabIx = 0;

		private int enemyIdMult = 1;

		private int currQuestTabType = 0;

		private int selectedQuestIndex = -1;

		[Header("UI References")]
		private Transform Canvas;

		private Transform ButtonsSection;

		private Transform TimeText;

		private Transform TravelTab;

		private Transform ContractsTab;

		private Transform ContractsVertList;

		private Transform ContractStickerTempl;

		private Transform TimeTab;

		public Transform Face;

		public FVRViveHand[] Hands = (FVRViveHand[])(object)new FVRViveHand[2];

		private FVRViveHand m_currentHand;

		private bool m_hasHands = false;

		private bool m_isActive = false;

		private float m_wristPointRange = 60f;

		private float m_faceAngleRange = 45f;

		public void Start()
		{
			SetHandsAndFace(((Component)GM.CurrentPlayerBody.RightHand).GetComponent<FVRViveHand>(), ((Component)GM.CurrentPlayerBody.LeftHand).GetComponent<FVRViveHand>(), ((Component)GM.CurrentPlayerBody.EyeCam).transform);
			FindUiVariables();
			AddTimeUiRunner();
			CloseTabs();
		}

		public void Update()
		{
			UpdateWristMenu();
		}

		private void FindUiVariables()
		{
			Canvas = ((Component)this).transform.Find("Canvas");
			ButtonsSection = Canvas.Find("SubmenuButs");
			TravelTab = Canvas.Find("TravelTab");
			ContractsTab = Canvas.Find("ContractsTab");
			TimeTab = Canvas.Find("TimeTab");
			TimeText = Canvas.Find("Time");
			ContractsVertList = ContractsTab.Find("ContractsList");
			ContractStickerTempl = ContractsVertList.Find("ContractStickerTmpl");
		}

		public void CloseTabs()
		{
			((Component)TravelTab).gameObject.SetActive(false);
			((Component)ContractsTab).gameObject.SetActive(false);
			((Component)TimeTab).gameObject.SetActive(false);
		}

		public void ClearContractTexts()
		{
			Text componentInChildren = ((Component)ContractStickerTempl.Find("Description")).GetComponentInChildren<Text>();
			componentInChildren.text = "";
			Text componentInChildren2 = ((Component)ContractsTab.Find("ContractDescription").Find("Description")).GetComponentInChildren<Text>();
			componentInChildren2.text = "";
		}

		public void BTN_DisplayQuests(int i)
		{
			currQuestTabType = i;
			selectedQuestIndex = -1;
			ClearContractTexts();
			List<FGContract> currentContractList = GetCurrentContractList();
			string text = i switch
			{
				0 => "[Available]", 
				1 => "[Active]", 
				_ => "", 
			};
			Text componentInChildren = ((Component)ContractStickerTempl.Find("Description")).GetComponentInChildren<Text>();
			using (List<FGContract>.Enumerator enumerator = currentContractList.GetEnumerator())
			{
				if (enumerator.MoveNext())
				{
					FGContract current = enumerator.Current;
					componentInChildren.text = "" + current.DisplayName + "\n" + current.TargetFirstName + " " + current.TargetLastName + "\n" + current.Infraction + "\n" + text;
				}
			}
			selectedQuestIndex = ((currentContractList.Count == 0) ? (-1) : 0);
			BTN_DisplayQuestDetail();
		}

		public void BTN_DisplayQuestDetail()
		{
			if (selectedQuestIndex >= 0)
			{
				List<FGContract> currentContractList = GetCurrentContractList();
				if (selectedQuestIndex < currentContractList.Count)
				{
					FGContract val = currentContractList[selectedQuestIndex];
					Text componentInChildren = ((Component)ContractsTab.Find("ContractDescription").Find("Description")).GetComponentInChildren<Text>();
					componentInChildren.text = val.PrintContract();
				}
			}
		}

		private List<FGContract> GetCurrentContractList()
		{
			return currQuestTabType switch
			{
				0 => FG_GM.Instance.contractMan.GetAvailableContracts(), 
				1 => FG_GM.Instance.contractMan.GetActiveContracts(), 
				_ => new List<FGContract>(), 
			};
		}

		public void BTN_AcceptContract()
		{
			if (selectedQuestIndex < 0 || currQuestTabType != 0)
			{
				Debug.LogWarning((object)("Selected index is invalid " + selectedQuestIndex + " or you didn't select Available tab " + currQuestTabType));
				return;
			}
			List<FGContract> currentContractList = GetCurrentContractList();
			if (selectedQuestIndex >= currentContractList.Count)
			{
				Debug.LogWarning((object)("Selected index is invalid too big " + selectedQuestIndex + " compared to available contracts list " + currentContractList.Count));
			}
			else
			{
				FG_GM.Instance.contractMan.AcceptContract(currentContractList[selectedQuestIndex].uniqueID);
				BTN_DisplayQuests(currQuestTabType);
				Debug.LogWarning((object)"Allegedly accepted quest.");
			}
		}

		public void BTN_OpenTab(int index)
		{
			CloseTabs();
			switch (index)
			{
			case 0:
				((Component)TravelTab).gameObject.SetActive(true);
				break;
			case 1:
				((Component)ContractsTab).gameObject.SetActive(true);
				BTN_DisplayQuests(currQuestTabType);
				break;
			case 2:
				((Component)TimeTab).gameObject.SetActive(true);
				break;
			default:
				Debug.LogError((object)("Selected tab not supported: " + index));
				return;
			}
			selectedTabIx = index;
		}

		public void BTN_TravelHome()
		{
			FG_GM.Instance.TransitionToLevel("IndoorRange_Updated");
		}

		public void BTN_TravelArea()
		{
			FG_GM.Instance.TransitionToLevel("Grillhouse_2Story");
		}

		public void BTN_AdvanceHour()
		{
			FGTimeSystem.Instance.AdvanceTime(3600);
		}

		public void AddTimeUiRunner()
		{
			FGTimeUi fGTimeUi = ((Component)this).gameObject.AddComponent<FGTimeUi>();
			Text componentInChildren = ((Component)TimeText).GetComponentInChildren<Text>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				fGTimeUi.timeText = componentInChildren;
			}
		}

		private void UpdateWristMenu()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: 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_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Invalid comparison between Unknown and I4
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Invalid comparison between Unknown and I4
			if (!m_hasHands)
			{
				return;
			}
			if (m_isActive)
			{
				PositionWristMenu();
				if ((Object)(object)m_currentHand.CurrentInteractable != (Object)null || Vector3.Angle(m_currentHand.GetWristMenuTarget().forward, -Face.forward) >= m_wristPointRange)
				{
					Deactivate();
					return;
				}
				if ((Object)(object)m_currentHand != (Object)null)
				{
					Vector3 val = m_currentHand.GetWristMenuTarget().position - Face.position;
					if (Vector3.Angle(Face.forward, val) >= m_faceAngleRange)
					{
						Deactivate();
						return;
					}
				}
			}
			if (m_isActive)
			{
				return;
			}
			for (int i = 0; i < Hands.Length; i++)
			{
				if ((Object)(object)Hands[i].CurrentInteractable == (Object)null && Vector3.Angle(Hands[i].GetWristMenuTarget().forward, -Face.forward) < m_wristPointRange)
				{
					Vector3 val2 = Hands[i].GetWristMenuTarget().position - Face.position;
					if ((!Hands[i].IsThisTheRightHand || (int)GM.Options.ControlOptions.WristMenuState != 2) && (Hands[i].IsThisTheRightHand || (int)GM.Options.ControlOptions.WristMenuState != 1) && Vector3.Angle(Face.forward, val2) < m_faceAngleRange)
					{
						ActivateOnHand(Hands[i]);
					}
				}
			}
		}

		public void SetHandsAndFace(FVRViveHand Hand0, FVRViveHand Hand1, Transform face)
		{
			Hands = (FVRViveHand[])(object)new FVRViveHand[2];
			Hands[0] = Hand0;
			Hands[1] = Hand1;
			Face = face;
			m_hasHands = true;
		}

		public void PositionWristMenu()
		{
			//IL_0031: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			if (m_isActive && (Object)(object)m_currentHand != (Object)null)
			{
				Transform wristMenuTarget = m_currentHand.GetWristMenuTarget();
				((Component)this).transform.position = wristMenuTarget.position + wristMenuTarget.right * -1f;
				((Component)this).transform.rotation = wristMenuTarget.rotation * Quaternion.Euler(0f, -90f, 0f);
			}
		}

		private void ActivateOnHand(FVRViveHand hand)
		{
			if (!m_isActive)
			{
				m_isActive = true;
				m_currentHand = hand;
				((Component)Canvas).gameObject.SetActive(true);
				PositionWristMenu();
			}
		}

		public void Deactivate()
		{
			if (m_isActive)
			{
				m_isActive = false;
				((Component)Canvas).gameObject.SetActive(false);
			}
		}
	}
}
namespace NGA.PlannerLite
{
	[BepInPlugin("NGA.PlannerLite", "PlannerLite", "0.1.0")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class PlannerLitePlugin : BaseUnityPlugin
	{
		private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

		internal static ManualLogSource Logger;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			LoadAssets();
		}

		private void LoadAssets()
		{
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "NGA.PlannerLite");
			OtherLoader.RegisterDirectLoad(BasePath, "NGA.PlannerLite", "", "", "nga_plannerlite", "");
		}
	}
}