using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using Photon.Pun;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("K.Y.S")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("K.Y.S")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("361d37ad-d43b-4908-bdd2-02729cf3904d")]
[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 DevTools.KYS;
[BepInPlugin("tony4twentys.kys", "K.Y.S", "1.0.0")]
public class KYSPlugin : BaseUnityPlugin
{
private ConfigEntry<KeyCode> kysKey;
private ConfigEntry<KeyCode> kysModifier;
private ConfigEntry<bool> kysModifierToggle;
private ConfigEntry<KeyCode> kysToggleKey;
private ConfigEntry<KeyCode> kysToggleModifier;
private ConfigEntry<bool> kysToggleModifierToggle;
private bool suicideEnabled = false;
private GameObject canvasObject;
private GameObject currentTextObj;
private void Awake()
{
kysModifierToggle = ((BaseUnityPlugin)this).Config.Bind<bool>("Hotkey", "kysModifierToggle", true, "Require modifier to be held with kysKey to trigger death");
kysModifier = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Hotkey", "kysModifier", (KeyCode)308, "Modifier key for death");
kysKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Hotkey", "kysKey", (KeyCode)100, "Key that triggers death");
kysToggleModifierToggle = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggle", "kysToggleModifierToggle", true, "Require modifier to toggle the suicide system");
kysToggleModifier = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Toggle", "kysToggleModifier", (KeyCode)308, "Modifier key for toggling");
kysToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Toggle", "kysToggleKey", (KeyCode)115, "Key to toggle suicide system");
}
private void Update()
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
if (kysToggleModifierToggle.Value)
{
if (Input.GetKey(kysToggleModifier.Value) && Input.GetKeyDown(kysToggleKey.Value))
{
ToggleSuicide();
}
}
else if (Input.GetKeyDown(kysToggleKey.Value))
{
ToggleSuicide();
}
if (!suicideEnabled)
{
return;
}
if (kysModifierToggle.Value)
{
if (Input.GetKey(kysModifier.Value) && Input.GetKeyDown(kysKey.Value))
{
KillYourself();
}
}
else if (Input.GetKeyDown(kysKey.Value))
{
KillYourself();
}
}
private void ToggleSuicide()
{
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
suicideEnabled = !suicideEnabled;
((BaseUnityPlugin)this).Logger.LogInfo((object)("KYS: Suicide ability toggled " + (suicideEnabled ? "ON" : "OFF")));
ShowPopup(suicideEnabled ? "K.Y.S ON" : "K.Y.S OFF", suicideEnabled ? Color.red : Color.green);
}
private void KillYourself()
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
Character localCharacter = Character.localCharacter;
if ((Object)(object)localCharacter == (Object)null || (Object)(object)localCharacter.refs?.view == (Object)null)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"KYS: Could not find local character or PhotonView.");
return;
}
Vector3 val = localCharacter.Center + Vector3.up * 0.2f + Vector3.forward * 0.1f;
localCharacter.refs.view.RPC("RPCA_Die", (RpcTarget)0, new object[1] { val });
((BaseUnityPlugin)this).Logger.LogInfo((object)"KYS: Suicide triggered via key press.");
}
private void ShowPopup(string message, Color color)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Expected O, but got Unknown
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)canvasObject == (Object)null)
{
canvasObject = new GameObject("KYSNotificationCanvas");
Canvas val = canvasObject.AddComponent<Canvas>();
val.renderMode = (RenderMode)0;
val.sortingOrder = 999;
canvasObject.AddComponent<CanvasScaler>();
canvasObject.AddComponent<GraphicRaycaster>();
Object.DontDestroyOnLoad((Object)(object)canvasObject);
}
if ((Object)(object)currentTextObj != (Object)null)
{
Object.Destroy((Object)(object)currentTextObj);
}
currentTextObj = new GameObject("KYSText");
currentTextObj.transform.SetParent(canvasObject.transform);
TextMeshProUGUI val2 = currentTextObj.AddComponent<TextMeshProUGUI>();
((TMP_Text)val2).text = message;
((TMP_Text)val2).fontSize = 80f;
((TMP_Text)val2).alignment = (TextAlignmentOptions)514;
((Graphic)val2).color = color;
((Graphic)val2).raycastTarget = false;
((TMP_Text)val2).enableWordWrapping = false;
((TMP_Text)val2).fontStyle = (FontStyles)1;
RectTransform component = ((Component)val2).GetComponent<RectTransform>();
component.sizeDelta = new Vector2(800f, 200f);
component.anchoredPosition = new Vector2(0f, -200f);
component.anchorMin = new Vector2(0.5f, 0.5f);
component.anchorMax = new Vector2(0.5f, 0.5f);
component.pivot = new Vector2(0.5f, 0.5f);
Object.Destroy((Object)(object)currentTextObj, 5f);
}
}