Decompiled source of RepoCoinScaleMod v1.0.3

RepoCoinScaleMod.dll

Decompiled 2 days ago
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
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("RepoCoinScaleMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RepoCoinScaleMod")]
[assembly: AssemblyTitle("RepoCoinScaleMod")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RepoCoinScaleMod;

[BepInPlugin("com.myname.repocoinscale", "Repo Coin Scale Mod", "3.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("com.myname.repocoinscale");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[컴포넌트 저격] 오직 세금 상자(CosmeticWorldObject)만 축소하는 종결 패치가 활성화되었습니다!");
	}
}
[HarmonyPatch(typeof(NotValuableObject), "Start")]
public static class SmoothCoinScalePatch
{
	[HarmonyPostfix]
	private static void Postfix(MonoBehaviour __instance)
	{
		if ((Object)(object)__instance != (Object)null && (Object)(object)((Component)__instance).gameObject != (Object)null)
		{
			CosmeticWorldObjectHealth componentInChildren = ((Component)__instance).GetComponentInChildren<CosmeticWorldObjectHealth>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				__instance.StartCoroutine(SmoothScaleRoutine(__instance));
			}
		}
	}

	private static IEnumerator SmoothScaleRoutine(MonoBehaviour instance)
	{
		while ((Object)(object)instance != (Object)null && (Object)(object)((Component)instance).gameObject != (Object)null)
		{
			if (!((Component)instance).gameObject.activeInHierarchy)
			{
				yield return (object)new WaitForSeconds(0.2f);
				continue;
			}
			PhysGrabObjectImpactDetector detector = ((Component)instance).GetComponent<PhysGrabObjectImpactDetector>();
			if ((Object)(object)detector != (Object)null)
			{
				Vector3 targetScale = (detector.inCart ? new Vector3(0.4f, 0.4f, 0.4f) : new Vector3(1f, 1f, 1f));
				((Component)instance).transform.localScale = Vector3.Lerp(((Component)instance).transform.localScale, targetScale, Time.deltaTime * 8f);
			}
			yield return null;
		}
	}
}