Decompiled source of SafeRubberDuck v1.0.1

BepInEx/plugins/RepoSafeRubberDuck.dll

Decompiled 11 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RepoSafeRubberDuck")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("RepoSafeRubberDuck")]
[assembly: AssemblyTitle("RepoSafeRubberDuck")]
[assembly: AssemblyVersion("1.0.1.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 RepoSafeRubberDuck
{
	[BepInPlugin("sunwo.reposaferubberduck", "Safe Rubber Duck", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		public const string Guid = "sunwo.reposaferubberduck";

		private void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("sunwo.reposaferubberduck").PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Rubber ducks are just cute ducks now.");
		}
	}
	[HarmonyPatch(typeof(ItemRubberDuck), "Quack")]
	internal static class QuackPatch
	{
		private static bool Prefix(ItemRubberDuck __instance, ItemBattery ___itemBattery, PhysGrabObject ___physGrabObject)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if (___itemBattery.batteryLife <= 0f || ___physGrabObject.grabbed)
			{
				return false;
			}
			__instance.soundQuack.Play(((Component)__instance).transform.position, 1f, 1f, 1f, 1f);
			return false;
		}
	}
	[HarmonyPatch(typeof(ItemRubberDuck), "Update")]
	internal static class NeverEmptyPatch
	{
		private static void Postfix(ItemBattery ___itemBattery)
		{
			___itemBattery.batteryLife = 100f;
		}
	}
}