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 Blue Items v1.5.0
BluePlugin.dll
Decompiled a year 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 GameNetcodeStuff; using LethalLib.Modules; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BluePlugin")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Blue Plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+4ed33b98d374c4db6a42ff9e0d55191c4c6b0438")] [assembly: AssemblyProduct("BluePlugin")] [assembly: AssemblyTitle("BluePlugin")] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class Culotte : GrabbableObject { private Animator animator; private Transform model; private Vector3 lastPosition; private Vector3 velocity; public override void EquipItem() { ((GrabbableObject)this).EquipItem(); } public override void Start() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Start(); model = ((Component)this).gameObject.transform.Find("model"); animator = ((Component)model.Find("culotte-export")).GetComponent<Animator>(); lastPosition = ((Component)this).transform.position; } public override void Update() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); velocity = (((Component)this).transform.position - lastPosition) / Time.deltaTime; float magnitude = ((Vector3)(ref velocity)).magnitude; lastPosition = ((Component)this).transform.position; velocity.y = 0f; float num = Mathf.Atan2(0f - velocity.z, velocity.x) * 57.29578f + 180f; if (base.isHeld && !base.isPocketed && magnitude > 0.05f) { animator.SetBool("moving", true); Vector3 eulerAngles = ((Component)base.playerHeldBy).transform.eulerAngles; float num2 = num - eulerAngles.y + 90f; float num3 = Mathf.LerpAngle(model.localEulerAngles.y, num2, Time.deltaTime * 3f); model.localRotation = Quaternion.Euler(0f, num3, 0f); } else { animator.SetBool("moving", false); } if (base.isHeld) { animator.SetBool("on_floor", false); } else { animator.SetBool("on_floor", true); } } public static Culotte setupScript(Item item) { Culotte culotte = item.spawnPrefab.AddComponent<Culotte>(); PhysicsProp component = item.spawnPrefab.GetComponent<PhysicsProp>(); ((GrabbableObject)culotte).grabbable = ((GrabbableObject)component).grabbable; ((GrabbableObject)culotte).itemProperties = item; ((GrabbableObject)culotte).isInFactory = ((GrabbableObject)component).isInFactory; ((GrabbableObject)culotte).grabbableToEnemies = ((GrabbableObject)component).grabbableToEnemies; ((GrabbableObject)culotte).customGrabTooltip = ((GrabbableObject)component).customGrabTooltip; Object.Destroy((Object)(object)component); return culotte; } } public class EMF : GrabbableObject { [Space(15f)] public AudioSource emfAudio; public AudioClip[] emfLevelClips; public AudioClip outOfBatteriesClip; private const float defaultTimeUpdate = 1f; private float timeCounter; private int currentLevel; private static readonly float[] LevelDistanceDict = new float[6] { 0f, 0f, 20f, 15f, 10f, 5f }; public MeshRenderer emfPrefab; private PlayerControllerB previousPlayerHeldBy; public override void Start() { ((GrabbableObject)this).Start(); } public void lightled(int num, bool on) { ((Behaviour)((Component)((Component)this).gameObject.transform.Find("lightled" + num)).GetComponent<Light>()).enabled = on; } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) SwitchEmf(used); emfAudio.PlayOneShot(emfLevelClips[Random.Range(0, 2)]); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 7f, 0.4f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); } public override void UseUpBatteries() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).UseUpBatteries(); SwitchEmf(on: false); emfAudio.PlayOneShot(outOfBatteriesClip, 1f); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 13f, 0.65f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); } public override void PocketItem() { if (!((NetworkBehaviour)this).IsOwner) { ((GrabbableObject)this).PocketItem(); return; } if ((Object)(object)previousPlayerHeldBy != (Object)null) { if (!base.isBeingUsed || (!((Object)(object)previousPlayerHeldBy.ItemSlots[previousPlayerHeldBy.currentItemSlot] == (Object)null) && previousPlayerHeldBy.ItemSlots[previousPlayerHeldBy.currentItemSlot].itemProperties.itemId == 1 && previousPlayerHeldBy.ItemSlots[previousPlayerHeldBy.currentItemSlot].itemProperties.itemId == 6)) { base.isBeingUsed = false; SwitchEmf(on: false); } } else { Debug.Log((object)"Could not find what player was holding this EMF item"); } ((GrabbableObject)this).PocketItem(); } public override void EquipItem() { previousPlayerHeldBy = base.playerHeldBy; if (base.isBeingUsed) { SwitchEmf(on: true); } ((GrabbableObject)this).EquipItem(); } public void SwitchEmf(bool on) { base.isBeingUsed = on; SetEmfLevel(on ? 1 : 0); } public override void Update() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); int num = 0; if (num < 2) { _ = 1; } if (base.isBeingUsed) { int num2 = 1; foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { if (((Component)spawnedEnemy).transform != null && !spawnedEnemy.isEnemyDead) { float num3 = Vector3.Distance(((Component)spawnedEnemy).transform.position, ((Component)this).gameObject.transform.position); int num4 = 1; if (num3 <= LevelDistanceDict[5]) { num4 = 5; } else if (num3 <= LevelDistanceDict[4]) { num4 = 4; } else if (num3 <= LevelDistanceDict[3]) { num4 = 3; } else if (num3 <= LevelDistanceDict[2]) { num4 = 2; } if (num4 > num2) { num2 = num4; } } } SetEmfLevel(num2); } else { currentLevel = 1; timeCounter = 1f; } } private void SetEmfLevel(int level) { for (int i = 1; i < 6; i++) { lightled(i, level >= i); } if (level != currentLevel && level > 1) { emfAudio.Stop(); emfAudio.loop = true; emfAudio.clip = emfLevelClips[level]; emfAudio.Play(); } else if (level <= 1) { emfAudio.Stop(); } currentLevel = level; } public static EMF setupScript(Item item) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown EMF eMF = item.spawnPrefab.AddComponent<EMF>(); FlashlightItem component = item.spawnPrefab.GetComponent<FlashlightItem>(); ((GrabbableObject)eMF).grabbable = ((GrabbableObject)component).grabbable; ((GrabbableObject)eMF).itemProperties = item; eMF.outOfBatteriesClip = component.outOfBatteriesClip; eMF.emfAudio = component.flashlightAudio; eMF.emfPrefab = component.flashlightMesh; ((GrabbableObject)eMF).grabbableToEnemies = ((GrabbableObject)component).grabbableToEnemies; if (((GrabbableObject)component).insertedBattery != null) { ((GrabbableObject)eMF).insertedBattery = new Battery(((GrabbableObject)component).insertedBattery.empty, ((GrabbableObject)component).insertedBattery.charge); } eMF.emfLevelClips = (AudioClip[])(object)new AudioClip[component.flashlightClips.Length]; component.flashlightClips.CopyTo(eMF.emfLevelClips, 0); Object.Destroy((Object)(object)component); return eMF; } } public class EnergySword : GrabbableObject { private Animator animator; private Light light1; private Light light2; private ParticleSystem particles; public int shovelHitForce = 1; public bool reelingUp; public bool isHoldingButton; private RaycastHit rayHit; private Coroutine reelingUpCoroutine; private RaycastHit[] objectsHitByShovel; private List<RaycastHit> objectsHitByShovelList = new List<RaycastHit>(); public AudioClip reelUp; public AudioClip swing; public AudioClip[] hitSFX; public AudioSource shovelAudio; private PlayerControllerB previousPlayerHeldBy; private int shovelMask = 1084754248; public override void Start() { ((GrabbableObject)this).Start(); Transform val = ((Component)this).gameObject.transform.Find("sword"); animator = ((Component)val).GetComponent<Animator>(); light1 = ((Component)((Component)this).gameObject.transform.Find("sword").Find("light1")).GetComponent<Light>(); light2 = ((Component)((Component)this).gameObject.transform.Find("sword").Find("light2")).GetComponent<Light>(); particles = ((Component)((Component)this).gameObject.transform.Find("particles")).GetComponent<ParticleSystem>(); } public override void Update() { ((GrabbableObject)this).Update(); if (base.isHeld && !base.isPocketed) { if (!((Behaviour)light1).enabled) { ((Behaviour)light1).enabled = true; } if (!((Behaviour)light2).enabled) { ((Behaviour)light2).enabled = true; } if (!particles.isPlaying) { particles.Play(); } animator.SetBool("equipped", true); } else { if (((Behaviour)light1).enabled) { ((Behaviour)light1).enabled = false; } if (((Behaviour)light2).enabled) { ((Behaviour)light2).enabled = false; } if (particles.isPlaying) { particles.Stop(); } animator.SetBool("equipped", false); } } public override void ItemActivate(bool used, bool buttonDown = true) { if ((Object)(object)base.playerHeldBy == (Object)null) { return; } isHoldingButton = buttonDown; if (!reelingUp && buttonDown) { reelingUp = true; previousPlayerHeldBy = base.playerHeldBy; if (reelingUpCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(reelingUpCoroutine); } reelingUpCoroutine = ((MonoBehaviour)this).StartCoroutine(reelUpShovel()); } } private IEnumerator reelUpShovel() { base.playerHeldBy.activatingItem = true; base.playerHeldBy.twoHanded = true; base.playerHeldBy.playerBodyAnimator.ResetTrigger("shovelHit"); base.playerHeldBy.playerBodyAnimator.SetBool("reelingUp", true); shovelAudio.PlayOneShot(reelUp); ReelUpSFXServerRpc(); yield return (object)new WaitForSeconds(0.35f); yield return (object)new WaitUntil((Func<bool>)(() => !isHoldingButton || !base.isHeld)); SwingShovel(!base.isHeld); yield return (object)new WaitForSeconds(0.13f); yield return (object)new WaitForEndOfFrame(); HitShovel(!base.isHeld); yield return (object)new WaitForSeconds(0.3f); reelingUp = false; reelingUpCoroutine = null; } [ServerRpc] public void ReelUpSFXServerRpc() { ReelUpSFXClientRpc(); } [ClientRpc] public void ReelUpSFXClientRpc() { if (!((NetworkBehaviour)this).IsOwner) { shovelAudio.PlayOneShot(reelUp); } } public override void DiscardItem() { if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.activatingItem = false; } ((GrabbableObject)this).DiscardItem(); } public void SwingShovel(bool cancel = false) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false); if (!cancel) { shovelAudio.PlayOneShot(swing); previousPlayerHeldBy.UpdateSpecialAnimationValue(true, (short)((Component)previousPlayerHeldBy).transform.localEulerAngles.y, 0.4f, false); } } public void HitShovel(bool cancel = false) { //IL_0050: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_0303: 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; bool flag3 = false; int num = -1; if (!cancel) { previousPlayerHeldBy.twoHanded = false; objectsHitByShovel = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, 0.8f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, 1.5f, shovelMask, (QueryTriggerInteraction)2); objectsHitByShovelList = objectsHitByShovel.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList(); List<EnemyAI> list = new List<EnemyAI>(); IHittable val2 = default(IHittable); for (int i = 0; i < objectsHitByShovelList.Count; i++) { RaycastHit val = objectsHitByShovelList[i]; if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8) { val = objectsHitByShovelList[i]; if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11) { val = objectsHitByShovelList[i]; if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2)) { continue; } val = objectsHitByShovelList[i]; if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform) { continue; } val = objectsHitByShovelList[i]; if (!(((RaycastHit)(ref val)).point == Vector3.zero)) { Vector3 position = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position; RaycastHit val3 = objectsHitByShovelList[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 = objectsHitByShovelList[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_02fb; } continue; } val = objectsHitByShovelList[i]; if (!((Object)(object)((Component)((RaycastHit)(ref val)).transform).GetComponent<PlayerControllerB>() != (Object)null)) { goto IL_02fb; } if (!flag3) { flag3 = true; goto IL_02fb; } goto end_IL_0288; IL_02fb: bool flag4 = val2.Hit(shovelHitForce, forward, previousPlayerHeldBy, true, 1); if (flag4 && (Object)(object)component != (Object)null) { list.Add(component.mainScript); } if (!flag2) { flag2 = flag4; } end_IL_0288:; } catch (Exception arg) { Debug.Log((object)$"Exception caught when hitting object with shovel from player #{previousPlayerHeldBy.playerClientId}: {arg}"); } continue; } } val = objectsHitByShovelList[i]; if (((RaycastHit)(ref val)).collider.isTrigger) { continue; } flag = true; val = objectsHitByShovelList[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) { RoundManager.PlayRandomClip(shovelAudio, hitSFX, true, 1f, 0, 1000); Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0); if (!flag2 && num != -1) { shovelAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX); WalkieTalkie.TransmitOneShotAudio(shovelAudio, StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX, 1f); } base.playerHeldBy.playerBodyAnimator.SetTrigger("shovelHit"); HitShovelServerRpc(num); } } [ServerRpc] public void HitShovelServerRpc(int hitSurfaceID) { HitShovelClientRpc(hitSurfaceID); } [ClientRpc] public void HitShovelClientRpc(int hitSurfaceID) { if (!((NetworkBehaviour)this).IsOwner) { RoundManager.PlayRandomClip(shovelAudio, hitSFX, true, 1f, 0, 1000); if (hitSurfaceID != -1) { HitSurfaceWithShovel(hitSurfaceID); } } } private void HitSurfaceWithShovel(int hitSurfaceID) { shovelAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX); WalkieTalkie.TransmitOneShotAudio(shovelAudio, StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX, 1f); } public static EnergySword setupScript(Item item) { EnergySword energySword = item.spawnPrefab.AddComponent<EnergySword>(); Shovel component = item.spawnPrefab.GetComponent<Shovel>(); ((GrabbableObject)energySword).grabbable = ((GrabbableObject)component).grabbable; ((GrabbableObject)energySword).itemProperties = item; energySword.reelUp = component.reelUp; energySword.swing = component.swing; energySword.shovelAudio = component.shovelAudio; energySword.hitSFX = component.hitSFX; ((GrabbableObject)energySword).isInFactory = ((GrabbableObject)component).isInFactory; ((GrabbableObject)energySword).grabbableToEnemies = ((GrabbableObject)component).grabbableToEnemies; energySword.shovelHitForce = component.shovelHitForce; ((GrabbableObject)energySword).customGrabTooltip = ((GrabbableObject)component).customGrabTooltip; Object.Destroy((Object)(object)component); return energySword; } } public class Kejdollv2 : NoisemakerProp { private Animator animator; private int chanceRatio = 25; private int probaLookAt = 4; private int probaReach = 1; private const float defaultTimeUpdate = 10f; private float timeCounter = 10f; private bool ready; private bool playing; public override void Start() { ((NoisemakerProp)this).Start(); base.noisemakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85); Transform val = ((Component)this).gameObject.transform.Find("kejdollv2"); animator = ((Component)val).GetComponent<Animator>(); } public override void Update() { ((GrabbableObject)this).Update(); if (!((GrabbableObject)this).isHeld) { if (animator.GetBool("isReaching") || animator.GetBool("isLookAt")) { animator.SetBool("isReaching", false); animator.SetBool("isLookAt", false); } playing = false; return; } if (!ready) { if (timeCounter >= 0f) { timeCounter -= Time.deltaTime; } else { timeCounter = 10f; ready = true; } } if (ready && !playing) { int num = base.noisemakerRandom.Next(0, chanceRatio); if (num < probaLookAt) { Debug.Log((object)"Look At"); animator.SetBool("isLookAt", true); playing = true; } else if (num < probaLookAt + probaReach && num >= probaLookAt) { Debug.Log((object)"Reaching"); animator.SetBool("isReaching", true); playing = true; } ready = false; } else if (ready) { playing = false; ready = false; Debug.Log((object)"Idle"); animator.SetBool("isLookAt", false); animator.SetBool("isReaching", false); } } public override void ItemActivate(bool used, bool buttonDown = true) { ((NoisemakerProp)this).ItemActivate(used, buttonDown); } public static Kejdollv2 setupScript(Item item) { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown Kejdollv2 kejdollv = item.spawnPrefab.AddComponent<Kejdollv2>(); NoisemakerProp component = item.spawnPrefab.GetComponent<NoisemakerProp>(); ((GrabbableObject)kejdollv).grabbable = ((GrabbableObject)component).grabbable; ((GrabbableObject)kejdollv).itemProperties = item; ((GrabbableObject)kejdollv).grabbableToEnemies = ((GrabbableObject)component).grabbableToEnemies; ((GrabbableObject)kejdollv).customGrabTooltip = ((GrabbableObject)component).customGrabTooltip; ((NoisemakerProp)kejdollv).noiseAudio = component.noiseAudio; ((NoisemakerProp)kejdollv).noiseAudioFar = component.noiseAudioFar; ((NoisemakerProp)kejdollv).noiseRange = component.noiseRange; ((NoisemakerProp)kejdollv).maxLoudness = component.maxLoudness; ((NoisemakerProp)kejdollv).minLoudness = component.minLoudness; ((NoisemakerProp)kejdollv).minPitch = component.minPitch; ((NoisemakerProp)kejdollv).maxPitch = component.maxPitch; ((NoisemakerProp)kejdollv).noisemakerRandom = component.noisemakerRandom; ((NoisemakerProp)kejdollv).triggerAnimator = component.triggerAnimator; if (((GrabbableObject)component).insertedBattery != null) { ((GrabbableObject)kejdollv).insertedBattery = new Battery(((GrabbableObject)component).insertedBattery.empty, ((GrabbableObject)component).insertedBattery.charge); } ((NoisemakerProp)kejdollv).noiseSFX = (AudioClip[])(object)new AudioClip[component.noiseSFX.Length]; component.noiseSFX.CopyTo(((NoisemakerProp)kejdollv).noiseSFX, 0); ((NoisemakerProp)kejdollv).noiseSFXFar = (AudioClip[])(object)new AudioClip[component.noiseSFXFar.Length]; component.noiseSFXFar.CopyTo(((NoisemakerProp)kejdollv).noiseSFXFar, 0); Object.Destroy((Object)(object)component); return kejdollv; } } public class NoiseOnSpotItem : GrabbableObject { public AudioSource noiseAudio; public AudioSource noiseAudioFar; [Space(3f)] public AudioClip[] noiseSFX; public AudioClip[] noiseSFXFar; [Space(3f)] public float noiseRange; public float maxLoudness; public float minLoudness; public float minPitch; public float maxPitch; private Random noisemakerRandom; public Animator triggerAnimator; private const float defaultTimeUpdate = 60f; private float timeCounter = 60f; private bool ready = true; private int soundChance = 5; private bool firstSound = true; public override void Start() { ((GrabbableObject)this).Start(); noisemakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 117); } public override void Update() { //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (noiseSFX.Length == 0) { return; } if (!ready) { if (timeCounter >= 0f) { timeCounter -= Time.deltaTime; } else { timeCounter = 60f; ready = true; } } if (!ready || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) { return; } Transform transform = ((Component)GameNetworkManager.Instance.localPlayerController).transform; Transform transform2 = ((Component)this).transform; LayerMask val = LayerMask.op_Implicit(~((1 << LayerMask.NameToLayer("TransparentFX")) | (1 << LayerMask.NameToLayer("Ignore Raycast")) | (1 << LayerMask.NameToLayer("Player")) | (1 << LayerMask.NameToLayer("HelmetVisor")) | (1 << LayerMask.NameToLayer("Colliders")) | (1 << LayerMask.NameToLayer("Props")) | (1 << LayerMask.NameToLayer("ScanNode")) | (1 << LayerMask.NameToLayer("Triggers")) | (1 << LayerMask.NameToLayer("NavigationSurface")) | (1 << LayerMask.NameToLayer("LineOfSight")) | (1 << LayerMask.NameToLayer("PlayerRagdoll")) | (1 << LayerMask.NameToLayer("DecalStickableSurface")) | (1 << LayerMask.NameToLayer("PlaceableShipObjects")) | (1 << LayerMask.NameToLayer("PlaceableShipObjects")))); Vector3 val2 = transform.position - transform2.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; float num = Vector3.Distance(transform2.position, transform.position); _ = 15f; RaycastHit val3 = default(RaycastHit); if (!Physics.Raycast(transform2.position, normalized, ref val3, num, LayerMask.op_Implicit(val))) { ready = false; bool flag = false; if (firstSound && base.isInShipRoom) { firstSound = false; } else if (firstSound) { flag = true; firstSound = false; } else if (noisemakerRandom.Next(0, soundChance) % soundChance == 0) { flag = true; } if (flag) { flag = false; int num2 = noisemakerRandom.Next(0, noiseSFX.Length); noiseAudio.PlayOneShot(noiseSFX[num2]); } } } public static NoiseOnSpotItem setupScript(Item item) { NoiseOnSpotItem noiseOnSpotItem = item.spawnPrefab.AddComponent<NoiseOnSpotItem>(); NoisemakerProp component = item.spawnPrefab.GetComponent<NoisemakerProp>(); ((GrabbableObject)noiseOnSpotItem).grabbable = ((GrabbableObject)component).grabbable; ((GrabbableObject)noiseOnSpotItem).itemProperties = item; ((GrabbableObject)noiseOnSpotItem).grabbableToEnemies = ((GrabbableObject)component).grabbableToEnemies; noiseOnSpotItem.noiseAudio = component.noiseAudio; noiseOnSpotItem.noiseAudioFar = component.noiseAudioFar; noiseOnSpotItem.noiseAudioFar = component.noiseAudioFar; noiseOnSpotItem.noiseRange = component.noiseRange; noiseOnSpotItem.maxLoudness = component.maxLoudness; noiseOnSpotItem.minLoudness = component.minLoudness; noiseOnSpotItem.noisemakerRandom = component.noisemakerRandom; noiseOnSpotItem.triggerAnimator = component.triggerAnimator; noiseOnSpotItem.noiseSFX = (AudioClip[])(object)new AudioClip[component.noiseSFX.Length]; component.noiseSFX.CopyTo(noiseOnSpotItem.noiseSFX, 0); noiseOnSpotItem.noiseSFXFar = (AudioClip[])(object)new AudioClip[component.noiseSFXFar.Length]; component.noiseSFXFar.CopyTo(noiseOnSpotItem.noiseSFXFar, 0); Object.Destroy((Object)(object)component); return noiseOnSpotItem; } } public class PouicPouic : GrabbableObject { public int shovelHitForce = 1; public bool reelingUp; public bool isHoldingButton; private RaycastHit rayHit; private Coroutine reelingUpCoroutine; private RaycastHit[] objectsHitByShovel; private List<RaycastHit> objectsHitByShovelList = new List<RaycastHit>(); public AudioClip reelUp; public AudioClip swing; public AudioClip[] hitSFX; public AudioSource shovelAudio; private PlayerControllerB previousPlayerHeldBy; private int shovelMask = 11012424; public override void ItemActivate(bool used, bool buttonDown = true) { if ((Object)(object)base.playerHeldBy == (Object)null) { return; } isHoldingButton = buttonDown; if (!reelingUp && buttonDown) { reelingUp = true; previousPlayerHeldBy = base.playerHeldBy; if (reelingUpCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(reelingUpCoroutine); } reelingUpCoroutine = ((MonoBehaviour)this).StartCoroutine(reelUpShovel()); } } private IEnumerator reelUpShovel() { base.playerHeldBy.activatingItem = true; base.playerHeldBy.twoHanded = true; base.playerHeldBy.playerBodyAnimator.ResetTrigger("shovelHit"); base.playerHeldBy.playerBodyAnimator.SetBool("reelingUp", true); shovelAudio.PlayOneShot(reelUp); ReelUpSFXServerRpc(); yield return (object)new WaitForSeconds(0.35f); yield return (object)new WaitUntil((Func<bool>)(() => !isHoldingButton || !base.isHeld)); SwingShovel(!base.isHeld); yield return (object)new WaitForSeconds(0.13f); yield return (object)new WaitForEndOfFrame(); HitShovel(!base.isHeld); yield return (object)new WaitForSeconds(0.3f); reelingUp = false; reelingUpCoroutine = null; } [ServerRpc] public void ReelUpSFXServerRpc() { ReelUpSFXClientRpc(); } [ClientRpc] public void ReelUpSFXClientRpc() { if (!((NetworkBehaviour)this).IsOwner) { shovelAudio.PlayOneShot(reelUp); } } public override void DiscardItem() { if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.activatingItem = false; } ((GrabbableObject)this).DiscardItem(); } public void SwingShovel(bool cancel = false) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false); if (!cancel) { shovelAudio.PlayOneShot(swing); previousPlayerHeldBy.UpdateSpecialAnimationValue(true, (short)((Component)previousPlayerHeldBy).transform.localEulerAngles.y, 0.4f, false); } } public void HitShovel(bool cancel = false) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: 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; if (!cancel) { previousPlayerHeldBy.twoHanded = false; objectsHitByShovel = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, 0.8f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, 1.5f, shovelMask, (QueryTriggerInteraction)2); objectsHitByShovelList = objectsHitByShovel.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList(); IHittable val2 = default(IHittable); RaycastHit val3 = default(RaycastHit); for (int i = 0; i < objectsHitByShovelList.Count; i++) { RaycastHit val = objectsHitByShovelList[i]; if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8) { val = objectsHitByShovelList[i]; if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11) { val = objectsHitByShovelList[i]; if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2)) { continue; } val = objectsHitByShovelList[i]; if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform) { continue; } val = objectsHitByShovelList[i]; if (!(((RaycastHit)(ref val)).point == Vector3.zero)) { Vector3 position = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position; val = objectsHitByShovelList[i]; if (Physics.Linecast(position, ((RaycastHit)(ref val)).point, ref val3, StartOfRound.Instance.collidersAndRoomMaskAndDefault)) { continue; } } flag = true; Vector3 forward = ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward; try { int num2 = calculateForce(); num2 = 0; PlayerControllerB val4 = (PlayerControllerB)(object)((val2 is PlayerControllerB) ? val2 : null); if ((Object)(object)val4 != (Object)null) { Debug.Log((object)("=========== =================== Pouic Pouic at " + ((Object)val4).GetInstanceID())); TextMeshProUGUI componentInChildren = ((Component)val4).gameObject.GetComponentInChildren<TextMeshProUGUI>(); if ((Object)(object)componentInChildren != (Object)null) { num2 = (((TMP_Text)componentInChildren).text.ToLower().Contains("elika") ? 20 : 0); } } else if (((object)val2).ToString().ToLower().Contains("hoarderbug")) { num2 = 20; } if (num2 > 0) { val2.Hit(num2, forward, previousPlayerHeldBy, true, 1); } flag2 = true; } catch (Exception arg) { Debug.Log((object)$"Exception caught when hitting object with shovel from player #{previousPlayerHeldBy.playerClientId}: {arg}"); } continue; } } flag = true; val = objectsHitByShovelList[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) { RoundManager.PlayRandomClip(shovelAudio, hitSFX, true, 1f, 0, 1000); Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0); if (!flag2 && num != -1) { shovelAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX); WalkieTalkie.TransmitOneShotAudio(shovelAudio, StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX, 1f); } base.playerHeldBy.playerBodyAnimator.SetTrigger("shovelHit"); } } public int calculateForce() { return 10; } [ServerRpc] public void HitShovelServerRpc(int hitSurfaceID) { HitShovelClientRpc(hitSurfaceID); } [ClientRpc] public void HitShovelClientRpc(int hitSurfaceID) { if (!((NetworkBehaviour)this).IsOwner) { RoundManager.PlayRandomClip(shovelAudio, hitSFX, true, 1f, 0, 1000); if (hitSurfaceID != -1) { HitSurfaceWithShovel(hitSurfaceID); } } } private void HitSurfaceWithShovel(int hitSurfaceID) { shovelAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX); WalkieTalkie.TransmitOneShotAudio(shovelAudio, StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX, 1f); } public static PouicPouic setupScript(Item item) { PouicPouic pouicPouic = item.spawnPrefab.AddComponent<PouicPouic>(); Shovel component = item.spawnPrefab.GetComponent<Shovel>(); ((GrabbableObject)pouicPouic).grabbable = ((GrabbableObject)component).grabbable; ((GrabbableObject)pouicPouic).itemProperties = item; pouicPouic.reelUp = component.reelUp; pouicPouic.swing = component.swing; pouicPouic.shovelAudio = component.shovelAudio; pouicPouic.hitSFX = component.hitSFX; ((GrabbableObject)pouicPouic).isInFactory = ((GrabbableObject)component).isInFactory; ((GrabbableObject)pouicPouic).grabbableToEnemies = ((GrabbableObject)component).grabbableToEnemies; pouicPouic.shovelHitForce = component.shovelHitForce; Object.Destroy((Object)(object)component); return pouicPouic; } } public static class Utils { public static void PrintMaterialProperties(Material material) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) Shader shader = material.shader; int propertyCount = shader.GetPropertyCount(); Debug.Log((object)("Material: " + ((Object)material).name + ", Shader: " + ((Object)shader).name)); Debug.Log((object)$"Property Count: {propertyCount}"); for (int i = 0; i < propertyCount; i++) { string propertyName = shader.GetPropertyName(i); ShaderPropertyType propertyType = shader.GetPropertyType(i); string materialPropertyValue = GetMaterialPropertyValue(material, propertyName, propertyType); Debug.Log((object)$"Property {i}: Name = {propertyName}, Type = {propertyType}, Value = {materialPropertyValue}"); } } public static string GetMaterialPropertyValue(Material material, string propertyName, ShaderPropertyType propertyType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected I4, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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) //IL_0039: Unknown result type (might be due to invalid IL or missing references) switch ((int)propertyType) { case 0: { Color color = material.GetColor(propertyName); return ((object)(Color)(ref color)).ToString(); } case 1: { Vector4 vector = material.GetVector(propertyName); return ((object)(Vector4)(ref vector)).ToString(); } case 2: case 3: return material.GetFloat(propertyName).ToString(); case 4: { Texture texture = material.GetTexture(propertyName); if (!Object.op_Implicit((Object)(object)texture)) { return "None"; } return ((Object)texture).name; } default: return "Unknown Type"; } } } namespace BluePlugin { [BepInPlugin("BluePlugin", "BluePlugin", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public static int globalRarity = 30; public static Plugin instance; private const bool loadFromFile = false; private const string LegacyAssetBundleAssemblyLogicalName = "res.mod.bundle.legacy"; private const string BlueItemsAssetBundleAssemblyLogicalName = "res.mod.bundle.blueitems2"; private const string AssetBundlePrefabDirectory = "Assets/LethalCompany/Mods/BlueItems/"; public static Material materialCube2; public static GameObject prefabCube; public static GameObject prefabCube2; public static GameObject prefabCar; public static GameObject prefabBigCar; private void loadItems() { } private void Awake() { if ((Object)(object)instance == (Object)null) { instance = this; } AssetBundle val = null; AssetBundle assetBundle = null; using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("res.mod.bundle.legacy"); val = AssetBundle.LoadFromStream(stream); using (Stream stream2 = Assembly.GetExecutingAssembly().GetManifestResourceStream("res.mod.bundle.blueitems2")) { assetBundle = AssetBundle.LoadFromStream(stream2); } globalRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "Spawn Rate for all items", globalRarity, "Spawn rate for all items. The higher the value, the more spawns.").Value; LoadItemsFromBundle(val); LoadItemsFromBundle(assetBundle); } private void LoadItemsFromBundle(AssetBundle assetBundle) { string[] allAssetNames = assetBundle.GetAllAssetNames(); foreach (string text in allAssetNames) { Item val = assetBundle.LoadAsset<Item>(text); if (!((Object)(object)val == (Object)null)) { _ = val.itemName; int itemId = val.itemId; SetupScripts(val); if (val.isScrap) { int num = ConvertRarity(itemId, globalRarity); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterScrap(val, num, (LevelTypes)(-1)); } continue; } break; } } public static void SetupScripts(Item item) { switch (item.itemId) { case 117006: PouicPouic.setupScript(item); break; case 117009: EMF.setupScript(item); break; case 117010: case 117011: NoiseOnSpotItem.setupScript(item); break; case 117012: Kejdollv2.setupScript(item); break; case 117013: Culotte.setupScript(item); break; case 117014: EnergySword.setupScript(item); break; case 117007: case 117008: break; } } public static int ConvertRarity(int id, int baseRarity) { double num = 1.0; switch (id) { case 117000: num = 1.0; break; case 117001: num = 1.0; break; case 117002: num = 0.2; break; case 117003: num = 1.4; break; case 117004: num = 0.8; break; case 117005: num = 0.7; break; case 117006: num = 0.9; break; case 117007: num = 0.3; break; case 117008: num = 0.8; break; case 117009: num = 1.6; break; case 117010: num = 1.0; break; case 117011: num = 1.0; break; case 117012: num = 1.5; break; case 117013: num = 1.2; break; case 117014: num = 1.2; break; } return (int)((double)baseRarity * num); } } public static class PluginInfo { public const string PLUGIN_GUID = "BluePlugin"; public const string PLUGIN_NAME = "BluePlugin"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }