using System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using Dawn; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ElowinyScrap")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+d623f605e6bc56764110e8685f67aae2e66227e8")] [assembly: AssemblyProduct("My first plugin")] [assembly: AssemblyTitle("ElowinyScrap")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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; } } } namespace ElowinyScrap { [BepInPlugin("com.elowiny.elowinyscrap", "ElowinyScrap", "1.0.0")] [BepInProcess("Lethal Company.exe")] public class Plugin : BaseUnityPlugin { public static readonly NamespacedKey MyScrapKey = NamespacedKey.From("elowiny", "custom_scrap"); private readonly Harmony harmony = new Harmony("com.elowiny.elowinyscrap"); private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"ElowinyScrap has started loading!"); harmony.PatchAll(); string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "elowinyscrap_bundle"); AssetBundle val = AssetBundle.LoadFromFile(text); Item val2 = val.LoadAsset("Assets/LaurentScrap/LaurentScrap.asset"); Item val3 = val.LoadAsset("Assets/GoldMacronScrap/GoldMacronScrap.asset"); Item val4 = val.LoadAsset("Assets/LorisFigurineScrap/LorisFigurineScrap.asset"); Item val5 = val.LoadAsset("Assets/MeopaSkullScrap/MeopaSkullScrap.asset"); Item val6 = val.LoadAsset("Assets/KatzenHelmetScrap/KatzenHelmetScrap.asset"); Item val7 = val.LoadAsset("Assets/MedievalShieldScrap/MedievalShieldScrap.asset"); Item val8 = val.LoadAsset("Assets/LorisKatanaScrap/LorisKatanaScrap.asset"); Item val9 = val.LoadAsset("Assets/GoldenLugerScrap/GoldenLugerScrap.asset"); Item val10 = val.LoadAsset("Assets/CromwellHeadScrap/CromwellHeadScrap.asset"); Item val11 = val.LoadAsset("Assets/KatzenRailgunScrap/KatzenRailgunScrap.asset"); Item val12 = val.LoadAsset("Assets/KatzenFlamethrowerScrap/KatzenFlamethrowerScrap.asset"); Item val13 = val.LoadAsset("Assets/KatzenLaserScrap/KatzenLaserScrap.asset"); Item val14 = val.LoadAsset("Assets/KatzenBolterScrap/KatzenBolterScrap.asset"); Item val15 = val.LoadAsset("Assets/KatzenHeavyFlamethrowerScrap/KatzenHeavyFlamethrowerScrap.asset"); Item val16 = val.LoadAsset("Assets/PimousseBustScrap/PimousseBustScrap.asset"); Item val17 = val.LoadAsset("Assets/BlueChickenScrap/BlueChickenScrap.asset"); Item val18 = val.LoadAsset("Assets/LostGourdScrap/LostGourdScrap.asset"); Item val19 = val.LoadAsset("Assets/ForestPlushieScrap/ForestPlushieScrap.asset"); Item val20 = val.LoadAsset("Assets/SonicPlushieScrap/SonicPlushieScrap.asset"); Item val21 = val.LoadAsset("Assets/PetainPlateScrap/PetainPlateScrap.asset"); val9.saveItemVariable = true; val11.saveItemVariable = true; val12.saveItemVariable = true; val13.saveItemVariable = true; val14.saveItemVariable = true; val15.saveItemVariable = true; DamageModifierComponent damageModifierComponent = val6.spawnPrefab.AddComponent(); damageModifierComponent.damageReductionMultiplier = 0.3f; FlatDamageModifierComponent flatDamageModifierComponent = val7.spawnPrefab.AddComponent(); flatDamageModifierComponent.flatDamageReduction = 15; SimpleWeaponComponent simpleWeaponComponent = val9.spawnPrefab.AddComponent(); simpleWeaponComponent.ammo = 6; simpleWeaponComponent.playerDamage = 30; simpleWeaponComponent.entityDamage = 2; AudioClip shootSound = val.LoadAsset("Assets/GoldenLugerScrap/GoldenLugerShot.mp3"); GameObject shootParticlePrefab = val.LoadAsset("Assets/GoldenLugerScrap/GoldenLugerParticle.prefab"); simpleWeaponComponent.shootSound = shootSound; simpleWeaponComponent.shootParticlePrefab = shootParticlePrefab; Transform val22 = val9.spawnPrefab.transform.Find("BarrelTip"); simpleWeaponComponent.barrelLocation = (((Object)(object)val22 != (Object)null) ? val22 : val9.spawnPrefab.transform); SimpleWeaponComponent simpleWeaponComponent2 = val11.spawnPrefab.AddComponent(); simpleWeaponComponent2.ammo = 2; simpleWeaponComponent2.playerDamage = 150; simpleWeaponComponent2.entityDamage = 20; AudioClip shootSound2 = val.LoadAsset("Assets/KatzenRailgunScrap/KatzenRailgunShot.mp3"); GameObject shootParticlePrefab2 = val.LoadAsset("Assets/KatzenRailgunScrap/KatzenRailgunParticle.prefab"); simpleWeaponComponent2.shootSound = shootSound2; simpleWeaponComponent2.shootParticlePrefab = shootParticlePrefab2; Transform val23 = val11.spawnPrefab.transform.Find("BarrelTip"); simpleWeaponComponent2.barrelLocation = (((Object)(object)val23 != (Object)null) ? val23 : val11.spawnPrefab.transform); SimpleWeaponComponent simpleWeaponComponent3 = val14.spawnPrefab.AddComponent(); simpleWeaponComponent3.ammo = 8; simpleWeaponComponent3.playerDamage = 50; simpleWeaponComponent3.entityDamage = 3; AudioClip shootSound3 = val.LoadAsset("Assets/KatzenBolterScrap/KatzenBolterShot.mp3"); GameObject shootParticlePrefab3 = val.LoadAsset("Assets/KatzenBolterScrap/KatzenBolterParticle.prefab"); simpleWeaponComponent3.shootSound = shootSound3; simpleWeaponComponent3.shootParticlePrefab = shootParticlePrefab3; Transform val24 = val14.spawnPrefab.transform.Find("BarrelTip"); simpleWeaponComponent3.barrelLocation = (((Object)(object)val24 != (Object)null) ? val24 : val14.spawnPrefab.transform); ContinuousWeaponComponent continuousWeaponComponent = val12.spawnPrefab.AddComponent(); continuousWeaponComponent.maxAmmoSeconds = 15f; continuousWeaponComponent.currentAmmo = 15f; continuousWeaponComponent.hitboxWidth = 0.5f; continuousWeaponComponent.hitboxLength = 5f; continuousWeaponComponent.playerDamage = 5; continuousWeaponComponent.entityDamage = 1; continuousWeaponComponent.damageInterval = 0.5f; AudioClip firingSound = val.LoadAsset("Assets/KatzenFlamethrowerScrap/KatzenFlamethrowerSound.mp3"); GameObject shootParticlePrefab4 = val.LoadAsset("Assets/KatzenFlamethrowerScrap/KatzenFlamethrowerParticle.prefab"); continuousWeaponComponent.firingSound = firingSound; continuousWeaponComponent.shootParticlePrefab = shootParticlePrefab4; Transform val25 = val12.spawnPrefab.transform.Find("BarrelTip"); continuousWeaponComponent.barrelLocation = (((Object)(object)val25 != (Object)null) ? val25 : val12.spawnPrefab.transform); ContinuousWeaponComponent continuousWeaponComponent2 = val13.spawnPrefab.AddComponent(); continuousWeaponComponent2.maxAmmoSeconds = 6f; continuousWeaponComponent2.currentAmmo = 6f; continuousWeaponComponent2.hitboxWidth = 0.2f; continuousWeaponComponent2.hitboxLength = 50f; continuousWeaponComponent2.playerDamage = 5; continuousWeaponComponent2.entityDamage = 1; continuousWeaponComponent2.damageInterval = 0.33f; AudioClip firingSound2 = val.LoadAsset("Assets/KatzenLaserScrap/KatzenLaserSound.mp3"); GameObject shootParticlePrefab5 = val.LoadAsset("Assets/KatzenLaserScrap/KatzenLaserParticle.prefab"); continuousWeaponComponent2.firingSound = firingSound2; continuousWeaponComponent2.shootParticlePrefab = shootParticlePrefab5; Transform val26 = val13.spawnPrefab.transform.Find("BarrelTip"); continuousWeaponComponent2.barrelLocation = (((Object)(object)val26 != (Object)null) ? val26 : val13.spawnPrefab.transform); ContinuousWeaponComponent continuousWeaponComponent3 = val15.spawnPrefab.AddComponent(); continuousWeaponComponent3.maxAmmoSeconds = 12f; continuousWeaponComponent3.currentAmmo = 12f; continuousWeaponComponent3.hitboxWidth = 1f; continuousWeaponComponent3.hitboxLength = 15f; continuousWeaponComponent3.playerDamage = 5; continuousWeaponComponent3.entityDamage = 1; continuousWeaponComponent3.damageInterval = 0.5f; AudioClip firingSound3 = val.LoadAsset("Assets/KatzenHeavyFlamethrowerScrap/KatzenHeavyFlamethrowerSound.mp3"); GameObject shootParticlePrefab6 = val.LoadAsset("Assets/KatzenHeavyFlamethrowerScrap/KatzenHeavyFlamethrowerParticle.prefab"); continuousWeaponComponent3.firingSound = firingSound3; continuousWeaponComponent3.shootParticlePrefab = shootParticlePrefab6; Transform val27 = val15.spawnPrefab.transform.Find("BarrelTip"); continuousWeaponComponent3.barrelLocation = (((Object)(object)val27 != (Object)null) ? val27 : val15.spawnPrefab.transform); NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val5.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val6.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val7.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val8.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val9.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val10.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val11.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val12.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val13.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val14.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val15.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val16.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val17.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val18.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val19.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val20.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val21.spawnPrefab); DawnLib.DefineItem(NamespacedKey.From("elowiny", "laurentscrap"), val2, (Action)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action>)delegate(WeightTableBuilder weightBuilder) { weightBuilder.SetGlobalWeight(100); }); }); }); DawnLib.DefineItem(NamespacedKey.From("elowiny", "goldmacronscrap"), val3, (Action)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action>)delegate(WeightTableBuilder weightBuilder) { weightBuilder.SetGlobalWeight(100); }); }); }); DawnLib.DefineItem(NamespacedKey.From("elowiny", "lorisfigurinescrap"), val4, (Action)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action>)delegate(WeightTableBuilder weightBuilder) { weightBuilder.SetGlobalWeight(100); }); }); }); DawnLib.DefineItem(NamespacedKey.From("elowiny", "meopaskullscrap"), val5, (Action)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action>)delegate(WeightTableBuilder weightBuilder) { weightBuilder.SetGlobalWeight(100); }); }); }); DawnLib.DefineItem(NamespacedKey.From("elowiny", "katzenhelmetscrap"), val6, (Action)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action>)delegate(WeightTableBuilder weightBuilder) { weightBuilder.SetGlobalWeight(100); }); }); }); DawnLib.DefineItem(NamespacedKey.From("elowiny", "medievalshieldscrap"), val7, (Action)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action>)delegate(WeightTableBuilder weightBuilder) { weightBuilder.SetGlobalWeight(100); }); }); }); DawnLib.DefineItem(NamespacedKey.From("elowiny", "loriskatanascrap"), val8, (Action)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action>)delegate(WeightTableBuilder weightBuilder) { weightBuilder.SetGlobalWeight(100); }); }); }); DawnLib.DefineItem(NamespacedKey.From("elowiny", "goldenlugerscrap"), val9, (Action)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action>)delegate(WeightTableBuilder weightBuilder) { weightBuilder.SetGlobalWeight(100); }); }); }); DawnLib.DefineItem(NamespacedKey.From("elowiny", "cromwellheadscrap"), val10, (Action)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action>)delegate(WeightTableBuilder weightBuilder) { weightBuilder.SetGlobalWeight(100); }); }); }); DawnLib.DefineItem(NamespacedKey.From("elowiny", "katzenrailgunscrap"), val11, (Action)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action>)delegate(WeightTableBuilder weightBuilder) { weightBuilder.SetGlobalWeight(100); }); }); }); DawnLib.DefineItem(NamespacedKey.From("elowiny", "katzenflamethrowerscrap"), val12, (Action)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action>)delegate(WeightTableBuilder weightBuilder) { weightBuilder.SetGlobalWeight(100); }); }); }); DawnLib.DefineItem(NamespacedKey.From("elowiny", "katzenlaserscrap"), val13, (Action)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action>)delegate(WeightTableBuilder weightBuilder) { weightBuilder.SetGlobalWeight(100); }); }); }); DawnLib.DefineItem(NamespacedKey.From("elowiny", "katzenbolterscrap"), val14, (Action)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action>)delegate(WeightTableBuilder weightBuilder) { weightBuilder.SetGlobalWeight(100); }); }); }); DawnLib.DefineItem(NamespacedKey.From("elowiny", "katzenheavyflamethrower"), val15, (Action)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action>)delegate(WeightTableBuilder weightBuilder) { weightBuilder.SetGlobalWeight(100); }); }); }); DawnLib.DefineItem(NamespacedKey.From("elowiny", "pimoussebustscrap"), val16, (Action)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action>)delegate(WeightTableBuilder weightBuilder) { weightBuilder.SetGlobalWeight(100); }); }); }); DawnLib.DefineItem(NamespacedKey.From("elowiny", "bluechickenscrap"), val17, (Action)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action>)delegate(WeightTableBuilder weightBuilder) { weightBuilder.SetGlobalWeight(100); }); }); }); DawnLib.DefineItem(NamespacedKey.From("elowiny", "lostgourdscrap"), val18, (Action)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action>)delegate(WeightTableBuilder weightBuilder) { weightBuilder.SetGlobalWeight(100); }); }); }); DawnLib.DefineItem(NamespacedKey.From("elowiny", "forestplushiescrap"), val19, (Action)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action>)delegate(WeightTableBuilder weightBuilder) { weightBuilder.SetGlobalWeight(100); }); }); }); DawnLib.DefineItem(NamespacedKey.From("elowiny", "sonicplushiescrap"), val20, (Action)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action>)delegate(WeightTableBuilder weightBuilder) { weightBuilder.SetGlobalWeight(100); }); }); }); DawnLib.DefineItem(NamespacedKey.From("elowiny", "petainplatescrap"), val21, (Action)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action>)delegate(WeightTableBuilder weightBuilder) { weightBuilder.SetGlobalWeight(100); }); }); }); ((BaseUnityPlugin)this).Logger.LogInfo((object)"ElowinyScrap finished loading!"); } } public class DamageModifierComponent : MonoBehaviour { public float damageReductionMultiplier = 0f; } public class FlatDamageModifierComponent : MonoBehaviour { public int flatDamageReduction = 0; } public class SimpleWeaponComponent : MonoBehaviour { public int ammo = 6; public int playerDamage = 30; public int entityDamage = 2; public AudioClip shootSound; public GameObject shootParticlePrefab; public Transform barrelLocation; } public class ContinuousWeaponComponent : MonoBehaviour { public float maxAmmoSeconds = 10f; public float currentAmmo = 10f; public int playerDamage = 2; public int entityDamage = 1; public float hitboxWidth = 4f; public float hitboxLength = 8f; public float damageInterval = 0.25f; public GameObject shootParticlePrefab; public AudioClip firingSound; public Transform barrelLocation; private bool isFiring = false; private float damageTickTimer = 0f; private ParticleSystem spawnedParticles = null; private AudioSource audioSource = null; private GrabbableObject itemScript; private void Start() { itemScript = ((Component)this).GetComponent(); audioSource = ((Component)this).gameObject.AddComponent(); audioSource.playOnAwake = false; audioSource.spatialBlend = 1f; audioSource.rolloffMode = (AudioRolloffMode)1; audioSource.maxDistance = 30f; if ((Object)(object)itemScript != (Object)null && (Object)(object)itemScript.itemProperties != (Object)null) { itemScript.itemProperties.holdButtonUse = true; } } private void Update() { if ((Object)(object)itemScript != (Object)null && (!itemScript.isHeld || itemScript.isPocketed)) { if (isFiring) { SetFiringState(state: false); itemScript.isBeingUsed = false; } } else { if (!isFiring) { return; } if (currentAmmo <= 0f) { currentAmmo = 0f; SetFiringState(state: false); if ((Object)(object)itemScript != (Object)null) { itemScript.isBeingUsed = false; } return; } currentAmmo -= Time.deltaTime; if ((Object)(object)itemScript.playerHeldBy != (Object)null && (Object)(object)itemScript.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController) { damageTickTimer += Time.deltaTime; if (damageTickTimer >= damageInterval) { damageTickTimer = 0f; FireSphereCast(itemScript.playerHeldBy); } } } } private void FireSphereCast(PlayerControllerB player) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) Ray val = default(Ray); ((Ray)(ref val))..ctor(((Component)player.gameplayCamera).transform.position, ((Component)player.gameplayCamera).transform.forward); float num = hitboxWidth / 2f; int num2 = 2621448; RaycastHit[] array = Physics.SphereCastAll(((Ray)(ref val)).origin, num, ((Ray)(ref val)).direction, hitboxLength, num2, (QueryTriggerInteraction)2); RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit val2 = array2[i]; GameObject gameObject = ((Component)((RaycastHit)(ref val2)).collider).gameObject; PlayerControllerB val3 = gameObject.GetComponentInParent(); if ((Object)(object)val3 == (Object)null) { val3 = gameObject.GetComponent(); } if ((Object)(object)val3 != (Object)null) { if ((Object)(object)val3 != (Object)(object)player) { val3.DamagePlayerFromOtherClientServerRpc(playerDamage, ((Ray)(ref val)).direction, (int)player.playerClientId); } continue; } EnemyAICollisionDetect component = gameObject.GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.mainScript != (Object)null) { component.mainScript.HitEnemyOnLocalClient(entityDamage, ((Ray)(ref val)).direction, player, true, -1); } } } public void SetFiringState(bool state) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) isFiring = state; if ((Object)(object)spawnedParticles == (Object)null && (Object)(object)shootParticlePrefab != (Object)null) { Transform val = (((Object)(object)barrelLocation != (Object)null) ? barrelLocation : ((Component)this).transform); GameObject val2 = Object.Instantiate(shootParticlePrefab, val.position, val.rotation, val); spawnedParticles = val2.GetComponent(); } if (isFiring) { if ((Object)(object)spawnedParticles != (Object)null) { spawnedParticles.Play(); } if ((Object)(object)audioSource != (Object)null && (Object)(object)firingSound != (Object)null) { audioSource.clip = firingSound; audioSource.loop = true; if (!audioSource.isPlaying) { audioSource.Play(); } } } else { if ((Object)(object)spawnedParticles != (Object)null) { spawnedParticles.Stop(); } if ((Object)(object)audioSource != (Object)null) { audioSource.Stop(); } } } } [HarmonyPatch(typeof(GrabbableObject))] public class ContinuousWeaponPatch { [HarmonyPatch("ItemActivate")] [HarmonyPrefix] public static bool ItemActivatePrefix(GrabbableObject __instance, bool used, bool buttonDown) { ContinuousWeaponComponent component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null) { if (buttonDown && component.currentAmmo > 0f) { __instance.isBeingUsed = true; component.SetFiringState(state: true); } else if (!buttonDown) { __instance.isBeingUsed = false; component.SetFiringState(state: false); } return true; } return true; } } [HarmonyPatch(typeof(PlayerControllerB))] public class PlayerDamagePatch { [HarmonyPatch("DamagePlayer")] [HarmonyPrefix] public static void Prefix(PlayerControllerB __instance, ref int damageNumber) { if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance.currentlyHeldObjectServer == (Object)null)) { DamageModifierComponent component = ((Component)__instance.currentlyHeldObjectServer).GetComponent(); FlatDamageModifierComponent component2 = ((Component)__instance.currentlyHeldObjectServer).GetComponent(); float num = damageNumber; if ((Object)(object)component != (Object)null && component.damageReductionMultiplier > 0f) { num *= 1f - component.damageReductionMultiplier; } if ((Object)(object)component2 != (Object)null && component2.flatDamageReduction > 0) { num -= (float)component2.flatDamageReduction; } damageNumber = Mathf.Max(0, Mathf.RoundToInt(num)); } } } [HarmonyPatch(typeof(GrabbableObject))] [HarmonyPatch(typeof(GrabbableObject))] [HarmonyPatch(typeof(GrabbableObject))] public class WeaponUsePatch { [HarmonyPatch("ItemActivate")] [HarmonyPrefix] public static void Prefix(GrabbableObject __instance, bool used, bool buttonDown) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_0203: 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) if (!buttonDown) { return; } SimpleWeaponComponent component = ((Component)__instance).GetComponent(); if (!((Object)(object)component != (Object)null) || component.ammo <= 0) { return; } component.ammo--; if ((Object)(object)component.shootSound != (Object)null) { AudioSource component2 = ((Component)__instance).GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.PlayOneShot(component.shootSound, 1f); } else { AudioSource.PlayClipAtPoint(component.shootSound, ((Component)__instance).transform.position, 1f); } } if ((Object)(object)component.shootParticlePrefab != (Object)null) { Transform val = (((Object)(object)component.barrelLocation != (Object)null) ? component.barrelLocation : ((Component)__instance).transform); GameObject val2 = Object.Instantiate(component.shootParticlePrefab, val.position, val.rotation); Object.Destroy((Object)(object)val2, 2f); } if (!((Object)(object)__instance.playerHeldBy != (Object)null) || !((Object)(object)__instance.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController)) { return; } PlayerControllerB playerHeldBy = __instance.playerHeldBy; Ray val3 = default(Ray); ((Ray)(ref val3))..ctor(((Component)playerHeldBy.gameplayCamera).transform.position, ((Component)playerHeldBy.gameplayCamera).transform.forward); int num = 2623753; RaycastHit[] array = Physics.RaycastAll(val3, 50f, num, (QueryTriggerInteraction)2); Array.Sort(array, (RaycastHit x, RaycastHit y) => ((RaycastHit)(ref x)).distance.CompareTo(((RaycastHit)(ref y)).distance)); RaycastHit[] array2 = array; for (int num2 = 0; num2 < array2.Length; num2++) { RaycastHit val4 = array2[num2]; GameObject gameObject = ((Component)((RaycastHit)(ref val4)).collider).gameObject; PlayerControllerB val5 = gameObject.GetComponentInParent(); if ((Object)(object)val5 == (Object)null) { val5 = gameObject.GetComponent(); } if ((Object)(object)val5 != (Object)null) { if ((Object)(object)val5 != (Object)(object)playerHeldBy) { val5.DamagePlayerFromOtherClientServerRpc(component.playerDamage, ((Ray)(ref val3)).direction, (int)playerHeldBy.playerClientId); break; } continue; } EnemyAICollisionDetect component3 = gameObject.GetComponent(); if ((Object)(object)component3 != (Object)null && (Object)(object)component3.mainScript != (Object)null) { component3.mainScript.HitEnemyOnLocalClient(component.entityDamage, ((Ray)(ref val3)).direction, playerHeldBy, true, -1); break; } if (gameObject.layer == 8 || gameObject.layer == 11 || gameObject.layer == 0) { break; } } } } [HarmonyPatch(typeof(HUDManager))] public class HUDManagerPatch { public static TextMeshProUGUI armorText; [HarmonyPatch("Start")] [HarmonyPostfix] public static void StartPostfix(HUDManager __instance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_005f: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("ElowinyArmorText"); val.transform.SetParent(((Component)((Graphic)__instance.weightCounter).canvas).transform, false); armorText = val.AddComponent(); ((TMP_Text)armorText).font = ((TMP_Text)__instance.weightCounter).font; ((TMP_Text)armorText).fontSize = 16f; ((Graphic)armorText).color = Color.green; ((TMP_Text)armorText).alignment = (TextAlignmentOptions)514; RectTransform component = ((Component)armorText).GetComponent(); component.sizeDelta = new Vector2(300f, 50f); component.anchorMin = new Vector2(0.5f, 0f); component.anchorMax = new Vector2(0.5f, 0f); component.pivot = new Vector2(0.5f, 0f); component.anchoredPosition = new Vector2(0f, 100f); ((TMP_Text)armorText).text = ""; } [HarmonyPatch("Update")] [HarmonyPostfix] public static void UpdatePostfix(HUDManager __instance) { if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null || (Object)(object)armorText == (Object)null) { return; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController.currentlyHeldObjectServer != (Object)null) { DamageModifierComponent component = ((Component)localPlayerController.currentlyHeldObjectServer).GetComponent(); FlatDamageModifierComponent component2 = ((Component)localPlayerController.currentlyHeldObjectServer).GetComponent(); SimpleWeaponComponent component3 = ((Component)localPlayerController.currentlyHeldObjectServer).GetComponent(); ContinuousWeaponComponent component4 = ((Component)localPlayerController.currentlyHeldObjectServer).GetComponent(); string text = ""; if ((Object)(object)component3 != (Object)null) { text += $"Ammo Remaining: {component3.ammo}\n"; } ((TMP_Text)armorText).text = text.Trim(); if ((Object)(object)component != (Object)null && component.damageReductionMultiplier > 0f) { int num = Mathf.RoundToInt(component.damageReductionMultiplier * 100f); text += $"Percentage Damage Reduction: {num}%\n"; } if ((Object)(object)component2 != (Object)null && component2.flatDamageReduction > 0) { text += $"Flat DMG Reduction: {component2.flatDamageReduction} DMG"; } if ((Object)(object)component4 != (Object)null) { int num2 = Mathf.CeilToInt(component4.currentAmmo); text += $"Fuel: {num2}s\n"; } ((TMP_Text)armorText).text = text.Trim(); } else { ((TMP_Text)armorText).text = ""; } } } [HarmonyPatch(typeof(GrabbableObject))] public class WeaponSavePatch { [HarmonyPatch("GetItemDataToSave")] [HarmonyPostfix] public static void SaveAmmo(GrabbableObject __instance, ref int __result) { SimpleWeaponComponent component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null) { __result = component.ammo + 1000; return; } ContinuousWeaponComponent component2 = ((Component)__instance).GetComponent(); if ((Object)(object)component2 != (Object)null) { __result = Mathf.RoundToInt(component2.currentAmmo * 100f) + 10000; } } [HarmonyPatch("LoadItemSaveData")] [HarmonyPostfix] public static void LoadAmmo(GrabbableObject __instance, int saveData) { SimpleWeaponComponent component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null) { if (saveData >= 1000) { component.ammo = saveData - 1000; } return; } ContinuousWeaponComponent component2 = ((Component)__instance).GetComponent(); if ((Object)(object)component2 != (Object)null && saveData >= 10000) { component2.currentAmmo = (float)(saveData - 10000) / 100f; } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "ElowinyScrap"; public const string PLUGIN_NAME = "My first plugin"; public const string PLUGIN_VERSION = "1.0.0"; } }