using System;
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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
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: AssemblyCompany("LethalLootBug")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A LootBug mod for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyInformationalVersion("1.0.3")]
[assembly: AssemblyProduct("LethalLootBug")]
[assembly: AssemblyTitle("LethalLootBug")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.3.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace LethalLootBug
{
[BepInPlugin("LethalLootBug", "LethalLootBug", "1.0.3")]
public class Plugin : BaseUnityPlugin
{
public class FakeItem : GrabbableObject
{
private Vector3? initialPosition = null;
private Quaternion? initialRotation = null;
private float? grabHeightDiff = null;
private bool grabbedLastFrame = false;
public override void Start()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Expected O, but got Unknown
base.grabbableToEnemies = true;
base.grabbable = true;
base.propColliders = (Collider[])(object)new Collider[0];
base.itemProperties = new Item();
base.itemProperties.isScrap = false;
}
public override void Update()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
if (!initialPosition.HasValue)
{
initialPosition = ((Component)this).transform.position;
}
if (!initialRotation.HasValue)
{
initialRotation = ((Component)this).transform.rotation;
}
}
public override void LateUpdate()
{
//IL_008e: 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_00ba: 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_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).LateUpdate();
if ((Object)(object)base.parentObject != (Object)null)
{
if (!grabbedLastFrame)
{
grabbedLastFrame = true;
}
else if (!grabHeightDiff.HasValue)
{
grabHeightDiff = ((Component)this).transform.position.y - initialPosition.Value.y;
}
}
else if (grabbedLastFrame)
{
((Component)this).transform.position = new Vector3(((Component)this).transform.position.x, ((Component)this).transform.position.y - grabHeightDiff.Value, ((Component)this).transform.position.z);
((Component)this).transform.rotation = initialRotation.Value;
grabbedLastFrame = false;
}
}
}
private Harmony _harmony = new Harmony("LethalLootBug");
public static ManualLogSource Logger;
public static ConfigEntry<bool> CanGrabTurret;
public static ConfigEntry<bool> CanGrabMine;
private void Awake()
{
Logger = Logger.CreateLogSource("LethalLootBug");
Logger.LogInfo((object)"Plugin LethalLootBug is loading.");
CanGrabTurret = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Grab Turret", "GrabTurret", true, "Whether or not the Lootbugs can grab Turrets");
CanGrabMine = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Grab Mine", "GrabMine", true, "Whether or not the Lootbugs can grab Mines");
Logger.LogInfo((object)"Loaded LethalLootBug. Patching.");
_harmony.PatchAll(typeof(Plugin));
}
[HarmonyPatch(typeof(RoundManager), "GenerateNewLevelClientRpc")]
[HarmonyPostfix]
public static void GameStart(RoundManager __instance, int randomSeed, int levelID)
{
SpawnableMapObject[] spawnableMapObjects = __instance.spawnableMapObjects;
foreach (SpawnableMapObject val in spawnableMapObjects)
{
if ((Object)(object)val.prefabToSpawn.GetComponentInChildren<Turret>() != (Object)null)
{
if ((Object)(object)val.prefabToSpawn.GetComponent<FakeItem>() == (Object)null)
{
val.prefabToSpawn.AddComponent<FakeItem>();
}
}
else if ((Object)(object)val.prefabToSpawn.GetComponentInChildren<Landmine>() != (Object)null && (Object)(object)val.prefabToSpawn.GetComponent<FakeItem>() == (Object)null)
{
val.prefabToSpawn.AddComponent<FakeItem>();
}
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "LethalLootBug";
public const string PLUGIN_NAME = "LethalLootBug";
public const string PLUGIN_VERSION = "1.0.3";
}
}