Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of ArtificerPrimaryRework v1.0.4
plugins/Moffein-ArtificerPrimaryRework/ArtificerPrimaryRework.dll
Decompiled 5 months agousing System; 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 ArtificerPrimaryRework.Components; using BepInEx; using BepInEx.Configuration; using EntityStates.Mage.Weapon; using HG; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.EntityStates.Mage.Weapon; using On.RoR2; using R2API; using R2API.Utils; using RoR2; using RoR2.Orbs; using RoR2.Projectile; using RoR2.Skills; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ArtificerPrimaryRework")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+8b99c36f2c2b84a8d3bb1ad6ea097f7dd6bf3b5e")] [assembly: AssemblyProduct("ArtificerPrimaryRework")] [assembly: AssemblyTitle("ArtificerPrimaryRework")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace ArtificerPrimaryRework { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Moffein.ArtificerPrimaryRework", "ArtificerPrimaryRework", "1.0.4")] public class ArtificerPrimaryReworkPlugin : BaseUnityPlugin { public static AssetBundle assetBundle; public static GameObject fireboltRepeatObject; public static PluginInfo pluginInfo; public static ModdedDamageType ApplyFireboltRepeat; public static ModdedDamageType QuadrupleHitstunPower; public static float procCoefficientFire; public static float procCoefficientLightning; private void Awake() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown pluginInfo = ((BaseUnityPlugin)this).Info; using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ArtificerPrimaryRework.artificerprimaryreworkbundle")) { assetBundle = AssetBundle.LoadFromStream(stream); } Tokens.Init(); QuadrupleHitstunPower = DamageAPI.ReserveDamageType(); SetStateOnHurt.OnTakeDamageServer += new Manipulator(SetStateOnHurt_OnTakeDamageServer); SetupLightningBolt(); SetupFirebolt(); procCoefficientFire = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Fire Bolt", "Proc Coefficient"), 1f, (ConfigDescription)null).Value; procCoefficientLightning = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Plasma Bolt", "Proc Coefficient"), 1f, (ConfigDescription)null).Value; } private void SetStateOnHurt_OnTakeDamageServer(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<DamageReport>(x, "damageDealt") })) { val.Emit(OpCodes.Ldarg_1); val.EmitDelegate<Func<float, DamageReport, float>>((Func<float, DamageReport, float>)((float damageDealt, DamageReport damageReport) => (damageReport.damageInfo != null && DamageAPI.HasModdedDamageType(damageReport.damageInfo, QuadrupleHitstunPower)) ? (damageDealt * 4f) : damageDealt)); } } private void SetupFirebolt() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown ApplyFireboltRepeat = DamageAPI.ReserveDamageType(); GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mage/MageFireboltBasic.prefab").WaitForCompletion(), "MoffeinArtificerPrimaryRework_Firebolt"); val.GetComponent<ProjectileSimple>().lifetime = 10f; val.AddComponent<FireBoltForceAddModdedDamageType>(); ContentAddition.AddProjectile(val); SetAddressableEntityStateField("RoR2/Base/Mage/EntityStates.Mage.Weapon.FireFireBolt.asset", "damageCoefficient", "0.7"); SetAddressableEntityStateField("RoR2/Base/Mage/EntityStates.Mage.Weapon.FireFireBolt.asset", "projectilePrefab", (Object)(object)val); FireBoltRepeatComponent.damageEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/OmniExplosionVFXQuick.prefab").WaitForCompletion(); SkillDef val2 = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Mage/MageBodyFireFirebolt.asset").WaitForCompletion(); val2.attackSpeedBuffsRestockSpeed = false; val2.skillDescriptionToken = "MAGE_PRIMARY_FIRE_DESCRIPTION_MOFFEINARTIFICERPRIMARYREWORK"; HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage); } private void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, damageInfo); if (NetworkServer.active && !damageInfo.rejected && DamageAPI.HasModdedDamageType(damageInfo, ApplyFireboltRepeat) && !(damageInfo.procCoefficient <= 0f)) { FireBoltRepeatComponent fireBoltRepeatComponent = ((Component)self).gameObject.AddComponent<FireBoltRepeatComponent>(); fireBoltRepeatComponent.attacker = damageInfo.attacker; fireBoltRepeatComponent.victim = ((Component)self).gameObject; fireBoltRepeatComponent.victimHealthComponent = self; fireBoltRepeatComponent.damage = damageInfo.damage; fireBoltRepeatComponent.damageType = damageInfo.damageType; DamageAPI.RemoveModdedDamageType(ref fireBoltRepeatComponent.damageType, ApplyFireboltRepeat); fireBoltRepeatComponent.isCrit = damageInfo.crit; fireBoltRepeatComponent.procCoefficient = damageInfo.procCoefficient; fireBoltRepeatComponent.force = ((Vector3)(ref damageInfo.force)).magnitude; } } private void SetupLightningBolt() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_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_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Expected O, but got Unknown GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mage/MageLightningboltBasic.prefab").WaitForCompletion(), "MoffeinArtificerPrimaryRework_Lightningbolt"); val.GetComponent<ProjectileSimple>().lifetime = 10f; val.AddComponent<LightningBoltTriggerComponent>(); ContentAddition.AddProjectile(val); SetAddressableEntityStateField("RoR2/Base/Mage/EntityStates.Mage.Weapon.FireLightningBolt.asset", "damageCoefficient", "0.85"); SetAddressableEntityStateField("RoR2/Base/Mage/EntityStates.Mage.Weapon.FireLightningBolt.asset", "projectilePrefab", (Object)(object)val); SkillDef val2 = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Mage/MageBodyFireLightningBolt.asset").WaitForCompletion(); val2.attackSpeedBuffsRestockSpeed = false; val2.skillDescriptionToken = "MAGE_PRIMARY_LIGHTNING_DESCRIPTION_MOFFEINARTIFICERPRIMARYREWORK"; ProjectileImpactExplosion component = val.GetComponent<ProjectileImpactExplosion>(); LightningBoltTriggerComponent.lightningboltRepeatObject = assetBundle.LoadAsset<GameObject>("LightningboltRepeatPrefab"); LightningBoltRepeatComponent lightningBoltRepeatComponent = LightningBoltTriggerComponent.lightningboltRepeatObject.AddComponent<LightningBoltRepeatComponent>(); lightningBoltRepeatComponent.range = 7.5f; ((ProjectileExplosion)component).blastRadius = 0f; ((ProjectileExplosion)component).blastProcCoefficient = 0f; lightningBoltRepeatComponent.activationEffectPrefab = component.impactEffect; component.impactEffect = null; ((ProjectileExplosion)component).blastDamageCoefficient = 0f; NetworkIdentity val3 = LightningBoltTriggerComponent.lightningboltRepeatObject.AddComponent<NetworkIdentity>(); PrefabAPI.RegisterNetworkPrefab(LightningBoltTriggerComponent.lightningboltRepeatObject); ContentAddition.AddNetworkedObject(LightningBoltTriggerComponent.lightningboltRepeatObject); RadialForceMassLimited radialForceMassLimited = LightningBoltTriggerComponent.lightningboltRepeatObject.AddComponent<RadialForceMassLimited>(); radialForceMassLimited.radius = lightningBoltRepeatComponent.range; radialForceMassLimited.damping = 0.5f; radialForceMassLimited.forceMagnitude = -250f; radialForceMassLimited.forceCoefficientAtEdge = 0.5f; radialForceMassLimited.maxMass = 250f; radialForceMassLimited.flyingOnly = false; radialForceMassLimited.ignorePlayerControlled = true; lightningBoltRepeatComponent.whiffEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/OmniImpactVFXLightning.prefab").WaitForCompletion(); lightningBoltRepeatComponent.activationEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/EliteLightning/LightningStakeNova.prefab").WaitForCompletion(); lightningBoltRepeatComponent.attackSound = ScriptableObject.CreateInstance<NetworkSoundEventDef>(); lightningBoltRepeatComponent.attackSound.eventName = "Play_item_proc_chain_lightning"; ContentAddition.AddNetworkSoundEventDef(lightningBoltRepeatComponent.attackSound); FireLightningBolt.ModifyProjectileInfo += new hook_ModifyProjectileInfo(FireLightningBolt_ModifyProjectileInfo); } private void FireLightningBolt_ModifyProjectileInfo(orig_ModifyProjectileInfo orig, FireLightningBolt self, ref FireProjectileInfo fireProjectileInfo) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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) //IL_003a: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, ref fireProjectileInfo); ref DamageTypeCombo? damageTypeOverride = ref fireProjectileInfo.damageTypeOverride; DamageTypeCombo? val = damageTypeOverride; DamageTypeCombo val2 = DamageTypeCombo.op_Implicit((DamageType)8); damageTypeOverride = (val.HasValue ? new DamageTypeCombo?(val.GetValueOrDefault() | val2) : null); } internal static bool SetAddressableEntityStateField(string fullEntityStatePath, string fieldName, string value) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) EntityStateConfiguration val = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)fullEntityStatePath).WaitForCompletion(); for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++) { if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName) { val.serializedFieldsCollection.serializedFields[i].fieldValue.stringValue = value; return true; } } Debug.LogError((object)("ArtificerPrimaryRework: " + fullEntityStatePath + " does not have field " + fieldName)); return false; } internal static bool SetAddressableEntityStateField(string fullEntityStatePath, string fieldName, Object newObject) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) EntityStateConfiguration val = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)fullEntityStatePath).WaitForCompletion(); for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++) { if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName) { val.serializedFieldsCollection.serializedFields[i].fieldValue.objectValue = newObject; return true; } } Debug.LogError((object)("ArtificerPrimaryRework: " + fullEntityStatePath + " does not have field " + fieldName)); return false; } public static List<HealthComponent> FindEnemiesInSphere(float radius, Vector3 position, TeamIndex team) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_0094: Unknown result type (might be due to invalid IL or missing references) List<HealthComponent> list = new List<HealthComponent>(); Collider[] array = Physics.OverlapSphere(position, radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask)); for (int i = 0; i < array.Length; i++) { HurtBox component = ((Component)array[i]).GetComponent<HurtBox>(); if (Object.op_Implicit((Object)(object)component)) { HealthComponent healthComponent = component.healthComponent; if (Object.op_Implicit((Object)(object)healthComponent) && !list.Contains(healthComponent) && Object.op_Implicit((Object)(object)healthComponent.body) && Object.op_Implicit((Object)(object)healthComponent.body.teamComponent) && healthComponent.body.teamComponent.teamIndex != team) { list.Add(healthComponent); } } } return list; } } internal class Tokens { private static bool initialized; internal static string languageRoot => Path.Combine(assemblyDir, "language"); internal static string assemblyDir => Path.GetDirectoryName(ArtificerPrimaryReworkPlugin.pluginInfo.Location); public static void Init() { if (!initialized) { initialized = true; LoadLanguage(); } } private static void LoadLanguage() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown Language.SetFolders += new hook_SetFolders(fixme); } private static void fixme(orig_SetFolders orig, Language self, IEnumerable<string> newFolders) { if (Directory.Exists(languageRoot)) { IEnumerable<string> second = Directory.EnumerateDirectories(Path.Combine(languageRoot), self.name); orig.Invoke(self, newFolders.Union(second)); } else { orig.Invoke(self, newFolders); } } } } namespace ArtificerPrimaryRework.Components { public class FireBoltForceAddModdedDamageType : MonoBehaviour { private void Start() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) ProjectileDamage component = ((Component)this).GetComponent<ProjectileDamage>(); if (Object.op_Implicit((Object)(object)component)) { DamageAPI.AddModdedDamageType(ref component.damageType, ArtificerPrimaryReworkPlugin.ApplyFireboltRepeat); DamageAPI.AddModdedDamageType(ref component.damageType, ArtificerPrimaryReworkPlugin.QuadrupleHitstunPower); } ProjectileImpactExplosion component2 = ((Component)this).GetComponent<ProjectileImpactExplosion>(); if (Object.op_Implicit((Object)(object)component2)) { ((ProjectileExplosion)component2).blastProcCoefficient = ArtificerPrimaryReworkPlugin.procCoefficientFire; } Object.Destroy((Object)(object)this); } } public class FireBoltRepeatComponent : MonoBehaviour { public static GameObject damageEffectPrefab; public float damage; public bool isCrit; public GameObject attacker; public GameObject victim; public HealthComponent victimHealthComponent; public DamageTypeCombo damageType; public float procCoefficient; public TeamIndex teamIndex; public float force; public float delayBetweenHits = 0.2f; public int totalHits = 4; private float delayTimer = 0f; public void Start() { //IL_0003: 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) teamIndex = (TeamIndex)(-1); if (Object.op_Implicit((Object)(object)attacker)) { CharacterBody component = attacker.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component)) { delayBetweenHits = 0.2f / component.attackSpeed; totalHits = Mathf.Max(totalHits, Mathf.FloorToInt((float)totalHits * component.attackSpeed)); if (Object.op_Implicit((Object)(object)component.teamComponent)) { teamIndex = component.teamComponent.teamIndex; } } } totalHits--; delayTimer = delayBetweenHits; } private void FixedUpdate() { if (!NetworkServer.active) { return; } if (totalHits <= 0) { Object.Destroy((Object)(object)this); return; } if (delayTimer <= 0f) { delayTimer += delayBetweenHits; TriggerAttackServer(); } delayTimer -= Time.fixedDeltaTime; } private void TriggerAttackServer() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_00f1: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { totalHits--; Vector3 position = ((Component)this).transform.position; if (Object.op_Implicit((Object)(object)victimHealthComponent) && Object.op_Implicit((Object)(object)victimHealthComponent.body) && Object.op_Implicit((Object)(object)victimHealthComponent.body.mainHurtBox)) { position = ((Component)victimHealthComponent.body.mainHurtBox).transform.position; } BlastAttack val = new BlastAttack { baseDamage = damage, radius = 2.5f, position = position, crit = isCrit, procChainMask = default(ProcChainMask), procCoefficient = procCoefficient, attacker = attacker, inflictor = attacker, baseForce = force, damageType = damageType, falloffModel = (FalloffModel)0, teamIndex = teamIndex }; val.Fire(); EffectManager.SpawnEffect(damageEffectPrefab, new EffectData { origin = position, scale = 2.5f }, true); } } } internal class LightningBoltRepeatComponent : MonoBehaviour { public NetworkSoundEventDef attackSound; public GameObject activationEffectPrefab; public GameObject whiffEffectPrefab; public float range; public float delayBetweenHits = 0.2f; public int totalHits = 4; private float delayTimer = 0f; public float damage; public bool isCrit; public GameObject attacker; public TeamIndex teamIndex; public DamageTypeCombo damageType; private void Start() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)attacker)) { CharacterBody component = attacker.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component)) { delayBetweenHits = 0.2f / component.attackSpeed; totalHits = Mathf.Max(totalHits, Mathf.FloorToInt((float)totalHits * component.attackSpeed)); } } if (NetworkServer.active) { EffectManager.SpawnEffect(activationEffectPrefab, new EffectData { origin = ((Component)this).transform.position, scale = range }, true); } } private void FixedUpdate() { if (!NetworkServer.active) { return; } if (totalHits <= 0) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } if (delayTimer <= 0f) { delayTimer += delayBetweenHits; TriggerAttackServer(); } delayTimer -= Time.fixedDeltaTime; } private void TriggerAttackServer() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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_0113: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_014f: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Expected O, but got Unknown //IL_0175: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } totalHits--; List<HealthComponent> list = ArtificerPrimaryReworkPlugin.FindEnemiesInSphere(range, ((Component)this).transform.position, teamIndex); EffectManager.SimpleSoundEffect(attackSound.index, ((Component)this).transform.position, true); bool flag = false; foreach (HealthComponent item in list) { if (Object.op_Implicit((Object)(object)item.body) && Object.op_Implicit((Object)(object)item.body.mainHurtBox) && ((Behaviour)item.body.mainHurtBox).isActiveAndEnabled) { LightningOrb val = new LightningOrb { attacker = attacker, inflictor = ((Component)this).gameObject, damageValue = damage, procCoefficient = ArtificerPrimaryReworkPlugin.procCoefficientLightning, teamIndex = teamIndex, isCrit = isCrit, procChainMask = default(ProcChainMask), lightningType = (LightningType)0, damageColorIndex = (DamageColorIndex)0, bouncesRemaining = 0, targetsToFindPerBounce = 1, range = range, origin = ((Component)this).transform.position, damageType = damageType, speed = 120f, target = item.body.mainHurtBox }; DamageAPI.AddModdedDamageType(ref val.damageType, ArtificerPrimaryReworkPlugin.QuadrupleHitstunPower); OrbManager.instance.AddOrb((Orb)(object)val); flag = true; } } if (!flag) { EffectManager.SimpleEffect(whiffEffectPrefab, ((Component)this).transform.position, ((Component)this).transform.rotation, true); } } } public class LightningBoltTriggerComponent : MonoBehaviour { public static GameObject lightningboltRepeatObject; public float damage; public bool isCrit; public GameObject attacker; public TeamIndex teamIndex; public DamageTypeCombo damageType; private void Start() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_0077: Unknown result type (might be due to invalid IL or missing references) ProjectileDamage component = ((Component)this).GetComponent<ProjectileDamage>(); if (Object.op_Implicit((Object)(object)component)) { damage = component.damage; isCrit = component.crit; damageType = component.damageType; } else { damage = 0f; } ProjectileController component2 = ((Component)this).GetComponent<ProjectileController>(); attacker = component2.owner; TeamFilter component3 = ((Component)this).GetComponent<TeamFilter>(); if (Object.op_Implicit((Object)(object)component3)) { teamIndex = component3.teamIndex; } else { teamIndex = (TeamIndex)(-1); } ProjectileImpactExplosion component4 = ((Component)this).GetComponent<ProjectileImpactExplosion>(); ((ProjectileExplosion)component4).OnProjectileExplosion = (Action<BlastAttack, Result>)Delegate.Combine(((ProjectileExplosion)component4).OnProjectileExplosion, new Action<BlastAttack, Result>(SpawnLightningObject)); } private void SpawnLightningObject(BlastAttack attack, Result result) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(lightningboltRepeatObject, attack.position, Quaternion.identity); LightningBoltRepeatComponent component = val.GetComponent<LightningBoltRepeatComponent>(); component.attacker = attacker; component.isCrit = isCrit; component.damage = damage; component.teamIndex = teamIndex; component.damageType = damageType; NetworkServer.Spawn(val); } } public class RadialForceMassLimited : MonoBehaviour { public TeamIndex teamIndex = (TeamIndex)(-1); public float maxMass; public float radius; public float damping = 0.2f; public float forceMagnitude; public float forceCoefficientAtEdge = 0.5f; public TetherVfxOrigin tetherVfxOrigin; public bool flyingOnly = false; public bool ignorePlayerControlled = false; private SphereSearch sphereSearch; public void Awake() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown sphereSearch = new SphereSearch(); } public void Start() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) LightningBoltRepeatComponent component = ((Component)this).GetComponent<LightningBoltRepeatComponent>(); if (Object.op_Implicit((Object)(object)component)) { teamIndex = component.teamIndex; } if ((int)teamIndex == -1) { Object.Destroy((Object)(object)this); } } public void FixedUpdate() { List<HurtBox> list = CollectionPool<HurtBox, List<HurtBox>>.RentCollection(); SearchForTargets(list); int i = 0; for (int count = list.Count; i < count; i++) { ApplyPullToHurtBox(list[i]); } if (Object.op_Implicit((Object)(object)tetherVfxOrigin)) { List<Transform> list2 = CollectionPool<Transform, List<Transform>>.RentCollection(); int j = 0; for (int count2 = list.Count; j < count2; j++) { HurtBox val = list[j]; if (!Object.op_Implicit((Object)(object)val)) { continue; } Transform item = ((Component)val).transform; HealthComponent healthComponent = val.healthComponent; if (Object.op_Implicit((Object)(object)healthComponent)) { Transform coreTransform = healthComponent.body.coreTransform; if (Object.op_Implicit((Object)(object)coreTransform)) { item = coreTransform; } } list2.Add(item); } tetherVfxOrigin.SetTetheredTransforms(list2); CollectionPool<Transform, List<Transform>>.ReturnCollection(list2); } CollectionPool<HurtBox, List<HurtBox>>.ReturnCollection(list); } public void SearchForTargets(List<HurtBox> dest) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) sphereSearch.mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask; sphereSearch.origin = ((Component)this).transform.position; sphereSearch.radius = radius; sphereSearch.queryTriggerInteraction = (QueryTriggerInteraction)0; sphereSearch.RefreshCandidates(); sphereSearch.FilterCandidatesByHurtBoxTeam(TeamMask.GetEnemyTeams(teamIndex)); sphereSearch.OrderCandidatesByDistance(); sphereSearch.FilterCandidatesByDistinctHurtBoxEntities(); sphereSearch.GetHurtBoxes(dest); sphereSearch.ClearCandidates(); } public void ApplyPullToHurtBox(HurtBox hurtBox) { //IL_0164: 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_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: 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_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: 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_022a: 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_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) bool flag = Object.op_Implicit((Object)(object)hurtBox) && Object.op_Implicit((Object)(object)hurtBox.healthComponent) && Object.op_Implicit((Object)(object)hurtBox.healthComponent.body); bool flag2 = false; bool flag3 = false; bool flag4 = false; if (flag) { flag2 = Object.op_Implicit((Object)(object)hurtBox.healthComponent.body.rigidbody); if (flag2) { flag3 = hurtBox.healthComponent.body.rigidbody.mass <= maxMass; } if (hurtBox.healthComponent.body.isFlying || (Object.op_Implicit((Object)(object)hurtBox.healthComponent.body.characterMotor) && !hurtBox.healthComponent.body.characterMotor.isGrounded)) { flag4 = true; } } if (!flag || !flag2 || !flag3 || (flyingOnly && !flag4)) { return; } HealthComponent healthComponent = hurtBox.healthComponent; if (!Object.op_Implicit((Object)(object)healthComponent) || !NetworkServer.active) { return; } bool flag5 = Object.op_Implicit((Object)(object)healthComponent.body) && healthComponent.body.isPlayerControlled; if (!ignorePlayerControlled || !flag5) { CharacterMotor characterMotor = healthComponent.body.characterMotor; Vector3 val = ((Component)hurtBox).transform.position - ((Component)this).transform.position; float num = 1f - Mathf.Clamp(((Vector3)(ref val)).magnitude / radius, 0f, 1f - forceCoefficientAtEdge); val = ((Vector3)(ref val)).normalized * forceMagnitude * (1f - num); Vector3 velocity; float mass; if (Object.op_Implicit((Object)(object)characterMotor)) { velocity = characterMotor.velocity; mass = characterMotor.mass; } else { Rigidbody rigidbody = healthComponent.body.rigidbody; velocity = rigidbody.velocity; mass = rigidbody.mass; } velocity.y += Physics.gravity.y * Time.fixedDeltaTime; healthComponent.TakeDamageForce(val - velocity * (damping * mass * num), true, false); } } } }