Please disclose if your mod was created primarily 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 SignalisScrap v1.4.4
LostryuuPancat.SignalisScrap.dll
Decompiled 6 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.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using LobbyCompatibility.Attributes; using Microsoft.CodeAnalysis; using SignalisScrap.Behaviors; using Unity.Netcode; using UnityEngine; [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("LostryuuPancat.SignalisScrap")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SignalisScrap")] [assembly: AssemblyTitle("LostryuuPancat.SignalisScrap")] [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 PlushieGargieItem : GrabbableObject { public AudioSource gargieAudio; public AudioClip meowSFX; public override void ItemActivate(bool used, bool buttonDown = true) { gargieAudio.PlayOneShot(meowSFX); WalkieTalkie.TransmitOneShotAudio(gargieAudio, meowSFX, 1f); } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); } } public class SignalisPistolItem : GrabbableObject { [CompilerGenerated] private sealed class <delayedEarsRinging>d__39 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float effectSeverity; public SignalisPistolItem <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <delayedEarsRinging>d__39(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 switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.6f); <>1__state = 1; return true; case 1: <>1__state = -1; SoundManager.Instance.earsRingingTimer = effectSeverity; 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(); } } [CompilerGenerated] private sealed class <reloadGunAnimation>d__46 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SignalisPistolItem <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <reloadGunAnimation>d__46(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Expected O, but got Unknown //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.isReloading = true; <>2__current = (object)new WaitForSeconds(0.3f); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.gunAudio.PlayOneShot(<>4__this.gunReloadSFX); <>4__this.gunAnimator.SetBool("Reloading", true); <>4__this.ReloadGunEffectsServerRpc(); <>2__current = (object)new WaitForSeconds(0.95f); <>1__state = 2; return true; case 2: <>1__state = -1; ((Renderer)<>4__this.shotgunShellInHand).enabled = true; <>4__this.shotgunShellInHandTransform.SetParent(((GrabbableObject)<>4__this).playerHeldBy.leftHandItemTarget); <>4__this.shotgunShellInHandTransform.localPosition = new Vector3(-0.0555f, 0.1469f, -0.0655f); <>4__this.shotgunShellInHandTransform.localEulerAngles = new Vector3(-1.956f, 143.856f, -16.427f); <>2__current = (object)new WaitForSeconds(0.95f); <>1__state = 3; return true; case 3: <>1__state = -1; ((GrabbableObject)<>4__this).playerHeldBy.DestroyItemInSlotAndSync(<>4__this.ammoSlotToUse); <>4__this.ammoSlotToUse = -1; <>4__this.shellsLoaded = 10; ((Renderer)<>4__this.shotgunShellInHand).enabled = false; <>4__this.shotgunShellInHandTransform.SetParent(((Component)<>4__this).transform); <>2__current = (object)new WaitForSeconds(0.45f); <>1__state = 4; return true; case 4: <>1__state = -1; <>4__this.gunAudio.PlayOneShot(<>4__this.gunReloadFinishSFX); <>4__this.gunAnimator.SetBool("Reloading", false); ((GrabbableObject)<>4__this).playerHeldBy.playerBodyAnimator.SetBool("ReloadShotgun", false); ((GrabbableObject)<>4__this).playerHeldBy.playerBodyAnimator.SetBool("ReloadShotgun2", false); <>4__this.isReloading = false; <>4__this.ReloadGunEffectsServerRpc(start: false); 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 int gunCompatibleAmmoID = 6969; public bool isReloading; public int shellsLoaded; public Animator gunAnimator; public AudioSource gunAudio; public AudioSource gunShootAudio; public AudioSource gunBulletsRicochetAudio; private Coroutine gunCoroutine; public AudioClip gunShootSFX; public AudioClip gunReloadSFX; public AudioClip gunReloadFinishSFX; public AudioClip noAmmoSFX; public AudioClip gunSafetySFX; public AudioClip switchSafetyOnSFX; public AudioClip switchSafetyOffSFX; public bool safetyOn; private float misfireTimer = 30f; private bool hasHitGroundWithSafetyOff = true; private int ammoSlotToUse = -1; private bool localClientSendingShootGunRPC; private PlayerControllerB previousPlayerHeldBy; public ParticleSystem gunShootParticle; public Transform SignalisPistolRayPoint; public MeshRenderer shotgunShellInHand; public Transform shotgunShellInHandTransform; private RaycastHit[] enemyColliders; private EnemyAI heldByEnemy; public override void Start() { ((GrabbableObject)this).Start(); misfireTimer = 30f; hasHitGroundWithSafetyOff = true; } public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); return shellsLoaded; } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); safetyOn = true; shellsLoaded = saveData; } public override void Update() { ((GrabbableObject)this).Update(); if (!((NetworkBehaviour)this).IsOwner || shellsLoaded <= 0 || isReloading || (Object)(object)heldByEnemy != (Object)null || base.isPocketed) { return; } if (base.hasHitGround && !safetyOn && !hasHitGroundWithSafetyOff && !base.isHeld) { if (Random.Range(0, 100) < 5) { ShootGunAndSync(heldByPlayer: false); } hasHitGroundWithSafetyOff = true; } else if (!safetyOn && misfireTimer <= 0f && !StartOfRound.Instance.inShipPhase) { if (Random.Range(0, 100) < 4) { ShootGunAndSync(base.isHeld); } if (Random.Range(0, 100) < 5) { misfireTimer = 2f; } else { misfireTimer = Random.Range(28f, 50f); } } else if (!safetyOn) { misfireTimer -= Time.deltaTime; } } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); previousPlayerHeldBy = base.playerHeldBy; previousPlayerHeldBy.equippedUsableItemQE = true; hasHitGroundWithSafetyOff = false; } public override void GrabItemFromEnemy(EnemyAI enemy) { ((GrabbableObject)this).GrabItemFromEnemy(enemy); heldByEnemy = enemy; hasHitGroundWithSafetyOff = false; } public override void DiscardItemFromEnemy() { ((GrabbableObject)this).DiscardItemFromEnemy(); heldByEnemy = null; } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!isReloading) { if (shellsLoaded == 0) { StartReloadGun(); } else if (safetyOn) { gunAudio.PlayOneShot(gunSafetySFX); } else if (((NetworkBehaviour)this).IsOwner) { ShootGunAndSync(heldByPlayer: true); } } } public void ShootGunAndSync(bool heldByPlayer) { //IL_003a: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_007c: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_00ab: Unknown result type (might be due to invalid IL or missing references) Vector3 signalisPistolPosition; Vector3 forward; if (!heldByPlayer) { signalisPistolPosition = SignalisPistolRayPoint.position; forward = SignalisPistolRayPoint.forward; } else { signalisPistolPosition = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.position - ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.up * 0.45f; forward = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.forward; } Debug.Log((object)"Calling shoot gun...."); ShootGun(signalisPistolPosition, forward); Debug.Log((object)"Calling shoot gun and sync"); localClientSendingShootGunRPC = true; ShootGunServerRpc(signalisPistolPosition, forward); } [ServerRpc(RequireOwnership = false)] public void ShootGunServerRpc(Vector3 SignalisPistolPosition, Vector3 SignalisPistolForward) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) ShootGunClientRpc(SignalisPistolPosition, SignalisPistolForward); } [ClientRpc] public void ShootGunClientRpc(Vector3 SignalisPistolPosition, Vector3 SignalisPistolForward) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"Shoot gun client rpc received"); if (localClientSendingShootGunRPC) { localClientSendingShootGunRPC = false; Debug.Log((object)"localClientSendingShootGunRPC was true"); } else { ShootGun(SignalisPistolPosition, SignalisPistolForward); } } public void ShootGun(Vector3 SignalisPistolPosition, Vector3 SignalisPistolForward) { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: 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_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) isReloading = false; bool flag = false; if (base.isHeld && (Object)(object)base.playerHeldBy != (Object)null && (Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController) { base.playerHeldBy.playerBodyAnimator.SetTrigger("ShootShotgun"); flag = true; } gunShootAudio.PlayOneShot(gunShootSFX); WalkieTalkie.TransmitOneShotAudio(gunShootAudio, gunShootSFX, 1f); gunShootParticle.Play(true); shellsLoaded = Mathf.Clamp(shellsLoaded - 1, 0, 10); PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null) { return; } float num = Vector3.Distance(((Component)localPlayerController).transform.position, ((Component)SignalisPistolRayPoint).transform.position); bool flag2 = false; int num2 = 0; float num3 = 0f; Vector3 val = localPlayerController.playerCollider.ClosestPoint(SignalisPistolPosition); if (!flag && !Physics.Linecast(SignalisPistolPosition, val, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) && Vector3.Angle(SignalisPistolForward, val - SignalisPistolPosition) < 30f) { flag2 = true; } if (num < 5f) { num3 = 0.8f; HUDManager.Instance.ShakeCamera((ScreenShakeType)1); num2 = 20; } if (num < 15f) { num3 = 0.5f; HUDManager.Instance.ShakeCamera((ScreenShakeType)1); num2 = 15; } else if (num < 23f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); num2 = 10; } else if (num < 30f) { num2 = 5; } if (num3 > 0f && SoundManager.Instance.timeSinceEarsStartedRinging > 16f) { ((MonoBehaviour)this).StartCoroutine(delayedEarsRinging(num3)); } Ray val2 = default(Ray); ((Ray)(ref val2))..ctor(SignalisPistolPosition, SignalisPistolForward); RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val2, ref val3, 30f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { ((Component)gunBulletsRicochetAudio).transform.position = ((Ray)(ref val2)).GetPoint(((RaycastHit)(ref val3)).distance - 0.5f); gunBulletsRicochetAudio.Play(); } if (flag2) { localPlayerController.DamagePlayer(num2, true, true, (CauseOfDeath)7, 0, false, SignalisPistolRayPoint.forward * 30f); } if (!((NetworkBehaviour)this).IsOwner) { return; } if (enemyColliders == null) { enemyColliders = (RaycastHit[])(object)new RaycastHit[10]; } ((Ray)(ref val2))..ctor(SignalisPistolPosition - SignalisPistolForward * 10f, SignalisPistolForward); int num4 = Physics.SphereCastNonAlloc(val2, 5f, enemyColliders, 15f, 524288, (QueryTriggerInteraction)2); List<EnemyAI> list = new List<EnemyAI>(); IHittable val4 = default(IHittable); for (int i = 0; i < num4; i++) { if (!Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref enemyColliders[i])).transform).GetComponent<EnemyAICollisionDetect>())) { continue; } EnemyAI mainScript = ((Component)((RaycastHit)(ref enemyColliders[i])).transform).GetComponent<EnemyAICollisionDetect>().mainScript; if ((Object)(object)heldByEnemy != (Object)null && (Object)(object)heldByEnemy == (Object)(object)mainScript) { continue; } if (((RaycastHit)(ref enemyColliders[i])).distance == 0f) { Debug.Log((object)"Spherecast started inside enemy collider"); } else if (!Physics.Linecast(SignalisPistolPosition, ((RaycastHit)(ref enemyColliders[i])).point, ref val3, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) && ((Component)((RaycastHit)(ref enemyColliders[i])).transform).TryGetComponent<IHittable>(ref val4)) { float num5 = Vector3.Distance(SignalisPistolPosition, ((RaycastHit)(ref enemyColliders[i])).point); int num6 = 1; EnemyAICollisionDetect component = ((Component)((RaycastHit)(ref enemyColliders[i])).collider).GetComponent<EnemyAICollisionDetect>(); if ((!((Object)(object)component != (Object)null) || (!((Object)(object)component.mainScript == (Object)null) && !list.Contains(component.mainScript))) && val4.Hit(num6, SignalisPistolForward, base.playerHeldBy, true, -1) && (Object)(object)component != (Object)null) { list.Add(component.mainScript); } } } } [IteratorStateMachine(typeof(<delayedEarsRinging>d__39))] private IEnumerator delayedEarsRinging(float effectSeverity) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <delayedEarsRinging>d__39(0) { <>4__this = this, effectSeverity = effectSeverity }; } public override void ItemInteractLeftRight(bool right) { ((GrabbableObject)this).ItemInteractLeftRight(right); if ((Object)(object)base.playerHeldBy == (Object)null) { return; } Debug.Log((object)$"r/l activate: {right}"); if (!right) { if (safetyOn) { safetyOn = false; gunAudio.PlayOneShot(switchSafetyOffSFX); WalkieTalkie.TransmitOneShotAudio(gunAudio, switchSafetyOffSFX, 1f); SetSafetyControlTip(); } else { safetyOn = true; gunAudio.PlayOneShot(switchSafetyOnSFX); WalkieTalkie.TransmitOneShotAudio(gunAudio, switchSafetyOnSFX, 1f); SetSafetyControlTip(); } base.playerHeldBy.playerBodyAnimator.SetTrigger("SwitchGunSafety"); } else if (!isReloading && shellsLoaded < 10) { StartReloadGun(); } } public override void SetControlTipsForItem() { string[] toolTips = base.itemProperties.toolTips; if (toolTips.Length <= 2) { Debug.LogError((object)"Shotgun control tips array length is too short to set tips!"); return; } if (safetyOn) { toolTips[2] = "Turn safety off: [Q]"; } else { toolTips[2] = "Turn safety on: [Q]"; } HUDManager.Instance.ChangeControlTipMultiple(toolTips, true, base.itemProperties); } private void SetSafetyControlTip() { string text = ((!safetyOn) ? "Turn safety on: [Q]" : "Turn safety off: [Q]"); if (((NetworkBehaviour)this).IsOwner) { HUDManager.Instance.ChangeControlTip(3, text, false); } } private void StartReloadGun() { if (ReloadedGun()) { if (((NetworkBehaviour)this).IsOwner) { if (gunCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(gunCoroutine); } gunCoroutine = ((MonoBehaviour)this).StartCoroutine(reloadGunAnimation()); } } else { gunAudio.PlayOneShot(noAmmoSFX); } } [ServerRpc] public void ReloadGunEffectsServerRpc(bool start = true) { ReloadGunEffectsClientRpc(start); } [ClientRpc] public void ReloadGunEffectsClientRpc(bool start = true) { if (!((NetworkBehaviour)this).IsOwner) { if (start) { gunAudio.PlayOneShot(gunReloadSFX); WalkieTalkie.TransmitOneShotAudio(gunAudio, gunReloadSFX, 1f); gunAnimator.SetBool("Reloading", true); isReloading = true; } else { shellsLoaded = Mathf.Clamp(shellsLoaded + 1, 0, 10); gunAudio.PlayOneShot(gunReloadFinishSFX); gunAnimator.SetBool("Reloading", false); isReloading = false; } } } [IteratorStateMachine(typeof(<reloadGunAnimation>d__46))] private IEnumerator reloadGunAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <reloadGunAnimation>d__46(0) { <>4__this = this }; } private bool ReloadedGun() { int num = FindAmmoInInventory(); if (num == -1) { Debug.Log((object)"not reloading"); return false; } Debug.Log((object)"reloading!"); ammoSlotToUse = num; return true; } private int FindAmmoInInventory() { for (int i = 0; i < base.playerHeldBy.ItemSlots.Length; i++) { if (!((Object)(object)base.playerHeldBy.ItemSlots[i] == (Object)null)) { GrabbableObject obj = base.playerHeldBy.ItemSlots[i]; GunAmmo val = (GunAmmo)(object)((obj is GunAmmo) ? obj : null); Debug.Log((object)$"Ammo null in slot #{i}?: {(Object)(object)val == (Object)null}"); if ((Object)(object)val != (Object)null) { Debug.Log((object)$"Ammo in slot #{i} id: {val.ammoType}"); } if ((Object)(object)val != (Object)null && val.ammoType == gunCompatibleAmmoID) { return i; } } } return -1; } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); StopUsingGun(); } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); StopUsingGun(); } private void StopUsingGun() { previousPlayerHeldBy.equippedUsableItemQE = false; if (isReloading) { if (gunCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(gunCoroutine); } gunAnimator.SetBool("Reloading", false); gunAudio.Stop(); if ((Object)(object)previousPlayerHeldBy != (Object)null) { previousPlayerHeldBy.playerBodyAnimator.SetBool("ReloadShotgun", false); previousPlayerHeldBy.playerBodyAnimator.SetBool("ReloadShotgun2", false); } ((Renderer)shotgunShellInHand).enabled = false; shotgunShellInHandTransform.SetParent(((Component)this).transform); isReloading = false; } } } public class STARBatonItem : GrabbableObject { [CompilerGenerated] private sealed class <playTaserSound>d__15 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public bool flag2; public int num; public STARBatonItem <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <playTaserSound>d__15(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_004f: 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_00f9: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.batonAudio.PlayOneShot(<>4__this.hitSFX); Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)<>4__this).transform.position, 17f, 0.8f, 0, false, 0); if (!flag2 && num != -1) { <>4__this.batonAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX); WalkieTalkie.TransmitOneShotAudio(<>4__this.batonAudio, StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX, 1f); } <>4__this.HitShovelServerRpc(num); <>2__current = (object)new WaitForSeconds(0.45f); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.taserSoundCoroutine = null; 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 AudioSource batonAudio; private List<RaycastHit> objectsHitByBatonList = new List<RaycastHit>(); public PlayerControllerB previousPlayerHeldBy; private RaycastHit[] objectsHitByBaton; public int batonHitForce = 1; public AudioClip hitSFX; public AudioClip swingSFX; private int batonMask = 1084754248; private float timeAtLastDamageDealt; private Coroutine taserSoundCoroutine; public override void ItemActivate(bool used, bool buttonDown = true) { batonAudio.PlayOneShot(swingSFX); if ((Object)(object)base.playerHeldBy != (Object)null) { previousPlayerHeldBy = base.playerHeldBy; if (((NetworkBehaviour)base.playerHeldBy).IsOwner) { base.playerHeldBy.playerBodyAnimator.SetTrigger("UseHeldItem1"); } } if (((NetworkBehaviour)this).IsOwner) { HitKnife(); } } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); } public void HitKnife(bool cancel = false) { //IL_0078: 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) //IL_0097: 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) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0235: 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) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)previousPlayerHeldBy == (Object)null) { Debug.LogError((object)"Previousplayerheldby is null on this client when HitShovel is called."); return; } previousPlayerHeldBy.activatingItem = false; bool flag = false; bool flag2 = false; int num = -1; bool flag3 = false; if (!cancel && Time.realtimeSinceStartup - timeAtLastDamageDealt > 0.43f) { previousPlayerHeldBy.twoHanded = false; objectsHitByBaton = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * 0.1f, 0.3f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, 2f, batonMask, (QueryTriggerInteraction)2); objectsHitByBatonList = objectsHitByBaton.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList(); List<EnemyAI> list = new List<EnemyAI>(); IHittable val2 = default(IHittable); for (int i = 0; i < objectsHitByBatonList.Count; i++) { RaycastHit val = objectsHitByBatonList[i]; if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8) { val = objectsHitByBatonList[i]; if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11) { val = objectsHitByBatonList[i]; if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2)) { continue; } val = objectsHitByBatonList[i]; if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform) { continue; } val = objectsHitByBatonList[i]; if (!(((RaycastHit)(ref val)).point == Vector3.zero)) { Vector3 position = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position; RaycastHit val3 = objectsHitByBatonList[i]; if (Physics.Linecast(position, ((RaycastHit)(ref val3)).point, ref val, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { continue; } } flag = true; Vector3 forward = ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward; try { val = objectsHitByBatonList[i]; EnemyAICollisionDetect component = ((Component)((RaycastHit)(ref val)).transform).GetComponent<EnemyAICollisionDetect>(); if ((Object)(object)component != (Object)null) { if (!((Object)(object)component.mainScript == (Object)null) && !list.Contains(component.mainScript)) { goto IL_034a; } continue; } val = objectsHitByBatonList[i]; if (!((Object)(object)((Component)((RaycastHit)(ref val)).transform).GetComponent<PlayerControllerB>() != (Object)null)) { goto IL_034a; } if (!flag3) { flag3 = true; goto IL_034a; } goto end_IL_02ae; IL_034a: bool flag4 = val2.Hit(batonHitForce, forward, previousPlayerHeldBy, true, 5); if (flag4 && (Object)(object)component != (Object)null) { list.Add(component.mainScript); } if (!flag2 && flag4) { flag2 = true; timeAtLastDamageDealt = Time.realtimeSinceStartup; } end_IL_02ae:; } catch (Exception arg) { Debug.Log((object)$"Exception caught when hitting object with baton from player #{previousPlayerHeldBy.playerClientId}: {arg}"); } continue; } } flag = true; val = objectsHitByBatonList[i]; string tag = ((Component)((RaycastHit)(ref val)).collider).gameObject.tag; for (int j = 0; j < StartOfRound.Instance.footstepSurfaces.Length; j++) { if (StartOfRound.Instance.footstepSurfaces[j].surfaceTag == tag) { num = j; break; } } } } if (flag && taserSoundCoroutine == null) { taserSoundCoroutine = ((MonoBehaviour)this).StartCoroutine(playTaserSound(flag2, num)); } } [IteratorStateMachine(typeof(<playTaserSound>d__15))] private IEnumerator playTaserSound(bool flag2, int num) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <playTaserSound>d__15(0) { <>4__this = this, flag2 = flag2, num = num }; } [ServerRpc] public void HitShovelServerRpc(int hitSurfaceID) { HitShovelClientRpc(hitSurfaceID); } [ClientRpc] public void HitShovelClientRpc(int hitSurfaceID) { if (!((NetworkBehaviour)this).IsOwner) { batonAudio.PlayOneShot(hitSFX); if (hitSurfaceID != -1) { HitSurfaceWithKnife(hitSurfaceID); } } } private void HitSurfaceWithKnife(int hitSurfaceID) { batonAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX); WalkieTalkie.TransmitOneShotAudio(batonAudio, StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX, 1f); } } namespace SignalisScrap { [BepInPlugin("LostryuuPancat.SignalisScrap", "SignalisScrap", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [LobbyCompatibility(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class SignalisScrap : BaseUnityPlugin { public static AssetBundle? SignalisScrapAssets; public static SignalisScrap Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } private void Awake() { //IL_052b: Unknown result type (might be due to invalid IL or missing references) //IL_0535: Expected O, but got Unknown //IL_05d2: Unknown result type (might be due to invalid IL or missing references) //IL_05dc: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; Instance = this; string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); SignalisScrapAssets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "lostryuu.scrapbundle")); if ((Object)(object)SignalisScrapAssets == (Object)null) { Logger.LogError((object)"Failed to load custom assets."); return; } int num = 10; Item val = SignalisScrapAssets.LoadAsset<Item>("Assets/Scraps/King in Yellow/King in Yellow.asset"); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterScrap(val, num, (LevelTypes)(-1)); num = 20; Item val2 = SignalisScrapAssets.LoadAsset<Item>("Assets/Scraps/K4Ration/K4Ration.asset"); NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Items.RegisterScrap(val2, num, (LevelTypes)(-1)); num = 15; Item val3 = SignalisScrapAssets.LoadAsset<Item>("Assets/Scraps/Flare Shell Box/FlareShellBox.asset"); NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab); Items.RegisterScrap(val3, num, (LevelTypes)(-1)); num = 15; Item val4 = SignalisScrapAssets.LoadAsset<Item>("Assets/Scraps/Body Bag/BodyBag.asset"); NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab); Items.RegisterScrap(val4, num, (LevelTypes)(-1)); num = 15; Item val5 = SignalisScrapAssets.LoadAsset<Item>("Assets/Scraps/Medication/Medication.asset"); NetworkPrefabs.RegisterNetworkPrefab(val5.spawnPrefab); Items.RegisterScrap(val5, num, (LevelTypes)(-1)); num = 15; Item val6 = SignalisScrapAssets.LoadAsset<Item>("Assets/Scraps/Taser/Taser.asset"); NetworkPrefabs.RegisterNetworkPrefab(val6.spawnPrefab); Items.RegisterScrap(val6, num, (LevelTypes)(-1)); num = 20; Item val7 = SignalisScrapAssets.LoadAsset<Item>("Assets/Scraps/Socket Wrench/Socket Wrench.asset"); NetworkPrefabs.RegisterNetworkPrefab(val7.spawnPrefab); Items.RegisterScrap(val7, num, (LevelTypes)(-1)); num = 20; Item val8 = SignalisScrapAssets.LoadAsset<Item>("Assets/Scraps/Socket 10mm/Socket 10mm.asset"); NetworkPrefabs.RegisterNetworkPrefab(val8.spawnPrefab); Items.RegisterScrap(val8, num, (LevelTypes)(-1)); num = 15; Item val9 = SignalisScrapAssets.LoadAsset<Item>("Assets/Scraps/VCR Tape/VCR Tape.asset"); NetworkPrefabs.RegisterNetworkPrefab(val9.spawnPrefab); Items.RegisterScrap(val9, num, (LevelTypes)(-1)); num = 10; Item val10 = SignalisScrapAssets.LoadAsset<Item>("Assets/Scraps/Pistol Ammo/PistolAmmo.asset"); PistolAmmoItem pistolAmmoItem = val10.spawnPrefab.AddComponent<PistolAmmoItem>(); ((GrabbableObject)pistolAmmoItem).grabbable = true; ((GrabbableObject)pistolAmmoItem).isInFactory = true; ((GrabbableObject)pistolAmmoItem).grabbableToEnemies = true; ((GrabbableObject)pistolAmmoItem).itemProperties = val10; ((GunAmmo)pistolAmmoItem).ammoType = 6969; NetworkPrefabs.RegisterNetworkPrefab(val10.spawnPrefab); Items.RegisterScrap(val10, num, (LevelTypes)(-1)); num = 15; Item val11 = SignalisScrapAssets.LoadAsset<Item>("Assets/Scraps/Flesh/Flesh.asset"); NetworkPrefabs.RegisterNetworkPrefab(val11.spawnPrefab); Items.RegisterScrap(val11, num, (LevelTypes)(-1)); num = 15; Item val12 = SignalisScrapAssets.LoadAsset<Item>("Assets/Scraps/HealthSpray/HealthSpray.asset"); HealthSprayItem healthSprayItem = val12.spawnPrefab.AddComponent<HealthSprayItem>(); ((GrabbableObject)healthSprayItem).grabbable = true; ((GrabbableObject)healthSprayItem).isInFactory = true; ((GrabbableObject)healthSprayItem).grabbableToEnemies = true; ((GrabbableObject)healthSprayItem).itemProperties = val12; healthSprayItem.scanNodeProperties = ((Component)val12.spawnPrefab.transform.GetChild(0)).GetComponent<ScanNodeProperties>(); NetworkPrefabs.RegisterNetworkPrefab(val12.spawnPrefab); Items.RegisterScrap(val12, num, (LevelTypes)(-1)); num = 10; Item val13 = SignalisScrapAssets.LoadAsset<Item>("Assets/Scraps/SignalisPistol/SignalisPistol.asset"); SignalisPistolItem signalisPistolItem = val13.spawnPrefab.AddComponent<SignalisPistolItem>(); GameObject spawnPrefab = val13.spawnPrefab; ((GrabbableObject)signalisPistolItem).grabbable = true; ((GrabbableObject)signalisPistolItem).isInFactory = true; ((GrabbableObject)signalisPistolItem).itemProperties = val13; ((GrabbableObject)signalisPistolItem).grabbableToEnemies = true; signalisPistolItem.shellsLoaded = 10; signalisPistolItem.gunAudio = spawnPrefab.GetComponent<AudioSource>(); signalisPistolItem.gunAnimator = spawnPrefab.GetComponent<Animator>(); signalisPistolItem.gunShootAudio = ((Component)spawnPrefab.transform.GetChild(0)).GetComponent<AudioSource>(); signalisPistolItem.gunShootSFX = signalisPistolItem.gunShootAudio.clip; signalisPistolItem.gunBulletsRicochetAudio = ((Component)spawnPrefab.transform.GetChild(1)).GetComponent<AudioSource>(); signalisPistolItem.shotgunShellInHand = ((Component)spawnPrefab.transform.GetChild(2)).GetComponent<MeshRenderer>(); signalisPistolItem.shotgunShellInHandTransform = ((Component)spawnPrefab.transform.GetChild(2)).transform; signalisPistolItem.SignalisPistolRayPoint = spawnPrefab.transform.GetChild(3); signalisPistolItem.gunShootParticle = ((Component)signalisPistolItem.SignalisPistolRayPoint.GetChild(0)).GetComponent<ParticleSystem>(); signalisPistolItem.gunReloadSFX = SignalisScrapAssets.LoadAsset<AudioClip>("Assets/Scraps/SignalisPistol/Pistol Mag Out.wav"); signalisPistolItem.gunReloadFinishSFX = SignalisScrapAssets.LoadAsset<AudioClip>("Assets/Scraps/SignalisPistol/Pistol Mag IN.wav"); signalisPistolItem.noAmmoSFX = signalisPistolItem.gunAudio.clip; signalisPistolItem.gunSafetySFX = SignalisScrapAssets.LoadAsset<AudioClip>("assets/lethalcompany/game/audio/audioclips/ShotgunSafetyOn.ogg"); signalisPistolItem.switchSafetyOnSFX = SignalisScrapAssets.LoadAsset<AudioClip>("assets/lethalcompany/game/audio/audioclips/ShotgunSafetyOn.ogg"); signalisPistolItem.switchSafetyOffSFX = SignalisScrapAssets.LoadAsset<AudioClip>("assets/lethalcompany/game/audio/audioclips/ShotgunSafetyOff.ogg"); NetworkPrefabs.RegisterNetworkPrefab(val13.spawnPrefab); Items.RegisterScrap(val13, num, (LevelTypes)(-1)); num = 15; Item val14 = SignalisScrapAssets.LoadAsset<Item>("Assets/Scraps/STARShield/STARShield.asset"); NetworkPrefabs.RegisterNetworkPrefab(val14.spawnPrefab); Items.RegisterScrap(val14, num, (LevelTypes)(-1)); num = 30; Item val15 = SignalisScrapAssets.LoadAsset<Item>("Assets/Scraps/Tape/Tape.asset"); NetworkPrefabs.RegisterNetworkPrefab(val15.spawnPrefab); Items.RegisterScrap(val15, num, (LevelTypes)(-1)); num = 5; Item val16 = SignalisScrapAssets.LoadAsset<Item>("Assets/Scraps/Gargieplushie/PlushieGargie.asset"); PlushieGargieItem plushieGargieItem = val16.spawnPrefab.AddComponent<PlushieGargieItem>(); ((GrabbableObject)plushieGargieItem).grabbable = true; ((GrabbableObject)plushieGargieItem).isInFactory = true; ((GrabbableObject)plushieGargieItem).itemProperties = val16; ((GrabbableObject)plushieGargieItem).insertedBattery = new Battery(false, 100f); ((GrabbableObject)plushieGargieItem).customGrabTooltip = "Grisp Himb? : [E]"; ((GrabbableObject)plushieGargieItem).grabbableToEnemies = true; plushieGargieItem.gargieAudio = val16.spawnPrefab.GetComponent<AudioSource>(); plushieGargieItem.meowSFX = plushieGargieItem.gargieAudio.clip; NetworkPrefabs.RegisterNetworkPrefab(val16.spawnPrefab); Items.RegisterScrap(val16, num, (LevelTypes)(-1)); num = 25; Item val17 = SignalisScrapAssets.LoadAsset<Item>("Assets/Scraps/STARBaton/STARBaton.asset"); STARBatonItem sTARBatonItem = val17.spawnPrefab.AddComponent<STARBatonItem>(); ((GrabbableObject)sTARBatonItem).grabbable = true; ((GrabbableObject)sTARBatonItem).scrapValue = 35; ((GrabbableObject)sTARBatonItem).isInFactory = true; ((GrabbableObject)sTARBatonItem).itemProperties = val17; ((GrabbableObject)sTARBatonItem).insertedBattery = new Battery(false, 100f); ((GrabbableObject)sTARBatonItem).grabbableToEnemies = true; sTARBatonItem.batonAudio = val17.spawnPrefab.GetComponent<AudioSource>(); sTARBatonItem.hitSFX = sTARBatonItem.batonAudio.clip; sTARBatonItem.swingSFX = SignalisScrapAssets.LoadAsset<AudioClip>("Assets/Scraps/STARBaton/WHOOSH_Air_Fast_Wind_Subtle_RR1_mono.wav"); NetworkPrefabs.RegisterNetworkPrefab(val17.spawnPrefab); Items.RegisterScrap(val17, num, (LevelTypes)(-1)); num = 5; Item val18 = SignalisScrapAssets.LoadAsset<Item>("Assets/Scraps/Health Patch/HealthPatch.asset"); HealthPatchItem healthPatchItem = val18.spawnPrefab.AddComponent<HealthPatchItem>(); ((GrabbableObject)healthPatchItem).grabbable = true; ((GrabbableObject)healthPatchItem).isInFactory = true; ((GrabbableObject)healthPatchItem).grabbableToEnemies = true; ((GrabbableObject)healthPatchItem).itemProperties = val18; healthPatchItem.scanNodeProperties = ((Component)val18.spawnPrefab.transform.GetChild(1)).GetComponent<ScanNodeProperties>(); NetworkPrefabs.RegisterNetworkPrefab(val18.spawnPrefab); Items.RegisterScrap(val18, num, (LevelTypes)(-1)); Patch(); Logger.LogInfo((object)"LostryuuPancat.SignalisScrap v1.0.0 has loaded!"); } internal static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("LostryuuPancat.SignalisScrap"); } Logger.LogDebug((object)"Patching..."); Harmony.PatchAll(); Logger.LogDebug((object)"Finished patching!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "LostryuuPancat.SignalisScrap"; public const string PLUGIN_NAME = "SignalisScrap"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace SignalisScrap.Behaviors { public class HealthPatchItem : GrabbableObject { public ScanNodeProperties scanNodeProperties; private bool saveDataLoaded; private bool usedUp; public override void Start() { ((GrabbableObject)this).Start(); if (!saveDataLoaded) { Random random = new Random(StartOfRound.Instance.randomMapSeed + 30 + (int)SystemClock.now.Ticks); usedUp = random.Next(0, 10) <= 5; if (usedUp) { SetUsedInfo(); } } else { Debug.Log((object)usedUp); } } private void SetUsedInfo() { base.scrapValue /= 2; scanNodeProperties.scrapValue = base.scrapValue; ScanNodeProperties obj = scanNodeProperties; obj.headerText += " (Used)"; } public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); return usedUp ? 1 : 0; } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); usedUp = saveData == 1; saveDataLoaded = true; if (usedUp) { scanNodeProperties.scrapValue = base.scrapValue; ScanNodeProperties obj = scanNodeProperties; obj.headerText += " (Used)"; } } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown) { if ((Object)(object)base.playerHeldBy != (Object)null && !usedUp) { PlayerControllerB playerHeldBy = base.playerHeldBy; playerHeldBy.health += 20; base.playerHeldBy.DamagePlayer(-20, false, true, (CauseOfDeath)0, 0, false, default(Vector3)); usedUp = true; SetUsedInfo(); HUDManager.Instance.ChangeControlTip(1, "It's used up.", false); } else if (usedUp) { HUDManager.Instance.DisplayTip("Can't use", "Case is empy.", true, false, "LC_Tip1"); } else { Debug.Log((object)"Not Healed"); } } } public override void GrabItem() { if (usedUp) { HUDManager.Instance.ChangeControlTip(1, "It's used up.", false); } ((GrabbableObject)this).GrabItem(); } public override void EquipItem() { if (usedUp) { HUDManager.Instance.ChangeControlTip(1, "It's used up.", false); } ((GrabbableObject)this).EquipItem(); } } public class HealthSprayItem : GrabbableObject { public ScanNodeProperties scanNodeProperties; private bool saveDataLoaded; private bool usedUp; public override void Start() { ((GrabbableObject)this).Start(); if (!saveDataLoaded) { Random random = new Random(StartOfRound.Instance.randomMapSeed + 30 + (int)SystemClock.now.Ticks); usedUp = random.Next(0, 10) <= 5; if (usedUp) { SetUsedInfo(); } } else { Debug.Log((object)usedUp); } } private void SetUsedInfo() { base.scrapValue /= 2; scanNodeProperties.scrapValue = base.scrapValue; ScanNodeProperties obj = scanNodeProperties; obj.headerText += " (Used)"; } public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); return usedUp ? 1 : 0; } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); usedUp = saveData == 1; saveDataLoaded = true; if (usedUp) { scanNodeProperties.scrapValue = base.scrapValue; ScanNodeProperties obj = scanNodeProperties; obj.headerText += " (Used)"; } } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown) { if ((Object)(object)base.playerHeldBy != (Object)null && !usedUp) { PlayerControllerB playerHeldBy = base.playerHeldBy; playerHeldBy.health += 20; base.playerHeldBy.DamagePlayer(-20, false, true, (CauseOfDeath)0, 0, false, default(Vector3)); usedUp = true; SetUsedInfo(); HUDManager.Instance.ChangeControlTip(1, "It's used up.", false); } else if (usedUp) { HUDManager.Instance.DisplayTip("Can't use", "Spray gun is out of resin.", true, false, "LC_Tip1"); } else { Debug.Log((object)"Not Healed"); } } } public override void GrabItem() { if (usedUp) { HUDManager.Instance.ChangeControlTip(1, "It's used up.", false); } ((GrabbableObject)this).GrabItem(); } public override void EquipItem() { if (usedUp) { HUDManager.Instance.ChangeControlTip(1, "It's used up.", false); } ((GrabbableObject)this).EquipItem(); } } public class PistolAmmoItem : GunAmmo { } }