Decompiled source of dragonbingbong v0.0.5

drakebingbong.dll

Decompiled 3 days ago
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("drakebingbong")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("drakebingbong")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("671468C7-DF20-44BB-86A3-B740F507A1B6")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace drakebingbong;

public static class BingBongGimmick
{
	private static float SinceLastShake;

	private static float TickTimer;

	public static void UpdateGimmick()
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Invalid comparison between Unknown and I4
		if (Character.AllCharacters == null || Character.AllCharacters.Count == 0)
		{
			return;
		}
		float deltaTime = Time.deltaTime;
		SinceLastShake += deltaTime;
		Item heldBingBongItem = BingBongPatches.heldBingBongItem;
		if ((Object)(object)heldBingBongItem != (Object)null && (int)heldBingBongItem.itemState == 1)
		{
			BingBongMechanics.BingBongUnheldFor = 0f;
			TickTimer = 0f;
		}
		else
		{
			BingBongMechanics.BingBongUnheldFor += deltaTime;
		}
		foreach (Character allCharacter in Character.AllCharacters)
		{
			if (!allCharacter.IsLocal)
			{
				continue;
			}
			if (allCharacter.data.passedOutOnTheBeach > 0f)
			{
				BingBongMechanics.BingBongUnheldFor = 0f;
				TickTimer = 0f;
				break;
			}
			if (BingBongMechanics.BingBongUnheldFor > 0.5f && BingBongMechanics.BingBongUnheldFor <= 1f && SinceLastShake > 0f)
			{
				SinceLastShake = 0f;
				GamefeelHandler.instance.AddPerlinShake(0.7f, 0.15f, 15f);
			}
			if (BingBongMechanics.BingBongUnheldFor >= 30f)
			{
				TickTimer += deltaTime;
				if (TickTimer >= 2f)
				{
					TickTimer = 0f;
					allCharacter.refs.afflictions.AddStatus((STATUSTYPE)8, 0.025f, false, true, true, false);
					allCharacter.refs.afflictions.AddStatus((STATUSTYPE)10, 0.025f, false, true, true, false);
					allCharacter.refs.afflictions.AddStatus((STATUSTYPE)6, 0.025f, false, true, true, false);
					allCharacter.refs.afflictions.AddStatus((STATUSTYPE)3, 0.025f, false, true, true, false);
				}
				break;
			}
		}
	}
}
internal class BingBongMechanics
{
	internal static float BingBongUnheldFor;
}
internal class BingBongPatches
{
	[HarmonyPatch(typeof(CharacterData), "set_currentItem")]
	internal static class Patch
	{
		[HarmonyPrefix]
		internal static void Prefix(Item value)
		{
			if ((Object)(object)value != (Object)null && (Object)(object)value != (Object)null)
			{
				bool? flag = value.UIData?.itemName?.ToLowerInvariant()?.Equals("bing bong");
				bool? flag2 = flag;
				if (flag2 == true)
				{
					heldBingBongItem = value;
					return;
				}
			}
			heldBingBongItem = null;
		}
	}

	internal static Item heldBingBongItem;
}
[BepInPlugin("com.thinnh.drakebingbong", "Drake Bing Bong", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private Harmony _harmony;

	private void Awake()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		_harmony = new Harmony("com.thinnh.drakebingbong");
		_harmony.PatchAll(typeof(BingBongPatches.Patch));
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Drake Bing Bong Mod đã khởi động! Cơ chế trừng phạt luôn luôn được bật.");
	}

	private void Update()
	{
		BingBongGimmick.UpdateGimmick();
	}
}