using System;
using System.Collections.Generic;
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 CustomItemBehaviourLibrary.Misc;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalLib.Extras;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using ShoppingCart.Behaviour;
using ShoppingCart.Compat;
using ShoppingCart.Input;
using ShoppingCart.Misc;
using ShoppingCart.NetcodePatcher;
using ShoppingCart.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 ShoppingCart
{
[BepInPlugin("com.github.WhiteSpike.ShoppingCart", "Shopping Cart", "1.0.2")]
[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.ShoppingCart");
internal static readonly ManualLogSource mls = Logger.CreateLogSource("Shopping Cart");
internal static readonly List<AudioClip> wheelsNoise = new List<AudioClip>();
public static PluginConfig Config;
private void Awake()
{
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: 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_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
//IL_031b: Unknown result type (might be due to invalid IL or missing references)
//IL_0320: Unknown result type (might be due to invalid IL or missing references)
//IL_0331: Unknown result type (might be due to invalid IL or missing references)
//IL_0336: Unknown result type (might be due to invalid IL or missing references)
//IL_033b: Unknown result type (might be due to invalid IL or missing references)
//IL_0345: Expected O, but got Unknown
//IL_034e: Unknown result type (might be due to invalid IL or missing references)
//IL_0353: Unknown result type (might be due to invalid IL or missing references)
//IL_0365: Expected O, but got Unknown
Config = new PluginConfig(((BaseUnityPlugin)this).Config);
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "shoppingcart");
AssetBundle val = AssetBundle.LoadFromFile(text);
string text2 = "Assets/Shopping Cart/";
Item val2 = ScriptableObject.CreateInstance<Item>();
((Object)val2).name = "ShoppingCartItemProperties";
val2.allowDroppingAheadOfPlayer = SyncedEntry<bool>.op_Implicit(Config.DROP_AHEAD_PLAYER);
val2.canBeGrabbedBeforeGameStart = SyncedEntry<bool>.op_Implicit(Config.GRABBED_BEFORE_START);
val2.canBeInspected = false;
val2.isScrap = true;
val2.minValue = SyncedEntry<int>.op_Implicit(Config.MINIMUM_VALUE);
val2.maxValue = SyncedEntry<int>.op_Implicit(Config.MAXIMUM_VALUE);
val2.floorYOffset = -90;
val2.restingRotation = new Vector3(0f, 0f, 0f);
val2.rotationOffset = new Vector3(0f, 0f, 0f);
val2.positionOffset = new Vector3(0f, -1.7f, 0.35f);
val2.weight = 0.99f + (float)SyncedEntry<int>.op_Implicit(Config.WEIGHT) / 100f;
val2.twoHanded = true;
val2.itemIcon = val.LoadAsset<Sprite>(text2 + "Icon.png");
val2.spawnPrefab = val.LoadAsset<GameObject>(text2 + "ShoppingCart.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");
wheelsNoise.Add(AssetBundleHandler.TryLoadAudioClipAsset(val, text2 + "Shopping_Cart_Move_1.ogg"));
wheelsNoise.Add(AssetBundleHandler.TryLoadAudioClipAsset(val, text2 + "Shopping_Cart_Move_2.ogg"));
wheelsNoise.Add(AssetBundleHandler.TryLoadAudioClipAsset(val, text2 + "Shopping_Cart_Move_3.ogg"));
wheelsNoise.Add(AssetBundleHandler.TryLoadAudioClipAsset(val, text2 + "Shopping_Cart_Move_4.ogg"));
val2.highestSalePercentage = 0;
val2.itemName = "Shopping Cart";
val2.itemSpawnsOnGround = true;
val2.isConductiveMetal = SyncedEntry<bool>.op_Implicit(Config.CONDUCTIVE);
val2.requiresBattery = false;
val2.batteryUsage = 0f;
val2.twoHandedAnimation = true;
val2.grabAnim = "HoldJetpack";
ShoppingCartBehaviour shoppingCartBehaviour = val2.spawnPrefab.AddComponent<ShoppingCartBehaviour>();
((GrabbableObject)shoppingCartBehaviour).itemProperties = val2;
((GrabbableObject)shoppingCartBehaviour).grabbable = true;
((GrabbableObject)shoppingCartBehaviour).grabbableToEnemies = true;
Utilities.FixMixerGroups(val2.spawnPrefab);
NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
Items.RegisterItem(val2);
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 val3 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>();
val3.spawnableMapObject = new SpawnableMapObject
{
prefabToSpawn = val2.spawnPrefab
};
MapObjects.RegisterMapObject(val3, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel _) => curve));
InputUtilsCompat.Init();
harmony.PatchAll(typeof(Keybinds));
mls.LogInfo((object)"Shopping Cart 1.0.2 has been loaded successfully.");
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "ShoppingCart";
public const string PLUGIN_NAME = "ShoppingCart";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace ShoppingCart.Util
{
internal static class Constants
{
internal const string ITEM_SCAN_NODE_KEY_FORMAT = "Enable scan node of {0}";
internal const bool ITEM_SCAN_NODE_DEFAULT = true;
internal const string ITEM_SCAN_NODE_DESCRIPTION = "Shows a scan node on the item when scanning";
internal const string SHOPPING_CART_RARITY_KEY = "Spawn Chance of the Shopping Cart Item";
internal const float SHOPPING_CART_RARITY_DEFAULT = 0.1f;
internal const string SHOPPING_CART_RARITY_DESCRIPTION = "How likely it is for a Shopping Cart item to spawn when landing on a moon. (0.1 = 10%)";
internal const string SHOPPING_CART_WEIGHT_KEY = "Weight of the Shopping Cart Item";
internal const int SHOPPING_CART_WEIGHT_DEFAULT = 25;
internal const string SHOPPING_CART_WEIGHT_DESCRIPTION = "Weight of the Shopping Cart without any items in lbs";
internal const string SHOPPING_CART_CONDUCTIVE_KEY = "Conductive";
internal const bool SHOPPING_CART_CONDUCTIVE_DEFAULT = true;
internal const string SHOPPING_CART_CONDUCTIVE_DESCRIPTION = "Wether it attracts lightning to the item or not. (Or other mechanics that rely on item being conductive)";
internal const string SHOPPING_CART_DROP_AHEAD_PLAYER_KEY = "Drop ahead of player when dropping";
internal const bool SHOPPING_CART_DROP_AHEAD_PLAYER_DEFAULT = true;
internal const string SHOPPING_CART_DROP_AHEAD_PLAYER_DESCRIPTION = "If on, the item will drop infront of the player. Otherwise, drops underneath them and slightly infront.";
internal const string SHOPPING_CART_GRABBED_BEFORE_START_KEY = "Grabbable before game start";
internal const bool SHOPPING_CART_GRABBED_BEFORE_START_DEFAULT = true;
internal const string SHOPPING_CART_GRABBED_BEFORE_START_DESCRIPTION = "Allows wether the item can be grabbed before hand or not";
internal const string SHOPPING_CART_HIGHEST_SALE_PERCENTAGE_KEY = "Highest Sale Percentage";
internal const int SHOPPING_CART_HIGHEST_SALE_PERCENTAGE_DEFAULT = 50;
internal const string SHOPPING_CART_HIGHEST_SALE_PERCENTAGE_DESCRIPTION = "Maximum percentage of sale allowed when this item is selected for a sale.";
internal const string SHOPPING_CART_RESTRICTION_MODE_KEY = "Restrictions on the Shopping Cart Item";
internal const Restrictions SHOPPING_CART_RESTRICTION_MODE_DEFAULT = 2;
internal const string SHOPPING_CART_RESTRICTION_MODE_DESCRIPTION = "Restriction applied when trying to insert an item on the Shopping Cart.\nSupported values: None, ItemCount, TotalWeight, All";
internal const string SHOPPING_CART_MINIMUM_VALUE_KEY = "Minimum scrap value of Shopping Cart";
internal const int SHOPPING_CART_MINIMUM_VALUE_DEFAULT = 50;
internal const string SHOPPING_CART_MINIMUM_VALUE_DESCRIPTION = "Lower boundary of the scrap's possible value";
internal const string SHOPPING_CART_MAXIMUM_VALUE_KEY = "Maximum scrap value of Shopping Cart";
internal const int SHOPPING_CART_MAXIMUM_VALUE_DEFAULT = 100;
internal const string SHOPPING_CART_MAXIMUM_VALUE_DESCRIPTION = "Higher boundary of the scrap's possible value";
internal const string SHOPPING_CART_MAXIMUM_WEIGHT_ALLOWED_KEY = "Maximum amount of weight for Shopping Cart";
internal const float SHOPPING_CART_MAXIMUM_WEIGHT_ALLOWED_DEFAULT = 100f;
internal const string SHOPPING_CART_MAXIMUM_WEIGHT_ALLOWED_DESCRIPTION = "How much weight (in lbs and after weight reduction multiplier is applied on the stored items) a Shopping Cart can carry in items before it is considered full.";
internal const string SHOPPING_CART_MAXIMUM_AMOUNT_ITEMS_KEY = "Maximum amount of items for Shopping Cart";
internal const int SHOPPING_CART_MAXIMUM_AMOUNT_ITEMS_DEFAULT = 6;
internal const string SHOPPING_CART_MAXIMUM_AMOUNT_ITEMS_DESCRIPTION = "Amount of items allowed before the Shopping Cart is considered full";
internal const string SHOPPING_CART_WEIGHT_REDUCTION_MULTIPLIER_KEY = "Weight reduction multiplier for Shopping Cart";
internal const float SHOPPING_CART_WEIGHT_REDUCTION_MULTIPLIER_DEFAULT = 0.5f;
internal const string SHOPPING_CART_WEIGHT_REDUCTION_MUTLIPLIER_DESCRIPTION = "How much an item's weight will be ignored to the Shopping Cart's total weight";
internal const string SHOPPING_CART_NOISE_RANGE_KEY = "Noise range of the Shopping Cart Item";
internal const float SHOPPING_CART_NOISE_RANGE_DEFAULT = 14f;
internal const string SHOPPING_CART_NOISE_RANGE_DESCRIPTION = "How far the Shopping Cart sound propagates to nearby enemies when in movement";
internal const string SHOPPING_CART_LOOK_SENSITIVITY_DRAWBACK_KEY = "Look sensitivity drawback of the Shopping Cart Item";
internal const float SHOPPING_CART_LOOK_SENSITIVITY_DRAWBACK_DEFAULT = 0.4f;
internal const string SHOPPING_CART_LOOK_SENSITIVITY_DRAWBACK_DESCRIPTION = "Value multiplied on the player's look sensitivity when moving with the Shopping Cart Item";
internal const string SHOPPING_CART_MOVEMENT_SLOPPY_KEY = "Sloppiness of the Shopping Cart Item";
internal const float SHOPPING_CART_MOVEMENT_SLOPPY_DEFAULT = 5f;
internal const string SHOPPING_CART_MOVEMENT_SLOPPY_DESCRIPTION = "Value multiplied on the player's movement to give the feeling of drifting while carrying the Shopping Cart Item";
internal const string SHOPPING_CART_PLAY_NOISE_KEY = "Plays noises for players with Shopping Cart Item";
internal const bool SHOPPING_CART_PLAY_NOISE_DEFAULT = true;
internal const string SHOPPING_CART_PLAY_NOISE_DESCRIPTION = "If false, it will just not play the sounds, it will still attract monsters to noise";
internal const string DROP_ALL_ITEMS_SHOPPING_CART_KEYBIND_NAME = "Drop all items from wheelbarrow";
internal const string DROP_ALL_ITEMS_SHOPPING_CART_DEFAULT_KEYBIND = "<Mouse>/middleButton";
internal static readonly string SHOPPING_CART_SCAN_NODE_KEY = string.Format("Enable scan node of {0}", "Shopping Cart");
}
}
namespace ShoppingCart.Misc
{
[DataContract]
public class PluginConfig : SyncedConfig2<PluginConfig>
{
[field: SyncedEntryField]
public SyncedEntry<float> RARITY { get; set; }
[field: SyncedEntryField]
public SyncedEntry<bool> SCAN_NODE { get; set; }
[field: SyncedEntryField]
public SyncedEntry<int> MINIMUM_VALUE { get; set; }
[field: SyncedEntryField]
public SyncedEntry<int> MAXIMUM_VALUE { 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<Restrictions> RESTRICTION_MODE { get; set; }
[field: SyncedEntryField]
public SyncedEntry<int> MAXIMUM_AMOUNT_ITEMS { get; set; }
[field: SyncedEntryField]
public SyncedEntry<float> MAXIMUM_WEIGHT_ALLOWED { get; set; }
[field: SyncedEntryField]
public SyncedEntry<float> WEIGHT_REDUCTION_MULTIPLIER { get; set; }
[field: SyncedEntryField]
public SyncedEntry<float> LOOK_SENSITIVITY_DRAWBACK { get; set; }
[field: SyncedEntryField]
public SyncedEntry<float> MOVEMENT_SLOPPY { get; set; }
[field: SyncedEntryField]
public SyncedEntry<float> NOISE_RANGE { get; set; }
[field: SyncedEntryField]
public SyncedEntry<bool> PLAY_NOISE { get; set; }
public PluginConfig(ConfigFile cfg)
: base("com.github.WhiteSpike.ShoppingCart")
{
string text = "Shopping Cart";
MINIMUM_VALUE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Minimum scrap value of Shopping Cart", 50, "Lower boundary of the scrap's possible value");
MAXIMUM_VALUE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Maximum scrap value of Shopping Cart", 100, "Higher boundary of the scrap's possible value");
RARITY = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Spawn Chance of the Shopping Cart Item", 0.1f, "How likely it is for a Shopping Cart item to spawn when landing on a moon. (0.1 = 10%)");
WEIGHT = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Weight of the Shopping Cart Item", 25, "Weight of the Shopping Cart without any items in lbs");
SCAN_NODE = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, Constants.SHOPPING_CART_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");
RESTRICTION_MODE = SyncedBindingExtensions.BindSyncedEntry<Restrictions>(cfg, text, "Restrictions on the Shopping Cart Item", (Restrictions)2, "Restriction applied when trying to insert an item on the Shopping Cart.\nSupported values: None, ItemCount, TotalWeight, All");
MAXIMUM_WEIGHT_ALLOWED = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Maximum amount of weight for Shopping Cart", 100f, "How much weight (in lbs and after weight reduction multiplier is applied on the stored items) a Shopping Cart can carry in items before it is considered full.");
MAXIMUM_AMOUNT_ITEMS = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Maximum amount of items for Shopping Cart", 6, "Amount of items allowed before the Shopping Cart is considered full");
WEIGHT_REDUCTION_MULTIPLIER = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Weight reduction multiplier for Shopping Cart", 0.5f, "How much an item's weight will be ignored to the Shopping Cart's total weight");
NOISE_RANGE = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Noise range of the Shopping Cart Item", 14f, "How far the Shopping Cart sound propagates to nearby enemies when in movement");
LOOK_SENSITIVITY_DRAWBACK = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Look sensitivity drawback of the Shopping Cart Item", 0.4f, "Value multiplied on the player's look sensitivity when moving with the Shopping Cart Item");
MOVEMENT_SLOPPY = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, text, "Sloppiness of the Shopping Cart Item", 5f, "Value multiplied on the player's movement to give the feeling of drifting while carrying the Shopping Cart Item");
PLAY_NOISE = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Plays noises for players with Shopping Cart Item", true, "If false, it will just not play the sounds, it will still attract monsters to noise");
ConfigManager.Register<PluginConfig>((SyncedConfig2<PluginConfig>)this);
}
}
internal static class Metadata
{
public const string GUID = "com.github.WhiteSpike.ShoppingCart";
public const string NAME = "Shopping Cart";
public const string VERSION = "1.0.2";
}
internal static class Tools
{
internal enum NodeType
{
GENERAL,
DANGER,
SCRAP
}
private static GameObject CreateCanvasScanNode(ref GameObject objectToAddScanNode)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(GameObject.CreatePrimitive((PrimitiveType)3), objectToAddScanNode.transform.position, Quaternion.Euler(Vector3.zero), objectToAddScanNode.transform);
((Object)val).name = "ScanNode";
val.layer = LayerMask.NameToLayer("ScanNode");
Object.Destroy((Object)(object)val.GetComponent<MeshRenderer>());
Object.Destroy((Object)(object)val.GetComponent<MeshFilter>());
return val;
}
private static void AddScanNode(GameObject objectToAddScanNode, NodeType nodeType, string header = "LGU Scan Node", string subText = "Used for LGU stuff", int creatureScanID = -1, int minRange = 2, int maxRange = 7)
{
GameObject val = CreateCanvasScanNode(ref objectToAddScanNode);
ScanNodeProperties scanNodeProperties = val.AddComponent<ScanNodeProperties>();
ChangeScanNode(ref scanNodeProperties, nodeType, header, subText, creatureScanID, 0, minRange, maxRange);
}
public static void AddScrapScanNode(GameObject objectToAddScanNode, string header = "LGU Scan Node", string subText = "Used for LGU stuff", int creatureScanID = -1, int minRange = 2, int maxRange = 7)
{
AddScanNode(objectToAddScanNode, NodeType.SCRAP, header, subText, creatureScanID, minRange, maxRange);
}
public static void ChangeScanNode(ref ScanNodeProperties scanNodeProperties, NodeType nodeType, string header = "LGU Scan Node", string subText = "Used for LGU stuff", int creatureScanID = -1, int scrapValue = 0, int minRange = 2, int maxRange = 7)
{
scanNodeProperties.headerText = header;
scanNodeProperties.subText = subText;
scanNodeProperties.nodeType = (int)nodeType;
scanNodeProperties.creatureScanID = creatureScanID;
scanNodeProperties.scrapValue = scrapValue;
scanNodeProperties.minRange = minRange;
scanNodeProperties.maxRange = maxRange;
}
}
}
namespace ShoppingCart.Input
{
internal class IngameKeybinds : LcInputActions
{
public static IngameKeybinds Instance;
[InputAction("<Mouse>/middleButton", Name = "Drop all items from wheelbarrow")]
public InputAction ShoppingCartKey { 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 ShoppingCartAction;
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];
ShoppingCartAction = InputUtilsCompat.ShoppingCartKey;
}
[HarmonyPatch(typeof(StartOfRound), "OnEnable")]
[HarmonyPostfix]
public static void OnEnable()
{
Asset.Enable();
ShoppingCartAction.performed += OnShoppingCartActionPerformed;
}
[HarmonyPatch(typeof(StartOfRound), "OnDisable")]
[HarmonyPostfix]
public static void OnDisable()
{
Asset.Disable();
ShoppingCartAction.performed -= OnShoppingCartActionPerformed;
}
private static void OnShoppingCartActionPerformed(CallbackContext context)
{
if (!((Object)(object)localPlayerController == (Object)null) && localPlayerController.isPlayerControlled && (!((NetworkBehaviour)localPlayerController).IsServer || localPlayerController.isHostPlayerObject) && Object.op_Implicit((Object)(object)localPlayerController.currentlyHeldObjectServer))
{
ShoppingCartBehaviour component = ((Component)localPlayerController.currentlyHeldObjectServer).GetComponent<ShoppingCartBehaviour>();
if (Object.op_Implicit((Object)(object)component))
{
((ContainerBehaviour)component).UpdateContainerDrop();
}
}
}
}
}
namespace ShoppingCart.Compat
{
public static class InputUtilsCompat
{
internal static InputActionAsset Asset => IngameKeybinds.GetAsset();
public static InputAction ShoppingCartKey => IngameKeybinds.Instance.ShoppingCartKey;
internal static void Init()
{
IngameKeybinds.Instance = new IngameKeybinds();
}
}
}
namespace ShoppingCart.Behaviour
{
internal class ShoppingCartBehaviour : ContainerBehaviour
{
internal const string ITEM_NAME = "Shopping Cart";
protected bool KeepScanNode => SyncedEntry<bool>.op_Implicit(Plugin.Config.SCAN_NODE);
public override void Start()
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
((ContainerBehaviour)this).Start();
PluginConfig config = Plugin.Config;
base.maximumAmountItems = config.MAXIMUM_AMOUNT_ITEMS.Value;
base.weightReduceMultiplier = config.WEIGHT_REDUCTION_MULTIPLIER.Value;
base.restriction = SyncedEntry<Restrictions>.op_Implicit(config.RESTRICTION_MODE);
base.maximumWeightAllowed = config.MAXIMUM_WEIGHT_ALLOWED.Value;
base.noiseRange = config.NOISE_RANGE.Value;
base.sloppiness = config.MOVEMENT_SLOPPY.Value;
base.lookSensitivityDrawback = config.LOOK_SENSITIVITY_DRAWBACK.Value;
base.playSounds = config.PLAY_NOISE.Value;
base.wheelsClip = Plugin.wheelsNoise.ToArray();
if (((GrabbableObject)this).scrapValue <= 0)
{
Random random = new Random(StartOfRound.Instance.randomMapSeed + 45);
((GrabbableObject)this).SetScrapValue(random.Next(config.MINIMUM_VALUE.Value, config.MAXIMUM_VALUE.Value));
}
if (!KeepScanNode)
{
Object.Destroy((Object)(object)((Component)this).gameObject.GetComponentInChildren<ScanNodeProperties>());
}
}
protected override void SetupScanNodeProperties()
{
ScanNodeProperties scanNodeProperties = ((Component)this).GetComponentInChildren<ScanNodeProperties>();
if ((Object)(object)scanNodeProperties != (Object)null)
{
Tools.ChangeScanNode(ref scanNodeProperties, (Tools.NodeType)scanNodeProperties.nodeType, "Shopping Cart");
}
else
{
Tools.AddScrapScanNode(((Component)this).gameObject, "Shopping Cart");
}
}
protected override string[] SetupContainerTooltips()
{
string bindingDisplayString = InputActionRebindingExtensions.GetBindingDisplayString(IngameKeybinds.Instance.ShoppingCartKey, (DisplayStringOptions)0, (string)null);
return new string[1] { "Drop all items: [" + bindingDisplayString + "]" };
}
protected override bool ShowDepositPrompts()
{
PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
return localPlayerController.isHoldingObject && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)(object)localPlayerController;
}
protected override void __initializeVariables()
{
((ContainerBehaviour)this).__initializeVariables();
}
protected internal override string __getTypeName()
{
return "ShoppingCartBehaviour";
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace ShoppingCart.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}