Decompiled source of RobeCalling v1.0.3

RobeCalling.dll

Decompiled a month ago
using System;
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 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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("Vippy")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyInformationalVersion("1.0.3+b47e5b6174b7801bdc84df0c17447c4ccbd92150")]
[assembly: AssemblyProduct("RobeCalling")]
[assembly: AssemblyTitle("RobeCalling")]
[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.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 RobeCalling
{
	internal static class BuildInfo
	{
		public const string Version = "1.0.3";
	}
	[BepInPlugin("Vippy.RobeCalling", "RobeCalling", "1.0.3")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(PhoneValuable), "Start")]
		private class PhonePatch
		{
			private static void Postfix(PhoneValuable __instance)
			{
				if ((Object)(object)_clip != (Object)null && __instance.ringTone?.Sounds != null)
				{
					for (int i = 0; i < __instance.ringTone.Sounds.Length; i++)
					{
						__instance.ringTone.Sounds[i] = _clip;
					}
					if ((Object)(object)__instance.ringTone.Source != (Object)null)
					{
						__instance.ringTone.Source.clip = _clip;
					}
				}
				if ((Object)(object)_emission != (Object)null)
				{
					MeshRenderer componentInChildren = ((Component)__instance).GetComponentInChildren<MeshRenderer>();
					if ((Object)(object)componentInChildren != (Object)null && ((Renderer)componentInChildren).material.HasProperty("_EmissionMap"))
					{
						((Renderer)componentInChildren).material.SetTexture("_EmissionMap", (Texture)(object)_emission);
					}
				}
			}
		}

		private static AudioClip? _clip;

		private static Texture2D? _emission;

		private void Awake()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "RobeCalling.bundle"));
			if (!((Object)(object)val == (Object)null))
			{
				_clip = val.LoadAsset<AudioClip>("phone ringtone_robe");
				_emission = val.LoadAsset<Texture2D>("arctic small valuables_DefaultMaterial_Emissive_Robe");
				new Harmony("Vippy.RobeCalling").PatchAll();
			}
		}
	}
}