using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using LethalLib.Modules;
using LobbyCompatibility.Attributes;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Huskslay.Nortdrew")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.4.0")]
[assembly: AssemblyInformationalVersion("1.0.4")]
[assembly: AssemblyProduct("Nortdrew")]
[assembly: AssemblyTitle("Huskslay.Nortdrew")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.4.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;
}
}
}
namespace Nortdrew
{
[BepInPlugin("Huskslay.Nortdrew", "Nortdrew", "1.0.4")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[LobbyCompatibility(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Nortdrew : BaseUnityPlugin
{
public static AssetBundle? assetBundle;
public static Nortdrew 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;
RegisterScraps();
Logger.LogInfo((object)"Huskslay.Nortdrew v1.0.4 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("Huskslay.Nortdrew");
}
Logger.LogDebug((object)"Patching...");
Harmony.PatchAll();
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!");
}
private void RegisterScraps()
{
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
assetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "nortdrew"));
if ((Object)(object)assetBundle == (Object)null)
{
Logger.LogError((object)"Failed to load custom assets.");
return;
}
AddScrap(assetBundle, "Assets/Mod/Norton/Norton.asset", 30);
AddScrap(assetBundle, "Assets/Mod/Andrew/Andrew.asset", 30);
}
private void AddScrap(AssetBundle assetBundle, string location, int iRarity)
{
Item val = assetBundle.LoadAsset<Item>(location);
Utilities.FixMixerGroups(val.spawnPrefab);
NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
Items.RegisterScrap(val, iRarity, (LevelTypes)(-1));
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "Huskslay.Nortdrew";
public const string PLUGIN_NAME = "Nortdrew";
public const string PLUGIN_VERSION = "1.0.4";
}
}
namespace Nortdrew.Items
{
public class Andrew : Lovers<Norton>
{
}
public class Lovers : PhysicsProp
{
public LoversPair? loversPair;
public virtual void Love()
{
}
}
public class Lovers<T> : Lovers where T : PhysicsProp
{
public override void OnNetworkSpawn()
{
((NetworkBehaviour)this).OnNetworkSpawn();
}
public override void OnHitGround()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).OnHitGround();
if ((Object)(object)loversPair == (Object)null)
{
return;
}
Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, 1.5f);
List<Lovers> list = new List<Lovers>();
Collider[] array2 = array;
Lovers lovers = default(Lovers);
foreach (Collider val in array2)
{
if (((Component)val).TryGetComponent<Lovers>(ref lovers) && (Object)(object)lovers.loversPair != (Object)null && typeof(T) == ((object)lovers).GetType())
{
list.Add(lovers);
}
}
if (list.Count == 0)
{
return;
}
Love();
foreach (Lovers item in list)
{
item.Love();
}
}
public override void Love()
{
if (!((Object)(object)loversPair == (Object)null))
{
loversPair.Love(ScrapValueServerRpc);
}
}
[ServerRpc(RequireOwnership = false)]
public void ScrapValueServerRpc(int newValue)
{
ScrapValueClientRpc(newValue);
}
[ClientRpc]
public void ScrapValueClientRpc(int newValue)
{
((GrabbableObject)this).SetScrapValue(newValue);
}
}
public class LoversPair : MonoBehaviour
{
public ScanNodeProperties? scanNode;
public GameObject? particles;
public AudioSource? audioSource;
public AudioClip? sexSfx;
protected bool loved;
public void Awake()
{
if ((Object)(object)particles != (Object)null)
{
particles.gameObject.SetActive(false);
}
}
public void Love(Action<int> ScrapValueServerRpc)
{
if ((Object)(object)audioSource != (Object)null && (Object)(object)sexSfx != (Object)null && !audioSource.isPlaying)
{
audioSource.clip = sexSfx;
audioSource.Play();
}
if (!loved)
{
loved = true;
if ((Object)(object)scanNode != (Object)null)
{
ScrapValueServerRpc(scanNode.scrapValue * 2 + 5);
}
if ((Object)(object)particles != (Object)null)
{
particles.gameObject.SetActive(true);
}
}
}
}
public class Norton : Lovers<Andrew>
{
}
}