Decompiled source of Portable Teleporters v1.0.3

BepInEx/plugins/PortableTeleporters/PortableTeleporters.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CSync.Extensions;
using CSync.Lib;
using CustomItemBehaviourLibrary.AbstractItems;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using PortableTeleporters.Behaviour;
using PortableTeleporters.Misc;
using PortableTeleporters.NetcodePatcher;
using ShoppingCart.Util;
using UnityEngine;

[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: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
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 ShoppingCart.Util
{
	internal static class Constants
	{
		internal const string ITEM_SCAN_NODE_KEY_FORMAT = "Enable scan node of {0}";

		internal const bool ITEM_SCAN_NODE_DEFAULT = true;

		internal const string ITEM_SCAN_NODE_DESCRIPTION = "Shows a scan node on the item when scanning";

		internal const string BREAK_CHANCE_KEY = "Chance to break on use";

		internal const string BREAK_CHANCE_DESCRIPTION = "value should be 0.00 - 1.00";

		internal const string KEEP_ITEMS_DESCRIPTION = "If set to false you will drop your items like when using the vanilla TP.";

		internal const string PORTABLE_TELEPORTER_PRICE_KEY = "Portable Teleporter price";

		internal const int PORTABLE_TELEPORTER_PRICE_DEFAULT = 500;

		internal const string PORTABLE_TELEPORTER_PRICE_DESCRIPTION = "Price for Portable Teleporter.";

		internal const string PORTABLE_TELEPORTER_WEIGHT_KEY = "Item weight";

		internal const int PORTABLE_TELEPORTER_WEIGHT_DEFAULT = 15;

		internal const string PORTABLE_TELEPORTER_WEIGHT_DESCRIPTION = "Weight (in lbs)";

		internal const string PORTABLE_TELEPORTER_TWO_HANDED_KEY = "Two Handed Item";

		internal const bool PORTABLE_TELEPORTER_TWO_HANDED_DEFAULT = false;

		internal const string PORTABLE_TELEPORTER_TWO_HANDED_DESCRIPTION = "One or two handed item.";

		internal const string PORTABLE_TELEPORTER_CONDUCTIVE_KEY = "Conductive";

		internal const bool PORTABLE_TELEPORTER_CONDUCTIVE_DEFAULT = true;

		internal const string PORTABLE_TELEPORTER_CONDUCTIVE_DESCRIPTION = "Wether it attracts lightning to the item or not. (Or other mechanics that rely on item being conductive)";

		internal const string PORTABLE_TELEPORTER_DROP_AHEAD_PLAYER_KEY = "Drop ahead of player when dropping";

		internal const bool PORTABLE_TELEPORTER_DROP_AHEAD_PLAYER_DEFAULT = true;

		internal const string PORTABLE_TELEPORTER_DROP_AHEAD_PLAYER_DESCRIPTION = "If on, the item will drop infront of the player. Otherwise, drops underneath them and slightly infront.";

		internal const string PORTABLE_TELEPORTER_GRABBED_BEFORE_START_KEY = "Grabbable before game start";

		internal const bool PORTABLE_TELEPORTER_GRABBED_BEFORE_START_DEFAULT = true;

		internal const string PORTABLE_TELEPORTER_GRABBED_BEFORE_START_DESCRIPTION = "Allows wether the item can be grabbed before hand or not";

		internal const string PORTABLE_TELEPORTER_HIGHEST_SALE_PERCENTAGE_KEY = "Highest Sale Percentage";

		internal const int PORTABLE_TELEPORTER_HIGHEST_SALE_PERCENTAGE_DEFAULT = 50;

		internal const string PORTABLE_TELEPORTER_HIGHEST_SALE_PERCENTAGE_DESCRIPTION = "Maximum percentage of sale allowed when this item is selected for a sale.";

		internal const string PORTABLE_TELEPORTER_BREAK_CHANCE_KEY = "Chance to break on use";

		internal const float PORTABLE_TELEPORTER_BREAK_CHANCE_DEFAULT = 0.9f;

		internal const string PORTABLE_TELEPORTER_BREAK_CHANCE_DESCRIPTION = "value should be 0.00 - 1.00";

		internal const string PORTABLE_TELEPORTER_KEEP_ITEMS_KEY = "Keep Items When Using Portable Teleporters";

		internal const bool PORTABLE_TELEPORTER_KEEP_ITEMS_DEFAULT = true;

		internal const string PORTABLE_TELEPORTER_KEEP_ITEMS_DESCRIPTION = "If set to false you will drop your items like when using the vanilla TP.";

		internal const string PORTABLE_TELEPORTER_USE_COOLDOWN_KEY = "Use Cooldown";

		internal const float PORTABLE_TELEPORTER_USE_COOLDOWN_DEFAULT = 2f;

		internal const string PORTABLE_TELEPORTER_USE_COOLDOWN_DESCRIPTION = "How long between interactions of the Portable Teleporter item";

		internal const string ADVANCED_PORTABLE_TELEPORTER_PRICE_KEY = "Advanced Portable Teleporter price";

		internal const int ADVANCED_PORTABLE_TELEPORTER_PRICE_DEFAULT = 1000;

		internal const string ADVANCED_PORTABLE_TELEPORTER_PRICE_DESCRIPTION = "Price for Advanced Portable Teleporter.";

		internal const string ADVANCED_PORTABLE_TELEPORTER_WEIGHT_KEY = "Item weight";

		internal const int ADVANCED_PORTABLE_TELEPORTER_WEIGHT_DEFAULT = 5;

		internal const string ADVANCED_PORTABLE_TELEPORTER_WEIGHT_DESCRIPTION = "Weight (in lbs)";

		internal const string ADVANCED_PORTABLE_TELEPORTER_TWO_HANDED_KEY = "Two Handed Item";

		internal const bool ADVANCED_PORTABLE_TELEPORTER_TWO_HANDED_DEFAULT = false;

		internal const string ADVANCED_PORTABLE_TELEPORTER_TWO_HANDED_DESCRIPTION = "One or two handed item.";

		internal const string ADVANCED_PORTABLE_TELEPORTER_CONDUCTIVE_KEY = "Conductive";

		internal const bool ADVANCED_PORTABLE_TELEPORTER_CONDUCTIVE_DEFAULT = true;

		internal const string ADVANCED_PORTABLE_TELEPORTER_CONDUCTIVE_DESCRIPTION = "Wether it attracts lightning to the item or not. (Or other mechanics that rely on item being conductive)";

		internal const string ADVANCED_PORTABLE_TELEPORTER_DROP_AHEAD_PLAYER_KEY = "Drop ahead of player when dropping";

		internal const bool ADVANCED_PORTABLE_TELEPORTER_DROP_AHEAD_PLAYER_DEFAULT = true;

		internal const string ADVANCED_PORTABLE_TELEPORTER_DROP_AHEAD_PLAYER_DESCRIPTION = "If on, the item will drop infront of the player. Otherwise, drops underneath them and slightly infront.";

		internal const string ADVANCED_PORTABLE_TELEPORTER_GRABBED_BEFORE_START_KEY = "Grabbable before game start";

		internal const bool ADVANCED_PORTABLE_TELEPORTER_GRABBED_BEFORE_START_DEFAULT = true;

		internal const string ADVANCED_PORTABLE_TELEPORTER_GRABBED_BEFORE_START_DESCRIPTION = "Allows wether the item can be grabbed before hand or not";

		internal const string ADVANCED_PORTABLE_TELEPORTER_HIGHEST_SALE_PERCENTAGE_KEY = "Highest Sale Percentage";

		internal const int ADVANCED_PORTABLE_TELEPORTER_HIGHEST_SALE_PERCENTAGE_DEFAULT = 50;

		internal const string ADVANCED_PORTABLE_TELEPORTER_HIGHEST_SALE_PERCENTAGE_DESCRIPTION = "Maximum percentage of sale allowed when this item is selected for a sale.";

		internal const string ADVANCED_PORTABLE_TELEPORTER_BREAK_CHANCE_KEY = "Chance to break on use";

		internal const float ADVANCED_PORTABLE_TELEPORTER_BREAK_CHANCE_DEFAULT = 0.1f;

		internal const string ADVANCED_PORTABLE_TELEPORTER_BREAK_CHANCE_DESCRIPTION = "value should be 0.00 - 1.00";

		internal const string ADVANCED_PORTABLE_TELEPORTER_KEEP_ITEMS_KEY = "Keep Items When Using Advanced Portable Teleporters";

		internal const bool ADVANCED_PORTABLE_TELEPORTER_KEEP_ITEMS_DEFAULT = true;

		internal const string ADVANCED_PORTABLE_TELEPORTER_KEEP_ITEMS_DESCRIPTION = "If set to false you will drop your items like when using the vanilla TP.";

		internal const string ADVANCED_PORTABLE_TELEPORTER_USE_COOLDOWN_KEY = "Use Cooldown";

		internal const float ADVANCED_PORTABLE_TELEPORTER_USE_COOLDOWN_DEFAULT = 2f;

		internal const string ADVANCED_PORTABLE_TELEPORTER_USE_COOLDOWN_DESCRIPTION = "How long between interactions of the Advanced Portable Teleporter item";

		internal static readonly string PORTABLE_TELEPORTER_SCAN_NODE_KEY = string.Format("Enable scan node of {0}", "Portable Teleporter");

		internal static readonly string ADVANCED_PORTABLE_TELEPORTER_SCAN_NODE_KEY = string.Format("Enable scan node of {0}", "Advanced Portable Teleporter");
	}
}
namespace PortableTeleporters
{
	[BepInPlugin("com.github.WhiteSpike.PortableTeleporters", "Portable Teleporters", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static readonly Harmony harmony = new Harmony("com.github.WhiteSpike.PortableTeleporters");

		internal static readonly ManualLogSource mls = Logger.CreateLogSource("Portable Teleporters");

		internal const string PORTABLE_ITEM_NAME = "Portable Teleporter";

		internal const string ADVANCED_PORTABLE_ITEM_NAME = "Advanced Portable Teleporter";

		internal static AudioClip ItemBreak;

		internal static AudioClip Error;

		internal static AudioClip ButtonPress;

		public static PluginConfig Config;

		private void Awake()
		{
			//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_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: 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_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			Config = new PluginConfig(((BaseUnityPlugin)this).Config);
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "portableteleporters");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			string text2 = "Assets/Portable Teleporters/";
			string text3 = text2 + "Portable Teleporter/";
			string text4 = text2 + "Advanced Portable Teleporter/";
			ItemBreak = val.LoadAsset<AudioClip>(text2 + "Break.mp3");
			Error = val.LoadAsset<AudioClip>(text2 + "Error.mp3");
			ButtonPress = val.LoadAsset<AudioClip>(text2 + "ButtonPress.ogg");
			Item val2 = ScriptableObject.CreateInstance<Item>();
			((Object)val2).name = "PortableTeleporterItemProperties";
			val2.creditsWorth = SyncedEntry<int>.op_Implicit(Config.PORTABLE_PRICE);
			val2.allowDroppingAheadOfPlayer = SyncedEntry<bool>.op_Implicit(Config.PORTABLE_DROP_AHEAD_PLAYER);
			val2.canBeGrabbedBeforeGameStart = SyncedEntry<bool>.op_Implicit(Config.PORTABLE_GRABBED_BEFORE_START);
			val2.canBeInspected = false;
			val2.floorYOffset = -90;
			val2.restingRotation = new Vector3(0f, 0f, -90f);
			val2.rotationOffset = new Vector3(-15f, -180f, 65f);
			val2.positionOffset = new Vector3(-0.07f, 0.05f, -0.05f);
			val2.weight = 0.99f + (float)SyncedEntry<int>.op_Implicit(Config.PORTABLE_WEIGHT) / 100f;
			val2.twoHanded = false;
			val2.itemIcon = val.LoadAsset<Sprite>(text3 + "Icon.png");
			val2.spawnPrefab = val.LoadAsset<GameObject>(text3 + "PortableTeleporter.prefab");
			val2.dropSFX = val.LoadAsset<AudioClip>(text2 + "Drop.ogg");
			val2.grabSFX = val.LoadAsset<AudioClip>(text2 + "Grab.ogg");
			val2.pocketSFX = val.LoadAsset<AudioClip>(text2 + "Pocket.ogg");
			val2.throwSFX = val.LoadAsset<AudioClip>(text2 + "Throw.ogg");
			val2.highestSalePercentage = SyncedEntry<int>.op_Implicit(Config.PORTABLE_HIGHEST_SALE_PERCENTAGE);
			val2.itemName = "Portable Teleporter";
			val2.itemSpawnsOnGround = true;
			val2.isConductiveMetal = SyncedEntry<bool>.op_Implicit(Config.PORTABLE_CONDUCTIVE);
			val2.requiresBattery = false;
			val2.batteryUsage = 0f;
			PortableTeleporter portableTeleporter = val2.spawnPrefab.AddComponent<PortableTeleporter>();
			mls.LogDebug((object)"Yay2");
			((GrabbableObject)portableTeleporter).itemProperties = val2;
			((GrabbableObject)portableTeleporter).grabbable = true;
			((GrabbableObject)portableTeleporter).grabbableToEnemies = true;
			Utilities.FixMixerGroups(val2.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			TerminalNode val3 = SetupInfoNode();
			Items.RegisterShopItem(val2, (TerminalNode)null, (TerminalNode)null, val3, val2.creditsWorth);
			val2 = ScriptableObject.CreateInstance<Item>();
			((Object)val2).name = "AdvancedPortableTeleporterItemProperties";
			val2.creditsWorth = SyncedEntry<int>.op_Implicit(Config.ADVANCED_PORTABLE_PRICE);
			val2.allowDroppingAheadOfPlayer = SyncedEntry<bool>.op_Implicit(Config.PORTABLE_DROP_AHEAD_PLAYER);
			val2.canBeGrabbedBeforeGameStart = SyncedEntry<bool>.op_Implicit(Config.PORTABLE_GRABBED_BEFORE_START);
			val2.canBeInspected = false;
			val2.floorYOffset = -90;
			val2.restingRotation = new Vector3(0f, 0f, -90f);
			val2.rotationOffset = new Vector3(-15f, -180f, 65f);
			val2.positionOffset = new Vector3(-0.07f, 0.05f, -0.05f);
			val2.weight = 0.99f + (float)SyncedEntry<int>.op_Implicit(Config.PORTABLE_WEIGHT) / 100f;
			val2.twoHanded = false;
			val2.itemIcon = val.LoadAsset<Sprite>(text4 + "Icon.png");
			val2.spawnPrefab = val.LoadAsset<GameObject>(text4 + "AdvancedPortableTeleporter.prefab");
			val2.dropSFX = val.LoadAsset<AudioClip>(text2 + "Drop.ogg");
			val2.grabSFX = val.LoadAsset<AudioClip>(text2 + "Grab.ogg");
			val2.pocketSFX = val.LoadAsset<AudioClip>(text2 + "Pocket.ogg");
			val2.throwSFX = val.LoadAsset<AudioClip>(text2 + "Throw.ogg");
			val2.highestSalePercentage = SyncedEntry<int>.op_Implicit(Config.PORTABLE_HIGHEST_SALE_PERCENTAGE);
			val2.itemName = "Advanced Portable Teleporter";
			val2.itemSpawnsOnGround = true;
			val2.isConductiveMetal = SyncedEntry<bool>.op_Implicit(Config.PORTABLE_CONDUCTIVE);
			val2.requiresBattery = false;
			val2.batteryUsage = 0f;
			AdvancedPortableTeleporter advancedPortableTeleporter = val2.spawnPrefab.AddComponent<AdvancedPortableTeleporter>();
			((GrabbableObject)advancedPortableTeleporter).itemProperties = val2;
			((GrabbableObject)advancedPortableTeleporter).grabbable = true;
			((GrabbableObject)advancedPortableTeleporter).grabbableToEnemies = true;
			Utilities.FixMixerGroups(val2.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			val3 = SetupInfoNode();
			Items.RegisterShopItem(val2, (TerminalNode)null, (TerminalNode)null, val3, val2.creditsWorth);
			mls.LogInfo((object)"Portable Teleporters 1.0.0 has been loaded successfully.");
		}

		internal static TerminalNode SetupInfoNode()
		{
			TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
			val.displayText = val.displayText + GetDisplayInfo() + "\n";
			val.clearPreviousText = true;
			return val;
		}

		public static string GetDisplayInfo()
		{
			return string.Format("A button that when pressed teleports you and your loot back to the ship. Must have Ship Teleporter unlocked!!!\n\nHas a {0}% chance to self destruct on use.\n", "Portable Teleporter");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "PortableTeleporters";

		public const string PLUGIN_NAME = "ShoppingCart";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace PortableTeleporters.Misc
{
	[DataContract]
	public class PluginConfig : SyncedConfig2<PluginConfig>
	{
		[field: SyncedEntryField]
		public SyncedEntry<bool> PORTABLE_SCAN_NODE { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> PORTABLE_PRICE { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> PORTABLE_WEIGHT { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<bool> PORTABLE_DROP_AHEAD_PLAYER { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<bool> PORTABLE_GRABBED_BEFORE_START { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<bool> PORTABLE_CONDUCTIVE { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<bool> PORTABLE_TWO_HANDED { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> PORTABLE_HIGHEST_SALE_PERCENTAGE { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<float> PORTABLE_CHANCE_TO_BREAK { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<bool> PORTABLE_KEEP_ITEMS_ON_TELEPORT { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<float> PORTABLE_USE_COOLDOWN { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<bool> ADVANCED_PORTABLE_SCAN_NODE { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> ADVANCED_PORTABLE_PRICE { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> ADVANCED_PORTABLE_WEIGHT { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<bool> ADVANCED_PORTABLE_TWO_HANDED { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<bool> ADVANCED_PORTABLE_DROP_AHEAD_PLAYER { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<bool> ADVANCED_PORTABLE_GRABBED_BEFORE_START { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<bool> ADVANCED_PORTABLE_CONDUCTIVE { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<int> ADVANCED_PORTABLE_HIGHEST_SALE_PERCENTAGE { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<float> ADVANCED_PORTABLE_CHANCE_TO_BREAK { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<bool> ADVANCED_PORTABLE_KEEP_ITEMS_ON_TELEPORT { get; set; }

		[field: SyncedEntryField]
		public SyncedEntry<float> ADVANCED_PORTABLE_USE_COOLDOWN { get; set; }

		public PluginConfig(ConfigFile cfg)
			: base("com.github.WhiteSpike.PortableTeleporters")
		{
			string text = "Portable Teleporter";
			PORTABLE_PRICE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Portable Teleporter price", 500, "Price for Portable Teleporter.");
			PORTABLE_WEIGHT = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Item weight", 15, "Weight (in lbs)");
			PORTABLE_SCAN_NODE = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, Constants.PORTABLE_TELEPORTER_SCAN_NODE_KEY, true, "Shows a scan node on the item when scanning");
			PORTABLE_TWO_HANDED = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Two Handed Item", false, "One or two handed item.");
			PORTABLE_DROP_AHEAD_PLAYER = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Drop ahead of player when dropping", true, "If on, the item will drop infront of the player. Otherwise, drops underneath them and slightly infront.");
			PORTABLE_CONDUCTIVE = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Conductive", true, "Wether it attracts lightning to the item or not. (Or other mechanics that rely on item being conductive)");
			PORTABLE_GRABBED_BEFORE_START = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Grabbable before game start", true, "Allows wether the item can be grabbed before hand or not");
			PORTABLE_HIGHEST_SALE_PERCENTAGE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Highest Sale Percentage", 50, "Maximum percentage of sale allowed when this item is selected for a sale.");
			PORTABLE_CHANCE_TO_BREAK = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Chance to break on use", 0.9f, "value should be 0.00 - 1.00");
			PORTABLE_KEEP_ITEMS_ON_TELEPORT = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Keep Items When Using Portable Teleporters", true, "If set to false you will drop your items like when using the vanilla TP.");
			PORTABLE_USE_COOLDOWN = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Use Cooldown", 2f, "How long between interactions of the Portable Teleporter item");
			text = "Advanced Portable Teleporter";
			ADVANCED_PORTABLE_PRICE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Advanced Portable Teleporter price", 1000, "Price for Advanced Portable Teleporter.");
			ADVANCED_PORTABLE_WEIGHT = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Item weight", 5, "Weight (in lbs)");
			ADVANCED_PORTABLE_SCAN_NODE = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, Constants.ADVANCED_PORTABLE_TELEPORTER_SCAN_NODE_KEY, true, "Shows a scan node on the item when scanning");
			ADVANCED_PORTABLE_TWO_HANDED = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Two Handed Item", false, "One or two handed item.");
			ADVANCED_PORTABLE_DROP_AHEAD_PLAYER = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Drop ahead of player when dropping", true, "If on, the item will drop infront of the player. Otherwise, drops underneath them and slightly infront.");
			ADVANCED_PORTABLE_CONDUCTIVE = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Conductive", true, "Wether it attracts lightning to the item or not. (Or other mechanics that rely on item being conductive)");
			ADVANCED_PORTABLE_GRABBED_BEFORE_START = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Grabbable before game start", true, "Allows wether the item can be grabbed before hand or not");
			ADVANCED_PORTABLE_HIGHEST_SALE_PERCENTAGE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Highest Sale Percentage", 50, "Maximum percentage of sale allowed when this item is selected for a sale.");
			ADVANCED_PORTABLE_CHANCE_TO_BREAK = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Chance to break on use", 0.1f, "value should be 0.00 - 1.00");
			ADVANCED_PORTABLE_KEEP_ITEMS_ON_TELEPORT = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Keep Items When Using Advanced Portable Teleporters", true, "If set to false you will drop your items like when using the vanilla TP.");
			ADVANCED_PORTABLE_USE_COOLDOWN = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Use Cooldown", 2f, "How long between interactions of the Advanced Portable Teleporter item");
			ConfigManager.Register<PluginConfig>((SyncedConfig2<PluginConfig>)this);
		}
	}
	internal static class Metadata
	{
		public const string GUID = "com.github.WhiteSpike.PortableTeleporters";

		public const string NAME = "Portable Teleporters";

		public const string VERSION = "1.0.0";
	}
	internal static class Tools
	{
		internal enum NodeType
		{
			GENERAL,
			DANGER,
			SCRAP
		}

		private static GameObject CreateCanvasScanNode(ref GameObject objectToAddScanNode)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(GameObject.CreatePrimitive((PrimitiveType)3), objectToAddScanNode.transform.position, Quaternion.Euler(Vector3.zero), objectToAddScanNode.transform);
			((Object)val).name = "ScanNode";
			val.layer = LayerMask.NameToLayer("ScanNode");
			Object.Destroy((Object)(object)val.GetComponent<MeshRenderer>());
			Object.Destroy((Object)(object)val.GetComponent<MeshFilter>());
			return val;
		}

		private static void AddScanNode(GameObject objectToAddScanNode, NodeType nodeType, string header = "LGU Scan Node", string subText = "Used for LGU stuff", int creatureScanID = -1, int minRange = 2, int maxRange = 7)
		{
			GameObject val = CreateCanvasScanNode(ref objectToAddScanNode);
			ScanNodeProperties scanNodeProperties = val.AddComponent<ScanNodeProperties>();
			ChangeScanNode(ref scanNodeProperties, nodeType, header, subText, creatureScanID, 0, minRange, maxRange);
		}

		public static void AddScrapScanNode(GameObject objectToAddScanNode, string header = "LGU Scan Node", string subText = "Used for LGU stuff", int creatureScanID = -1, int minRange = 2, int maxRange = 7)
		{
			AddScanNode(objectToAddScanNode, NodeType.SCRAP, header, subText, creatureScanID, minRange, maxRange);
		}

		public static void ChangeScanNode(ref ScanNodeProperties scanNodeProperties, NodeType nodeType, string header = "LGU Scan Node", string subText = "Used for LGU stuff", int creatureScanID = -1, int scrapValue = 0, int minRange = 2, int maxRange = 7)
		{
			scanNodeProperties.headerText = header;
			scanNodeProperties.subText = subText;
			scanNodeProperties.nodeType = (int)nodeType;
			scanNodeProperties.creatureScanID = creatureScanID;
			scanNodeProperties.scrapValue = scrapValue;
			scanNodeProperties.minRange = minRange;
			scanNodeProperties.maxRange = maxRange;
		}
	}
}
namespace PortableTeleporters.Behaviour
{
	internal class AdvancedPortableTeleporter : BasePortableTeleporter
	{
		protected override bool KeepScanNode => SyncedEntry<bool>.op_Implicit(Plugin.Config.ADVANCED_PORTABLE_SCAN_NODE);

		public override void Start()
		{
			base.Start();
			breakChance = 1f - SyncedEntry<float>.op_Implicit(Plugin.Config.ADVANCED_PORTABLE_CHANCE_TO_BREAK);
			((PortableTeleporterBehaviour)this).keepItems = SyncedEntry<bool>.op_Implicit(Plugin.Config.ADVANCED_PORTABLE_KEEP_ITEMS_ON_TELEPORT);
			((GrabbableObject)this).useCooldown = SyncedEntry<float>.op_Implicit(Plugin.Config.ADVANCED_PORTABLE_USE_COOLDOWN);
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "AdvancedPortableTeleporter";
		}
	}
	internal abstract class BasePortableTeleporter : PortableTeleporterBehaviour
	{
		public AudioClip ItemBreak;

		public AudioClip error;

		public AudioClip buttonPress;

		private AudioSource audio;

		protected float breakChance;

		protected abstract bool KeepScanNode { get; }

		public override void Start()
		{
			((GrabbableObject)this).Start();
			if (!KeepScanNode)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject.GetComponentInChildren<ScanNodeProperties>());
			}
			audio = ((Component)this).GetComponent<AudioSource>();
			ItemBreak = Plugin.ItemBreak;
			error = Plugin.Error;
			buttonPress = Plugin.ButtonPress;
		}

		protected override void TeleportPlayer(int playerRadarIndex, ref ShipTeleporter teleporter)
		{
			((PortableTeleporterBehaviour)this).TeleportPlayer(playerRadarIndex, ref teleporter);
			if (playerRadarIndex == -1 && Random.Range(0f, 1f) > breakChance)
			{
				audio.PlayOneShot(ItemBreak);
				((GrabbableObject)this).itemUsedUp = true;
				HUDManager.Instance.DisplayTip("TELEPORTER BROKE!", "The teleporter button has suffered irreparable damage and destroyed itself!", true, false, "LC_Tip1");
				((GrabbableObject)this).playerHeldBy.DespawnHeldObject();
			}
		}

		protected override IEnumerator WaitToTP(ShipTeleporter tele)
		{
			yield return ((MonoBehaviour)this).StartCoroutine(<>n__0(tele));
			if (Random.Range(0f, 1f) > breakChance)
			{
				audio.PlayOneShot(ItemBreak);
				((GrabbableObject)this).itemUsedUp = true;
				HUDManager.Instance.DisplayTip("TELEPORTER BROKE!", "The teleporter button has suffered irreparable damage and destroyed itself!", true, false, "LC_Tip1");
				((GrabbableObject)this).playerHeldBy.DespawnHeldObject();
			}
		}

		protected override bool CanUsePortableTeleporter()
		{
			audio.PlayOneShot(buttonPress);
			bool flag = ((PortableTeleporterBehaviour)this).CanUsePortableTeleporter();
			if (!flag)
			{
				audio.PlayOneShot(error);
			}
			return flag;
		}

		[CompilerGenerated]
		[DebuggerHidden]
		private IEnumerator <>n__0(ShipTeleporter tele)
		{
			return ((PortableTeleporterBehaviour)this).WaitToTP(tele);
		}

		protected override void __initializeVariables()
		{
			((PortableTeleporterBehaviour)this).__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "BasePortableTeleporter";
		}
	}
	internal class PortableTeleporter : BasePortableTeleporter
	{
		protected override bool KeepScanNode => SyncedEntry<bool>.op_Implicit(Plugin.Config.PORTABLE_SCAN_NODE);

		public override void Start()
		{
			base.Start();
			breakChance = 1f - SyncedEntry<float>.op_Implicit(Plugin.Config.PORTABLE_CHANCE_TO_BREAK);
			((PortableTeleporterBehaviour)this).keepItems = SyncedEntry<bool>.op_Implicit(Plugin.Config.PORTABLE_KEEP_ITEMS_ON_TELEPORT);
			((GrabbableObject)this).useCooldown = SyncedEntry<float>.op_Implicit(Plugin.Config.PORTABLE_USE_COOLDOWN);
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "PortableTeleporter";
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace PortableTeleporters.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}