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.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 DivingKit.Behaviour;
using DivingKit.Misc;
using DivingKit.Misc.Util;
using DivingKit.NetcodePatcher;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
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 DivingKit
{
[BepInPlugin("com.github.WhiteSpike.DivingKit", "Diving Kit", "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.DivingKit");
internal static readonly ManualLogSource mls = Logger.CreateLogSource("Diving Kit");
public static PluginConfig Config;
private void Awake()
{
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
Config = new PluginConfig(((BaseUnityPlugin)this).Config);
IEnumerable<Type> enumerable;
try
{
enumerable = Assembly.GetExecutingAssembly().GetTypes();
}
catch (ReflectionTypeLoadException ex)
{
enumerable = ex.Types.Where((Type t) => t != null);
}
foreach (Type item in enumerable)
{
MethodInfo[] methods = item.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array = methods;
foreach (MethodInfo methodInfo in array)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "divingkit");
AssetBundle val = AssetBundle.LoadFromFile(text);
string text2 = "Assets/Diving Kit/";
Item val2 = ScriptableObject.CreateInstance<Item>();
((Object)val2).name = "DivingKitItemProperties";
val2.allowDroppingAheadOfPlayer = SyncedEntry<bool>.op_Implicit(Config.DROP_AHEAD_PLAYER);
val2.canBeGrabbedBeforeGameStart = SyncedEntry<bool>.op_Implicit(Config.GRABBED_BEFORE_START);
val2.canBeInspected = false;
val2.creditsWorth = SyncedEntry<int>.op_Implicit(Config.PRICE);
val2.restingRotation = new Vector3(0f, 0f, 0f);
val2.rotationOffset = new Vector3(0f, 20f, -95f);
val2.positionOffset = new Vector3(-0.15f, -0.65f, -0.25f);
val2.weight = 1f + (float)(SyncedEntry<int>.op_Implicit(Config.WEIGHT) - 1) / 100f;
val2.twoHanded = SyncedEntry<bool>.op_Implicit(Config.TWO_HANDED);
val2.itemIcon = val.LoadAsset<Sprite>(text2 + "Icon.png");
val2.spawnPrefab = val.LoadAsset<GameObject>(text2 + "DivingKit.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.HIGHEST_SALE_PERCENTAGE);
val2.itemName = "Diving Kit";
val2.itemSpawnsOnGround = true;
val2.isConductiveMetal = SyncedEntry<bool>.op_Implicit(Config.CONDUCTIVE);
val2.requiresBattery = false;
val2.batteryUsage = 0f;
DivingKitBehaviour divingKitBehaviour = val2.spawnPrefab.AddComponent<DivingKitBehaviour>();
((GrabbableObject)divingKitBehaviour).itemProperties = val2;
((GrabbableObject)divingKitBehaviour).grabbable = true;
((GrabbableObject)divingKitBehaviour).grabbableToEnemies = true;
NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
TerminalNode val3 = SetupInfoNode();
Items.RegisterShopItem(val2, (TerminalNode)null, (TerminalNode)null, val3, val2.creditsWorth);
mls.LogInfo((object)"Diving Kit 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()
{
string arg = (Config.TWO_HANDED.Value ? "two" : "one");
return $"DIVING KIT - ${Config.PRICE.Value}\n\n" + "Breath underwater.\n" + $"Weights {Mathf.RoundToInt((float)((Config.WEIGHT.Value - 1) * 100))} lbs and is {arg} handed.";
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "DivingKit";
public const string PLUGIN_NAME = "DivingKit";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace DivingKit.Misc
{
[DataContract]
public class PluginConfig : SyncedConfig2<PluginConfig>
{
[field: SyncedEntryField]
public SyncedEntry<bool> SCAN_NODE { get; set; }
[field: SyncedEntryField]
public SyncedEntry<int> PRICE { get; set; }
[field: SyncedEntryField]
public SyncedEntry<int> WEIGHT { get; set; }
[field: SyncedEntryField]
public SyncedEntry<bool> TWO_HANDED { get; set; }
[field: SyncedEntryField]
public SyncedEntry<bool> DROP_AHEAD_PLAYER { get; set; }
[field: SyncedEntryField]
public SyncedEntry<bool> GRABBED_BEFORE_START { get; set; }
[field: SyncedEntryField]
public SyncedEntry<bool> CONDUCTIVE { get; set; }
[field: SyncedEntryField]
public SyncedEntry<int> HIGHEST_SALE_PERCENTAGE { get; set; }
public PluginConfig(ConfigFile cfg)
: base("com.github.WhiteSpike.DivingKit")
{
string text = "Diving Kit";
PRICE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Diving Kit price", 650, "Price for Diving Kit.");
WEIGHT = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Item weight", 65, "Weight (in lbs)");
TWO_HANDED = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Two Handed Item", true, "One or two handed item.");
SCAN_NODE = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, Constants.DIVING_KIT_SCAN_NODE_KEY, true, "Shows a scan node on the item when scanning");
DROP_AHEAD_PLAYER = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Drop ahead of player when dropping", false, "If on, the item will drop infront of the player. Otherwise, drops underneath them and slightly infront.");
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)");
GRABBED_BEFORE_START = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Grabbable before game start", false, "Allows wether the item can be grabbed before hand or not");
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.");
ConfigManager.Register<PluginConfig>((SyncedConfig2<PluginConfig>)this);
}
}
internal static class Metadata
{
public const string GUID = "com.github.WhiteSpike.DivingKit";
public const string NAME = "Diving Kit";
public const string VERSION = "1.0.0";
}
}
namespace DivingKit.Misc.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 DIVING_KIT_PRICE_KEY = "Diving Kit price";
internal const int DIVING_KIT_PRICE_DEFAULT = 650;
internal const string DIVING_KIT_PRICE_DESCRIPTION = "Price for Diving Kit.";
internal const string DIVING_KIT_WEIGHT_KEY = "Item weight";
internal const int DIVING_KIT_WEIGHT_DEFAULT = 65;
internal const string DIVING_KIT_WEIGHT_DESCRIPTION = "Weight (in lbs)";
internal const string DIVING_KIT_TWO_HANDED_KEY = "Two Handed Item";
internal const bool DIVING_KIT_TWO_HANDED_DEFAULT = true;
internal const string DIVING_KIT_TWO_HANDED_DESCRIPTION = "One or two handed item.";
internal const string DIVING_KIT_CONDUCTIVE_KEY = "Conductive";
internal const bool DIVING_KIT_CONDUCTIVE_DEFAULT = true;
internal const string DIVING_KIT_CONDUCTIVE_DESCRIPTION = "Wether it attracts lightning to the item or not. (Or other mechanics that rely on item being conductive)";
internal const string DIVING_KIT_DROP_AHEAD_PLAYER_KEY = "Drop ahead of player when dropping";
internal const bool DIVING_KIT_DROP_AHEAD_PLAYER_DEFAULT = false;
internal const string DIVING_KIT_DROP_AHEAD_PLAYER_DESCRIPTION = "If on, the item will drop infront of the player. Otherwise, drops underneath them and slightly infront.";
internal const string DIVING_KIT_GRABBED_BEFORE_START_KEY = "Grabbable before game start";
internal const bool DIVING_KIT_GRABBED_BEFORE_START_DEFAULT = false;
internal const string DIVING_KIT_GRABBED_BEFORE_START_DESCRIPTION = "Allows wether the item can be grabbed before hand or not";
internal const string DIVING_KIT_HIGHEST_SALE_PERCENTAGE_KEY = "Highest Sale Percentage";
internal const int DIVING_KIT_HIGHEST_SALE_PERCENTAGE_DEFAULT = 50;
internal const string DIVING_KIT_HIGHEST_SALE_PERCENTAGE_DESCRIPTION = "Maximum percentage of sale allowed when this item is selected for a sale.";
internal static readonly string DIVING_KIT_SCAN_NODE_KEY = string.Format("Enable scan node of {0}", "Diving Kit");
}
}
namespace DivingKit.Behaviour
{
internal class DivingKitBehaviour : UnderwaterBreatherBehaviour
{
internal const string ITEM_NAME = "Diving Kit";
protected bool KeepScanNode => SyncedEntry<bool>.op_Implicit(Plugin.Config.SCAN_NODE);
public override void Start()
{
((UnderwaterBreatherBehaviour)this).Start();
if (!KeepScanNode)
{
Object.Destroy((Object)(object)((Component)this).gameObject.GetComponentInChildren<ScanNodeProperties>());
}
}
protected override void __initializeVariables()
{
((UnderwaterBreatherBehaviour)this).__initializeVariables();
}
protected internal override string __getTypeName()
{
return "DivingKitBehaviour";
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace DivingKit.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}