using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MyFirstTabsMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MyFirstTabsMod")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("27e647e8-cb0c-4427-b53e-063ca0134b7c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AntiLagSuperMod;
[BepInPlugin("com.myname.antilagpro", "Anti-Lag Super Mod", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private bool isAntiLagEnabled = false;
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"\ud83d\ude80 ม\u0e47อดโหมดล\u0e37\u0e48นข\u0e31\u0e49นเทพพร\u0e49อมทำงาน! กด F8 เพ\u0e37\u0e48อเป\u0e34ด/ป\u0e34ดระบบลบพาร\u0e4cท\u0e34เค\u0e34ลและลบศพ \ud83d\ude80");
SceneManager.sceneLoaded += OnSceneLoaded;
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (isAntiLagEnabled)
{
DisableAllParticlesInScene();
}
}
private void Update()
{
if (Input.GetKeyDown((KeyCode)289))
{
isAntiLagEnabled = !isAntiLagEnabled;
if (isAntiLagEnabled)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"\ud83e\uddf9 [เป\u0e34ดโหมดล\u0e37\u0e48น] พาร\u0e4cท\u0e34เค\u0e34ลจะถ\u0e39กลบ และศพจะสลายร\u0e48างใน 3 ว\u0e34นาท\u0e35หล\u0e31งตาย!");
DisableAllParticlesInScene();
}
else
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"✨ [ป\u0e34ดโหมดล\u0e37\u0e48น] กล\u0e31บส\u0e39\u0e48โหมดภาพสวยและศพไม\u0e48หายตามปกต\u0e34");
}
}
if (isAntiLagEnabled)
{
DisableAllParticlesInScene();
HandleDeadBodies();
}
}
private void DisableAllParticlesInScene()
{
ParticleSystem[] array = Object.FindObjectsOfType<ParticleSystem>();
ParticleSystem[] array2 = array;
foreach (ParticleSystem val in array2)
{
if ((Object)(object)val != (Object)null)
{
val.Stop();
Object.Destroy((Object)(object)((Component)val).gameObject);
}
}
}
private void HandleDeadBodies()
{
PlayerHealth[] array = Object.FindObjectsOfType<PlayerHealth>();
PlayerHealth[] array2 = array;
foreach (PlayerHealth val in array2)
{
if ((Object)(object)val != (Object)null && val.health <= 0f)
{
GameObject gameObject = ((Component)val).gameObject;
if ((Object)(object)gameObject != (Object)null && (Object)(object)gameObject.GetComponent<BodyDisappearTimer>() == (Object)null)
{
gameObject.AddComponent<BodyDisappearTimer>();
}
}
}
}
private void OnDestroy()
{
SceneManager.sceneLoaded -= OnSceneLoaded;
}
}
public class BodyDisappearTimer : MonoBehaviour
{
private float timer = 0f;
private float disappearTime = 3f;
private void Update()
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
timer += Time.deltaTime;
if (timer >= disappearTime - 1f)
{
((Component)this).transform.localScale = Vector3.Lerp(((Component)this).transform.localScale, Vector3.zero, Time.deltaTime * 5f);
}
if (timer >= disappearTime)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
}