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 Stranger Deaths v1.0.3
RunningUpThatHill.dll
Decompiled 3 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using ExitGames.Client.Photon; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using UnityEngine; using UnityEngine.AI; using UnityEngine.Networking; [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: AssemblyCompany("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RunningUpThatHill")] [assembly: AssemblyTitle("RunningUpThatHill")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] 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; } } } namespace Empress.GravityDeath { [BepInPlugin("Empress.GravityDeath", "GravityDeath", "1.0.9")] public class GravityDeathPlugin : BaseUnityPlugin, IOnEventCallback { public const string PluginGuid = "Empress.GravityDeath"; public const string PluginName = "GravityDeath"; public const string PluginVersion = "1.0.9"; private const byte GravityEventCode = 155; private ConfigEntry<KeyCode> _triggerKey; public static AudioClip MusicClip; private void Awake() { ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); _triggerKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "TriggerKey", (KeyCode)118, "Key to trigger the gravity kill effect."); ((MonoBehaviour)this).StartCoroutine(LoadAudio()); } private void Start() { PhotonNetwork.AddCallbackTarget((object)this); } private void OnDestroy() { PhotonNetwork.RemoveCallbackTarget((object)this); } private IEnumerator LoadAudio() { string directory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); string path = Path.Combine(directory ?? "", "running.ogg"); if (!File.Exists(path)) { string[] files = Directory.GetFiles(Paths.PluginPath, "running.ogg", SearchOption.AllDirectories); if (files.Length != 0) { path = files[0]; } } if (!File.Exists(path)) { yield break; } UnityWebRequest uwr = UnityWebRequestMultimedia.GetAudioClip("file://" + path, (AudioType)14); try { yield return uwr.SendWebRequest(); if ((int)uwr.result == 1) { MusicClip = DownloadHandlerAudioClip.GetContent(uwr); } } finally { ((IDisposable)uwr)?.Dispose(); } } private void Update() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.RunIsLobby() && !SemiFunc.RunIsLobbyMenu() && !SemiFunc.IsMainMenu() && !SemiFunc.IsSplashScreen() && (!PhotonNetwork.InRoom || PhotonNetwork.IsMasterClient) && Input.GetKeyDown(_triggerKey.Value)) { PerformRaycast(); } } private void PerformRaycast() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) Camera val = SemiFunc.MainCamera(); if ((Object)(object)val == (Object)null) { return; } Ray val2 = default(Ray); ((Ray)(ref val2))..ctor(((Component)val).transform.position, ((Component)val).transform.forward); int num = LayerMask.op_Implicit(SemiFunc.LayerMaskGetShouldHits()); RaycastHit val3 = default(RaycastHit); if (!Physics.Raycast(val2, ref val3, 50f, num, (QueryTriggerInteraction)1)) { return; } GameObject gameObject = ((Component)((RaycastHit)(ref val3)).collider).gameObject; PhotonView componentInParent = gameObject.GetComponentInParent<PhotonView>(); Enemy val4 = gameObject.GetComponentInParent<Enemy>(); EnemyRigidbody val5 = gameObject.GetComponentInParent<EnemyRigidbody>(); if ((Object)(object)val4 == (Object)null && (Object)(object)val5 != (Object)null) { val4 = val5.enemy; } if ((Object)(object)val4 != (Object)null) { if ((Object)(object)val5 == (Object)null) { val5 = ((Component)val4).GetComponentInChildren<EnemyRigidbody>(); } GameObject target = (((Object)(object)val5 != (Object)null) ? ((Component)val5).gameObject : ((Component)val4).gameObject); ApplyGravity(target, isEnemy: true, val4); if ((Object)(object)componentInParent != (Object)null) { SendGravityEvent(componentInParent.ViewID, 0); } return; } PlayerAvatar val6 = gameObject.GetComponentInParent<PlayerAvatar>(); if ((Object)(object)val6 == (Object)null) { PlayerController componentInParent2 = gameObject.GetComponentInParent<PlayerController>(); if ((Object)(object)componentInParent2 != (Object)null) { val6 = componentInParent2.playerAvatarScript; } } if ((Object)(object)val6 != (Object)null && !val6.isDisabled) { ApplyGravity(((Component)val6).gameObject, isEnemy: false, null); if ((Object)(object)componentInParent != (Object)null) { SendGravityEvent(componentInParent.ViewID, 1); } return; } Rigidbody componentInParent3 = gameObject.GetComponentInParent<Rigidbody>(); if ((Object)(object)componentInParent3 != (Object)null && !componentInParent3.isKinematic) { ApplyGravity(((Component)componentInParent3).gameObject, isEnemy: false, null); if ((Object)(object)componentInParent != (Object)null) { SendGravityEvent(componentInParent.ViewID, 2); } } } private void SendGravityEvent(int viewID, int type) { //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: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) object[] array = new object[2] { viewID, type }; RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)0 }; PhotonNetwork.RaiseEvent((byte)155, (object)array, val, SendOptions.SendReliable); } public void OnEvent(EventData photonEvent) { if (photonEvent.Code != 155) { return; } try { object[] array = (object[])photonEvent.CustomData; int num = (int)array[0]; int type = (int)array[1]; PhotonView val = PhotonView.Find(num); if ((Object)(object)val != (Object)null) { HandleClientEffect(((Component)val).gameObject, type); } } catch (Exception ex) { Debug.LogError((object)("[GravityDeath] Error handling event: " + ex.Message)); } } private void HandleClientEffect(GameObject rootObj, int type) { GameObject target = rootObj; Enemy val = null; bool isEnemy = false; switch (type) { case 0: isEnemy = true; val = rootObj.GetComponent<Enemy>(); if ((Object)(object)val == (Object)null) { val = rootObj.GetComponentInChildren<Enemy>(); } if ((Object)(object)val != (Object)null) { EnemyRigidbody componentInChildren = ((Component)val).GetComponentInChildren<EnemyRigidbody>(); target = (((Object)(object)componentInChildren != (Object)null) ? ((Component)componentInChildren).gameObject : ((Component)val).gameObject); } break; case 1: target = rootObj; break; case 2: target = rootObj; break; } ApplyGravity(target, isEnemy, val); } private void ApplyGravity(GameObject target, bool isEnemy, Enemy enemyScript) { if (!Object.op_Implicit((Object)(object)target.GetComponent<GravityLifter>())) { GravityLifter gravityLifter = target.AddComponent<GravityLifter>(); gravityLifter.Setup(MusicClip, isEnemy, enemyScript); } } } public class GravityLifter : MonoBehaviour { private AudioClip _clip; private bool _isEnemy; private Enemy _enemyScript; private float _timer; private bool _exploding; private Vector3 _liftSpeed = Vector3.up * 0.5f; private AudioSource _audioSource; private NavMeshAgent _agent; private Rigidbody _rb; private MonoBehaviour _enemyRbScript; private MonoBehaviour _enemyNavScript; private MonoBehaviour _mainEnemyScript; public void Setup(AudioClip clip, bool isEnemy, Enemy enemyScript) { _clip = clip; _isEnemy = isEnemy; _enemyScript = enemyScript; } private void Start() { if (SemiFunc.RunIsLobby() || SemiFunc.RunIsLobbyMenu()) { Object.Destroy((Object)(object)this); return; } if ((Object)(object)_clip != (Object)null) { _audioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); _audioSource.spatialBlend = 1f; _audioSource.minDistance = 5f; _audioSource.maxDistance = 40f; _audioSource.PlayOneShot(_clip); } _rb = ((Component)this).GetComponent<Rigidbody>(); if (_isEnemy) { if ((Object)(object)_enemyScript != (Object)null) { _agent = ((Component)_enemyScript).GetComponent<NavMeshAgent>(); if ((Object)(object)_agent == (Object)null) { _agent = ((Component)_enemyScript).GetComponentInChildren<NavMeshAgent>(); } if ((Object)(object)_agent != (Object)null) { ((Behaviour)_agent).enabled = false; _agent.updatePosition = false; _agent.updateRotation = false; } _enemyNavScript = (MonoBehaviour)(object)((Component)_enemyScript).GetComponent<EnemyNavMeshAgent>(); if ((Object)(object)_enemyNavScript == (Object)null) { _enemyNavScript = (MonoBehaviour)(object)((Component)_enemyScript).GetComponentInChildren<EnemyNavMeshAgent>(); } if ((Object)(object)_enemyNavScript != (Object)null) { ((Behaviour)_enemyNavScript).enabled = false; } _mainEnemyScript = (MonoBehaviour)(object)_enemyScript; ((Behaviour)_mainEnemyScript).enabled = false; } _enemyRbScript = (MonoBehaviour)(object)((Component)this).GetComponent<EnemyRigidbody>(); if ((Object)(object)_enemyRbScript == (Object)null) { _enemyRbScript = (MonoBehaviour)(object)((Component)this).GetComponentInChildren<EnemyRigidbody>(); } if ((Object)(object)_enemyRbScript != (Object)null) { ((Behaviour)_enemyRbScript).enabled = false; } if ((Object)(object)_rb != (Object)null) { _rb.isKinematic = true; } } else if ((Object)(object)_rb != (Object)null) { _rb.isKinematic = true; } } private void LateUpdate() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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) if (!_exploding) { Transform transform = ((Component)this).transform; transform.position += _liftSpeed * Time.deltaTime; _timer += Time.deltaTime; if (_timer >= 5f) { Explode(); } } } private void Explode() { //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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) _exploding = true; ExplosionPreset[] source = Resources.FindObjectsOfTypeAll<ExplosionPreset>(); ExplosionPreset val = ((IEnumerable<ExplosionPreset>)source).FirstOrDefault((Func<ExplosionPreset, bool>)((ExplosionPreset p) => ((Object)p).name.Contains("Grenade"))) ?? source.FirstOrDefault(); GameObject val2 = Resources.Load<GameObject>("Effects/Part Prefab Explosion"); if ((Object)(object)val2 != (Object)null && (Object)(object)val != (Object)null) { GameObject val3 = Object.Instantiate<GameObject>(val2, ((Component)this).transform.position, Quaternion.identity); ParticlePrefabExplosion component = val3.GetComponent<ParticlePrefabExplosion>(); if ((Object)(object)component != (Object)null) { component.explosionSize = 1.5f; component.explosionDamage = 75; component.explosionDamageEnemy = 200; MainModule main = component.particleFire.main; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(val.explosionColors); MainModule main2 = component.particleSmoke.main; ((MainModule)(ref main2)).startColor = MinMaxGradient.op_Implicit(val.smokeColors); component.lightColorOverTime = val.lightColor; if (val.explosionSoundBig != null) { val.explosionSoundBig.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); } } } if (PhotonNetwork.IsMasterClient) { if (_isEnemy) { if ((Object)(object)_enemyScript != (Object)null) { if ((Object)(object)_agent != (Object)null) { ((Behaviour)_agent).enabled = true; } if ((Object)(object)_rb != (Object)null) { _rb.isKinematic = false; } if ((Object)(object)_enemyRbScript != (Object)null) { ((Behaviour)_enemyRbScript).enabled = true; } if ((Object)(object)_enemyNavScript != (Object)null) { ((Behaviour)_enemyNavScript).enabled = true; } if ((Object)(object)_mainEnemyScript != (Object)null) { ((Behaviour)_mainEnemyScript).enabled = true; } if ((Object)(object)_enemyScript.Health != (Object)null) { _enemyScript.Health.Hurt(9999, Vector3.up); } } } else { PlayerHealth component2 = ((Component)this).GetComponent<PlayerHealth>(); if ((Object)(object)component2 != (Object)null) { component2.Hurt(9999, false, -1); } else { if ((Object)(object)_rb != (Object)null) { _rb.isKinematic = false; _rb.AddExplosionForce(2000f, ((Component)this).transform.position - Vector3.up, 5f); } PhysGrabObject component3 = ((Component)this).GetComponent<PhysGrabObject>(); if ((Object)(object)component3 != (Object)null) { component3.heavyBreakImpulse = true; } } } } if (!_isEnemy && (Object)(object)_rb != (Object)null) { _rb.isKinematic = false; } if (_isEnemy && !PhotonNetwork.IsMasterClient) { if ((Object)(object)_rb != (Object)null) { _rb.isKinematic = false; } if ((Object)(object)_enemyRbScript != (Object)null) { ((Behaviour)_enemyRbScript).enabled = true; } } Object.Destroy((Object)(object)this); } } }