Decompiled source of Nortdrew v1.2.1

plugins/Huskslay-Nortdrew.dll

Decompiled a day ago
using System;
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.Logging;
using Dawn.Utils;
using Dusk;
using HarmonyLib;
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.2.1.0")]
[assembly: AssemblyInformationalVersion("1.2.1+805174ddbe5c378f5bd354feb297445c09e10309")]
[assembly: AssemblyProduct("Nortdrew")]
[assembly: AssemblyTitle("Huskslay-Nortdrew")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.1.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.2.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Nortdrew : BaseUnityPlugin
	{
		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Huskslay-Nortdrew v1.2.1 is loading...");
			AssetBundle val = AssetBundleUtils.LoadBundle(Assembly.GetExecutingAssembly(), "nortdrew.main");
			DuskMod val2 = DuskMod.RegisterMod((BaseUnityPlugin)(object)this, val);
			val2.RegisterContentHandlers();
			Logger.LogInfo((object)"Huskslay-Nortdrew v1.2.1 has loaded!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Huskslay-Nortdrew";

		public const string PLUGIN_NAME = "Nortdrew";

		public const string PLUGIN_VERSION = "1.2.1";
	}
}
namespace Nortdrew.Items
{
	public class Andrew : Lovers<Norton>
	{
	}
	public class ItemContentHandler : ContentHandler<ItemContentHandler>
	{
		public class DevToolsAssets : AssetBundleLoader<DevToolsAssets>
		{
			public DevToolsAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public DevToolsAssets? DevTools = null;

		public ItemContentHandler(DuskMod mod)
			: base(mod)
		{
			((ContentHandler)this).RegisterContent<DevToolsAssets>("nortdrew", ref DevTools, false);
		}
	}
	public class Lovers : PhysicsProp
	{
		public LoversPair? loversPair;

		public bool loved = false;

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			loversPair?.Init(loved);
		}

		public override int GetItemDataToSave()
		{
			((GrabbableObject)this).GetItemDataToSave();
			return loved ? 1 : 0;
		}

		public override void LoadItemSaveData(int saveData)
		{
			((GrabbableObject)this).LoadItemSaveData(saveData);
			loved = saveData > 0;
		}

		public void Love()
		{
			if (!((Object)(object)loversPair == (Object)null))
			{
				loversPair.Love(ScrapValueServerRpc, ref loved);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ScrapValueServerRpc(int newValue)
		{
			ScrapValueClientRpc(newValue);
		}

		[ClientRpc]
		public void ScrapValueClientRpc(int newValue)
		{
			((GrabbableObject)this).SetScrapValue(newValue);
		}
	}
	public class Lovers<T> : Lovers where T : PhysicsProp
	{
		private static readonly float sexDistance = 0.15f;

		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, sexDistance);
			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 class LoversPair : MonoBehaviour
	{
		public ScanNodeProperties? scanNode;

		public GameObject? particles;

		public AudioSource? audioSource;

		public AudioClip? sexSfx;

		public void Love(Action<int> ScrapValueServerRpc, ref bool loved)
		{
			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);
				}
				GameObject? obj = particles;
				if (obj != null)
				{
					obj.gameObject.SetActive(true);
				}
			}
		}

		public void Init(bool loved)
		{
			GameObject? obj = particles;
			if (obj != null)
			{
				obj.gameObject.SetActive(loved);
			}
		}
	}
	public class Norton : Lovers<Andrew>
	{
	}
}