using System;
using System.Collections.Generic;
using System.Diagnostics;
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.Configuration;
using BepInEx.Logging;
using CruiserAddition_MoveFilter;
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("HitsujiSauce.CruiserAddition_MoveFilter")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CruiserAddition_MoveFilter")]
[assembly: AssemblyTitle("HitsujiSauce.CruiserAddition_MoveFilter")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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.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;
}
}
}
public class CruiserAdditionsMoveFilterConfig
{
public static ConfigEntry<string> excludedItems;
public static List<string> itemList;
public static void Load(ConfigFile config)
{
excludedItems = config.Bind<string>("General", "ExcludedItems", "Shotgun,Kitchen knife", "List of items to be excluded.Separate by comma.");
itemList = new List<string>();
string[] array = excludedItems.Value.Split(",");
foreach (string text in array)
{
itemList.Add(text.Trim());
}
}
public static bool isExcludedItem(string itemName)
{
foreach (string item in itemList)
{
if (itemName.Contains(item, StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
return false;
}
}
[HarmonyPatch(typeof(StartOfRound), "ShipHasLeft")]
public static class Patch_ShipHasLeft
{
public class ItemBackup
{
public Transform parent;
public Vector3 position;
public Quaternion rotation;
public GrabbableObject item;
}
public static List<ItemBackup> excludedItemsBackup = new List<ItemBackup>();
[HarmonyPrefix]
public static void Prefix()
{
//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_0101: 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)
excludedItemsBackup.Clear();
VehicleController cruiser = Object.FindObjectOfType<VehicleController>();
if ((Object)(object)cruiser == (Object)null)
{
return;
}
List<GrabbableObject> list = (from obj in Object.FindObjectsOfType<GrabbableObject>()
where ((Component)obj).transform.IsChildOf(((Component)cruiser).transform) && !(obj is RagdollGrabbableObject) && obj.itemProperties.isScrap
select obj).ToList();
foreach (GrabbableObject item in list)
{
if (!((Object)(object)item == (Object)null) && !((Object)(object)item.itemProperties == (Object)null) && (Object)(object)((Component)item).transform.parent == (Object)(object)((Component)cruiser).transform && CruiserAdditionsMoveFilterConfig.isExcludedItem(item.itemProperties.itemName))
{
excludedItemsBackup.Add(new ItemBackup
{
item = item,
parent = ((Component)item).transform.parent,
position = ((Component)item).transform.localPosition,
rotation = ((Component)item).transform.localRotation
});
CruiserAdditionMoveFilter.Logger.LogInfo((object)("Save position :" + item.itemProperties.itemName));
}
}
}
}
[HarmonyPatch(typeof(StartOfRound), "EndOfGame")]
public static class Patch_EndOfGame
{
[HarmonyPostfix]
public static void Postfix()
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: 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_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: 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)
foreach (Patch_ShipHasLeft.ItemBackup item in Patch_ShipHasLeft.excludedItemsBackup)
{
((Component)item.item).transform.SetParent(item.parent);
((Component)item.item).transform.position = item.position;
((Component)item.item).transform.rotation = item.rotation;
item.item.startFallingPosition = item.position;
item.item.targetFloorPosition = item.position;
item.item.hasHitGround = true;
Rigidbody component = ((Component)item.item).GetComponent<Rigidbody>();
if ((Object)(object)component != (Object)null)
{
component.velocity = Vector3.zero;
component.angularVelocity = Vector3.zero;
}
Debug.Log((object)$"Restored {item.item.itemProperties.itemName} to {item.position}");
}
Patch_ShipHasLeft.excludedItemsBackup.Clear();
}
}
namespace CruiserAddition_MoveFilter
{
[BepInPlugin("HitsujiSauce.CruiserAddition_MoveFilter", "CruiserAddition_MoveFilter", "1.0.0")]
public class CruiserAdditionMoveFilter : BaseUnityPlugin
{
public static CruiserAdditionMoveFilter Instance { get; private set; }
internal static ManualLogSource Logger { get; private set; }
internal static Harmony? Harmony { get; set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
Patch();
CruiserAdditionsMoveFilterConfig.Load(((BaseUnityPlugin)this).Config);
Logger.LogInfo((object)"HitsujiSauce.CruiserAddition_MoveFilter 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("HitsujiSauce.CruiserAddition_MoveFilter");
}
Harmony.PatchAll();
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "HitsujiSauce.CruiserAddition_MoveFilter";
public const string PLUGIN_NAME = "CruiserAddition_MoveFilter";
public const string PLUGIN_VERSION = "1.0.0";
}
}