

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 Amnestics.Behaviour;
using Amnestics.Misc;
using Amnestics.NetcodePatcher;
using Amnestics.Util;
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 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 Amnestics
{
[BepInPlugin("com.github.WhiteSpike.Amnestics", "Amnestics", "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.Amnestics");
internal static readonly ManualLogSource mls = Logger.CreateLogSource("Amnestics");
public static PluginConfig Config;
private void Awake()
{
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: 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_01b5: 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), "amnestics");
AssetBundle val = AssetBundle.LoadFromFile(text);
string text2 = "Assets/Amnestics/";
Item val2 = ScriptableObject.CreateInstance<Item>();
((Object)val2).name = "amnesticsItemProperties";
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.verticalOffset = 0.04f;
val2.restingRotation = new Vector3(-90f, 0f, 0f);
val2.rotationOffset = new Vector3(0f, 90f, 0f);
val2.positionOffset = new Vector3(0f, 0.12f, 0.02f);
val2.weight = 0.99f + (float)(SyncedEntry<int>.op_Implicit(Config.WEIGHT) - 1) / 100f;
val2.twoHanded = false;
val2.itemIcon = val.LoadAsset<Sprite>(text2 + "Icon.png");
val2.spawnPrefab = val.LoadAsset<GameObject>(text2 + "Amnestics.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 = "Amnestics";
val2.itemSpawnsOnGround = true;
val2.isConductiveMetal = SyncedEntry<bool>.op_Implicit(Config.CONDUCTIVE);
val2.requiresBattery = false;
val2.batteryUsage = 0f;
AmnesticsBehaviour amnesticsBehaviour = val2.spawnPrefab.AddComponent<AmnesticsBehaviour>();
((GrabbableObject)amnesticsBehaviour).itemProperties = val2;
((GrabbableObject)amnesticsBehaviour).grabbable = true;
((GrabbableObject)amnesticsBehaviour).grabbableToEnemies = true;
NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
TerminalNode val3 = SetupInfoNode();
Items.RegisterShopItem(val2, (TerminalNode)null, (TerminalNode)null, val3, val2.creditsWorth);
mls.LogInfo((object)"Amnestics 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 "Recharges items' battery life when interacting";
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "Amnestics";
public const string PLUGIN_NAME = "Amnestics";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace Amnestics.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 AMNESTICS_PRICE_KEY = "Amnestics price";
internal const int AMNESTICS_PRICE_DEFAULT = 50;
internal const string AMNESTICS_PRICE_DESCRIPTION = "Price for Amnestics.";
internal const string AMNESTICS_WEIGHT_KEY = "Item weight";
internal const int AMNESTICS_WEIGHT_DEFAULT = 5;
internal const string AMNESTICS_WEIGHT_DESCRIPTION = "Weight (in lbs)";
internal const string AMNESTICS_TWO_HANDED_KEY = "Two Handed Item";
internal const bool AMNESTICS_TWO_HANDED_DEFAULT = true;
internal const string AMNESTICS_TWO_HANDED_DESCRIPTION = "One or two handed item.";
internal const string AMNESTICS_CONDUCTIVE_KEY = "Conductive";
internal const bool AMNESTICS_CONDUCTIVE_DEFAULT = true;
internal const string AMNESTICS_CONDUCTIVE_DESCRIPTION = "Wether it attracts lightning to the item or not. (Or other mechanics that rely on item being conductive)";
internal const string AMNESTICS_DROP_AHEAD_PLAYER_KEY = "Drop ahead of player when dropping";
internal const bool AMNESTICS_DROP_AHEAD_PLAYER_DEFAULT = false;
internal const string AMNESTICS_DROP_AHEAD_PLAYER_DESCRIPTION = "If on, the item will drop infront of the player. Otherwise, drops underneath them and slightly infront.";
internal const string AMNESTICS_GRABBED_BEFORE_START_KEY = "Grabbable before game start";
internal const bool AMNESTICS_GRABBED_BEFORE_START_DEFAULT = false;
internal const string AMNESTICS_GRABBED_BEFORE_START_DESCRIPTION = "Allows wether the item can be grabbed before hand or not";
internal const string AMNESTICS_HIGHEST_SALE_PERCENTAGE_KEY = "Highest Sale Percentage";
internal const int AMNESTICS_HIGHEST_SALE_PERCENTAGE_DEFAULT = 50;
internal const string AMNESTICS_HIGHEST_SALE_PERCENTAGE_DESCRIPTION = "Maximum percentage of sale allowed when this item is selected for a sale.";
internal const string AMNESTICS_USAGES_KEY = "Recharge Usages";
internal const int AMNESTICS_USAGES_DEFAULT = 1;
internal const string AMNESTICS_USAGES_DESCRIPTION = "Amount of times the item can be used to recharge your sanity";
internal const string AMNESTICS_RECHARGE_PERCENTAGE_KEY = "Recharge Percentage";
internal const int AMNESTICS_RECHARGE_PERCENTAGE_DEFAULT = 100;
internal const string AMNESTICS_RECHARGE_PERCENTAGE_DESCRIPTION = "Amount (%) of sanity recharge it provides to the item when used";
internal const string AMNESTICS_RECHARGE_OVERTIME_KEY = "Recharge over time";
internal const float AMNESTICS_RECHARGE_OVERTIME_DEFAULT = 10f;
internal const string AMNESTICS_RECHARGE_OVERTIME_DESCRIPTION = "Amount of time (in seconds) where you replenish sanity after consuming the item.";
internal const string AMNESTICS_RECHARGE_OVERTIME_RATE_KEY = "Recharge overtime rate";
internal const float AMNESTICS_RECHARGE_OVERTIME_RATE_DEFAULT = 3f;
internal const string AMNESTICS_RECHARGE_OVERTIME_RATE_DESCRIPTION = "Rate of which you gain sanity after consuming the item during the recharge over time buff";
internal const string AMNESTICS_DESTROY_KEY = "Destroy Item when Exausted";
internal const bool AMNESTICS_DESTROY_DEFAULT = true;
internal const string AMNESTICS_DESTROY_DESCRIPTION = "When you can no longer recharge sanity with the ammnestics, the ammnestics get cleared from your inventory";
internal static readonly string AMNESTICS_SCAN_NODE_KEY = string.Format("Enable scan node of {0}", "Amnestics");
}
}
namespace Amnestics.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> 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; }
[field: SyncedEntryField]
public SyncedEntry<int> USAGES { get; set; }
[field: SyncedEntryField]
public SyncedEntry<int> RECHARGE_PERCENTAGE { get; set; }
[field: SyncedEntryField]
public SyncedEntry<float> RECHARGE_OVERTIME { get; set; }
[field: SyncedEntryField]
public SyncedEntry<float> RECHARGE_OVERTIME_RATE { get; set; }
[field: SyncedEntryField]
public SyncedEntry<bool> DESTROY { get; set; }
public PluginConfig(ConfigFile cfg)
: base("com.github.WhiteSpike.Amnestics")
{
string text = "Amnestics";
PRICE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Amnestics price", 50, "Price for Amnestics.");
WEIGHT = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Item weight", 5, "Weight (in lbs)");
SCAN_NODE = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, Constants.AMNESTICS_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.");
USAGES = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Recharge Usages", 1, "Amount of times the item can be used to recharge your sanity");
RECHARGE_PERCENTAGE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Recharge Percentage", 100, "Amount (%) of sanity recharge it provides to the item when used");
RECHARGE_OVERTIME = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Recharge over time", 10f, "Amount of time (in seconds) where you replenish sanity after consuming the item.");
RECHARGE_OVERTIME_RATE = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Recharge overtime rate", 3f, "Rate of which you gain sanity after consuming the item during the recharge over time buff");
DESTROY = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Destroy Item when Exausted", true, "When you can no longer recharge sanity with the ammnestics, the ammnestics get cleared from your inventory");
ConfigManager.Register<PluginConfig>((SyncedConfig2<PluginConfig>)this);
}
}
internal static class Metadata
{
public const string GUID = "com.github.WhiteSpike.Amnestics";
public const string NAME = "Amnestics";
public const string VERSION = "1.0.0";
}
}
namespace Amnestics.Behaviour
{
internal class AmnesticsBehaviour : ReplenishSanityBehaviour
{
internal const string ITEM_NAME = "Amnestics";
protected bool KeepScanNode => SyncedEntry<bool>.op_Implicit(Plugin.Config.SCAN_NODE);
public override void Start()
{
((GrabbableObject)this).Start();
if (!KeepScanNode)
{
Object.Destroy((Object)(object)((Component)this).gameObject.GetComponentInChildren<ScanNodeProperties>());
}
base.rechargeUsages = SyncedEntry<int>.op_Implicit(Plugin.Config.USAGES);
base.sanityReplenish = (float)SyncedEntry<int>.op_Implicit(Plugin.Config.RECHARGE_PERCENTAGE) / 100f;
base.sanityOvertime = SyncedEntry<float>.op_Implicit(Plugin.Config.RECHARGE_OVERTIME);
base.sanityOvertimeReplenish = SyncedEntry<float>.op_Implicit(Plugin.Config.RECHARGE_OVERTIME_RATE);
base.destroyUponExaustion = SyncedEntry<bool>.op_Implicit(Plugin.Config.DESTROY);
}
protected override void __initializeVariables()
{
((ReplenishSanityBehaviour)this).__initializeVariables();
}
protected internal override string __getTypeName()
{
return "AmnesticsBehaviour";
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace Amnestics.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}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 Batteries.Behaviour;
using Batteries.Misc;
using Batteries.NetcodePatcher;
using Batteries.Util;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using CSync.Extensions;
using CSync.Lib;
using CustomItemBehaviourLibrary.AbstractItems;
using CustomItemBehaviourLibrary.Compatibility;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using MoreShipUpgrades.UpgradeComponents.TierUpgrades.Player;
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 CustomItemBehaviourLibrary.Compatibility
{
internal static class LategameCompatibility
{
public static bool Enabled => Chainloader.PluginInfos.ContainsKey("com.malco.lethalcompany.moreshipupgrades");
public static float GetGrabDistance()
{
return MechanicalArms.GetIncreasedGrabDistance(GameNetworkManager.Instance.localPlayerController.grabDistance);
}
}
}
namespace Batteries
{
[BepInPlugin("com.github.WhiteSpike.Batteries", "Batteries", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[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.Batteries");
internal static readonly ManualLogSource mls = Logger.CreateLogSource("Batteries");
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), "batteries");
AssetBundle val = AssetBundle.LoadFromFile(text);
string text2 = "Assets/Batteries/";
Item val2 = ScriptableObject.CreateInstance<Item>();
((Object)val2).name = "batteriesItemProperties";
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, 0f, 180f);
val2.positionOffset = new Vector3(0f, 0.15f, -0.04f);
val2.weight = 0.99f + (float)(SyncedEntry<int>.op_Implicit(Config.WEIGHT) - 1) / 100f;
val2.twoHanded = false;
val2.itemIcon = val.LoadAsset<Sprite>(text2 + "Icon.png");
val2.spawnPrefab = val.LoadAsset<GameObject>(text2 + "Battery.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 = "Batteries";
val2.itemSpawnsOnGround = true;
val2.isConductiveMetal = SyncedEntry<bool>.op_Implicit(Config.CONDUCTIVE);
val2.requiresBattery = false;
val2.batteryUsage = 0f;
BatteriesBehaviour batteriesBehaviour = val2.spawnPrefab.AddComponent<BatteriesBehaviour>();
((GrabbableObject)batteriesBehaviour).itemProperties = val2;
((GrabbableObject)batteriesBehaviour).grabbable = true;
((GrabbableObject)batteriesBehaviour).grabbableToEnemies = true;
NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
TerminalNode val3 = SetupInfoNode();
Items.RegisterShopItem(val2, (TerminalNode)null, (TerminalNode)null, val3, val2.creditsWorth);
Item val4 = Object.Instantiate<Item>(val2);
((Object)val4).name = "scrapBatteriesItemProperties";
val4.isScrap = true;
val4.minValue = SyncedEntry<int>.op_Implicit(Config.MINIMUM_SCRAP_VALUE);
val4.maxValue = SyncedEntry<int>.op_Implicit(Config.MAXIMUM_SCRAP_VALUE);
val4.itemName = "Scrap Batteries";
val4.spawnPrefab = val.LoadAsset<GameObject>(text2 + "ScrapBattery.prefab");
batteriesBehaviour = val4.spawnPrefab.AddComponent<BatteriesBehaviour>();
((GrabbableObject)batteriesBehaviour).itemProperties = val4;
((GrabbableObject)batteriesBehaviour).grabbable = true;
((GrabbableObject)batteriesBehaviour).grabbableToEnemies = true;
NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab);
Items.RegisterScrap(val4, SyncedEntry<int>.op_Implicit(Config.RARITY), (LevelTypes)(-1));
mls.LogInfo((object)"Batteries 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 "Recharges items' battery life when interacting";
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "Batteries";
public const string PLUGIN_NAME = "Batteries";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace Batteries.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 BATTERIES_PRICE_KEY = "Batteries price";
internal const int BATTERIES_PRICE_DEFAULT = 50;
internal const string BATTERIES_PRICE_DESCRIPTION = "Price for Batteries.";
internal const string BATTERIES_WEIGHT_KEY = "Item weight";
internal const int BATTERIES_WEIGHT_DEFAULT = 5;
internal const string BATTERIES_WEIGHT_DESCRIPTION = "Weight (in lbs)";
internal const string BATTERIES_TWO_HANDED_KEY = "Two Handed Item";
internal const bool BATTERIES_TWO_HANDED_DEFAULT = true;
internal const string BATTERIES_TWO_HANDED_DESCRIPTION = "One or two handed item.";
internal const string BATTERIES_CONDUCTIVE_KEY = "Conductive";
internal const bool BATTERIES_CONDUCTIVE_DEFAULT = true;
internal const string BATTERIES_CONDUCTIVE_DESCRIPTION = "Wether it attracts lightning to the item or not. (Or other mechanics that rely on item being conductive)";
internal const string BATTERIES_DROP_AHEAD_PLAYER_KEY = "Drop ahead of player when dropping";
internal const bool BATTERIES_DROP_AHEAD_PLAYER_DEFAULT = false;
internal const string BATTERIES_DROP_AHEAD_PLAYER_DESCRIPTION = "If on, the item will drop infront of the player. Otherwise, drops underneath them and slightly infront.";
internal const string BATTERIES_GRABBED_BEFORE_START_KEY = "Grabbable before game start";
internal const bool BATTERIES_GRABBED_BEFORE_START_DEFAULT = false;
internal const string BATTERIES_GRABBED_BEFORE_START_DESCRIPTION = "Allows wether the item can be grabbed before hand or not";
internal const string BATTERIES_HIGHEST_SALE_PERCENTAGE_KEY = "Highest Sale Percentage";
internal const int BATTERIES_HIGHEST_SALE_PERCENTAGE_DEFAULT = 50;
internal const string BATTERIES_HIGHEST_SALE_PERCENTAGE_DESCRIPTION = "Maximum percentage of sale allowed when this item is selected for a sale.";
internal const string BATTERIES_RARITY_KEY = "Scrap Rarity";
internal const int BATTERIES_RARITY_DEFAULT = 100;
internal const string BATTERIES_RARITY_DESCRIPTION = "Spawn Weight of the item spawning as a scrap";
internal const string BATTERIES_MINIMUM_SCRAP_VALUE_KEY = "Minimum Scrap Value";
internal const int BATTERIES_MINIMUM_SCRAP_VALUE_DEFAULT = 25;
internal const string BATTERIES_MINIMUM_SCRAP_VALUE_DESCRIPTION = "Minimum value that the scrap version can have. (Before the scrap multipler (0.4))";
internal const string BATTERIES_MAXIMUM_SCRAP_VALUE_KEY = "Maximum Scrap Value";
internal const int BATTERIES_MAXIMUM_SCRAP_VALUE_DEFAULT = 35;
internal const string BATTERIES_MAXIMUM_SCRAP_VALUE_DESCRIPTION = "Maximum value that the scrap version can have. (Before the scrap multipler (0.4))";
internal const string BATTERIES_USAGES_KEY = "Recharge Usages";
internal const int BATTERIES_USAGES_DEFAULT = 1;
internal const string BATTERIES_USAGES_DESCRIPTION = "Amount of times the item can be used to recharge items";
internal const string BATTERIES_RECHARGE_PERCENTAGE_KEY = "Recharge Percentage";
internal const int BATTERIES_RECHARGE_PERCENTAGE_DEFAULT = 100;
internal const string BATTERIES_RECHARGE_PERCENTAGE_DESCRIPTION = "Amount (%) of recharge it provides to the item when used";
internal const string BATTERIES_OVERCHARGE_KEY = "Overcharge Battery Life";
internal const bool BATTERIES_OVERCHARGE_DEFAULT = false;
internal const string BATTERIES_OVERCHARGE_DESCRIPTION = "Wether the battery life of the recharged item can exceed 100%";
internal const string BATTERIES_DESTROY_KEY = "Destroy Item when Exausted";
internal const bool BATTERIES_DESTROY_DEFAULT = true;
internal const string BATTERIES_DESTROY_DESCRIPTION = "When you can no longer recharge items with the battery, the battery gets cleared from your inventory";
internal static readonly string BATTERIES_SCAN_NODE_KEY = string.Format("Enable scan node of {0}", "Batteries");
}
}
namespace Batteries.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> 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; }
[field: SyncedEntryField]
public SyncedEntry<int> RARITY { get; set; }
[field: SyncedEntryField]
public SyncedEntry<int> MINIMUM_SCRAP_VALUE { get; set; }
[field: SyncedEntryField]
public SyncedEntry<int> MAXIMUM_SCRAP_VALUE { get; set; }
[field: SyncedEntryField]
public SyncedEntry<int> USAGES { get; set; }
[field: SyncedEntryField]
public SyncedEntry<int> RECHARGE_PERCENTAGE { get; set; }
[field: SyncedEntryField]
public SyncedEntry<bool> OVERCHARGE { get; set; }
[field: SyncedEntryField]
public SyncedEntry<bool> DESTROY { get; set; }
public PluginConfig(ConfigFile cfg)
: base("com.github.WhiteSpike.Batteries")
{
string text = "Batteries";
PRICE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Batteries price", 50, "Price for Batteries.");
WEIGHT = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Item weight", 5, "Weight (in lbs)");
SCAN_NODE = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, Constants.BATTERIES_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.");
RARITY = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Scrap Rarity", 100, "Spawn Weight of the item spawning as a scrap");
MINIMUM_SCRAP_VALUE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Minimum Scrap Value", 25, "Minimum value that the scrap version can have. (Before the scrap multipler (0.4))");
MAXIMUM_SCRAP_VALUE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Maximum Scrap Value", 35, "Maximum value that the scrap version can have. (Before the scrap multipler (0.4))");
USAGES = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Recharge Usages", 1, "Amount of times the item can be used to recharge items");
RECHARGE_PERCENTAGE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Recharge Percentage", 100, "Amount (%) of recharge it provides to the item when used");
OVERCHARGE = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Overcharge Battery Life", false, "Wether the battery life of the recharged item can exceed 100%");
DESTROY = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Destroy Item when Exausted", true, "When you can no longer recharge items with the battery, the battery gets cleared from your inventory");
ConfigManager.Register<PluginConfig>((SyncedConfig2<PluginConfig>)this);
}
}
internal static class Metadata
{
public const string GUID = "com.github.WhiteSpike.Batteries";
public const string NAME = "Batteries";
public const string VERSION = "1.0.0";
}
}
namespace Batteries.Behaviour
{
internal class BatteriesBehaviour : ReplenishBatteryBehaviour
{
internal const string ITEM_NAME = "Batteries";
private RaycastHit hit;
protected bool KeepScanNode => SyncedEntry<bool>.op_Implicit(Plugin.Config.SCAN_NODE);
public override void Start()
{
((GrabbableObject)this).Start();
if (((GrabbableObject)this).itemProperties.isScrap)
{
((Component)this).gameObject.GetComponentInChildren<ScanNodeProperties>().nodeType = 2;
}
if (!KeepScanNode)
{
Object.Destroy((Object)(object)((Component)this).gameObject.GetComponentInChildren<ScanNodeProperties>());
}
base.rechargeUsages = SyncedEntry<int>.op_Implicit(Plugin.Config.USAGES);
base.rechargePercentage = (float)SyncedEntry<int>.op_Implicit(Plugin.Config.RECHARGE_PERCENTAGE) / 100f;
base.canOvercharge = SyncedEntry<bool>.op_Implicit(Plugin.Config.OVERCHARGE);
base.destroyUponOutOfUsages = SyncedEntry<bool>.op_Implicit(Plugin.Config.DESTROY);
}
protected override bool CanRechargeItem(GrabbableObject grabbableObject)
{
return grabbableObject.itemProperties.requiresBattery && grabbableObject.insertedBattery.charge + base.rechargePercentage <= (base.canOvercharge ? float.MaxValue : 1f);
}
protected override bool CanRechargeItems()
{
return base.rechargeUsages > 0f;
}
protected override GrabbableObject GrabItemToRecharge()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
float grabDistance = ((GrabbableObject)this).playerHeldBy.grabDistance;
if (LategameCompatibility.Enabled)
{
grabDistance = LategameCompatibility.GetGrabDistance();
}
if (!Physics.Raycast(((GrabbableObject)this).playerHeldBy.interactRay, ref hit, grabDistance, ((GrabbableObject)this).playerHeldBy.interactableObjectsMask) || ((Component)((RaycastHit)(ref hit)).collider).gameObject.layer == 8 || ((Component)((RaycastHit)(ref hit)).collider).gameObject.layer == 30)
{
return null;
}
return ((Component)((Component)((RaycastHit)(ref hit)).collider).transform).gameObject.GetComponent<GrabbableObject>();
}
protected override void __initializeVariables()
{
((ReplenishBatteryBehaviour)this).__initializeVariables();
}
protected internal override string __getTypeName()
{
return "BatteriesBehaviour";
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace Batteries.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}using System;
using System.Collections;
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 BepInEx;
using BepInEx.Logging;
using ChargeableJailbird.Behaviours;
using ChargeableJailbird.NetcodePatcher;
using GameNetcodeStuff;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ChargeableJailbird")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+8674ec67b29b04305150a5c7ddd419e611ff36b0")]
[assembly: AssemblyProduct("a Recharge-able jailbird for lethal company")]
[assembly: AssemblyTitle("ChargeableJailbird")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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 ChargeableJailbird
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "com.elmish.lethalcompany.chargeablejailbird";
public const string PLUGIN_NAME = "ChargeableJailbird";
public const string PLUGIN_VERSION = "1.0.0";
}
[BepInPlugin("com.elmish.lethalcompany.chargeablejailbird", "ChargeableJailbird", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
private static Item jailbirditemprops;
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin com.elmish.lethalcompany.chargeablejailbird is loaded!");
LoadAssetBundle();
Patch();
}
private void Patch()
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
private void LoadAssetBundle()
{
using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ChargeableJailbird.Resources.jailbirdassets"))
{
AssetBundle val = AssetBundle.LoadFromStream(stream);
if ((Object)(object)val == (Object)null)
{
Logger.LogError((object)"JAILBIRD BUNDLE IS NULL");
return;
}
jailbirditemprops = val.LoadAsset<Item>("JailbirdItemProps");
if ((Object)(object)jailbirditemprops == (Object)null)
{
Logger.LogError((object)"JAILBIRD ITEM IS NULL");
return;
}
ChargeableJailbird.Behaviours.ChargeableJailbird chargeableJailbird = jailbirditemprops.spawnPrefab.AddComponent<ChargeableJailbird.Behaviours.ChargeableJailbird>();
((GrabbableObject)chargeableJailbird).itemProperties = jailbirditemprops;
((GrabbableObject)chargeableJailbird).grabbable = true;
chargeableJailbird.reelUpSFX = val.LoadAsset<AudioClip>("ShovelReelUp");
chargeableJailbird.swingSFX[0] = val.LoadAsset<AudioClip>("Jailbirdswing1");
chargeableJailbird.swingSFX[1] = val.LoadAsset<AudioClip>("ShovelSwing");
chargeableJailbird.hitSFX = (AudioClip[])(object)new AudioClip[1];
chargeableJailbird.hitSFX[0] = val.LoadAsset<AudioClip>("Normal_Hit");
chargeableJailbird.jailbirdAudio = ((Component)jailbirditemprops.spawnPrefab.transform).GetComponent<AudioSource>();
chargeableJailbird.jailbirdAudio.spatialize = true;
}
Utilities.FixMixerGroups(jailbirditemprops.spawnPrefab);
TerminalNode val2 = ScriptableObject.CreateInstance<TerminalNode>();
val2.clearPreviousText = true;
val2.displayText = "???";
Items.RegisterShopItem(jailbirditemprops, (TerminalNode)null, (TerminalNode)null, val2, 300);
NetworkPrefabs.RegisterNetworkPrefab(jailbirditemprops.spawnPrefab);
Logger.LogInfo((object)"successfully set-up item");
}
}
}
namespace ChargeableJailbird.Behaviours
{
public class ChargeableJailbird : GrabbableObject
{
public int shovelHitForce = 3;
public bool reelingUp;
public bool isHoldingButton;
private RaycastHit rayHit;
private Coroutine reelingUpCoroutine;
private RaycastHit[] objectsHitByShovel;
private List<RaycastHit> objectsHitByShovelList = new List<RaycastHit>();
public AudioClip reelUpSFX;
public AudioClip[] swingSFX = (AudioClip[])(object)new AudioClip[2];
public AudioClip[] hitSFX;
public AudioSource jailbirdAudio;
private PlayerControllerB previousPlayerHeldBy;
private int shovelMask = 1084754248;
private GameObject blueGlow;
public override void Start()
{
((GrabbableObject)this).Start();
blueGlow = ((Component)((Component)this).transform.Find("jailbird/Mesh_Jailbird/blue_glow")).gameObject;
base.insertedBattery.charge = 1f;
Plugin.Logger.LogMessage((object)"new jailbird created");
}
public override void GrabItem()
{
((GrabbableObject)this).GrabItem();
if ((double)base.insertedBattery.charge == 0.5)
{
base.insertedBattery.charge = 0.001f;
}
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
if ((Object)(object)base.playerHeldBy == (Object)null)
{
return;
}
isHoldingButton = buttonDown;
if (!reelingUp && buttonDown)
{
reelingUp = true;
previousPlayerHeldBy = base.playerHeldBy;
if (reelingUpCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(reelingUpCoroutine);
}
reelingUpCoroutine = ((MonoBehaviour)this).StartCoroutine(reelUpShovel());
}
}
private IEnumerator reelUpShovel()
{
base.playerHeldBy.activatingItem = true;
base.playerHeldBy.twoHanded = true;
base.playerHeldBy.playerBodyAnimator.ResetTrigger("shovelHit");
base.playerHeldBy.playerBodyAnimator.SetBool("reelingUp", true);
jailbirdAudio.PlayOneShot(reelUpSFX);
ReelUpSFXServerRpc();
yield return (object)new WaitForSeconds(0.35f);
yield return (object)new WaitUntil((Func<bool>)(() => !isHoldingButton || !base.isHeld));
SwingSFXServerRpc();
yield return (object)new WaitForSeconds((shovelHitForce == 3) ? 0.15f : 0f);
SwingShovel(!base.isHeld);
yield return (object)new WaitForSeconds(0.13f);
yield return (object)new WaitForEndOfFrame();
HitShovel(!base.isHeld);
yield return (object)new WaitForSeconds(0.3f);
reelingUp = false;
reelingUpCoroutine = null;
}
public override void DiscardItem()
{
if ((Object)(object)base.playerHeldBy != (Object)null)
{
base.playerHeldBy.activatingItem = false;
}
if (base.insertedBattery.charge < 0.5f)
{
base.insertedBattery.charge = 0.5f;
}
((GrabbableObject)this).DiscardItem();
}
public void SwingShovel(bool cancel = false)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false);
if (!cancel)
{
previousPlayerHeldBy.UpdateSpecialAnimationValue(true, (short)((Component)previousPlayerHeldBy).transform.localEulerAngles.y, 0.4f, false);
}
}
public void HitShovel(bool cancel = false)
{
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_045b: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_027d: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Unknown result type (might be due to invalid IL or missing references)
//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
//IL_0329: Unknown result type (might be due to invalid IL or missing references)
//IL_032e: Unknown result type (might be due to invalid IL or missing references)
//IL_0368: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)previousPlayerHeldBy == (Object)null)
{
Debug.LogError((object)"Previousplayerheldby is null on this client when HitShovel is called.");
return;
}
previousPlayerHeldBy.activatingItem = false;
bool flag = false;
bool flag2 = false;
bool flag3 = false;
int num = -1;
if (!cancel)
{
previousPlayerHeldBy.twoHanded = false;
objectsHitByShovel = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, 0.8f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, 1.5f, shovelMask, (QueryTriggerInteraction)2);
objectsHitByShovelList = objectsHitByShovel.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList();
List<EnemyAI> list = new List<EnemyAI>();
IHittable val2 = default(IHittable);
for (int i = 0; i < objectsHitByShovelList.Count; i++)
{
RaycastHit val = objectsHitByShovelList[i];
if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8)
{
val = objectsHitByShovelList[i];
if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11)
{
val = objectsHitByShovelList[i];
if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2))
{
continue;
}
val = objectsHitByShovelList[i];
if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform)
{
continue;
}
val = objectsHitByShovelList[i];
if (!(((RaycastHit)(ref val)).point == Vector3.zero))
{
Vector3 position = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position;
RaycastHit val3 = objectsHitByShovelList[i];
if (Physics.Linecast(position, ((RaycastHit)(ref val3)).point, ref val, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
{
continue;
}
}
flag = true;
Vector3 forward = ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward;
try
{
val = objectsHitByShovelList[i];
EnemyAICollisionDetect component = ((Component)((RaycastHit)(ref val)).transform).GetComponent<EnemyAICollisionDetect>();
if ((Object)(object)component != (Object)null)
{
if (!((Object)(object)component.mainScript == (Object)null) && !list.Contains(component.mainScript))
{
goto IL_035f;
}
continue;
}
val = objectsHitByShovelList[i];
if (!((Object)(object)((Component)((RaycastHit)(ref val)).transform).GetComponent<PlayerControllerB>() != (Object)null))
{
goto IL_035f;
}
if (!flag3)
{
flag3 = true;
goto IL_035f;
}
goto end_IL_02c3;
IL_035f:
bool flag4 = val2.Hit(shovelHitForce, forward, previousPlayerHeldBy, true, 1);
if (flag4 && (Object)(object)component != (Object)null)
{
list.Add(component.mainScript);
if (shovelHitForce == 3)
{
StunEnemiesServerRpc(((NetworkBehaviour)component.mainScript).NetworkObjectId);
}
HitEnemyWithShovelServerRpc();
}
if (!flag2)
{
flag2 = flag4;
}
end_IL_02c3:;
}
catch (Exception arg)
{
Debug.Log((object)$"Exception caught when hitting object with shovel from player #{previousPlayerHeldBy.playerClientId}: {arg}");
}
continue;
}
}
val = objectsHitByShovelList[i];
if (((RaycastHit)(ref val)).collider.isTrigger)
{
continue;
}
flag = true;
val = objectsHitByShovelList[i];
string tag = ((Component)((RaycastHit)(ref val)).collider).gameObject.tag;
for (int j = 0; j < StartOfRound.Instance.footstepSurfaces.Length; j++)
{
if (StartOfRound.Instance.footstepSurfaces[j].surfaceTag == tag)
{
num = j;
break;
}
}
}
}
if (flag)
{
RoundManager.PlayRandomClip(jailbirdAudio, hitSFX, true, 1f, 0, 1000);
Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0);
if (!flag2 && num != -1)
{
jailbirdAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX);
WalkieTalkie.TransmitOneShotAudio(jailbirdAudio, StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX, 1f);
}
base.playerHeldBy.playerBodyAnimator.SetTrigger("shovelHit");
HitShovelServerRpc(num);
}
}
private void HitSurfaceWithShovel(int hitSurfaceID)
{
try
{
jailbirdAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX);
WalkieTalkie.TransmitOneShotAudio(jailbirdAudio, StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX, 1f);
}
catch (Exception ex)
{
Plugin.Logger.LogError((object)ex);
}
}
public void OnJailbirdHit()
{
if (shovelHitForce == 3)
{
base.insertedBattery.charge = 0.001f;
shovelHitForce = 1;
blueGlow.SetActive(false);
}
}
public override void ChargeBatteries()
{
((GrabbableObject)this).ChargeBatteries();
if (base.insertedBattery.charge == 1f)
{
shovelHitForce = 3;
blueGlow.SetActive(true);
}
}
public void TryStunEnemy(ulong enemyID)
{
RoundManager.Instance.RefreshEnemiesList();
foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
{
if (((NetworkBehaviour)spawnedEnemy).NetworkObjectId == enemyID)
{
Plugin.Logger.LogMessage((object)$"found enemy with id {enemyID}");
spawnedEnemy.SetEnemyStunned(true, 4.5f, (PlayerControllerB)null);
return;
}
}
Plugin.Logger.LogError((object)$"could not find enemy with id {enemyID}");
}
[ServerRpc]
public void HitEnemyWithShovelServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Invalid comparison between Unknown and I4
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4051162151u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4051162151u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
HitEnemyWithShovelClientRpc();
}
}
[ClientRpc]
public void HitEnemyWithShovelClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(749202693u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 749202693u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
OnJailbirdHit();
}
}
}
[ServerRpc]
public void HitShovelServerRpc(int hitSurfaceID)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Invalid comparison between Unknown and I4
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3129188199u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, hitSurfaceID);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3129188199u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
HitShovelClientRpc(hitSurfaceID);
}
}
[ClientRpc]
public void HitShovelClientRpc(int hitSurfaceID)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(9340190u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, hitSurfaceID);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 9340190u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
HitSurfaceWithShovel(hitSurfaceID);
}
}
}
[ServerRpc]
public void ReelUpSFXServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Invalid comparison between Unknown and I4
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3945880777u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3945880777u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
ReelUpSFXClientRpc();
}
}
[ClientRpc]
public void ReelUpSFXClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2997558882u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2997558882u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
jailbirdAudio.PlayOneShot(reelUpSFX);
}
}
}
[ServerRpc]
public void SwingSFXServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Invalid comparison between Unknown and I4
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(907157750u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 907157750u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
SwingSFXClientRpc();
}
}
[ClientRpc]
public void SwingSFXClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3430652948u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3430652948u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
jailbirdAudio.PlayOneShot(swingSFX[(shovelHitForce != 3) ? 1u : 0u]);
}
}
}
[ServerRpc]
public void StunEnemiesServerRpc(ulong enemyID)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Invalid comparison between Unknown and I4
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3625734691u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, enemyID);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3625734691u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
StunEnemiesClientRpc(enemyID);
}
}
[ClientRpc]
public void StunEnemiesClientRpc(ulong enemyID)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1610222793u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, enemyID);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1610222793u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
TryStunEnemy(enemyID);
}
}
}
protected override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_ChargeableJailbird()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Expected O, but got Unknown
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Expected O, but got Unknown
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(4051162151u, new RpcReceiveHandler(__rpc_handler_4051162151));
NetworkManager.__rpc_func_table.Add(749202693u, new RpcReceiveHandler(__rpc_handler_749202693));
NetworkManager.__rpc_func_table.Add(3129188199u, new RpcReceiveHandler(__rpc_handler_3129188199));
NetworkManager.__rpc_func_table.Add(9340190u, new RpcReceiveHandler(__rpc_handler_9340190));
NetworkManager.__rpc_func_table.Add(3945880777u, new RpcReceiveHandler(__rpc_handler_3945880777));
NetworkManager.__rpc_func_table.Add(2997558882u, new RpcReceiveHandler(__rpc_handler_2997558882));
NetworkManager.__rpc_func_table.Add(907157750u, new RpcReceiveHandler(__rpc_handler_907157750));
NetworkManager.__rpc_func_table.Add(3430652948u, new RpcReceiveHandler(__rpc_handler_3430652948));
NetworkManager.__rpc_func_table.Add(3625734691u, new RpcReceiveHandler(__rpc_handler_3625734691));
NetworkManager.__rpc_func_table.Add(1610222793u, new RpcReceiveHandler(__rpc_handler_1610222793));
}
private static void __rpc_handler_4051162151(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
}
else
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((ChargeableJailbird)(object)target).HitEnemyWithShovelServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_749202693(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)2;
((ChargeableJailbird)(object)target).HitEnemyWithShovelClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3129188199(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: 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_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
}
else
{
int hitSurfaceID = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref hitSurfaceID);
target.__rpc_exec_stage = (__RpcExecStage)1;
((ChargeableJailbird)(object)target).HitShovelServerRpc(hitSurfaceID);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_9340190(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int hitSurfaceID = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref hitSurfaceID);
target.__rpc_exec_stage = (__RpcExecStage)2;
((ChargeableJailbird)(object)target).HitShovelClientRpc(hitSurfaceID);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3945880777(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
}
else
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((ChargeableJailbird)(object)target).ReelUpSFXServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2997558882(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)2;
((ChargeableJailbird)(object)target).ReelUpSFXClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_907157750(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
}
else
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((ChargeableJailbird)(object)target).SwingSFXServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3430652948(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)2;
((ChargeableJailbird)(object)target).SwingSFXClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3625734691(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: 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_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
}
else
{
ulong enemyID = default(ulong);
ByteUnpacker.ReadValueBitPacked(reader, ref enemyID);
target.__rpc_exec_stage = (__RpcExecStage)1;
((ChargeableJailbird)(object)target).StunEnemiesServerRpc(enemyID);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1610222793(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
ulong enemyID = default(ulong);
ByteUnpacker.ReadValueBitPacked(reader, ref enemyID);
target.__rpc_exec_stage = (__RpcExecStage)2;
((ChargeableJailbird)(object)target).StunEnemiesClientRpc(enemyID);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "ChargeableJailbird";
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace ChargeableJailbird.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using CustomItemBehaviourLibrary.AbstractItems;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLevelLoader;
using Microsoft.CodeAnalysis;
using Pincers.Patches;
using TMPro;
using Unity.Netcode;
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 = "")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("CustomItemBehaviourLibrary")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("LethalLevelLoader")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("ReindogFan1372.Pincers")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Pincers")]
[assembly: AssemblyTitle("ReindogFan1372.Pincers")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace Pincers
{
[BepInPlugin("ReindogFan1372.Pincers", "Pincers", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Pincers : BaseUnityPlugin
{
public static Pincers Instance { get; private set; }
internal static ManualLogSource Logger { get; private set; }
internal static Harmony? Harmony { get; set; }
internal static MyModConfig PincersModConfig { get; private set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
PincersModConfig = new MyModConfig(((BaseUnityPlugin)this).Config);
AssetBundleLoader.AddOnExtendedModLoadedListener((Action<ExtendedMod>)OnExtendedModRegistered, "ReindogFan1372Pincer", "PincerMod");
Patch();
Logger.LogInfo((object)"ReindogFan1372.Pincers v1.0.0 has loaded!");
}
internal static void Patch()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
if (Harmony == null)
{
Harmony = new Harmony("ReindogFan1372.Pincers");
}
Logger.LogDebug((object)"Patching...");
Harmony.PatchAll(typeof(PincerDepositItemDesk));
Harmony.PatchAll(typeof(PincerGrabPlace));
Harmony.PatchAll(typeof(PincerGrabPatch));
TrySoftPatch("com.github.WhiteSpike.CustomItemBehaviourLibrary", typeof(ContainerPatch));
Logger.LogDebug((object)"Finished patching!");
}
internal static void Unpatch()
{
Logger.LogDebug((object)"Unpatching...");
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
Logger.LogDebug((object)"Finished unpatching!");
}
internal static void TrySoftPatch(string pluginName, Type type)
{
if (Chainloader.PluginInfos.ContainsKey(pluginName))
{
Harmony.CreateClassProcessor(type, true).Patch();
Logger.LogInfo((object)(pluginName + "found, enabling compatability patch."));
}
}
internal static void OnExtendedModRegistered(ExtendedMod myMod)
{
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Expected O, but got Unknown
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Expected O, but got Unknown
if ((Object)(object)myMod == (Object)null)
{
return;
}
foreach (ExtendedItem extendedItem in myMod.ExtendedItems)
{
if (extendedItem.Item.itemName == "Pincers")
{
extendedItem.Item.creditsWorth = PincersModConfig.price.Value;
extendedItem.Item.twoHanded = PincersModConfig.twoHanded.Value;
extendedItem.Item.isScrap = PincersModConfig.isScrap.Value;
if (PincersModConfig.isScrap.Value)
{
int value = PincersModConfig.spawnWeight.Value;
StringWithRarity item = new StringWithRarity("Vanilla", value);
StringWithRarity item2 = new StringWithRarity("Custom", value);
extendedItem.LevelMatchingProperties.levelTags.Clear();
extendedItem.LevelMatchingProperties.levelTags.TrimExcess();
extendedItem.LevelMatchingProperties.levelTags.Add(item2);
extendedItem.LevelMatchingProperties.levelTags.Add(item);
}
}
}
}
}
internal class MyModConfig
{
public readonly ConfigEntry<bool> twoHanded;
public readonly ConfigEntry<bool> isScrap;
public readonly ConfigEntry<int> spawnWeight;
public readonly ConfigEntry<int> price;
public readonly ConfigEntry<bool> twoHandedPickup;
public readonly ConfigEntry<bool> twoHandedPickupNatural;
public MyModConfig(ConfigFile cfg)
{
cfg.SaveOnConfigSet = false;
twoHanded = cfg.Bind<bool>("Pincers", "require two handed?", false, "should the Pincers be two handed?");
isScrap = cfg.Bind<bool>("Pincers", "is scrap??", false, "should the Pincers be able to be found inside dungeons");
spawnWeight = cfg.Bind<int>("Pincers", "Spawn Weight", 0, "if marked as scrap, how rare should the Pincers be? 30-40 is roughly normal vanilla weighting for standard scrap");
price = cfg.Bind<int>("Pincers", "Price of the item", 70, "If purchasable, how much should the item cost to buy?");
twoHandedPickup = cfg.Bind<bool>("Pincers", "Become Two Handed when picking up an item?", true, "Should the Pincers switch to two handed when picking up an item?");
twoHandedPickupNatural = cfg.Bind<bool>("Pincers", "Become Two Handed only when picking up a two-handed item?", true, "Should the Pincers only switch to two handed when picking up a naturally two handed item? (Requires Two Handed Pickup Enabled)");
ClearOrphanedEntries(cfg);
cfg.Save();
cfg.SaveOnConfigSet = true;
}
private static void ClearOrphanedEntries(ConfigFile cfg)
{
PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries");
Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(cfg);
dictionary.Clear();
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "ReindogFan1372.Pincers";
public const string PLUGIN_NAME = "Pincers";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace Pincers.Patches
{
[HarmonyPatch(typeof(ContainerBehaviour))]
public class ContainerPatch
{
[HarmonyPatch("StoreItemInContainer")]
[HarmonyPrefix]
public static bool StoreItemInContainerPrefix(ref PlayerControllerB playerInteractor, ContainerBehaviour __instance)
{
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)playerInteractor.currentlyHeldObjectServer == (Object)null)
{
return true;
}
PincersObject pincersObject = default(PincersObject);
if (!((Component)playerInteractor.currentlyHeldObjectServer).TryGetComponent<PincersObject>(ref pincersObject))
{
return true;
}
if ((Object)(object)pincersObject.objectHeldByPincers == (Object)null)
{
return true;
}
Collider container = (Collider)(object)__instance.container;
Vector3 val = RoundManager.RandomPointInBounds(container.bounds);
Bounds bounds = container.bounds;
val.y = ((Bounds)(ref bounds)).max.y;
val.y += pincersObject.objectHeldByPincers.itemProperties.verticalOffset;
val = ((Component)((Component)__instance).GetComponent<NetworkObject>()).transform.InverseTransformPoint(val);
GrabbableObject objectHeldByPincers = pincersObject.objectHeldByPincers;
playerInteractor.DiscardHeldObject(true, ((Component)__instance).GetComponent<NetworkObject>(), val, false);
objectHeldByPincers.EnableItemMeshes(!__instance.makeItemsInvisible);
__instance.UpdateContainerWeightServerRpc();
return false;
}
}
public class PincersObject : GrabbableObject
{
[HideInInspector]
public GrabbableObject objectHeldByPincers;
public Transform holdPoint;
[HideInInspector]
public AudioSource pincerAudioSource;
public AudioClip pincerGrabClip;
public AudioClip pincerDropClip;
public void Awake()
{
}
public override void Start()
{
((GrabbableObject)this).Start();
}
public override void OnNetworkSpawn()
{
((NetworkBehaviour)this).OnNetworkSpawn();
pincerAudioSource = ((Component)this).GetComponent<AudioSource>();
base.itemProperties.twoHanded = Pincers.PincersModConfig.twoHanded.Value;
}
public override void LateUpdate()
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).LateUpdate();
if ((Object)(object)objectHeldByPincers != (Object)null)
{
((Component)objectHeldByPincers).transform.rotation = holdPoint.rotation;
((Component)objectHeldByPincers).transform.Rotate(base.itemProperties.rotationOffset);
((Component)objectHeldByPincers).transform.position = holdPoint.position;
Vector3 positionOffset = base.itemProperties.positionOffset;
positionOffset = holdPoint.rotation * positionOffset;
Transform transform = ((Component)objectHeldByPincers).transform;
transform.position += positionOffset;
}
}
public override void EnableItemMeshes(bool enable)
{
((GrabbableObject)this).EnableItemMeshes(enable);
if ((Object)(object)objectHeldByPincers == (Object)null)
{
return;
}
MeshRenderer[] componentsInChildren = ((Component)objectHeldByPincers).GetComponentsInChildren<MeshRenderer>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
if (!((Component)componentsInChildren[i]).gameObject.CompareTag("DoNotSet") && !((Component)componentsInChildren[i]).gameObject.CompareTag("InteractTrigger"))
{
((Renderer)componentsInChildren[i]).enabled = enable;
}
}
SkinnedMeshRenderer[] componentsInChildren2 = ((Component)objectHeldByPincers).GetComponentsInChildren<SkinnedMeshRenderer>();
for (int j = 0; j < componentsInChildren2.Length; j++)
{
((Renderer)componentsInChildren2[j]).enabled = enable;
Debug.Log((object)("DISABLING/ENABLING SKINNEDMESH: " + ((Object)((Component)componentsInChildren2[j]).gameObject).name));
}
}
public void PincerGrabTwoHanded(bool toggle)
{
if (Pincers.PincersModConfig.twoHandedPickup.Value && ((NetworkBehaviour)this).IsOwner)
{
base.itemProperties.twoHanded = toggle;
if (Object.op_Implicit((Object)(object)base.playerHeldBy))
{
base.playerHeldBy.twoHanded = toggle;
}
HUDManager.Instance.ClearControlTips();
((Behaviour)HUDManager.Instance.holdingTwoHandedItem).enabled = toggle;
((GrabbableObject)this).SetControlTipsForItem();
SyncPincerTwoHandedServerRpc(toggle);
}
}
[ServerRpc(RequireOwnership = false)]
public void SyncPincerTwoHandedServerRpc(bool toggle)
{
SyncPincerTwoHandedClientRpc(toggle);
}
[ClientRpc]
public void SyncPincerTwoHandedClientRpc(bool toggle)
{
if (!((NetworkBehaviour)this).IsOwner)
{
base.itemProperties.twoHanded = toggle;
if (Object.op_Implicit((Object)(object)base.playerHeldBy))
{
base.playerHeldBy.twoHanded = toggle;
}
}
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
public class PincerGrabPatch
{
[HarmonyPatch("BeginGrabObject")]
[HarmonyPrefix]
public static bool BeginGrabObjectPrefix(Camera ___gameplayCamera, float ___grabDistance, int ___interactableObjectsMask, float ___sinkingValue, bool ___inSpecialInteractAnimation, PlayerControllerB __instance)
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)__instance.currentlyHeldObjectServer == (Object)null)
{
return true;
}
PincersObject pincersObject = default(PincersObject);
if (!((Component)__instance.currentlyHeldObjectServer).TryGetComponent<PincersObject>(ref pincersObject))
{
return true;
}
if ((Object)(object)pincersObject.objectHeldByPincers != (Object)null)
{
return false;
}
__instance.interactRay = new Ray(((Component)___gameplayCamera).transform.position, ((Component)___gameplayCamera).transform.forward);
if (!Physics.Raycast(__instance.interactRay, ref __instance.hit, ___grabDistance, ___interactableObjectsMask) || ((Component)((RaycastHit)(ref __instance.hit)).collider).gameObject.layer == 8 || !(((Component)((RaycastHit)(ref __instance.hit)).collider).tag == "PhysicsProp") || ___sinkingValue > 0.73f || Physics.Linecast(((Component)___gameplayCamera).transform.position, ((Component)((RaycastHit)(ref __instance.hit)).collider).transform.position + ((Component)__instance).transform.up * 0.16f, 1073741824, (QueryTriggerInteraction)1))
{
return false;
}
__instance.currentlyGrabbingObject = ((Component)((Component)((RaycastHit)(ref __instance.hit)).collider).transform).gameObject.GetComponent<GrabbableObject>();
if (!GameNetworkManager.Instance.gameHasStarted && !__instance.currentlyGrabbingObject.itemProperties.canBeGrabbedBeforeGameStart && (Object)(object)StartOfRound.Instance.testRoom == (Object)null)
{
return false;
}
if ((Object)(object)__instance.currentlyGrabbingObject == (Object)null || ___inSpecialInteractAnimation || __instance.currentlyGrabbingObject.isHeld || __instance.currentlyGrabbingObject.isPocketed)
{
return false;
}
NetworkObject networkObject = ((NetworkBehaviour)__instance.currentlyGrabbingObject).NetworkObject;
if ((Object)(object)networkObject == (Object)null || !networkObject.IsSpawned)
{
return false;
}
if (__instance.currentlyGrabbingObject.grabbable)
{
__instance.isGrabbingObjectAnimation = true;
((Behaviour)__instance.cursorIcon).enabled = false;
((TMP_Text)__instance.cursorTip).text = "";
__instance.carryWeight = Mathf.Clamp(__instance.carryWeight + (__instance.currentlyGrabbingObject.itemProperties.weight - 1f), 1f, 10f);
if (__instance.currentlyGrabbingObject.itemProperties.grabAnimationTime > 0f)
{
__instance.grabObjectAnimationTime = __instance.currentlyGrabbingObject.itemProperties.grabAnimationTime;
}
else
{
__instance.grabObjectAnimationTime = 0.4f;
}
if (!__instance.isTestingPlayer)
{
__instance.GrabObjectServerRpc(NetworkObjectReference.op_Implicit(networkObject));
}
if (__instance.grabObjectCoroutine != null)
{
((MonoBehaviour)__instance).StopCoroutine(__instance.grabObjectCoroutine);
}
__instance.grabObjectCoroutine = ((MonoBehaviour)__instance).StartCoroutine(GrabObjectPincerFix(__instance));
}
return false;
}
[HarmonyPatch("GrabObjectClientRpc")]
[HarmonyPrefix]
public static bool GrabObjectClientRpcPrefix(bool grabValidated, NetworkObjectReference grabbedObject, PlayerControllerB __instance)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Invalid comparison between Unknown and I4
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager;
if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening)
{
return true;
}
if ((int)((NetworkBehaviour)__instance).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
{
return true;
}
if ((Object)(object)__instance.currentlyHeldObjectServer == (Object)null)
{
return true;
}
PincersObject pincersObject = default(PincersObject);
if (!((Component)__instance.currentlyHeldObjectServer).TryGetComponent<PincersObject>(ref pincersObject))
{
return true;
}
GrabbableObject componentInChildren = ((Component)NetworkObjectReference.op_Implicit(grabbedObject)).gameObject.GetComponentInChildren<GrabbableObject>();
if (grabValidated)
{
componentInChildren.EnablePhysics(false);
componentInChildren.hasHitGround = false;
componentInChildren.isInFactory = __instance.isInsideFactory;
__instance.SetItemInElevator(__instance.isInHangarShipRoom, __instance.isInElevator, componentInChildren);
if (!((NetworkBehaviour)__instance).IsOwner)
{
componentInChildren.parentObject = pincersObject.holdPoint;
__instance.isHoldingObject = true;
__instance.carryWeight = Mathf.Clamp(__instance.carryWeight + (componentInChildren.itemProperties.weight - 1f), 1f, 10f);
if ((Object)(object)componentInChildren.itemProperties.grabSFX != (Object)null)
{
__instance.itemAudio.PlayOneShot(componentInChildren.itemProperties.grabSFX, 1f);
pincersObject.pincerAudioSource.PlayOneShot(pincersObject.pincerGrabClip, 1f);
}
if ((Object)(object)componentInChildren.playerHeldBy != (Object)null)
{
Debug.Log((object)$"playerHeldBy on grabbed object: {componentInChildren.playerHeldBy}");
}
else
{
Debug.Log((object)"grabbed object playerHeldBy is null");
}
}
}
else
{
Debug.Log((object)$"Player #{__instance.playerClientId}: Was grabbing object {((NetworkBehaviour)componentInChildren).NetworkObjectId} validated by server? : {grabValidated}");
if (((NetworkBehaviour)__instance).IsOwner)
{
Debug.Log((object)"Local client got grab invalidated");
__instance.grabInvalidated = true;
}
}
pincersObject.objectHeldByPincers = componentInChildren;
return false;
}
public static IEnumerator GrabObjectPincerFix(PlayerControllerB __instance)
{
PincersObject pincer = default(PincersObject);
if ((Object)(object)__instance.currentlyHeldObjectServer == (Object)null || !((Component)__instance.currentlyHeldObjectServer).TryGetComponent<PincersObject>(ref pincer))
{
yield break;
}
__instance.grabbedObjectValidated = false;
yield return (object)new WaitForSeconds(0.1f);
__instance.currentlyGrabbingObject.parentObject = pincer.holdPoint;
if ((Object)(object)__instance.currentlyGrabbingObject.itemProperties.grabSFX != (Object)null)
{
__instance.itemAudio.PlayOneShot(__instance.currentlyGrabbingObject.itemProperties.grabSFX, 1f);
pincer.pincerAudioSource.PlayOneShot(pincer.pincerGrabClip, 1f);
}
while (!__instance.currentlyGrabbingObject.wasOwnerLastFrame && !__instance.grabInvalidated)
{
Debug.Log((object)$"grabInvalidated: {__instance.grabInvalidated}");
yield return null;
}
if (__instance.grabInvalidated)
{
__instance.grabInvalidated = false;
Debug.Log((object)("Grab was invalidated on object: " + ((Object)__instance.currentlyGrabbingObject).name));
if ((Object)(object)__instance.currentlyGrabbingObject.playerHeldBy != (Object)null)
{
Debug.Log((object)$"playerHeldBy on currentlyGrabbingObject 2: {__instance.currentlyGrabbingObject.playerHeldBy}");
}
if ((Object)(object)__instance.currentlyGrabbingObject.parentObject == (Object)(object)__instance.localItemHolder)
{
if ((Object)(object)__instance.currentlyGrabbingObject.playerHeldBy != (Object)null)
{
Debug.Log((object)$"Grab invalidated; giving grabbed object to the client who got it first; {__instance.currentlyGrabbingObject.playerHeldBy}");
__instance.currentlyGrabbingObject.parentObject = __instance.currentlyGrabbingObject.playerHeldBy.serverItemHolder;
}
else
{
Debug.Log((object)"Grab invalidated; no other client has possession of it, so set its parent object to null.");
__instance.currentlyGrabbingObject.parentObject = null;
}
}
__instance.SetSpecialGrabAnimationBool(false, (GrabbableObject)(object)pincer);
if ((Object)(object)__instance.currentlyHeldObjectServer != (Object)null)
{
}
__instance.carryWeight = Mathf.Clamp(__instance.carryWeight - (__instance.currentlyGrabbingObject.itemProperties.weight - 1f), 1f, 10f);
__instance.isGrabbingObjectAnimation = false;
__instance.currentlyGrabbingObject = null;
yield break;
}
pincer.objectHeldByPincers = __instance.currentlyGrabbingObject;
__instance.grabbedObjectValidated = true;
if (Pincers.PincersModConfig.twoHandedPickupNatural.Value)
{
if (pincer.objectHeldByPincers.itemProperties.twoHanded)
{
pincer.PincerGrabTwoHanded(toggle: true);
}
}
else
{
pincer.PincerGrabTwoHanded(toggle: true);
}
__instance.isHoldingObject = true;
yield return (object)new WaitForSeconds(__instance.grabObjectAnimationTime - 0.2f);
__instance.isGrabbingObjectAnimation = false;
}
[HarmonyPatch("DiscardHeldObject")]
[HarmonyPrefix]
public static bool DiscardHeldObjectPrefix(ref bool placeObject, ref NetworkObject parentObjectTo, ref Vector3 placePosition, ref bool matchRotationOfParent, PlayerControllerB __instance)
{
//IL_0245: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_0259: Unknown result type (might be due to invalid IL or missing references)
//IL_025e: 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_026d: 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_0099: 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_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_05c2: Unknown result type (might be due to invalid IL or missing references)
//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
//IL_05ca: Unknown result type (might be due to invalid IL or missing references)
//IL_05cf: Unknown result type (might be due to invalid IL or missing references)
//IL_05dd: Unknown result type (might be due to invalid IL or missing references)
//IL_05e2: Unknown result type (might be due to invalid IL or missing references)
//IL_05e6: Unknown result type (might be due to invalid IL or missing references)
//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
//IL_04ef: Unknown result type (might be due to invalid IL or missing references)
//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
//IL_02d8: 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_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: 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_011c: 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_061d: Unknown result type (might be due to invalid IL or missing references)
//IL_061f: Unknown result type (might be due to invalid IL or missing references)
//IL_0624: Unknown result type (might be due to invalid IL or missing references)
//IL_0605: Unknown result type (might be due to invalid IL or missing references)
//IL_0607: Unknown result type (might be due to invalid IL or missing references)
//IL_060c: Unknown result type (might be due to invalid IL or missing references)
//IL_0552: Unknown result type (might be due to invalid IL or missing references)
//IL_0558: Unknown result type (might be due to invalid IL or missing references)
//IL_055a: Unknown result type (might be due to invalid IL or missing references)
//IL_0543: Unknown result type (might be due to invalid IL or missing references)
//IL_042b: Unknown result type (might be due to invalid IL or missing references)
//IL_0430: Unknown result type (might be due to invalid IL or missing references)
//IL_0414: Unknown result type (might be due to invalid IL or missing references)
//IL_0419: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: 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_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_055f: Unknown result type (might be due to invalid IL or missing references)
//IL_056d: Unknown result type (might be due to invalid IL or missing references)
//IL_0572: Unknown result type (might be due to invalid IL or missing references)
//IL_0576: Unknown result type (might be due to invalid IL or missing references)
//IL_0435: Unknown result type (might be due to invalid IL or missing references)
//IL_0441: Unknown result type (might be due to invalid IL or missing references)
//IL_045f: Unknown result type (might be due to invalid IL or missing references)
//IL_048c: Unknown result type (might be due to invalid IL or missing references)
//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
//IL_062e: Unknown result type (might be due to invalid IL or missing references)
//IL_0644: Unknown result type (might be due to invalid IL or missing references)
//IL_0667: Unknown result type (might be due to invalid IL or missing references)
//IL_0674: Unknown result type (might be due to invalid IL or missing references)
//IL_05ad: Unknown result type (might be due to invalid IL or missing references)
//IL_05af: Unknown result type (might be due to invalid IL or missing references)
//IL_05b4: Unknown result type (might be due to invalid IL or missing references)
//IL_0593: Unknown result type (might be due to invalid IL or missing references)
//IL_0595: Unknown result type (might be due to invalid IL or missing references)
//IL_059a: Unknown result type (might be due to invalid IL or missing references)
//IL_0326: Unknown result type (might be due to invalid IL or missing references)
//IL_032b: Unknown result type (might be due to invalid IL or missing references)
//IL_0337: Unknown result type (might be due to invalid IL or missing references)
//IL_039c: Unknown result type (might be due to invalid IL or missing references)
//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)__instance.currentlyHeldObjectServer == (Object)null)
{
return true;
}
PincersObject pincersObject = default(PincersObject);
if (!((Component)__instance.currentlyHeldObjectServer).TryGetComponent<PincersObject>(ref pincersObject))
{
return true;
}
if ((Object)(object)pincersObject.objectHeldByPincers == (Object)null)
{
return true;
}
if (!placeObject)
{
Transform val = null;
Ray val2 = default(Ray);
if (pincersObject.objectHeldByPincers.itemProperties.allowDroppingAheadOfPlayer)
{
((Ray)(ref val2))..ctor(pincersObject.holdPoint.position + Vector3.up * 0.4f, ((Component)__instance.gameplayCamera).transform.forward);
if (Physics.Raycast(val2, ref __instance.hit, 4f, 1342179585, (QueryTriggerInteraction)1))
{
val = ((Component)((RaycastHit)(ref __instance.hit)).collider).gameObject.transform;
Debug.DrawRay(pincersObject.holdPoint.position + Vector3.up * 0.4f, ((Component)__instance.gameplayCamera).transform.forward * 1.7f, Color.yellow, 3f);
}
else
{
((Ray)(ref val2))..ctor(pincersObject.holdPoint.position + Vector3.up * 0.4f, -Vector3.up);
if (Physics.Raycast(val2, ref __instance.hit, 4f, 1342179585, (QueryTriggerInteraction)1))
{
val = ((Component)((RaycastHit)(ref __instance.hit)).collider).gameObject.transform;
Debug.DrawRay(pincersObject.holdPoint.position + Vector3.up * 0.4f, -Vector3.up * 1.7f, Color.yellow, 3f);
}
else
{
Debug.DrawRay(pincersObject.holdPoint.position + Vector3.up * 0.4f, -Vector3.up * 1.7f, Color.red, 3f);
}
}
}
else
{
((Ray)(ref val2))..ctor(pincersObject.holdPoint.position + Vector3.up * 0.4f, -Vector3.up);
if (Physics.Raycast(val2, ref __instance.hit, 4f, 1342179585, (QueryTriggerInteraction)1))
{
val = ((Component)((RaycastHit)(ref __instance.hit)).collider).gameObject.transform;
Debug.DrawRay(pincersObject.holdPoint.position + Vector3.up * 0.4f, -Vector3.up * 1.7f, Color.yellow, 3f);
}
}
if ((Object)(object)val != (Object)null)
{
PlayerPhysicsRegion componentInChildren = ((Component)val).GetComponentInChildren<PlayerPhysicsRegion>();
if ((Object)(object)componentInChildren != (Object)null && componentInChildren.allowDroppingItems && componentInChildren.itemDropCollider.ClosestPoint(((RaycastHit)(ref __instance.hit)).point) == ((RaycastHit)(ref __instance.hit)).point)
{
NetworkObject component = ((Component)val).GetComponent<NetworkObject>();
if ((Object)(object)component != (Object)null)
{
Debug.Log((object)"parenting item to physics parent");
placePosition = ((Component)component).transform.InverseTransformPoint(((Ray)(ref val2)).GetPoint(Mathf.Clamp(((RaycastHit)(ref __instance.hit)).distance - 0.3f, 0.01f, 500f)));
parentObjectTo = component;
placeObject = true;
matchRotationOfParent = false;
}
else
{
Debug.LogError((object)("Error: physics region transform does not have network object?: " + ((Object)((Component)val).gameObject).name));
}
}
}
}
if (placeObject)
{
if ((Object)(object)parentObjectTo == (Object)null)
{
__instance.throwingObject = true;
placePosition = ((!__instance.isInElevator) ? StartOfRound.Instance.propsContainer.InverseTransformPoint(placePosition) : StartOfRound.Instance.elevatorTransform.InverseTransformPoint(placePosition));
int num = (int)((Component)__instance).transform.localEulerAngles.y;
__instance.SetObjectAsNoLongerHeld(__instance.isInElevator, __instance.isInHangarShipRoom, placePosition, pincersObject.objectHeldByPincers, num);
pincersObject.PincerGrabTwoHanded(toggle: false);
__instance.ThrowObjectServerRpc(NetworkObjectReference.op_Implicit(((Component)pincersObject.objectHeldByPincers).gameObject.GetComponent<NetworkObject>()), __instance.isInElevator, __instance.isInHangarShipRoom, placePosition, num);
}
else
{
__instance.PlaceGrabbableObject(((Component)parentObjectTo).transform, placePosition, matchRotationOfParent, pincersObject.objectHeldByPincers);
pincersObject.PincerGrabTwoHanded(toggle: false);
__instance.PlaceObjectServerRpc(NetworkObjectReference.op_Implicit(((Component)pincersObject.objectHeldByPincers).gameObject.GetComponent<NetworkObject>()), NetworkObjectReference.op_Implicit(parentObjectTo), placePosition, matchRotationOfParent);
}
return false;
}
__instance.throwingObject = true;
bool flag = __instance.isInElevator;
Bounds bounds;
Vector3 val4;
if (!__instance.isInElevator)
{
Vector3 val3 = ((!pincersObject.objectHeldByPincers.itemProperties.allowDroppingAheadOfPlayer) ? pincersObject.objectHeldByPincers.GetItemFloorPosition(default(Vector3)) : __instance.DropItemAheadOfPlayer());
bounds = __instance.playersManager.shipBounds.bounds;
if (!((Bounds)(ref bounds)).Contains(val3))
{
val4 = __instance.playersManager.propsContainer.InverseTransformPoint(val3);
}
else
{
flag = true;
val4 = __instance.playersManager.elevatorTransform.InverseTransformPoint(val3);
}
}
else
{
Vector3 itemFloorPosition = pincersObject.objectHeldByPincers.GetItemFloorPosition(default(Vector3));
bounds = __instance.playersManager.shipBounds.bounds;
if (!((Bounds)(ref bounds)).Contains(itemFloorPosition))
{
flag = false;
val4 = __instance.playersManager.propsContainer.InverseTransformPoint(itemFloorPosition);
}
else
{
val4 = __instance.playersManager.elevatorTransform.InverseTransformPoint(itemFloorPosition);
}
}
int num2 = (int)((Component)__instance).transform.localEulerAngles.y;
__instance.SetObjectAsNoLongerHeld(flag, __instance.isInHangarShipRoom, val4, pincersObject.objectHeldByPincers, num2);
pincersObject.PincerGrabTwoHanded(toggle: false);
__instance.ThrowObjectServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)pincersObject.objectHeldByPincers).NetworkObject), flag, __instance.isInHangarShipRoom, val4, num2);
return false;
}
[HarmonyPatch("PlaceObjectClientRpc")]
[HarmonyPrefix]
public static bool PlaceObjectClientRpcPrefix(ref NetworkObjectReference parentObjectReference, Vector3 placePositionOffset, bool matchRotationOfParent, ref NetworkObjectReference grabbedObject, PlayerControllerB __instance)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Invalid comparison between Unknown and I4
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager;
if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening)
{
return true;
}
if ((int)((NetworkBehaviour)__instance).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
{
return true;
}
if ((Object)(object)__instance.currentlyHeldObjectServer == (Object)null)
{
return true;
}
PincersObject pincersObject = default(PincersObject);
if (!((Component)__instance.currentlyHeldObjectServer).TryGetComponent<PincersObject>(ref pincersObject))
{
return true;
}
if ((Object)(object)pincersObject.objectHeldByPincers == (Object)null)
{
return true;
}
NetworkObject val = default(NetworkObject);
if (((NetworkObjectReference)(ref grabbedObject)).TryGet(ref val, (NetworkManager)null))
{
GrabbableObject component = ((Component)val).GetComponent<GrabbableObject>();
if (!((NetworkBehaviour)__instance).IsOwner)
{
NetworkObject val2 = default(NetworkObject);
if (((NetworkObjectReference)(ref parentObjectReference)).TryGet(ref val2, (NetworkManager)null))
{
__instance.PlaceGrabbableObject(((Component)val2).transform, placePositionOffset, matchRotationOfParent, component);
}
else
{
__instance.PlaceGrabbableObject((Transform)null, placePositionOffset, matchRotationOfParent, component);
Debug.LogError((object)$"Reference to parent object when placing was missing. object: {component} placed by {((Object)((Component)__instance).gameObject).name}");
}
}
if (!component.itemProperties.syncDiscardFunction)
{
component.playerHeldBy = null;
}
else
{
Debug.LogError((object)"The server did not have a reference to the held object (when attempting to PLACE object on client.)");
}
if (((NetworkBehaviour)__instance).IsOwner)
{
__instance.throwingObject = false;
}
pincersObject.objectHeldByPincers = null;
pincersObject.pincerAudioSource.PlayOneShot(pincersObject.pincerDropClip, 1f);
}
return false;
}
[HarmonyPatch("ThrowObjectClientRpc")]
[HarmonyPrefix]
public static bool ThrowObjectClientRpcPrefix(bool droppedInElevator, bool droppedInShipRoom, Vector3 targetFloorPosition, ref NetworkObjectReference grabbedObject, int floorYRot, PlayerControllerB __instance)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Invalid comparison between Unknown and I4
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager;
if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening)
{
return true;
}
if ((int)((NetworkBehaviour)__instance).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
{
return true;
}
if ((Object)(object)__instance.currentlyHeldObjectServer == (Object)null)
{
return true;
}
PincersObject pincersObject = default(PincersObject);
if (!((Component)__instance.currentlyHeldObjectServer).TryGetComponent<PincersObject>(ref pincersObject))
{
return true;
}
if ((Object)(object)pincersObject.objectHeldByPincers == (Object)null)
{
return true;
}
NetworkObject val = default(NetworkObject);
if (((NetworkObjectReference)(ref grabbedObject)).TryGet(ref val, (NetworkManager)null))
{
GrabbableObject component = ((Component)val).GetComponent<GrabbableObject>();
if (!((NetworkBehaviour)__instance).IsOwner)
{
__instance.SetObjectAsNoLongerHeld(droppedInElevator, droppedInShipRoom, targetFloorPosition, component, -1);
}
if (!component.itemProperties.syncDiscardFunction)
{
component.playerHeldBy = null;
}
}
else
{
Debug.LogError((object)"The server did not have a reference to the held object (when attempting to THROW on client.)");
}
if (((NetworkBehaviour)__instance).IsOwner)
{
__instance.throwingObject = false;
}
pincersObject.objectHeldByPincers = null;
pincersObject.pincerAudioSource.PlayOneShot(pincersObject.pincerDropClip, 1f);
return false;
}
[HarmonyPatch("SetObjectAsNoLongerHeld")]
[HarmonyPrefix]
public static bool SetObjectAsNoLongerHeldPrefix(bool droppedInElevator, bool droppedInShipRoom, Vector3 targetFloorPosition, GrabbableObject dropObject, int floorYRot, PlayerControllerB __instance)
{
//IL_00be: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)__instance.currentlyHeldObjectServer == (Object)null)
{
return true;
}
PincersObject pincersObject = default(PincersObject);
if (!((Component)__instance.currentlyHeldObjectServer).TryGetComponent<PincersObject>(ref pincersObject))
{
return true;
}
if ((Object)(object)pincersObject.objectHeldByPincers == (Object)null)
{
return true;
}
dropObject.heldByPlayerOnServer = false;
dropObject.parentObject = null;
if (droppedInElevator)
{
((Component)dropObject).transform.SetParent(__instance.playersManager.elevatorTransform, true);
}
else
{
((Component)dropObject).transform.SetParent(__instance.playersManager.propsContainer, true);
}
__instance.SetItemInElevator(droppedInShipRoom, droppedInElevator, dropObject);
dropObject.EnablePhysics(true);
dropObject.EnableItemMeshes(true);
((Component)dropObject).transform.localScale = dropObject.originalScale;
dropObject.isHeld = false;
dropObject.isPocketed = false;
dropObject.fallTime = 0f;
dropObject.startFallingPosition = ((Component)dropObject).transform.parent.InverseTransformPoint(((Component)dropObject).transform.position);
dropObject.targetFloorPosition = targetFloorPosition;
dropObject.floorYRot = floorYRot;
__instance.carryWeight = Mathf.Clamp(__instance.carryWeight - (dropObject.itemProperties.weight - 1f), 1f, 10f);
return false;
}
[HarmonyPatch("PlaceGrabbableObject")]
[HarmonyPrefix]
public static bool PlaceGrabbableObjectPrefix(Transform parentObject, Vector3 positionOffset, bool matchRotationOfParent, GrabbableObject placeObject, PlayerControllerB __instance)
{
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: 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)
if ((Object)(object)__instance.currentlyHeldObjectServer == (Object)null)
{
return true;
}
PincersObject pincersObject = default(PincersObject);
if (!((Component)__instance.currentlyHeldObjectServer).TryGetComponent<PincersObject>(ref pincersObject))
{
return true;
}
if ((Object)(object)pincersObject.objectHeldByPincers == (Object)null)
{
return true;
}
placeObject.EnablePhysics(true);
placeObject.EnableItemMeshes(true);
placeObject.isHeld = false;
placeObject.isPocketed = false;
placeObject.heldByPlayerOnServer = false;
__instance.SetItemInElevator(__instance.isInHangarShipRoom, __instance.isInElevator, placeObject);
placeObject.parentObject = null;
((Component)placeObject).transform.SetParent(parentObject, true);
placeObject.startFallingPosition = ((Component)placeObject).transform.localPosition;
((Component)placeObject).transform.localScale = placeObject.originalScale;
((Component)placeObject).transform.localPosition = positionOffset;
placeObject.targetFloorPosition = positionOffset;
if (!matchRotationOfParent)
{
placeObject.fallTime = 0f;
}
else
{
((Component)placeObject).transform.localEulerAngles = new Vector3(0f, 0f, 0f);
placeObject.fallTime = 1.1f;
}
placeObject.OnPlaceObject();
__instance.carryWeight = Mathf.Clamp(__instance.carryWeight - (placeObject.itemProperties.weight - 1f), 1f, 10f);
return false;
}
}
[HarmonyPatch(typeof(PlaceableObjectsSurface))]
public class PincerGrabPlace
{
[HarmonyPatch("PlaceObject")]
[HarmonyPrefix]
public static bool PlaceObjectPrefix(PlayerControllerB playerWhoTriggered, PlaceableObjectsSurface __instance)
{
//IL_0099: 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_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)playerWhoTriggered.currentlyHeldObjectServer == (Object)null)
{
return true;
}
PincersObject pincersObject = default(PincersObject);
if (!((Component)playerWhoTriggered.currentlyHeldObjectServer).TryGetComponent<PincersObject>(ref pincersObject))
{
return true;
}
if ((Object)(object)pincersObject.objectHeldByPincers == (Object)null)
{
return true;
}
if (!playerWhoTriggered.isHoldingObject || playerWhoTriggered.isGrabbingObjectAnimation || !((Object)(object)playerWhoTriggered.currentlyHeldObjectServer != (Object)null))
{
return false;
}
Debug.Log((object)"Placing object in storage");
Vector3 val = __instance.itemPlacementPosition(((Component)playerWhoTriggered.gameplayCamera).transform, pincersObject.objectHeldByPincers);
if (!(val == Vector3.zero))
{
if ((Object)(object)__instance.parentTo != (Object)null)
{
val = ((Component)__instance.parentTo).transform.InverseTransformPoint(val);
}
playerWhoTriggered.DiscardHeldObject(true, __instance.parentTo, val, false);
Debug.Log((object)"discard held object called from placeobject");
}
return false;
}
}
[HarmonyPatch(typeof(DepositItemsDesk))]
public class PincerDepositItemDesk
{
[HarmonyPatch("PlaceItemOnCounter")]
[HarmonyPrefix]
public static bool PlaceItemOnCounterPrefix(PlayerControllerB playerWhoTriggered, DepositItemsDesk __instance)
{
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: 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_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)playerWhoTriggered.currentlyHeldObjectServer == (Object)null)
{
return true;
}
PincersObject pincersObject = default(PincersObject);
if (!((Component)playerWhoTriggered.currentlyHeldObjectServer).TryGetComponent<PincersObject>(ref pincersObject))
{
return true;
}
if ((Object)(object)pincersObject.objectHeldByPincers == (Object)null)
{
return true;
}
if (((Component)__instance.deskObjectsContainer).GetComponentsInChildren<GrabbableObject>().Length < 12 && !__instance.inGrabbingObjectsAnimation && (Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)playerWhoTriggered == (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
Vector3 val = RoundManager.RandomPointInBounds(((Collider)__instance.triggerCollider).bounds);
Bounds bounds = ((Collider)__instance.triggerCollider).bounds;
val.y = ((Bounds)(ref bounds)).min.y;
RaycastHit val2 = default(RaycastHit);
if (Physics.Raycast(new Ray(val + Vector3.up * 3f, Vector3.down), ref val2, 8f, 1048640, (QueryTriggerInteraction)2))
{
val = ((RaycastHit)(ref val2)).point;
}
val.y += pincersObject.objectHeldByPincers.itemProperties.verticalOffset;
val = ((Component)__instance.deskObjectsContainer).transform.InverseTransformPoint(val);
__instance.AddObjectToDeskServerRpc(NetworkObjectReference.op_Implicit(((Component)pincersObject.objectHeldByPincers).gameObject.GetComponent<NetworkObject>()));
playerWhoTriggered.DiscardHeldObject(true, __instance.deskObjectsContainer, val, false);
Debug.Log((object)"discard held object called from deposit items desk");
}
return false;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}using System;
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 GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalLib.Extras;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using SCPContainer.Behaviour;
using SCPContainer.Compat;
using SCPContainer.Input;
using SCPContainer.Misc;
using SCPContainer.NetcodePatcher;
using SCPContainer.Util;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace SCPContainer
{
[BepInPlugin("com.github.WhiteSpike.SCPContainer", "SCP Container", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[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.SCPContainer");
internal static readonly ManualLogSource mls = Logger.CreateLogSource("SCP Container");
public static PluginConfig Config;
private void Awake()
{
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
//IL_02de: Unknown result type (might be due to invalid IL or missing references)
//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0308: Expected O, but got Unknown
//IL_0311: Unknown result type (might be due to invalid IL or missing references)
//IL_0316: Unknown result type (might be due to invalid IL or missing references)
//IL_0327: Expected O, but got Unknown
Config = new PluginConfig(((BaseUnityPlugin)this).Config);
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "scpcontainer");
AssetBundle val = AssetBundle.LoadFromFile(text);
string text2 = "Assets/SCP Container/";
Item val2 = ScriptableObject.CreateInstance<Item>();
((Object)val2).name = "SCPContainerItemProperties";
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.floorYOffset = 0;
val2.restingRotation = new Vector3(0f, 0f, 0f);
val2.rotationOffset = new Vector3(0f, 90f, 0f);
val2.positionOffset = new Vector3(0f, -0.35f, 0.3f);
val2.verticalOffset = 0f;
val2.weight = 0.99f + (float)SyncedEntry<int>.op_Implicit(Config.WEIGHT) / 100f;
val2.isScrap = false;
val2.twoHanded = true;
val2.itemIcon = val.LoadAsset<Sprite>(text2 + "Icon.png");
val2.spawnPrefab = val.LoadAsset<GameObject>(text2 + "SCPContainer.prefab");
val2.spawnPrefab.transform.localScale = new Vector3(0.7f, 0.7f, 0.7f);
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 = "SCP Container";
val2.itemSpawnsOnGround = true;
val2.isConductiveMetal = SyncedEntry<bool>.op_Implicit(Config.CONDUCTIVE);
val2.requiresBattery = false;
val2.batteryUsage = 0f;
val2.twoHandedAnimation = true;
val2.grabAnim = "HoldJetpack";
ScpContainerBehaviour scpContainerBehaviour = val2.spawnPrefab.AddComponent<ScpContainerBehaviour>();
((GrabbableObject)scpContainerBehaviour).itemProperties = val2;
((GrabbableObject)scpContainerBehaviour).grabbable = true;
((GrabbableObject)scpContainerBehaviour).grabbableToEnemies = true;
Utilities.FixMixerGroups(val2.spawnPrefab);
NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
TerminalNode val3 = SetupInfoNode();
Items.RegisterShopItem(val2, (TerminalNode)null, (TerminalNode)null, val3, val2.creditsWorth);
if (SyncedEntry<bool>.op_Implicit(Config.SCRAP))
{
AnimationCurve curve = new AnimationCurve((Keyframe[])(object)new Keyframe[3]
{
new Keyframe(0f, 0f),
new Keyframe(1f - Config.RARITY.Value, 1f),
new Keyframe(1f, 1f)
});
SpawnableMapObjectDef val4 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>();
val4.spawnableMapObject = new SpawnableMapObject
{
prefabToSpawn = val2.spawnPrefab
};
MapObjects.RegisterMapObject(val4, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel _) => curve));
}
InputUtilsCompat.Init();
harmony.PatchAll(typeof(Keybinds));
mls.LogInfo((object)"SCP Container 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 $"A portable container which has a maximum capacity of {Config.MAXIMUM_AMOUNT_ITEMS.Value}" + $" and reduces the effective weight of the inserted items by {Config.WEIGHT_REDUCTION_MULTIPLIER.Value * 100f} %.\n" + " Helps subjudgate negative effects from item carried within\n" + $"It weighs {Config.WEIGHT.Value} lbs";
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "SCPContainer";
public const string PLUGIN_NAME = "SCPContainer";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace SCPContainer.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 SCP_CONTAINER_PRICE_KEY = "SCP Container price";
internal const int SCP_CONTAINER_PRICE_DEFAULT = 500;
internal const string SCP_CONTAINER_PRICE_DESCRIPTION = "Price for SCP Container.";
internal const string SCP_CONTAINER_WEIGHT_KEY = "Item weight";
internal const int SCP_CONTAINER_WEIGHT_DEFAULT = 15;
internal const string SCP_CONTAINER_WEIGHT_DESCRIPTION = "Weight (in lbs)";
internal const string SCP_CONTAINER_CONDUCTIVE_KEY = "Conductive";
internal const bool SCP_CONTAINER_CONDUCTIVE_DEFAULT = true;
internal const string SCP_CONTAINER_CONDUCTIVE_DESCRIPTION = "Wether it attracts lightning to the item or not. (Or other mechanics that rely on item being conductive)";
internal const string SCP_CONTAINER_DROP_AHEAD_PLAYER_KEY = "Drop ahead of player when dropping";
internal const bool SCP_CONTAINER_DROP_AHEAD_PLAYER_DEFAULT = true;
internal const string SCP_CONTAINER_DROP_AHEAD_PLAYER_DESCRIPTION = "If on, the item will drop infront of the player. Otherwise, drops underneath them and slightly infront.";
internal const string SCP_CONTAINER_GRABBED_BEFORE_START_KEY = "Grabbable before game start";
internal const bool SCP_CONTAINER_GRABBED_BEFORE_START_DEFAULT = true;
internal const string SCP_CONTAINER_GRABBED_BEFORE_START_DESCRIPTION = "Allows wether the item can be grabbed before hand or not";
internal const string SCP_CONTAINER_HIGHEST_SALE_PERCENTAGE_KEY = "Highest Sale Percentage";
internal const int SCP_CONTAINER_HIGHEST_SALE_PERCENTAGE_DEFAULT = 50;
internal const string SCP_CONTAINER_HIGHEST_SALE_PERCENTAGE_DESCRIPTION = "Maximum percentage of sale allowed when this item is selected for a sale.";
internal const string SCP_CONTAINER_MAXIMUM_AMOUNT_ITEMS_KEY = "Maximum amount of items for SCP Container";
internal const int SCP_CONTAINER_MAXIMUM_AMOUNT_ITEMS_DEFAULT = 4;
internal const string SCP_CONTAINER_MAXIMUM_AMOUNT_ITEMS_DESCRIPTION = "Amount of items allowed before the SCP Container is considered full";
internal const string SCP_CONTAINER_RARITY_KEY = "Spawn Chance of the SCP Container Item";
internal const float SCP_CONTAINER_RARITY_DEFAULT = 0.1f;
internal const string SCP_CONTAINER_RARITY_DESCRIPTION = "How likely it is for a SCP Container item to spawn when landing on a moon. (0.1 = 10%)";
internal const string SCP_CONTAINER_WEIGHT_REDUCTION_MULTIPLIER_KEY = "Weight reduction multiplier for SCP Container";
internal const float SCP_CONTAINER_WEIGHT_REDUCTION_MULTIPLIER_DEFAULT = 0.7f;
internal const string SCP_CONTAINER_WEIGHT_REDUCTION_MUTLIPLIER_DESCRIPTION = "How much an item's weight will be ignored to the SCP Container's total weight";
internal const string SCP_CONTAINER_SCRAP_KEY = "Scrap Item";
internal const bool SCP_CONTAINER_SCRAP_DEFAULT = false;
internal const string SCP_CONTAINER_SCRAP_DESCRIPTION = "If true, it can spawn inside the facility. It won't have a scrap value to be sold for The Company.";
internal const string DROP_ALL_ITEMS_SCP_CONTAINER_KEYBIND_NAME = "Drop all items from container";
internal const string DROP_ALL_ITEMS_SCP_CONTAINER_DEFAULT_KEYBIND = "<Mouse>/middleButton";
internal static readonly string SCP_CONTAINER_SCAN_NODE_KEY = string.Format("Enable scan node of {0}", "SCP Container");
}
}
namespace SCPContainer.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> 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; }
[field: SyncedEntryField]
public SyncedEntry<int> MAXIMUM_AMOUNT_ITEMS { get; set; }
[field: SyncedEntryField]
public SyncedEntry<float> WEIGHT_REDUCTION_MULTIPLIER { get; set; }
[field: SyncedEntryField]
public SyncedEntry<bool> SCRAP { get; set; }
[field: SyncedEntryField]
public SyncedEntry<float> RARITY { get; set; }
public PluginConfig(ConfigFile cfg)
: base("com.github.WhiteSpike.SCPContainer")
{
string text = "SCP Container";
PRICE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "SCP Container price", 500, "Price for SCP Container.");
WEIGHT = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Item weight", 15, "Weight (in lbs)");
SCAN_NODE = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, Constants.SCP_CONTAINER_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", true, "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", true, "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.");
MAXIMUM_AMOUNT_ITEMS = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Maximum amount of items for SCP Container", 4, "Amount of items allowed before the SCP Container is considered full");
WEIGHT_REDUCTION_MULTIPLIER = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Weight reduction multiplier for SCP Container", 0.7f, "How much an item's weight will be ignored to the SCP Container's total weight");
SCRAP = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Scrap Item", false, "If true, it can spawn inside the facility. It won't have a scrap value to be sold for The Company.");
RARITY = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Spawn Chance of the SCP Container Item", 0.1f, "How likely it is for a SCP Container item to spawn when landing on a moon. (0.1 = 10%)");
ConfigManager.Register<PluginConfig>((SyncedConfig2<PluginConfig>)this);
}
}
internal static class Metadata
{
public const string GUID = "com.github.WhiteSpike.SCPContainer";
public const string NAME = "SCP Container";
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 AddGeneralScanNode(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.GENERAL, 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 SCPContainer.Input
{
internal class IngameKeybinds : LcInputActions
{
public static IngameKeybinds Instance;
[InputAction("<Mouse>/middleButton", Name = "Drop all items from container")]
public InputAction SCPContainerKey { get; set; }
internal static InputActionAsset GetAsset()
{
return ((LcInputActions)Instance).Asset;
}
}
[HarmonyPatch]
internal static class Keybinds
{
public static InputActionAsset Asset;
public static InputActionMap ActionMap;
public static InputAction SCPContainerAction;
public static PlayerControllerB localPlayerController => StartOfRound.Instance?.localPlayerController;
[HarmonyPatch(typeof(PreInitSceneScript), "Awake")]
[HarmonyPrefix]
public static void AddToKeybindMenu()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
Asset = InputUtilsCompat.Asset;
ActionMap = Asset.actionMaps[0];
SCPContainerAction = InputUtilsCompat.SCPContainerKey;
}
[HarmonyPatch(typeof(StartOfRound), "OnEnable")]
[HarmonyPostfix]
public static void OnEnable()
{
Asset.Enable();
SCPContainerAction.performed += OnSCPContainerActionActionPerformed;
}
[HarmonyPatch(typeof(StartOfRound), "OnDisable")]
[HarmonyPostfix]
public static void OnDisable()
{
Asset.Disable();
SCPContainerAction.performed -= OnSCPContainerActionActionPerformed;
}
private static void OnSCPContainerActionActionPerformed(CallbackContext context)
{
if (!((Object)(object)localPlayerController == (Object)null) && localPlayerController.isPlayerControlled && (!((NetworkBehaviour)localPlayerController).IsServer || localPlayerController.isHostPlayerObject) && Object.op_Implicit((Object)(object)localPlayerController.currentlyHeldObjectServer))
{
ScpContainerBehaviour component = ((Component)localPlayerController.currentlyHeldObjectServer).GetComponent<ScpContainerBehaviour>();
if (Object.op_Implicit((Object)(object)component))
{
((ContainerBehaviour)component).UpdateContainerDrop();
}
}
}
}
}
namespace SCPContainer.Compat
{
public static class InputUtilsCompat
{
internal static InputActionAsset Asset => IngameKeybinds.GetAsset();
public static InputAction SCPContainerKey => IngameKeybinds.Instance.SCPContainerKey;
internal static void Init()
{
IngameKeybinds.Instance = new IngameKeybinds();
}
}
}
namespace SCPContainer.Behaviour
{
internal class ScpContainerBehaviour : ContainerBehaviour
{
internal const string ITEM_NAME = "SCP Container";
internal const string ITEM_DESCRIPTION = "Allows carrying dangerous items";
protected bool KeepScanNode => SyncedEntry<bool>.op_Implicit(Plugin.Config.SCAN_NODE);
public override void Start()
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
((ContainerBehaviour)this).Start();
if (!KeepScanNode)
{
Object.Destroy((Object)(object)((Component)this).gameObject.GetComponentInChildren<ScanNodeProperties>());
}
PluginConfig config = Plugin.Config;
base.maximumAmountItems = config.MAXIMUM_AMOUNT_ITEMS.Value;
base.weightReduceMultiplier = config.WEIGHT_REDUCTION_MULTIPLIER.Value;
base.restriction = (Restrictions)2;
base.maximumWeightAllowed = 0f;
base.noiseRange = 0f;
base.sloppiness = 1f;
base.lookSensitivityDrawback = 1f;
base.makeItemsInvisible = true;
base.playSounds = false;
base.wheelsClip = Array.Empty<AudioClip>();
}
protected override bool ShowDepositPrompts()
{
PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
return localPlayerController.isHoldingObject && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)(object)localPlayerController;
}
protected override void SetupScanNodeProperties()
{
ScanNodeProperties scanNodeProperties = ((Component)this).GetComponentInChildren<ScanNodeProperties>();
if ((Object)(object)scanNodeProperties != (Object)null)
{
Tools.ChangeScanNode(ref scanNodeProperties, (Tools.NodeType)scanNodeProperties.nodeType, "SCP Container", "Allows carrying dangerous items");
}
else
{
Tools.AddGeneralScanNode(((Component)this).gameObject, "SCP Container", "Allows carrying dangerous items");
}
}
protected override string[] SetupContainerTooltips()
{
string bindingDisplayString = InputActionRebindingExtensions.GetBindingDisplayString(IngameKeybinds.Instance.SCPContainerKey, (DisplayStringOptions)0, (string)null);
return new string[1] { "Drop all items: [" + bindingDisplayString + "]" };
}
protected override void __initializeVariables()
{
((ContainerBehaviour)this).__initializeVariables();
}
protected internal override string __getTypeName()
{
return "ScpContainerBehaviour";
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace SCPContainer.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}