Decompiled source of RemoveTaredStatus v1.0.0

RemoveTaredStatus.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
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: AssemblyTitle("RemoveTaredStatus")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RemoveTaredStatus")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("756D5299-78E1-4341-9DED-BFB063114C12")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RemoveTaredStatus;

[BepInPlugin("com.sighsorry.removetaredstatus", "RemoveTaredStatus", "1.0.0")]
public class RemoveTaredStatusPlugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(Player), "ConsumeItem")]
	public static class Patch_Player_ConsumeItem
	{
		private static void Postfix(Player __instance, ItemData item)
		{
			object obj;
			if (item == null)
			{
				obj = null;
			}
			else
			{
				GameObject dropPrefab = item.m_dropPrefab;
				obj = ((dropPrefab != null) ? ((Object)dropPrefab).name : null);
			}
			if ((string?)obj != "VC_FulingMedicine")
			{
				return;
			}
			SEMan sEMan = ((Character)__instance).GetSEMan();
			if (sEMan == null)
			{
				return;
			}
			List<StatusEffect> statusEffects = sEMan.GetStatusEffects();
			for (int num = statusEffects.Count - 1; num >= 0; num--)
			{
				StatusEffect val = statusEffects[num];
				if (((Object)val).name.Equals("Tared", StringComparison.OrdinalIgnoreCase))
				{
					sEMan.RemoveStatusEffect(val, false);
					Debug.Log((object)("[RemoveTaredStatus] VC_FulingMedicine consumed. Removed status effect: " + ((Object)val).name));
				}
			}
		}
	}

	private readonly Harmony _harmony = new Harmony("com.sighsorry.removetaredstatus");

	private void Awake()
	{
		_harmony.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"RemoveTaredStatus Plugin Loaded!");
	}
}