Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Zeytron v1.0.7
Zeytron.dll
Decompiled a year agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; using UnityEngine.Events; using UnityEngine.Serialization; [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: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: AssemblyCompany("Accel")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Zeytron")] [assembly: AssemblyTitle("Zeytron")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class ItemGrenadeDuctTapedZey : MonoBehaviour { public GameObject grenadePrefab; private ParticleScriptExplosion particleScriptExplosion; private PhotonView photonView; public Sound soundExplosion; public Sound soundExplosionGlobal; private void Start() { particleScriptExplosion = ((Component)this).GetComponent<ParticleScriptExplosion>(); photonView = ((Component)this).GetComponent<PhotonView>(); } public void Explosion() { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMultiplayer()) { Vector3 val = default(Vector3); for (int i = 0; i < 8; i++) { ((Vector3)(ref val))..ctor(0f, 0.2f * (float)i, 0f); ItemGrenadeHuman component = Object.Instantiate<GameObject>(grenadePrefab, ((Component)this).transform.position + val, Quaternion.identity).GetComponent<ItemGrenadeHuman>(); component.Initialize(); component.Spawn(); } } else if (SemiFunc.IsMasterClient()) { Vector3 val2 = default(Vector3); for (int j = 0; j < 8; j++) { ((Vector3)(ref val2))..ctor(0f, 0.2f * (float)j, 0f); GameObject val3 = PhotonNetwork.Instantiate("Items/Item Grenade Human Rising Zey", ((Component)this).transform.position + val2, Quaternion.identity, (byte)0, (object[])null); val3.GetComponent<ItemGrenadeHuman>().Initialize(); val3.GetComponent<ItemGrenadeHuman>().Spawn(); } } particleScriptExplosion.Spawn(((Component)this).transform.position, 0.8f, 50, 100, 4f, false, true, 1f); soundExplosion.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); soundExplosionGlobal.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); } } public class ItemGrenadeZey : MonoBehaviour { [CompilerGenerated] private sealed class <DelayedTickEnd>d__34 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ItemGrenadeZey <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayedTickEnd>d__34(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1.5f); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.onDetonate.Invoke(); if (SemiFunc.IsMasterClientOrSingleplayer()) { if (!SemiFunc.RunIsShop() || <>4__this.isSpawnedGrenade) { if (!<>4__this.isSpawnedGrenade) { StatsManager.instance.ItemRemove(<>4__this.itemAttributes.instanceName); } <>4__this.physGrabObjectImpactDetector.DestroyObject(true); } else { <>4__this.physGrabObject.Teleport(<>4__this.grenadeStartPosition, <>4__this.grenadeStartRotation); } } if (SemiFunc.RunIsShop() && !<>4__this.isSpawnedGrenade) { <>4__this.GrenadeReset(); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public Color blinkColor; public UnityEvent onDetonate; private ItemToggle itemToggle; private ItemAttributes itemAttributes; internal bool isActive; private float grenadeTimer; public float tickTime = 3f; private PhotonView photonView; private PhysGrabObjectImpactDetector physGrabObjectImpactDetector; public Sound soundSplinter; public Sound soundTick; public Sound soundTickLast; private float splinterAnimationProgress; public AnimationCurve splinterAnimationCurve; private Transform splinterTransform; private Material grenadeEmissionMaterial; private ItemEquippable itemEquippable; private Vector3 grenadeStartPosition; private Quaternion grenadeStartRotation; private PhysGrabObject physGrabObject; private Vector3 prevPosition; [FormerlySerializedAs("isThiefGrenade")] [HideInInspector] public bool isSpawnedGrenade; public GameObject throwLine; private Rigidbody rb; private float throwLineTimer; private TrailRenderer throwLineTrail; private void Start() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) itemEquippable = ((Component)this).GetComponent<ItemEquippable>(); itemToggle = ((Component)this).GetComponent<ItemToggle>(); itemAttributes = ((Component)this).GetComponent<ItemAttributes>(); photonView = ((Component)this).GetComponent<PhotonView>(); physGrabObjectImpactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>(); splinterTransform = ((Component)this).transform.Find("Splinter"); GameObject gameObject = ((Component)((Component)this).transform.Find("Mesh")).gameObject; grenadeEmissionMaterial = gameObject.GetComponent<Renderer>().material; grenadeStartPosition = ((Component)this).transform.position; grenadeStartRotation = ((Component)this).transform.rotation; physGrabObject = ((Component)this).GetComponent<PhysGrabObject>(); rb = ((Component)this).GetComponent<Rigidbody>(); throwLineTrail = throwLine.GetComponent<TrailRenderer>(); } private void FixedUpdate() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (itemEquippable.isEquipped || itemEquippable.wasEquippedTimer > 0f) { prevPosition = rb.position; return; } Vector3 val = (rb.position - prevPosition) / Time.fixedDeltaTime; Vector3 val2 = rb.position - prevPosition; _ = ((Vector3)(ref val2)).normalized; prevPosition = rb.position; if (!physGrabObject.grabbed && ((Vector3)(ref val)).magnitude > 2f) { throwLineTimer = 0.2f; } if (throwLineTimer > 0f) { throwLineTrail.emitting = true; throwLineTimer -= Time.fixedDeltaTime; } else { throwLineTrail.emitting = false; } } private void Update() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) soundTick.PlayLoop(isActive, 2f, 2f, 1f); if (itemEquippable.isEquipped) { if (isActive) { isActive = false; grenadeTimer = 0f; splinterAnimationProgress = 0f; itemToggle.ToggleItem(false, -1); splinterTransform.localEulerAngles = new Vector3(0f, 0f, 0f); grenadeEmissionMaterial.SetColor("_EmissionColor", Color.black); } return; } if (isActive) { if (splinterAnimationProgress < 1f) { splinterAnimationProgress += 5f * Time.deltaTime; float num = splinterAnimationCurve.Evaluate(splinterAnimationProgress); splinterTransform.localEulerAngles = new Vector3(num * 90f, 0f, 0f); } float num2 = Mathf.PingPong(Time.time * 8f, 1f); Color val = blinkColor * Mathf.LinearToGammaSpace(num2); grenadeEmissionMaterial.SetColor("_EmissionColor", val); } if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } if (itemToggle.toggleState && !isActive) { isActive = true; TickStart(); } if (isActive) { grenadeTimer += Time.deltaTime; if (grenadeTimer >= tickTime) { soundTickLast.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); grenadeTimer = 0f; TickEnd(); } } } private void GrenadeReset() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) isActive = false; grenadeTimer = 0f; throwLine.SetActive(false); splinterAnimationProgress = 0f; itemToggle.ToggleItem(false, -1); splinterTransform.localEulerAngles = new Vector3(0f, 0f, 0f); grenadeEmissionMaterial.SetColor("_EmissionColor", Color.black); if (SemiFunc.IsMasterClientOrSingleplayer()) { Rigidbody component = ((Component)this).GetComponent<Rigidbody>(); component.velocity = Vector3.zero; component.angularVelocity = Vector3.zero; } } private void TickStart() { if (SemiFunc.IsMasterClient()) { photonView.RPC("TickStartRPC", (RpcTarget)0, Array.Empty<object>()); } else { TickStartRPC(); } } private void TickEnd() { if (SemiFunc.IsMasterClient()) { photonView.RPC("TickEndRPC", (RpcTarget)0, Array.Empty<object>()); } else { TickEndRPC(); } } [PunRPC] private void TickStartRPC() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) soundSplinter.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); isActive = true; } [PunRPC] private void TickEndRPC() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (!itemEquippable.isEquipped) { soundTickLast.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); ((MonoBehaviour)this).StartCoroutine(DelayedTickEnd()); } } [IteratorStateMachine(typeof(<DelayedTickEnd>d__34))] private IEnumerator DelayedTickEnd() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DelayedTickEnd>d__34(0) { <>4__this = this }; } } namespace Zeytron { [HarmonyPatch(typeof(ItemAttributes), "Start")] internal class AccelRenameItems { private static void Prefix(ItemAttributes __instance) { if (!((Object)(object)__instance?.item == (Object)null) && __instance.item.itemAssetName == "Item Grenade Duct Taped") { __instance.item.itemName = "Fake Zeygranate"; Debug.Log((object)"[Zeytron] Renamed 'Duct Taped Grenades' to 'Fake Zeygranate'"); } } } [HarmonyPatch(typeof(PlayerController))] internal static class ExamplePlayerControllerPatch { [HarmonyPrefix] [HarmonyPatch("Start")] private static void Start_Prefix(PlayerController __instance) { Zeytron.Logger.LogDebug((object)$"{__instance} Start Prefix"); } [HarmonyPostfix] [HarmonyPatch("Start")] private static void Start_Postfix(PlayerController __instance) { Zeytron.Logger.LogDebug((object)$"{__instance} Start Postfix"); } } public class ItemFixedMesh : MonoBehaviour { private Transform parent; private Quaternion initialRotation; private void Start() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) parent = ((Component)this).transform.parent; initialRotation = Quaternion.identity; } private void LateUpdate() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.position = parent.position; ((Component)this).transform.rotation = initialRotation; } } [BepInPlugin("Szene.Zeytron", "Zeytron", "1.0")] public class Zeytron : BaseUnityPlugin { internal static Zeytron Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { } } }