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 CommandoDrone v0.1.3
CommandoDrone.dll
Decompiled 11 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using CommandoDrone.States; using EntityStates; using EntityStates.Drone; using EntityStates.Drone.Command; using EntityStates.Drone.DroneWeapon; using EntityStates.Mage.Weapon; using EntityStates.Toolbot; using Microsoft.CodeAnalysis; using On.EntityStates.Drone; using R2API; using RoR2; using RoR2.AsyncManagement; using RoR2.CharacterAI; using RoR2.ContentManagement; using RoR2.Projectile; using RoR2.Skills; using RoR2BepInExPack.GameAssetPathsBetter; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("CommandoDrone")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+4d018cc6376f1021b445a54d46c5496d93bc8fd8")] [assembly: AssemblyProduct("CommandoDrone")] [assembly: AssemblyTitle("CommandoDrone")] [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 CommandoDrone { internal sealed class ArmAimer : MonoBehaviour { private sealed class Arm { internal Transform shoulder; internal Transform elbow; internal Quaternion shoulderRest; internal Quaternion elbowRest; internal Vector3 elbowRestPosition; } private const float MaxAimAngle = 70f; private const float ShoulderShare = 0.4f; private const float RecoilDistance = 0.05f; private const float RecoilRecovery = 14f; private CharacterBody body; private Arm gripper; private Arm torch; private Transform gun; private Transform gunMuzzle; private Transform flameMuzzle; private Quaternion gunRest; private float recoil; private void Start() { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) CharacterModel componentInParent = ((Component)this).GetComponentInParent<CharacterModel>(); body = (Object.op_Implicit((Object)(object)componentInParent) ? componentInParent.body : null); Transform[] children = ((Component)this).GetComponentsInChildren<Transform>(true); gripper = MakeArm(Find("ArmPivotRight"), Find("ElbowPivotRight")); torch = MakeArm(Find("ArmPivotLeft"), Find("ElbowPivotLeft")); gun = Find("GunPivot"); if (Object.op_Implicit((Object)(object)gun)) { gunRest = Quaternion.Inverse(((Component)this).transform.rotation) * gun.rotation; } gunMuzzle = Find("Muzzle"); flameMuzzle = Find("FlameMuzzle"); if (!Object.op_Implicit((Object)(object)body) || (gripper == null && torch == null && !Object.op_Implicit((Object)(object)gun))) { ((Behaviour)this).enabled = false; } Transform Find(string name) { return ((IEnumerable<Transform>)children).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == name)); } } private Arm MakeArm(Transform shoulder, Transform elbow) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)shoulder) || !Object.op_Implicit((Object)(object)elbow)) { return null; } return new Arm { shoulder = shoulder, elbow = elbow, shoulderRest = Quaternion.Inverse(((Component)this).transform.rotation) * shoulder.rotation, elbowRest = Quaternion.Inverse(((Component)this).transform.rotation) * elbow.rotation, elbowRestPosition = elbow.localPosition }; } internal void Recoil() { recoil = 1f; } private void LateUpdate() { //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_0024: 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) //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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019b: 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_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: 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_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body.inputBank)) { return; } Vector3 aimDirection = body.inputBank.aimDirection; Quaternion val = Quaternion.RotateTowards(Quaternion.identity, Quaternion.FromToRotation(body.transform.forward, aimDirection), 70f); Quaternion val2 = Quaternion.Slerp(Quaternion.identity, val, 0.4f); recoil = Mathf.Lerp(recoil, 0f, 1f - Mathf.Exp(-14f * Time.deltaTime)); foreach (Arm item in new Arm[2] { gripper, torch }.Where((Arm a) => a != null)) { item.shoulder.rotation = val2 * ((Component)this).transform.rotation * item.shoulderRest; item.elbow.localPosition = item.elbowRestPosition; item.elbow.rotation = val * ((Component)this).transform.rotation * item.elbowRest; } if (gripper != null) { Transform elbow = gripper.elbow; elbow.position -= aimDirection * (recoil * 0.05f); } if (Object.op_Implicit((Object)(object)gun)) { gun.rotation = val * ((Component)this).transform.rotation * gunRest; } if (Object.op_Implicit((Object)(object)gunMuzzle)) { gunMuzzle.rotation = Quaternion.LookRotation(aimDirection); } if (Object.op_Implicit((Object)(object)flameMuzzle)) { flameMuzzle.rotation = Quaternion.LookRotation(aimDirection); } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Luc1405.CommandoDrone", "CommandoDrone", "0.1.3")] public sealed class CommandoDronePlugin : BaseUnityPlugin { public const string PluginName = "CommandoDrone"; public const string PluginAuthor = "Luc1405"; public const string PluginGUID = "com.Luc1405.CommandoDrone"; public const string PluginVersion = "0.1.3"; internal static ManualLogSource Log; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; DroneSurvivor.Init(); EmpowerBuff.Init(); WingmenPassive.Init(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"CommandoDrone 0.1.3 loaded"); } } internal static class CustomModel { private sealed class ModelMaterials { private readonly Material droneMaterial = DroneSurvivor.Load<Material>(RoR2_DLC3_Drones.matDrone1_A_mat); private readonly AssetBundle bundle; private readonly Dictionary<string, Material> made = new Dictionary<string, Material>(); internal ModelMaterials(AssetBundle bundle) { this.bundle = bundle; } internal Material For(Material imported) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (!made.TryGetValue(((Object)imported).name, out var value)) { value = (made[((Object)imported).name] = Create(((Object)imported).name, imported.color)); } return value; } private Material Create(string name, Color color) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) switch (name) { case "Drone": return Textured("texDrone1ArmyGreen", keepEmission: true); case "DroneBlade": return OperatorGunnerBladeMaterial(); case "RepairKit": return Textured("DrkDroneTex", keepEmission: false); case "HardHat": return Textured("texHardHat", keepEmission: false); default: { Material val = Copy((Texture)(object)Texture2D.whiteTexture, keepEmission: false); val.color = color; if (name.StartsWith("TorchFire") || name.Contains("Glow")) { val.SetTexture("_EmTex", (Texture)(object)Texture2D.whiteTexture); val.SetColor("_EmColor", color); val.SetFloat("_EmPower", 4f); } return val; } } } private Material OperatorGunnerBladeMaterial() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) SkinDefParams val = DroneSurvivor.Load<SkinDefParams>(RoR2_DLC3_Drones.skinDTGunnerlDefault_params_asset); Material defaultMaterial = ((IEnumerable<RendererInfo>)val.rendererInfos).FirstOrDefault((Func<RendererInfo, bool>)((RendererInfo i) => Object.op_Implicit((Object)(object)i.renderer) && ((Object)i.renderer).name.Contains("Blade"))).defaultMaterial; if (Object.op_Implicit((Object)(object)defaultMaterial)) { return defaultMaterial; } CommandoDronePlugin.Log.LogInfo((object)("Operator gunner skin renderers: " + string.Join(", ", val.rendererInfos.Select((RendererInfo i) => (Object.op_Implicit((Object)(object)i.renderer) ? ((Object)i.renderer).name : "null") + "=" + (Object.op_Implicit((Object)(object)i.defaultMaterial) ? ((Object)i.defaultMaterial).name : "null"))))); return DroneSurvivor.Load<Material>(RoR2_Base_Drones.matDroneBlades_mat); } private Material Textured(string textureName, bool keepEmission) { return Copy((Texture)(object)bundle.LoadAsset<Texture2D>(textureName), keepEmission); } private Material Copy(Texture texture, bool keepEmission) { //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_0013: Expected O, but got Unknown Material val = new Material(droneMaterial) { mainTexture = texture }; if (!keepEmission) { val.SetTexture("_EmTex", (Texture)(object)Texture2D.blackTexture); } return val; } } private const string BundleName = "commandodrone"; private const float RotorDegreesPerSecond = 1080f; private const float ExportScale = 2f; private static AssetBundle bundle; private static AssetBundle Bundle { get { if (!Object.op_Implicit((Object)(object)bundle)) { return bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(typeof(CustomModel).Assembly.Location), "commandodrone")); } return bundle; } } internal static Texture2D LoadTexture(string name) { return Bundle.LoadAsset<Texture2D>(name); } private static Transform Place(GameObject bodyPrefab, Transform parent, string modelName) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_007d: Unknown result type (might be due to invalid IL or missing references) GameObject val = Bundle.LoadAsset<GameObject>(modelName); Transform transform = Object.Instantiate<GameObject>(val, parent).transform; Transform transform2 = bodyPrefab.transform; transform.rotation = transform2.rotation * Quaternion.Euler(0f, 180f, 0f) * val.transform.localRotation; transform.localScale = val.transform.localScale * (2f / parent.lossyScale.x); transform.position = transform2.position; return transform; } internal static void Apply(GameObject bodyPrefab, string modelName, Sprite skinIcon = null) { //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) //IL_0099: 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_00b3: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_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) Transform modelTransform = bodyPrefab.GetComponent<ModelLocator>().modelTransform; Transform parent = modelTransform.parent; CharacterModel component = ((Component)modelTransform).GetComponent<CharacterModel>(); foreach (Renderer item2 in from r in ((Component)modelTransform).GetComponentsInChildren<Renderer>(true) where r is MeshRenderer || r is SkinnedMeshRenderer select r) { Object.DestroyImmediate((Object)(object)item2); } Object.DestroyImmediate((Object)(object)((Component)modelTransform).GetComponent<ModelSkinController>()); Transform val = Place(bodyPrefab, modelTransform, modelName); Bounds val2 = MeshBounds(val, parent); val.position += parent.TransformVector(new Vector3(0f - ((Bounds)(ref val2)).center.x, 0f, 0f - ((Bounds)(ref val2)).center.z)); MeshRenderer[] componentsInChildren = ((Component)val).GetComponentsInChildren<MeshRenderer>(true); ModelMaterials materials = new ModelMaterials(Bundle); component.baseRendererInfos = ((IEnumerable<MeshRenderer>)componentsInChildren).Select((Func<MeshRenderer, RendererInfo>)delegate(MeshRenderer r) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) ((Renderer)r).sharedMaterial = materials.For(((Renderer)r).sharedMaterial); return new RendererInfo { renderer = (Renderer)(object)r, defaultMaterial = ((Renderer)r).sharedMaterial, defaultShadowCastingMode = (ShadowCastingMode)1 }; }).ToArray(); SetDefaultSkin(modelTransform, ((Object)bodyPrefab).name + "Default", skinIcon, component.baseRendererInfos); foreach (Transform item3 in from t in ((Component)val).GetComponentsInChildren<Transform>(true) where ((Object)t).name.StartsWith("Rotor") select t) { float num = ((item3.localPosition.x < 0f) ? (-1f) : 1f); ((Component)item3).gameObject.AddComponent<RotateObject>().rotationSpeed = new Vector3(0f, 0f, 1080f * num); } Transform item = Unscaled(FindChild(val, "FlameMuzzle")); SetChildren(((Component)modelTransform).GetComponent<ChildLocator>(), ("Muzzle", Unscaled(FindChild(val, "Muzzle"))), ("SniperMuzzle", Unscaled(FindChild(val, "SniperMuzzle"))), ("MuzzleLeft", item), ("MuzzleRight", item), ("MuzzleCenter", item), ("BombPoint", Unscaled(FindChild(val, "BombPoint")))); FitHurtBoxes(modelTransform, val); ((Component)val).gameObject.AddComponent<ArmAimer>(); } internal static void ApplyJunkLook(GameObject bodyPrefab) { //IL_001d: 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_003c: Expected O, but got Unknown //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_019e: 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) Transform modelTransform = bodyPrefab.GetComponent<ModelLocator>().modelTransform; Material camo = new Material(DroneSurvivor.Load<Material>(RoR2_DLC3_Drones.matJunkDrone_mat)) { mainTexture = (Texture)(object)Bundle.LoadAsset<Texture2D>("texJunkDroneCamo") }; Transform val = Place(bodyPrefab, modelTransform, "Junk Attachments"); ModelMaterials modelMaterials = new ModelMaterials(Bundle); MeshRenderer[] componentsInChildren = ((Component)val).GetComponentsInChildren<MeshRenderer>(true); foreach (MeshRenderer val2 in componentsInChildren) { ((Renderer)val2).sharedMaterial = modelMaterials.For(((Renderer)val2).sharedMaterial); } Transform[] componentsInChildren2 = ((Component)modelTransform).GetComponentsInChildren<Transform>(true); Transform[] array = (from t in ((Component)val).GetComponentsInChildren<Transform>(true) where ((Object)t).name.StartsWith("Attach_") select t).ToArray(); foreach (Transform group in array) { Transform val3 = ((IEnumerable<Transform>)componentsInChildren2).FirstOrDefault((Func<Transform, bool>)((Transform b) => ((Object)b).name == ((Object)group).name.Substring("Attach_".Length))); if (Object.op_Implicit((Object)(object)val3)) { group.SetParent(val3, true); } else { CommandoDronePlugin.Log.LogWarning((object)("Junk Drone has no bone for " + ((Object)group).name)); } } Object.DestroyImmediate((Object)(object)((Component)val).gameObject); RendererInfo[] array2 = (from r in ((Component)modelTransform).GetComponentsInChildren<Renderer>(true) where r is MeshRenderer || r is SkinnedMeshRenderer select r).Select((Func<Renderer, RendererInfo>)((Renderer r) => new RendererInfo { renderer = r, defaultMaterial = ((r is SkinnedMeshRenderer) ? camo : r.sharedMaterial), defaultShadowCastingMode = (ShadowCastingMode)1 })).ToArray(); RendererInfo[] array3 = array2; foreach (RendererInfo val4 in array3) { val4.renderer.sharedMaterial = val4.defaultMaterial; } SkinDef val5 = DroneSurvivor.Load<SkinDef>(RoR2_DLC3_Drones.skinJunkDroneBodyDefault_asset); SetDefaultSkin(modelTransform, ((Object)bodyPrefab).name + "Default", val5.icon, array2, val5); } internal static void SetDefaultSkin(Transform model, string name, Sprite icon, RendererInfo[] renderers, params SkinDef[] baseSkins) { SkinDefParams val = ScriptableObject.CreateInstance<SkinDefParams>(); ((Object)val).name = name + "Params"; val.rendererInfos = renderers; SkinDef val2 = ScriptableObject.CreateInstance<SkinDef>(); ((Object)val2).name = name; val2.nameToken = "DEFAULT_SKIN"; val2.icon = icon; val2.rootObject = ((Component)model).gameObject; val2.baseSkins = baseSkins; val2.skinDefParams = val; ModelSkinController val3 = ((Component)model).GetComponent<ModelSkinController>(); if (!Object.op_Implicit((Object)(object)val3)) { val3 = ((Component)model).gameObject.AddComponent<ModelSkinController>(); } val3.skins = (SkinDef[])(object)new SkinDef[1] { val2 }; } internal static Sprite CreateSkinIcon(Color top, Color right, Color bottom, Color left) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_007d: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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) Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false); for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { bool flag = i > j; bool flag2 = i > 127 - j; val.SetPixel(j, i, (flag && flag2) ? top : ((!flag && !flag2) ? bottom : (flag ? left : right))); } } val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f)); } private static Transform FindChild(Transform model, string name) { return ((IEnumerable<Transform>)((Component)model).GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == name)); } private static Transform Unscaled(Transform point) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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) if (!Object.op_Implicit((Object)(object)point)) { return null; } Transform transform = new GameObject(((Object)point).name + "Unscaled").transform; transform.SetParent(point, false); transform.localScale = Vector3.one / point.lossyScale.x; return transform; } private static void SetChildren(ChildLocator childLocator, params (string name, Transform transform)[] children) { children = children.Where(((string name, Transform transform) c) => Object.op_Implicit((Object)(object)c.transform)).ToArray(); childLocator.transformPairs = childLocator.transformPairs.Where((NameTransformPair p) => children.All(((string name, Transform transform) c) => c.name != p.name)).Concat(children.Select(delegate((string name, Transform transform) c) { //IL_0002: 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) NameTransformPair result = default(NameTransformPair); (result.name, result.transform) = c; return result; })).ToArray(); } private static void FitHurtBoxes(Transform oldModel, Transform model) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_008c: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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) HurtBox[] componentsInChildren = ((Component)oldModel).GetComponentsInChildren<HurtBox>(true); foreach (HurtBox val in componentsInChildren) { Collider component = ((Component)val).GetComponent<Collider>(); CapsuleCollider val2 = (CapsuleCollider)(object)((component is CapsuleCollider) ? component : null); if (val2 == null) { CommandoDronePlugin.Log.LogWarning((object)("Hurtbox " + ((Object)val).name + " is a " + ((object)((Component)val).GetComponent<Collider>())?.GetType().Name + ", not resized")); } else { Bounds val3 = MeshBounds(model, ((Component)val2).transform); Vector3 size = ((Bounds)(ref val3)).size; int num = (val2.direction = ((!(size.x >= size.y) || !(size.x >= size.z)) ? ((size.y >= size.z) ? 1 : 2) : 0)); val2.center = ((Bounds)(ref val3)).center; val2.height = ((Vector3)(ref size))[num]; val2.radius = Mathf.Max(((Vector3)(ref size))[(num + 1) % 3], ((Vector3)(ref size))[(num + 2) % 3]) / 2f; } } } private static Bounds MeshBounds(Transform root, Transform space) { //IL_004b: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00cd: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) Bounds? val = null; foreach (MeshFilter item in from f in ((Component)root).GetComponentsInChildren<MeshFilter>(true) where !((Object)f).name.Contains("Blade") select f) { Bounds bounds = item.sharedMesh.bounds; for (int num = 0; num < 8; num++) { Vector3 val2 = ((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3((float)((num & 1) * 2 - 1), (float)((num & 2) - 1), (float)((num & 4) / 2 - 1))); Vector3 val3 = space.InverseTransformPoint(((Component)item).transform.TransformPoint(val2)); if (val.HasValue) { Bounds value = val.Value; ((Bounds)(ref value)).Encapsulate(val3); val = value; } else { val = new Bounds(val3, Vector3.zero); } } } return val.GetValueOrDefault(); } } internal static class DroneSurvivor { internal const string Prefix = "LUC1405_COMMANDODRONE_"; internal static GameObject BodyPrefab; private const float AngularDrag = 4f; private const float DisplayHoverHeight = 1.2f; internal static T Load<T>(string key) { //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) return Addressables.LoadAssetAsync<T>((object)key).WaitForCompletion(); } internal static void Init() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) BodyPrefab = PrefabAPI.InstantiateClone(Load<GameObject>(RoR2_DLC3_Drones.DTGunnerDroneBody_prefab), "CommandoDroneBody", true); CustomModel.Apply(BodyPrefab, "Commando Drone", CustomModel.CreateSkinIcon(new Color(0.24f, 0.31f, 0.13f), new Color(0.32f, 0.37f, 0.22f), new Color(0.2f, 0.2f, 0.23f), new Color(0.62f, 0.62f, 0.66f))); SetupBody(); SetupSkills(); SetupSurvivor(); AddLanguage(); } private static void SetupBody() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_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_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: 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_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) BodyPrefab.GetComponent<NetworkIdentity>().localPlayerAuthority = true; CharacterBody component = BodyPrefab.GetComponent<CharacterBody>(); component.baseNameToken = "LUC1405_COMMANDODRONE_NAME"; Texture2D val = CustomModel.LoadTexture("texIconCommandoDrone"); if (Object.op_Implicit((Object)(object)val)) { component.portraitIcon = (Texture)(object)val; } component.subtitleNameToken = "LUC1405_COMMANDODRONE_SUBTITLE"; component.bodyFlags = (BodyFlags)(component.bodyFlags & -4194305); component.baseMaxHealth = 110f; component.baseRegen = 1f; component.baseMaxShield = 0f; component.baseDamage = 12f; component.baseAttackSpeed = 1f; component.baseCrit = 1f; component.baseArmor = 0f; component.baseMoveSpeed = 7f; component.autoCalculateLevelStats = true; component.defaultCrosshairPrefab = Load<GameObject>(RoR2_Base_UI.StandardCrosshair_prefab); component.useSprintCrosshair = false; component.preferredInitialStateType = new SerializableEntityStateType(typeof(DroneMainState)); BodyPrefab.GetComponent<RigidbodyMotor>().canTakeImpactDamage = false; BodyPrefab.GetComponent<Rigidbody>().angularDrag = 4f; BodyPrefab.GetComponent<CameraTargetParams>().cameraParams = Load<CharacterCameraParams>(RoR2_DLC3.ccpDroneStandard_asset); BodyPrefab.GetComponent<CharacterDeathBehavior>().deathState = new SerializableEntityStateType(typeof(DeathState)); if (!Object.op_Implicit((Object)(object)BodyPrefab.GetComponent<Interactor>())) { BodyPrefab.AddComponent<Interactor>().maxInteractionDistance = 5f; } if (!Object.op_Implicit((Object)(object)BodyPrefab.GetComponent<InteractionDriver>())) { BodyPrefab.AddComponent<InteractionDriver>(); } if (!Object.op_Implicit((Object)(object)BodyPrefab.GetComponent<EquipmentSlot>())) { BodyPrefab.AddComponent<EquipmentSlot>(); } EntityStateMachine obj = EntityStateMachine.FindByCustomName(BodyPrefab, "Body"); obj.initialStateType = (obj.mainStateType = new SerializableEntityStateType(typeof(DroneMainState))); EnsureStateMachine(BodyPrefab, "Weapon"); EnsureStateMachine(BodyPrefab, "Special"); ChildLocator component2 = ((Component)BodyPrefab.GetComponent<ModelLocator>().modelTransform).GetComponent<ChildLocator>(); List<NameTransformPair> list = component2.transformPairs.ToList(); CommandoDronePlugin.Log.LogDebug((object)("Model children: " + string.Join(", ", list.Select((NameTransformPair p) => p.name)))); Transform val2 = component2.FindChild("Muzzle"); if (!Object.op_Implicit((Object)(object)val2)) { val2 = ((Component)component2).transform; } string[] array = new string[4] { "Muzzle", "MuzzleLeft", "MuzzleRight", "MuzzleCenter" }; foreach (string text in array) { if (!Object.op_Implicit((Object)(object)component2.FindChild(text))) { list.Add(new NameTransformPair { name = text, transform = val2 }); } } component2.transformPairs = list.ToArray(); } internal static void EnsureStateMachine(GameObject bodyPrefab, string name) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)EntityStateMachine.FindByCustomName(bodyPrefab, name))) { EntityStateMachine val = bodyPrefab.AddComponent<EntityStateMachine>(); val.customName = name; val.initialStateType = (val.mainStateType = new SerializableEntityStateType(typeof(Idle))); NetworkStateMachine component = bodyPrefab.GetComponent<NetworkStateMachine>(); component.stateMachines = component.stateMachines.Append(val).ToArray(); } } private static void SetupSkills() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_005e: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) bool flag = default(bool); ContentAddition.AddEntityState<DroneMainState>(ref flag); ContentAddition.AddEntityState<FireGunBurst>(ref flag); ContentAddition.AddEntityState<BombDash>(ref flag); ContentAddition.AddEntityState<Empower>(ref flag); ContentAddition.AddEntityState<FireCoveringFire>(ref flag); GenericSkill[] components = BodyPrefab.GetComponents<GenericSkill>(); for (int i = 0; i < components.Length; i++) { Object.DestroyImmediate((Object)(object)components[i]); } SkillLocator component = BodyPrefab.GetComponent<SkillLocator>(); component.passiveSkill = new PassiveSkill { enabled = true, skillNameToken = "LUC1405_COMMANDODRONE_PASSIVE_NAME", skillDescriptionToken = "LUC1405_COMMANDODRONE_PASSIVE_DESCRIPTION", icon = Load<Sprite>(RoR2_DLC3_Drone_Tech.texDTGunnerDroneIcon_png_texDTGunnerDroneIcon_) }; SkillDef val = Load<SkillDef>(RoR2_Base_Drones.Drone1BodyGun_asset); FireGunBurst.DroneGunCooldown = val.baseRechargeInterval; SkillDef val2 = CreateSkillDef("PRIMARY", typeof(FireGunBurst), "Weapon", 0f, val.icon); val2.skillDescriptionToken = Load<DroneDef>(RoR2_Base_Drones.Drone1_asset).skillDescriptionToken; val2.mustKeyPress = false; val2.isCombatSkill = true; val2.interruptPriority = (InterruptPriority)0; component.primary = AddSkill(BodyPrefab, "Primary", val2); component.secondary = AddSkill(skillDef: CreateSkillDef("SECONDARY", typeof(Flamethrower), "Weapon", 5f, Load<SkillDef>(RoR2_Base_Drones.FlameDroneBodyFlamethrower_asset).icon), bodyPrefab: BodyPrefab, slotName: "Secondary"); SkillDef val3 = CreateSkillDef("UTILITY", typeof(FireCoveringFire), "Special", 10f, Load<Sprite>(RoR2_Base_Missile.texMissileLauncherIcon_png_texMissileLauncherIcon_)); val3.baseMaxStock = 2; val3.mustKeyPress = true; component.utility = AddSkill(BodyPrefab, "Utility", val3); SkillDef val4 = CreateSkillDef("SPECIAL", typeof(Empower), "Special", 20f, Load<BuffDef>(RoR2_Base_EnergizedOnEquipmentUse.bdEnergized_asset).iconSprite); val4.isCombatSkill = false; component.special = AddSkill(BodyPrefab, "Special", val4); } internal static SkillDef CreateSkillDef(string key, Type state, string machine, float cooldown, Sprite icon) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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) SkillDef val = ScriptableObject.CreateInstance<SkillDef>(); val.skillName = "LUC1405_COMMANDODRONE_" + key; ((Object)val).name = val.skillName; val.skillNameToken = "LUC1405_COMMANDODRONE_" + key + "_NAME"; val.skillDescriptionToken = "LUC1405_COMMANDODRONE_" + key + "_DESCRIPTION"; val.icon = icon; val.activationState = new SerializableEntityStateType(state); val.activationStateMachineName = machine; val.baseRechargeInterval = cooldown; val.baseMaxStock = 1; val.rechargeStock = 1; val.requiredStock = 1; val.stockToConsume = 1; val.interruptPriority = (InterruptPriority)1; val.isCombatSkill = true; val.fullRestockOnAssign = true; val.cancelSprintingOnActivation = false; val.canceledFromSprinting = false; ContentAddition.AddSkillDef(val); return val; } internal static GenericSkill AddSkill(GameObject bodyPrefab, string slotName, SkillDef skillDef) { //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_0049: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) SkillFamily val = ScriptableObject.CreateInstance<SkillFamily>(); ((Object)val).name = skillDef.skillName + "_FAMILY"; Variant[] array = new Variant[1]; Variant val2 = new Variant { skillDef = skillDef }; ((Variant)(ref val2)).viewableNode = new Node(skillDef.skillNameToken, false, (Node)null); array[0] = val2; val.variants = (Variant[])(object)array; ContentAddition.AddSkillFamily(val); GenericSkill obj = bodyPrefab.AddComponent<GenericSkill>(); obj.skillName = slotName; obj._skillFamily = val; return obj; } private static void SetupSurvivor() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_006f: 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) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00ac: 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_0137: Unknown result type (might be due to invalid IL or missing references) Transform modelTransform = BodyPrefab.GetComponent<ModelLocator>().modelTransform; GameObject val = PrefabAPI.InstantiateClone(((Component)modelTransform).gameObject, "CommandoDroneDisplay", false); Quaternion val2 = Quaternion.Inverse(BodyPrefab.transform.rotation) * modelTransform.rotation; val.transform.rotation = Quaternion.identity; foreach (Transform item in val.transform) { Transform val3 = item; val3.localPosition = val2 * val3.localPosition; val3.localRotation = val2 * val3.localRotation; val3.position += Vector3.up * 1.2f; } SurvivorDef obj = ScriptableObject.CreateInstance<SurvivorDef>(); ((Object)obj).name = "CommandoDrone"; obj.bodyPrefab = BodyPrefab; obj.displayPrefab = val; obj.displayNameToken = "LUC1405_COMMANDODRONE_NAME"; obj.descriptionToken = "LUC1405_COMMANDODRONE_DESCRIPTION"; obj.outroFlavorToken = "LUC1405_COMMANDODRONE_OUTRO_FLAVOR"; obj.mainEndingEscapeFailureFlavorToken = "LUC1405_COMMANDODRONE_OUTRO_FAILURE"; obj.primaryColor = new Color(0.85f, 0.65f, 0.3f); obj.desiredSortPosition = 100f; ContentAddition.AddBody(BodyPrefab); ContentAddition.AddSurvivorDef(obj); GameObject obj2 = PrefabAPI.InstantiateClone(Load<GameObject>(RoR2_Base_Drones.Drone1Master_prefab), "CommandoDroneMonsterMaster", true); obj2.GetComponent<CharacterMaster>().bodyPrefab = BodyPrefab; ContentAddition.AddMaster(obj2); } private static void AddSkillNumbers() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown Flamethrower val = (Flamethrower)EntityStateCatalog.InstantiateState(typeof(Flamethrower)); LanguageAPI.Add("LUC1405_COMMANDODRONE_SECONDARY_DESCRIPTION", "<style=cIsDamage>Ignite</style>. Burn enemies at close range with the blowtorch for " + $"<style=cIsDamage>{((Flamethrower)val).totalDamageCoefficient:0%} damage</style> over {((Flamethrower)val).baseFlamethrowerDuration:0.#} seconds."); } private static void AddLanguage() { RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(AddSkillNumbers)); LanguageAPI.Add("LUC1405_COMMANDODRONE_NAME", "Gen. HARD-HAT"); LanguageAPI.Add("LUC1405_COMMANDODRONE_SUBTITLE", "Leader of the Swarm"); LanguageAPI.Add("LUC1405_COMMANDODRONE_DESCRIPTION", "Gen. HARD-HAT is a rogue drone. Having fixed up two other trashed drones, they now seek to complete their mission on Petrichor V.<style=cSub>\r\n\r\n< ! > Wingmen gives you two drones who inherit a stack of each of your items, increasing when you use a drone combiner station to upgrade them.\r\n\r\n< ! > Burst Fire gives you consistent, albeit low damage.\r\n\r\n< ! > Blowtorch gives you a close range burst of damage, igniting your enemies as you fly along.\r\n\r\n< ! > Covering Fire launches a missile from you and all your drones. The more drones you have, the stronger it will become.\r\n\r\n< ! > UPGRADE! empowers you and your allies for a big battle or a quick escape.</style>\r\n"); LanguageAPI.Add("LUC1405_COMMANDODRONE_LORE", "\"You think you're ever gonna get that hunk of junk working?\"\n\n\"It's almost finished. I just need to reprogram it's directives.\"\n\n\"Was it worth the effort? Do you really think it'll help us?\"\n\n\"We can only hope. We're stuck here on this godforsaken planet anyways.\"\n\n\"Sure, but what's a little repair drone gonna do?\""); LanguageAPI.Add("LUC1405_COMMANDODRONE_OUTRO_FLAVOR", "..and so it left, its wingmen in tow."); LanguageAPI.Add("LUC1405_COMMANDODRONE_OUTRO_FAILURE", "..and so it vanished, a broken drone among many."); LanguageAPI.Add("LUC1405_COMMANDODRONE_PASSIVE_NAME", "Wingmen"); LanguageAPI.Add("LUC1405_COMMANDODRONE_PASSIVE_DESCRIPTION", string.Format("Start with <style=cIsUtility>{0}</style>, a Gunner Drone whose sniper rifle fires a piercing shot for <style=cIsDamage>{1:0%} damage</style>, and <style=cIsUtility>{2}</style>, a Junk Drone that lobs junk for <style=cIsDamage>{3:0%} damage</style> and flies Bombing Runs dropping <style=cIsDamage>{4}x{5:0%} damage</style> bombs. Each inherits <style=cIsUtility>one stack of each of your items</style>, plus one per Drone Combiner upgrade. Destroyed wingmen <style=cIsHealing>repair</style> after {6} seconds.", "Pvt. P4RTS", 5f, "Sgt. SCRAP-SPER", 3f, 10, 1f, 30f)); LanguageAPI.Add("LUC1405_COMMANDODRONE_PRIMARY_NAME", "Burst Fire"); LanguageAPI.Add("LUC1405_COMMANDODRONE_SECONDARY_NAME", "Blowtorch"); LanguageAPI.Add("LUC1405_COMMANDODRONE_UTILITY_NAME", "Covering Fire"); LanguageAPI.Add("LUC1405_COMMANDODRONE_UTILITY_DESCRIPTION", $"Launch a missile from yourself and <style=cIsUtility>every drone you own</style> for <style=cIsDamage>{3f:0%} damage</style> each."); LanguageAPI.Add("LUC1405_COMMANDODRONE_SPECIAL_NAME", "UPGRADE!"); LanguageAPI.Add("LUC1405_COMMANDODRONE_SPECIAL_DESCRIPTION", $"Empower yourself and your drones for <style=cIsUtility>{8f} seconds</style>: <style=cIsUtility>+20% movement speed</style>, <style=cIsDamage>+20% attack speed</style> and <style=cIsUtility>50% reduced cooldowns</style>."); } } internal static class EmpowerBuff { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static StatHookEventHandler <>9__1_0; public static EffectCondition <>9__1_1; internal void <Init>b__1_0(CharacterBody body, StatHookEventArgs args) { if (body.HasBuff(BuffDef)) { args.moveSpeedMultAdd += 0.2f; args.attackSpeedMultAdd += 0.2f; args.allSkills.cooldownMultiplier *= 0.5f; } } internal bool <Init>b__1_1(CharacterBody body) { return body.HasBuff(BuffDef); } } internal static BuffDef BuffDef; internal static void Init() { //IL_0048: 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_0087: 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_0092: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown BuffDef val = DroneSurvivor.Load<BuffDef>(RoR2_Base_EnergizedOnEquipmentUse.bdEnergized_asset); BuffDef = ScriptableObject.CreateInstance<BuffDef>(); ((Object)BuffDef).name = "bdCommandoDroneEmpower"; BuffDef.iconSprite = val.iconSprite; BuffDef.buffColor = new Color(1f, 0.75f, 0.2f); BuffDef.canStack = false; BuffDef.isDebuff = false; ContentAddition.AddBuffDef(BuffDef); object obj = <>c.<>9__1_0; if (obj == null) { StatHookEventHandler val2 = delegate(CharacterBody body, StatHookEventArgs args) { if (body.HasBuff(BuffDef)) { args.moveSpeedMultAdd += 0.2f; args.attackSpeedMultAdd += 0.2f; args.allSkills.cooldownMultiplier *= 0.5f; } }; <>c.<>9__1_0 = val2; obj = (object)val2; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj; GameObject obj2 = DroneSurvivor.Load<GameObject>(RoR2_Base_TeamWarCry.TeamWarCryAura_prefab); object obj3 = <>c.<>9__1_1; if (obj3 == null) { EffectCondition val3 = (CharacterBody body) => body.HasBuff(BuffDef); <>c.<>9__1_1 = val3; obj3 = (object)val3; } TempVisualEffectAPI.AddTemporaryVisualEffect(obj2, (EffectCondition)obj3, false, ""); } } internal sealed class WingmenPassive : MonoBehaviour { private sealed class Wingman : MonoBehaviour { } private sealed class DroneContent : IContentPackProvider { private readonly ContentPack pack = new ContentPack(); public string identifier => "com.Luc1405.CommandoDrone.Drones"; public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { pack.identifier = identifier; pack.droneDefs.Add(wingmanDroneDefs); args.ReportProgress(1f); yield break; } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(pack, args.output); args.ReportProgress(1f); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); yield break; } } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static CollectContentPackProvidersDelegate <>9__13_0; public static Action<CharacterBody> <>9__13_1; public static hook_OnImpactServer <>9__13_2; public static Action<CharacterBody> <>9__13_3; internal void <Init>b__13_0(AddContentPackProviderDelegate add) { add.Invoke((IContentPackProvider)(object)new DroneContent()); } internal void <Init>b__13_1(CharacterBody body) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && Object.op_Implicit((Object)(object)body.master) && Object.op_Implicit((Object)(object)body.master.playerCharacterMasterController) && body.bodyIndex == BodyCatalog.FindBodyIndex(DroneSurvivor.BodyPrefab)) { WingmenPassive wingmenPassive = ((Component)body.master).GetComponent<WingmenPassive>(); if (!Object.op_Implicit((Object)(object)wingmenPassive)) { wingmenPassive = ((Component)body.master).gameObject.AddComponent<WingmenPassive>(); } wingmenPassive.OnOwnerBodyStart(body); } } internal void <Init>b__13_2(orig_OnImpactServer orig, DeathState self, Vector3 contactPoint) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)((EntityState)self).characterBody) || !Object.op_Implicit((Object)(object)((EntityState)self).characterBody.master) || !Object.op_Implicit((Object)(object)((Component)((EntityState)self).characterBody.master).GetComponent<Wingman>())) { orig.Invoke(self, contactPoint); } } internal void <Init>b__13_3(CharacterBody body) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) //IL_0059: Unknown result type (might be due to invalid IL or missing references) <>c__DisplayClass13_0 CS$<>8__locals1 = new <>c__DisplayClass13_0 { body = body }; int num = Array.FindIndex(wingmanBodyPrefabs, (GameObject b) => CS$<>8__locals1.body.bodyIndex == BodyCatalog.FindBodyIndex(b)); if (num < 0) { return; } PickupIndex val = PickupCatalog.FindPickupIndex(wingmanDroneDefs[num].droneIndex); foreach (LocalUser readOnlyLocalUsers in LocalUserManager.readOnlyLocalUsersList) { UserProfile userProfile = readOnlyLocalUsers.userProfile; if (userProfile != null) { userProfile.DiscoverPickup(val); } } } } [CompilerGenerated] private sealed class <>c__DisplayClass13_0 { public CharacterBody body; internal bool <Init>b__4(GameObject b) { //IL_0006: 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) return body.bodyIndex == BodyCatalog.FindBodyIndex(b); } } public const float RepairTime = 30f; public const string GunnerName = "Pvt. P4RTS"; public const string JunkName = "Sgt. SCRAP-SPER"; private const float EnemyAttentionDuration = 2f; private static GameObject[] wingmanMasterPrefabs; private static GameObject[] wingmanBodyPrefabs; private static string[] originalBodyKeys; private static DroneDef[] wingmanDroneDefs; private CharacterMaster[] drones; private float[] repairTimers; private CharacterMaster master; private bool syncing; internal static void Init() { //IL_00f0: 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_00fb: Expected O, but got Unknown //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Expected O, but got Unknown originalBodyKeys = new string[2] { RoR2_Base_Drones.Drone1Body_prefab, RoR2_DLC3_Drones.JunkDroneBody_prefab }; wingmanBodyPrefabs = (GameObject[])(object)new GameObject[2]; wingmanDroneDefs = (DroneDef[])(object)new DroneDef[2]; wingmanMasterPrefabs = (GameObject[])(object)new GameObject[2] { CreateWingmanMaster(0, RoR2_Base_Drones.Drone1Master_prefab, RoR2_Base_Drones.Drone1_asset, "CommandoDroneGunnerWingman", "WINGMAN_GUNNER", "Pvt. P4RTS", "texIconPvtP4RTS", $"Fires bursts from its swivelling gun, and a piercing sniper shot for <style=cIsDamage>{5f:0%} damage</style> every 8 seconds.", "\"Why did you bolt a monocle to it?\"\n\n\"It was the only optic I could salvage. It seems to like it, though.\"\n\n\"And the rifle?\"\n\n\"Same story. Half of this thing used to be something else.\""), CreateWingmanMaster(1, RoR2_DLC3_Drones.JunkDroneMaster_prefab, RoR2_DLC3_Drones.JunkDrone_asset, "CommandoDroneJunkWingman", "WINGMAN_JUNK", "Sgt. SCRAP-SPER", "texIconB3RN13", $"Lobs a ball of junk for <style=cIsDamage>{3f:0%} damage</style> every 5 seconds, and flies Bombing Runs over enemies, " + $"dropping <style=cIsDamage>{10} bombs</style> for <style=cIsDamage>{1f:0%} damage</style> each.", "\"That one still rattles when it flies.\"\n\n\"It's carrying half the scrapyard. Every piece it picks up, it throws back at something.\"\n\n\"Did you teach it that?\"\n\n\"No. It figured that out on its own.\"") }; object obj = <>c.<>9__13_0; if (obj == null) { CollectContentPackProvidersDelegate val = delegate(AddContentPackProviderDelegate add) { add.Invoke((IContentPackProvider)(object)new DroneContent()); }; <>c.<>9__13_0 = val; obj = (object)val; } ContentManager.collectContentPackProviders += (CollectContentPackProvidersDelegate)obj; SetupSniperDrone(wingmanBodyPrefabs[0], wingmanMasterPrefabs[0]); SetupJunkDrone(wingmanBodyPrefabs[1], wingmanMasterPrefabs[1]); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(RegisterWithDroneSystems)); CharacterBody.onBodyStartGlobal += delegate(CharacterBody body) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && Object.op_Implicit((Object)(object)body.master) && Object.op_Implicit((Object)(object)body.master.playerCharacterMasterController) && body.bodyIndex == BodyCatalog.FindBodyIndex(DroneSurvivor.BodyPrefab)) { WingmenPassive wingmenPassive = ((Component)body.master).GetComponent<WingmenPassive>(); if (!Object.op_Implicit((Object)(object)wingmenPassive)) { wingmenPassive = ((Component)body.master).gameObject.AddComponent<WingmenPassive>(); } wingmenPassive.OnOwnerBodyStart(body); } }; object obj2 = <>c.<>9__13_2; if (obj2 == null) { hook_OnImpactServer val2 = delegate(orig_OnImpactServer orig, DeathState self, Vector3 contactPoint) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)((EntityState)self).characterBody) || !Object.op_Implicit((Object)(object)((EntityState)self).characterBody.master) || !Object.op_Implicit((Object)(object)((Component)((EntityState)self).characterBody.master).GetComponent<Wingman>())) { orig.Invoke(self, contactPoint); } }; <>c.<>9__13_2 = val2; obj2 = (object)val2; } DeathState.OnImpactServer += (hook_OnImpactServer)obj2; CharacterBody.onBodyStartGlobal += delegate(CharacterBody body) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) //IL_0059: Unknown result type (might be due to invalid IL or missing references) int num = Array.FindIndex(wingmanBodyPrefabs, (GameObject b) => body.bodyIndex == BodyCatalog.FindBodyIndex(b)); if (num < 0) { return; } PickupIndex val3 = PickupCatalog.FindPickupIndex(wingmanDroneDefs[num].droneIndex); foreach (LocalUser readOnlyLocalUsers in LocalUserManager.readOnlyLocalUsersList) { UserProfile userProfile = readOnlyLocalUsers.userProfile; if (userProfile != null) { userProfile.DiscoverPickup(val3); } } }; } private static GameObject CreateWingmanMaster(int i, string masterKey, string droneDefKey, string name, string tokenKey, string displayName, string iconName, string skills, string lore) { //IL_0140: 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) GameObject val = PrefabAPI.InstantiateClone(DroneSurvivor.Load<GameObject>(originalBodyKeys[i]), name + "Body", true); string text = "LUC1405_COMMANDODRONE_" + tokenKey; val.GetComponent<CharacterBody>().baseNameToken = text + "_NAME"; Texture2D val2 = CustomModel.LoadTexture(iconName); if (Object.op_Implicit((Object)(object)val2)) { val.GetComponent<CharacterBody>().portraitIcon = (Texture)(object)val2; } else { CommandoDronePlugin.Log.LogWarning((object)("Bundle has no " + iconName + ", keeping the vanilla icon")); } LanguageAPI.Add(text + "_NAME", displayName); LanguageAPI.Add(text + "_SKILLS", skills); LanguageAPI.Add(text + "_LORE", lore); ContentAddition.AddBody(val); wingmanBodyPrefabs[i] = val; DroneDef val3 = Object.Instantiate<DroneDef>(DroneSurvivor.Load<DroneDef>(droneDefKey)); ((Object)val3).name = name; val3.bodyPrefab = val; val3.nameToken = text + "_NAME"; val3.skillDescriptionToken = text + "_SKILLS"; val3.droneBrokenSpawnCard = null; val3.remoteOpBody = null; val3.canDrop = false; val3.canScrap = false; val3.canCombine = true; if (Object.op_Implicit((Object)(object)val2)) { val3.iconSprite = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f)); val3.iconSpriteReference = new AssetReferenceT<Sprite>(""); } wingmanDroneDefs[i] = val3; GameObject obj = PrefabAPI.InstantiateClone(DroneSurvivor.Load<GameObject>(masterKey), name + "Master", true); obj.GetComponent<CharacterMaster>().bodyPrefab = val; obj.GetComponent<BaseAI>().enemyAttentionDuration = 2f; ContentAddition.AddMaster(obj); return obj; } private static void SetupSniperDrone(GameObject body, GameObject master) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) CustomModel.Apply(body, "Gunner Wingman"); bool flag = default(bool); ContentAddition.AddEntityState<FireSniperShot>(ref flag); DroneSurvivor.EnsureStateMachine(body, "Sniper"); SkillDef skillDef = DroneSurvivor.CreateSkillDef("WINGMAN_SNIPER", typeof(FireSniperShot), "Sniper", 8f, DroneSurvivor.Load<SkillDef>(RoR2_Base_Drones.Drone1BodyGun_asset).icon); body.GetComponent<SkillLocator>().secondary = DroneSurvivor.AddSkill(body, "Secondary", skillDef); AISkillDriver[] components = master.GetComponents<AISkillDriver>(); for (int i = 0; i < components.Length; i++) { Object.DestroyImmediate((Object)(object)components[i]); } AddDriver(master, "LeashToLeader", (SkillSlot)(-1), (TargetType)2, 60f, float.PositiveInfinity, (MovementType)1, (AimType)1, needsLoS: true, sprint: true); AddDriver(master, "Snipe", (SkillSlot)1, (TargetType)0, 0f, 100f, (MovementType)2, (AimType)2); AddDriver(master, "FleeCloseEnemy", (SkillSlot)(-1), (TargetType)0, 0f, 8f, (MovementType)3, (AimType)2); AddDriver(master, "StrafeEnemyGun", (SkillSlot)0, (TargetType)0, 0f, 30f, (MovementType)2, (AimType)2, needsLoS: true, sprint: false, requireReady: false); AddDriver(master, "ChaseEnemyGun", (SkillSlot)0, (TargetType)0, 0f, 90f, (MovementType)1, (AimType)2, needsLoS: true, sprint: false, requireReady: false); AddDriver(master, "IdleNearLeader", (SkillSlot)(-1), (TargetType)2, 0f, 20f, (MovementType)2, (AimType)1, needsLoS: false); AddDriver(master, "ReturnToLeader", (SkillSlot)(-1), (TargetType)2, 0f, float.PositiveInfinity, (MovementType)1, (AimType)1, needsLoS: false); } private static void SetupJunkDrone(GameObject body, GameObject master) { //IL_0008: 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) CustomModel.ApplyJunkLook(body); bool flag = default(bool); ContentAddition.AddEntityState<FireJunkBall>(ref flag); DroneSurvivor.EnsureStateMachine(body, "Weapon"); SkillLocator component = body.GetComponent<SkillLocator>(); GenericSkill[] components = body.GetComponents<GenericSkill>(); for (int i = 0; i < components.Length; i++) { Object.DestroyImmediate((Object)(object)components[i]); } Sprite icon = DroneSurvivor.Load<Sprite>(RoR2_DLC3_Drones.texJunkDroneIcon_png_texJunkDroneIcon_); component.primary = DroneSurvivor.AddSkill(body, "Primary", DroneSurvivor.CreateSkillDef("WINGMAN_JUNKBALL", typeof(FireJunkBall), "Weapon", 5f, icon)); SkillDef val = DroneSurvivor.CreateSkillDef("WINGMAN_BOMBINGRUN", typeof(BombDash), "Body", 7f, icon); val.interruptPriority = (InterruptPriority)2; component.utility = DroneSurvivor.AddSkill(body, "Utility", val); AISkillDriver[] components2 = master.GetComponents<AISkillDriver>(); for (int i = 0; i < components2.Length; i++) { Object.DestroyImmediate((Object)(object)components2[i]); } AddDriver(master, "LeashToLeader", (SkillSlot)(-1), (TargetType)2, 60f, float.PositiveInfinity, (MovementType)1, (AimType)1, needsLoS: true, sprint: true); AddDriver(master, "BombingRun", (SkillSlot)2, (TargetType)0, 0f, 15f, (MovementType)1, (AimType)2); AddDriver(master, "FleeCloseEnemy", (SkillSlot)(-1), (TargetType)0, 0f, 8f, (MovementType)3, (AimType)2); AddDriver(master, "JunkBall", (SkillSlot)0, (TargetType)0, 0f, 45f, (MovementType)2, (AimType)2); AddDriver(master, "StrafeEnemy", (SkillSlot)(-1), (TargetType)0, 0f, 30f, (MovementType)2, (AimType)2); AddDriver(master, "ChaseEnemy", (SkillSlot)(-1), (TargetType)0, 0f, 90f, (MovementType)1, (AimType)2); AddDriver(master, "IdleNearLeader", (SkillSlot)(-1), (TargetType)2, 0f, 20f, (MovementType)2, (AimType)1, needsLoS: false); AddDriver(master, "ReturnToLeader", (SkillSlot)(-1), (TargetType)2, 0f, float.PositiveInfinity, (MovementType)1, (AimType)1, needsLoS: false); } private static void AddDriver(GameObject master, string name, SkillSlot slot, TargetType target, float minDistance, float maxDistance, MovementType movement, AimType aim, bool needsLoS = true, bool sprint = false, bool requireReady = true) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_0029: 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) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0067: Unknown result type (might be due to invalid IL or missing references) AISkillDriver obj = master.AddComponent<AISkillDriver>(); obj.customName = name; obj.skillSlot = slot; obj.requireSkillReady = requireReady && (int)slot != -1; obj.moveTargetType = target; obj.minDistance = minDistance; obj.maxDistance = maxDistance; obj.selectionRequiresTargetLoS = needsLoS && (int)target == 0; obj.activationRequiresTargetLoS = obj.selectionRequiresTargetLoS; obj.movementType = movement; obj.aimType = aim; obj.shouldSprint = sprint; } private static void RegisterWithDroneSystems() { //IL_000b: 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_0016: 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_0032: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < wingmanBodyPrefabs.Length; i++) { BodyIndex val = BodyCatalog.FindBodyIndex(wingmanBodyPrefabs[i]); DroneCombinerController.droneCompatibilityLUT[val] = BodyCatalog.FindBodyIndex(DroneSurvivor.Load<GameObject>(originalBodyKeys[i])); DroneCombinerController.doNotDestroy.Add(val); } } private void Awake() { master = ((Component)this).GetComponent<CharacterMaster>(); drones = (CharacterMaster[])(object)new CharacterMaster[wingmanMasterPrefabs.Length]; repairTimers = new float[wingmanMasterPrefabs.Length]; master.inventory.onInventoryChanged += SyncInventories; } private void OnDestroy() { if (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.inventory)) { master.inventory.onInventoryChanged -= SyncInventories; } CharacterMaster[] array = drones; foreach (CharacterMaster val in array) { if (Object.op_Implicit((Object)(object)val)) { val.inventory.onInventoryChanged -= SyncInventories; val.TrueKill(); } } } private void OnOwnerBodyStart(CharacterBody owner) { for (int i = 0; i < drones.Length; i++) { ReviveDrone(i, owner); } } private void FixedUpdate() { CharacterBody body = master.GetBody(); for (int i = 0; i < drones.Length; i++) { if (Object.op_Implicit((Object)(object)drones[i]) && Object.op_Implicit((Object)(object)drones[i].GetBody())) { repairTimers[i] = 0f; continue; } repairTimers[i] += Time.fixedDeltaTime; if (repairTimers[i] >= 30f && Object.op_Implicit((Object)(object)body)) { ReviveDrone(i, body); } } } private void ReviveDrone(int i, CharacterBody owner) { //IL_000e: 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_001d: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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) //IL_005a: 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) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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) //IL_007e: 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_0109: Unknown result type (might be due to invalid IL or missing references) repairTimers[i] = 0f; Vector3 val = owner.footPosition + Vector3.up * 2f; if (!Object.op_Implicit((Object)(object)drones[i])) { drones[i] = new MasterSummon { masterPrefab = wingmanMasterPrefabs[i], position = val, rotation = owner.transform.rotation, summonerBodyObject = ((Component)owner).gameObject, ignoreTeamMemberLimit = true, useAmbientLevel = true }.Perform(); if (Object.op_Implicit((Object)(object)drones[i])) { drones[i].destroyOnBodyDeath = false; ((Component)drones[i]).gameObject.AddComponent<Wingman>(); drones[i].inventory.onInventoryChanged += SyncInventories; SyncInventories(); } } else if (!Object.op_Implicit((Object)(object)drones[i].GetBody())) { drones[i].Respawn(val, owner.transform.rotation, false); } } private unsafe void SyncInventories() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Invalid comparison between Unknown and I4 //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) if (syncing) { return; } syncing = true; try { CharacterMaster[] array = drones; foreach (CharacterMaster val in array) { if (!Object.op_Implicit((Object)(object)val)) { continue; } int num = 1 + val.inventory.GetItemCountEffective(Items.DroneUpgradeHidden); AllItemsEnumerator enumerator = ItemCatalog.allItems.GetEnumerator(); try { while (((AllItemsEnumerator)(ref enumerator)).MoveNext()) { ItemIndex current = ((AllItemsEnumerator)(ref enumerator)).Current; ItemDef itemDef = ItemCatalog.GetItemDef(current); if ((int)itemDef.tier != 5 && !itemDef.ContainsTag((ItemTag)13)) { int num2 = Mathf.Min(master.inventory.GetItemCountEffective(current), num); int itemCountPermanent = val.inventory.GetItemCountPermanent(current); if (itemCountPermanent < num2) { val.inventory.GiveItemPermanent(current, num2 - itemCountPermanent); } else if (itemCountPermanent > num2) { val.inventory.RemoveItemPermanent(current, itemCountPermanent - num2); } } } } finally { ((IDisposable)(*(AllItemsEnumerator*)(&enumerator))/*cast due to .constrained prefix*/).Dispose(); } } } finally { syncing = false; } } } } namespace CommandoDrone.States { public class BombDash : BaseSkillState { public const int BombCount = 10; public const float BombDamageCoefficient = 1f; public const float Duration = 0.4f; public const float SpeedCoefficient = 5f; private static readonly GameObject bombPrefab = DroneSurvivor.Load<GameObject>(RoR2_Base_Toolbot.CryoCanisterBombletsProjectile_prefab); private const float AIRunHeight = 6f; private Vector3 dashDirection; private float dashSpeed; private int bombsDropped; public override void OnEnter() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); Vector3 val; if (!(((EntityState)this).inputBank.moveVector != Vector3.zero)) { Ray aimRay = ((BaseState)this).GetAimRay(); val = ((Ray)(ref aimRay)).direction; } else { val = ((Vector3)(ref ((EntityState)this).inputBank.moveVector)).normalized; } dashDirection = val; dashSpeed = ((EntityState)this).characterBody.moveSpeed * 5f; BaseAI val2 = (Object.op_Implicit((Object)(object)((EntityState)this).characterBody.master) ? ((Component)((EntityState)this).characterBody.master).GetComponent<BaseAI>() : null); CharacterBody val3 = (Object.op_Implicit((Object)(object)val2) ? val2.currentEnemy.characterBody : null); if (!((EntityState)this).characterBody.isPlayerControlled && Object.op_Implicit((Object)(object)val3)) { Vector3 val4 = val3.corePosition + Vector3.up * 6f - ((EntityState)this).transform.position; dashDirection = ((Vector3)(ref val4)).normalized; dashSpeed = 2f * ((Vector3)(ref val4)).magnitude / 0.4f; } } public override void FixedUpdate() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); if (((EntityState)this).isAuthority) { Vector3 val = dashDirection * dashSpeed; ((EntityState)this).rigidbodyMotor.moveVector = val; ((EntityState)this).rigidbodyMotor.rigid.velocity = val; int num = Mathf.Min(10, Mathf.CeilToInt(((EntityState)this).fixedAge / 0.4f * 10f)); while (bombsDropped < num) { DropBomb(); } if (((EntityState)this).fixedAge >= 0.4f) { ((EntityState)this).outer.SetNextStateToMain(); } } } private void DropBomb() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) bombsDropped++; Transform val = ((BaseState)this).FindModelChild("BombPoint"); ProjectileManager instance = ProjectileManager.instance; FireProjectileInfo val2 = new FireProjectileInfo { projectilePrefab = bombPrefab, position = (Object.op_Implicit((Object)(object)val) ? val.position : ((EntityState)this).characterBody.corePosition), rotation = Quaternion.LookRotation(Vector3.down), owner = ((EntityState)this).gameObject, damage = ((BaseState)this).damageStat * 1f, crit = ((BaseState)this).RollCrit(), damageTypeOverride = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)0), (DamageTypeExtended)0, (DamageSource)4) }; ((FireProjectileInfo)(ref val2)).speedOverride = 5f; instance.FireProjectile(val2); } public override void OnExit() { //IL_0021: 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) if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).rigidbodyMotor)) { Rigidbody rigid = ((EntityState)this).rigidbodyMotor.rigid; rigid.velocity *= 0.2f; } ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)7; } } public class DroneMainState : FlyState { private static readonly float SprintMinAimMoveDot = Mathf.Cos(MathF.PI / 3f); public override void PerformInputs() { //IL_00bb: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) ((FlyState)this).PerformInputs(); if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).inputBank) && Object.op_Implicit((Object)(object)((EntityState)this).rigidbodyMotor)) { float num = (((EntityState)this).inputBank.jump.down ? 1f : 0f) - (((EntityState)this).inputBank.rawSprintInput.down ? 1f : 0f); if (num != 0f) { ((EntityState)this).rigidbodyMotor.moveVector = Vector3.ClampMagnitude(((EntityState)this).rigidbodyMotor.moveVector + Vector3.up * num * ((EntityState)this).characterBody.moveSpeed, ((EntityState)this).characterBody.moveSpeed); } Vector3 moveVector = ((EntityState)this).inputBank.moveVector; ((EntityState)this).characterBody.isSprinting = moveVector != Vector3.zero && Vector3.Dot(((Vector3)(ref moveVector)).normalized, ((EntityState)this).inputBank.aimDirection) >= SprintMinAimMoveDot; } } public override bool CanExecuteSkill(GenericSkill skillSlot) { if (!((FlyState)this).CanExecuteSkill(skillSlot)) { return false; } if (!skillSlot.mustKeyPress) { return true; } ref ButtonState reference = ref ((EntityState)this).inputBank.skill1; if ((Object)(object)skillSlot == (Object)(object)((EntityState)this).skillLocator.secondary) { reference = ref ((EntityState)this).inputBank.skill2; } else if ((Object)(object)skillSlot == (Object)(object)((EntityState)this).skillLocator.utility) { reference = ref ((EntityState)this).inputBank.skill3; } else if ((Object)(object)skillSlot == (Object)(object)((EntityState)this).skillLocator.special) { reference = ref ((EntityState)this).inputBank.skill4; } if (reference.hasPressBeenClaimed) { return false; } reference.hasPressBeenClaimed = true; return true; } } public class Empower : BaseSkillState { public const float BuffDuration = 8f; public override void OnEnter() { ((BaseState)this).OnEnter(); if (NetworkServer.active) { ((EntityState)this).characterBody.AddTimedBuff(EmpowerBuff.BuffDef, 8f); CharacterBody[] minionBodies = ((EntityState)this).characterBody.GetMinionBodies(); foreach (CharacterBody val in minionBodies) { if (Object.op_Implicit((Object)(object)val) && val.IsDrone) { val.AddTimedBuff(EmpowerBuff.BuffDef, 8f); } } } if (((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)1; } } public class FireCoveringFire : BaseSkillState { public const float DamageCoefficient = 3f; private static readonly GameObject missilePrefab = DroneSurvivor.Load<GameObject>(RoR2_Base_Common.MissileProjectile_prefab); public override void OnEnter() { ((BaseState)this).OnEnter(); if (!((EntityState)this).isAuthority) { return; } Launch(((EntityState)this).characterBody); CharacterBody[] minionBodies = ((EntityState)this).characterBody.GetMinionBodies(); foreach (CharacterBody val in minionBodies) { if (Object.op_Implicit((Object)(object)val) && val.IsDrone) { Launch(val); } } ((EntityState)this).outer.SetNextStateToMain(); } private void Launch(CharacterBody from) { //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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0029: Unknown result type (might be due to invalid IL or missing references) MissileUtils.FireMissile(from.corePosition + Vector3.up * from.radius, ((EntityState)this).characterBody, default(ProcChainMask), (GameObject)null, ((BaseState)this).damageStat * 3f, ((BaseState)this).RollCrit(), missilePrefab, (DamageColorIndex)0, false); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)1; } } public class FireGunBurst : BaseSkillState { internal static float DroneGunCooldown; private int shotCount; private float shotInterval; private float duration; private int shotsFired; public override void OnEnter() { ((BaseState)this).OnEnter(); shotCount = Mathf.Max(1, FireTurret.bulletCount); shotInterval = FireTurret.durationBetweenShots / ((BaseState)this).attackSpeedStat; float num = FireTurret.durationBetweenShots * (float)(shotCount - 1) + FireTurret.baseDuration; duration = Mathf.Max(num, DroneGunCooldown) / ((BaseState)this).attackSpeedStat; ((EntityState)this).characterBody.SetAimTimer(2f); FireBullet(); } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); while (shotsFired < shotCount && ((EntityState)this).fixedAge >= (float)shotsFired * shotInterval) { FireBullet(); } if (((EntityState)this).isAuthority && shotsFired >= shotCount && ((EntityState)this).fixedAge >= duration) { ((EntityState)this).outer.SetNextStateToMain(); } } private void FireBullet() { //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) //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_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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00a5: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_0115: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) shotsFired++; Util.PlaySound(FireTurret.attackSoundString, ((EntityState)this).gameObject); if (Object.op_Implicit((Object)(object)FireTurret.effectPrefab)) { EffectManager.SimpleMuzzleFlash(FireTurret.effectPrefab, ((EntityState)this).gameObject, "Muzzle", false); } Transform modelTransform = ((EntityState)this).GetModelTransform(); ArmAimer armAimer = (Object.op_Implicit((Object)(object)modelTransform) ? ((Component)modelTransform).GetComponentInChildren<ArmAimer>() : null); if (Object.op_Implicit((Object)(object)armAimer)) { armAimer.Recoil(); } if (((EntityState)this).isAuthority) { Ray aimRay = ((BaseState)this).GetAimRay(); new BulletAttack { owner = ((EntityState)this).gameObject, weapon = ((EntityState)this).gameObject, origin = ((Ray)(ref aimRay)).origin, aimVector = ((Ray)(ref aimRay)).direction, minSpread = FireTurret.minSpread, maxSpread = FireTurret.maxSpread, radius = 0.5f, smartCollision = true, damage = FireTurret.damageCoefficient * ((BaseState)this).damageStat, force = FireTurret.force, tracerEffectPrefab = FireTurret.tracerEffectPrefab, muzzleName = "Muzzle", hitEffectPrefab = FireTurret.hitEffectPrefab, isCrit = ((BaseState)this).RollCrit(), damageType = DamageTypeCombo.GenericPrimary }.Fire(); } } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)1; } } public class FireJunkBall : BaseSkillState { public const float DamageCoefficient = 3f; private const float MaxTargetDistance = 80f; private const float OpenAnimationLength = 2f; private static CommandFireJunk vanilla; private float duration; private bool hasFired; public override void OnEnter() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown ((BaseState)this).OnEnter(); if (vanilla == null) { vanilla = (CommandFireJunk)EntityStateCatalog.InstantiateState(typeof(CommandFireJunk)); } duration = 2f / ((BaseState)this).attackSpeedStat; ((EntityState)this).PlayAnimation("Gesture, Override", "BombsAway", "Surprise.playbackRate", duration, 0f); } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (!hasFired && ((EntityState)this).fixedAge >= duration * vanilla.fireTime) { hasFired = true; Fire(); } if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration) { ((EntityState)this).outer.SetNextStateToMain(); } } private void Fire() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_0108: 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_0137: 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_0169: Unknown result type (might be due to invalid IL or missing references) EffectManager.SimpleMuzzleFlash(EntityStateGameObject.op_Implicit(vanilla.effectPrefab), ((EntityState)this).gameObject, vanilla.muzzleString, false); Util.PlaySound(vanilla.fireSoundString, ((EntityState)this).gameObject); if (((EntityState)this).isAuthority) { Ray aimRay = ((BaseState)this).GetAimRay(); Transform val = ((BaseState)this).FindModelChild(vanilla.muzzleString); Vector3 val2 = (Object.op_Implicit((Object)(object)val) ? val.position : ((Ray)(ref aimRay)).origin); RaycastHit val4 = default(RaycastHit); Vector3 val3 = (Util.CharacterRaycast(((EntityState)this).gameObject, aimRay, ref val4, 80f, CommonMasks.bullet, (QueryTriggerInteraction)1) ? ((RaycastHit)(ref val4)).point : ((Ray)(ref aimRay)).GetPoint(80f)) - val2; Vector2 val5 = default(Vector2); ((Vector2)(ref val5))..ctor(val3.x, val3.z); float num = Mathf.Max(((Vector2)(ref val5)).magnitude, 0.01f); float num2 = Trajectory.CalculateInitialYSpeed(num / vanilla.projectileSpeed, val3.y); Vector3 val6 = default(Vector3); ((Vector3)(ref val6))..ctor(val5.x / num * vanilla.projectileSpeed, num2, val5.y / num * vanilla.projectileSpeed); ProjectileManager.instance.FireProjectile(EntityStateGameObject.op_Implicit(vanilla.projectilePrefab), val2, Util.QuaternionSafeLookRotation(val6), ((EntityState)this).gameObject, ((BaseState)this).damageStat * 3f, vanilla.force, ((BaseState)this).RollCrit(), (DamageColorIndex)0, (GameObject)null, ((Vector3)(ref val6)).magnitude, (DamageTypeCombo?)DamageTypeCombo.GenericPrimary); } } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)1; } } public class FireSniperShot : BaseSkillState { public const float DamageCoefficient = 5f; private const float BaseDuration = 0.5f; private const float MaxDistance = 1000f; private const string MuzzleName = "SniperMuzzle"; private static FireSpear rebar; public override void OnEnter() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //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) //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_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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00a5: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_0107: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); if (rebar == null) { rebar = (FireSpear)EntityStateCatalog.InstantiateState(typeof(FireSpear)); } Util.PlaySound(((GenericBulletBaseState)rebar).fireSoundString, ((EntityState)this).gameObject); if (Object.op_Implicit((Object)(object)((GenericBulletBaseState)rebar).muzzleFlashPrefab)) { EffectManager.SimpleMuzzleFlash(((GenericBulletBaseState)rebar).muzzleFlashPrefab, ((EntityState)this).gameObject, "SniperMuzzle", false); } if (((EntityState)this).isAuthority) { Ray aimRay = ((BaseState)this).GetAimRay(); new BulletAttack { owner = ((EntityState)this).gameObject, weapon = ((EntityState)this).gameObject, origin = ((Ray)(ref aimRay)).origin, aimVector = ((Ray)(ref aimRay)).direction, muzzleName = "SniperMuzzle", damage = ((BaseState)this).damageStat * 5f, force = ((GenericBulletBaseState)rebar).force, radius = ((GenericBulletBaseState)rebar).bulletRadius, maxDistance = 1000f, stopperMask = ((LayerIndex)(ref LayerIndex.world)).mask, falloffModel = (FalloffModel)0