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 MoreDrones v1.1.0
plugins/MoreDrones/MoreDrones.dll
Decompiled 15 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.Drone; using HG.Reflection; using Microsoft.CodeAnalysis; using MoreDrones.Components; using MoreDrones.Drones; using MoreDrones.States.Seeker; using R2API; using R2API.Utils; using RoR2; using RoR2.CharacterAI; 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: OptIn] [assembly: NetworkCompatibility(/*Could not decode attribute arguments.*/)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MoreDrones")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+c988079955e49d627ea90ee7f89be9a0c0585f20")] [assembly: AssemblyProduct("MoreDrones")] [assembly: AssemblyTitle("MoreDrones")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: UnverifiableCode] 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 MoreDrones { internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } private static string getLogPrefix(string callerPath, string callerMemberName, int callerLineNumber) { int num = callerPath.LastIndexOf("MoreDrones"); if (num >= 0) { callerPath = callerPath.Substring(num + "MoreDrones".Length + 1); } return $"{callerPath}:{callerLineNumber} ({callerMemberName}) "; } internal static void Error(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogError((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data)); } internal static void Error_NoCallerPrefix(object data) { _logSource.LogError(data); } internal static void Fatal(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogFatal((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data)); } internal static void Fatal_NoCallerPrefix(object data) { _logSource.LogFatal(data); } internal static void Info(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogInfo((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data)); } internal static void Info_NoCallerPrefix(object data) { _logSource.LogInfo(data); } internal static void Message(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogMessage((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data)); } internal static void Message_NoCallerPrefix(object data) { _logSource.LogMessage(data); } internal static void Warning(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogWarning((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data)); } internal static void Warning_NoCallerPrefix(object data) { _logSource.LogWarning(data); } } [BepInPlugin("Phreel.MoreDrones", "MoreDrones", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Main : BaseUnityPlugin { public const string PluginGUID = "Phreel.MoreDrones"; public const string PluginAuthor = "Phreel"; public const string PluginName = "MoreDrones"; public const string PluginVersion = "1.1.0"; public static AssetBundle bundle; internal static Main Instance { get; private set; } public static string PluginDirectory { get; private set; } public void Awake() { Instance = this; Log.Init(((BaseUnityPlugin)this).Logger); PluginDirectory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); bundle = AssetBundle.LoadFromFile(Path.Combine(PluginDirectory, "dronebundle")); if (!Object.op_Implicit((Object)(object)bundle)) { Log.Error("Could not load the dronebundle, it should be next to MoreDrones.dll. No drones were added.", "D:\\Games\\LostItems\\moredronesrevive\\MoreDrones\\Main.cs", "Awake", 40); return; } ConvertShaders(); foreach (Type item in from type in typeof(Main).Assembly.GetTypes() where !type.IsAbstract && type.IsSubclassOf(typeof(DroneBase)) select type) { DroneBase droneBase = (DroneBase)Activator.CreateInstance(item); try { droneBase.Initialize(((BaseUnityPlugin)this).Config); } catch (Exception arg) { Log.Error($"Failed to set up {droneBase.name}: {arg}", "D:\\Games\\LostItems\\moredronesrevive\\MoreDrones\\Main.cs", "Awake", 55); } } } private static void ConvertShaders() { //IL_0005: 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) Shader shader = Addressables.LoadAssetAsync<Shader>((object)RoR2_Base_Shaders.HGStandard_shader).WaitForCompletion(); Material[] array = bundle.LoadAllAssets<Material>(); foreach (Material val in array) { if (((Object)val.shader).name == "StubbedShader/deferred/hgstandard") { val.shader = shader; } } } } } namespace MoreDrones.States.Seeker { public class Charge : BaseState { public static float duration = 1f; public static float speed = 60f; private BaseAI ai; public override void OnEnter() { ((BaseState)this).OnEnter(); if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.master)) { ai = ((Component)((EntityState)this).characterBody.master).GetComponent<BaseAI>(); } } public override void FixedUpdate() { //IL_0031: 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_0036: 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_00af: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_009a: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); if (((EntityState)this).isAuthority) { Vector3 val = (Object.op_Implicit((Object)(object)((EntityState)this).inputBank) ? ((EntityState)this).inputBank.aimDirection : ((EntityState)this).transform.forward); if (Object.op_Implicit((Object)(object)ai) && ai.currentEnemy != null && Object.op_Implicit((Object)(object)ai.currentEnemy.gameObject)) { Vector3 val2 = ai.currentEnemy.gameObject.transform.position - ((EntityState)this).transform.position; val = ((Vector3)(ref val2)).normalized; } if (Object.op_Implicit((Object)(object)((EntityState)this).rigidbodyDirection)) { ((EntityState)this).rigidbodyDirection.aimDirection = val; } if (Object.op_Implicit((Object)(object)((EntityState)this).rigidbodyMotor)) { RigidbodyMotor rigidbodyMotor = ((EntityState)this).rigidbodyMotor; rigidbodyMotor.rootMotion += val * speed * Time.fixedDeltaTime; } if (((EntityState)this).fixedAge >= duration) { ((EntityState)this).outer.SetNextStateToMain(); } } } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)1; } } } namespace MoreDrones.Drones { public class BoosterDrone : DroneBase { public static BoosterDrone instance { get; private set; } public float wardRadius { get; private set; } = 20f; public GameObject wardPrefab { get; private set; } public override string ConfigName => "Booster Drone"; public override string TokenPrefix => "MOREDRONES_BOOSTER"; public override string BundleBodyName => "BoosterDroneBody.prefab"; public override string BundleBrokenName => "BrokenBoosterDrone.prefab"; public override string BundleBrokenModelPath => "Model Base/model"; public override int PurchaseCost => 40; public override int DirectorCost => 20; public override Type DeathStateType => typeof(BoosterDeathState); public override string TierTemplateKey => RoR2_Base_Drones.Drone2_asset; public override Stage[] Stages { get { Stage[] array = new Stage[5]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); return (Stage[])(object)array; } } public override Dictionary<string, string> Tokens => new Dictionary<string, string> { { "MOREDRONES_BOOSTER_NAME", "Booster Drone" }, { "MOREDRONES_BOOSTER_INTERACTABLE_NAME", "Broken Booster Drone" }, { "MOREDRONES_BOOSTER_CONTEXT", "Repair Booster Drone" }, { "MOREDRONES_BOOSTER_PICKUP", "Empowers nearby allies." }, { "MOREDRONES_BOOSTER_DESCRIPTION", $"Projects a field that sends allies within <style=cIsUtility>{wardRadius}m</style> into a <style=cIsDamage>frenzy</style>, increasing <style=cIsUtility>movement speed</style> and <style=cIsDamage>attack speed</style>." }, { "MOREDRONES_BOOSTER_SKILL_DESCRIPTION", $"Boost: Allies within <style=cIsUtility>{wardRadius}m</style> gain <style=cIsDamage>frenzy</style>." } }; public BoosterDrone() { instance = this; } protected override void SetupConfig() { wardRadius = config.Bind<float>(base.configCategory, "Ward Radius", wardRadius, "Radius of the field that empowers allies.").Value; } protected override void Setup(CharacterBody body, SkillLocator locator, AISkillDriver[] skillDrivers) { //IL_00c0: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_0181: Unknown result type (might be due to invalid IL or missing references) wardPrefab = PrefabAPI.InstantiateClone(DroneBase.Load<GameObject>(RoR2_DLC1_Railgunner.RailgunnerMineAltDetonated_prefab), "MoreDronesBoosterWard", false); Transform val = wardPrefab.transform.Find("AreaIndicator"); Transform val2 = (Object.op_Implicit((Object)(object)val) ? val.Find("Sphere") : null); MeshRenderer val3 = (Object.op_Implicit((Object)(object)val2) ? ((Component)val2).GetComponent<MeshRenderer>() : null); if (Object.op_Implicit((Object)(object)val3) && ((Renderer)val3).sharedMaterials.Length > 1) { Material[] sharedMaterials = ((Renderer)val3).sharedMaterials; sharedMaterials[1] = DroneBase.Load<Material>(RoR2_Base_moon2.matMoonbatteryRangeIndicator_mat); ((Renderer)val3).sharedMaterials = sharedMaterials; } Transform val4 = (Object.op_Implicit((Object)(object)val) ? val.Find("SoftGlow") : null); ParticleSystem val5 = (Object.op_Implicit((Object)(object)val4) ? ((Component)val4).GetComponent<ParticleSystem>() : null); if (Object.op_Implicit((Object)(object)val5)) { MainModule main = val5.main; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(Color.white); } BuffWard component = wardPrefab.GetComponent<BuffWard>(); component.expires = false; component.expireDuration = 10000f; component.invertTeamFilter = false; component.radius = wardRadius; component.buffDef = DroneBase.Load<BuffDef>(RoR2_Base_WarCryOnMultiKill.bdWarCryBuff_asset); SlowDownProjectiles component2 = wardPrefab.GetComponent<SlowDownProjectiles>(); if (Object.op_Implicit((Object)(object)component2)) { Object.DestroyImmediate((Object)(object)component2); } DestroyOnTimer component3 = wardPrefab.GetComponent<DestroyOnTimer>(); if (Object.op_Implicit((Object)(object)component3)) { Object.DestroyImmediate((Object)(object)component3); } base.droneBody.AddComponent<BoosterDroneWard>(); foreach (AISkillDriver val6 in skillDrivers) { if (Object.op_Implicit((Object)(object)val6) && (int)val6.skillSlot == 0) { val6.skillSlot = (SkillSlot)(-1); } } } } public class BoosterDeathState : DroneDeathState { protected override DroneBase Drone => BoosterDrone.instance; } public abstract class DroneBase { protected ConfigFile config; private DirectorCardHolder directorCardHolder; private static readonly HashSet<string> NoDroneStages = new HashSet<string> { "champrush" }; public string name => GetType().Name; public bool enabled { get; private set; } = true; public bool canBeRepurchased { get; private set; } = true; public int spawnWeight { get; private set; } public GameObject droneBody { get; private set; } public GameObject droneMaster { get; private set; } public GameObject brokenObject { get; private set; } public InteractableSpawnCard iSpawnCard { get; private set; } public DroneDef droneDef { get; private set; } protected string configCategory => "Drones :: " + ConfigName; public abstract string ConfigName { get; } public abstract string TokenPrefix { get; } public abstract Dictionary<string, string> Tokens { get; } public abstract string BundleBodyName { get; } public abstract string BundleBrokenName { get; } public abstract string BundleBrokenModelPath { get; } public abstract int PurchaseCost { get; } public abstract int DirectorCost { get; } public virtual int DefaultSpawnWeight => 4; public abstract Stage[] Stages { get; } public abstract Type DeathStateType { get; } public abstract string TierTemplateKey { get; } public void Initialize(ConfigFile configFile) { //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Expected O, but got Unknown //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Expected O, but got Unknown //IL_02b0: Unknown result type (might be due to invalid IL or missing references) config = configFile; enabled = config.Bind<bool>(configCategory, "Enabled", true, "Allow this drone to appear.").Value; if (!enabled) { return; } canBeRepurchased = config.Bind<bool>(configCategory, "Can Be Repurchased", true, "Leave a broken drone behind when this drone is destroyed.").Value; spawnWeight = config.Bind<int>(configCategory, "Spawn Weight", DefaultSpawnWeight, "How likely the director is to place this broken drone on a stage.").Value; SetupConfig(); foreach (KeyValuePair<string, string> token in Tokens) { LanguageAPI.Add(token.Key, token.Value); } InteractableSpawnCard val = Load<InteractableSpawnCard>(RoR2_Base_Drones.iscBrokenDrone1_asset); brokenObject = PrefabAPI.InstantiateClone(((SpawnCard)val).prefab, name + "Broken", true); SummonMasterBehavior component = brokenObject.GetComponent<SummonMasterBehavior>(); droneMaster = PrefabAPI.InstantiateClone(component.masterPrefab, name + "Master", true); CharacterMaster component2 = droneMaster.GetComponent<CharacterMaster>(); droneBody = PrefabAPI.InstantiateClone(component2.bodyPrefab, name + "Body", true); component2.bodyPrefab = droneBody; component.masterPrefab = droneMaster; ContentAddition.AddMaster(droneMaster); ContentAddition.AddBody(droneBody); GameObject obj = Main.bundle.LoadAsset<GameObject>(BundleBodyName); CharacterBody component3 = obj.GetComponent<CharacterBody>(); CharacterBody component4 = droneBody.GetComponent<CharacterBody>(); component4.baseNameToken = TokenPrefix + "_NAME"; component4.subtitleNameToken = ""; component4.portraitIcon = component3.portraitIcon; CopyStats(component3, component4); GameObject val2 = CreateCleanModel(((Component)obj.GetComponent<ModelLocator>().modelTransform).gameObject, "mdl" + name); GameObject displayPrefab = CreatePickupDisplay(val2); ReplaceModel(droneBody, val2); InitializeDroneModel(val2, component4); SkillLocator component5 = droneBody.GetComponent<SkillLocator>(); UseEquipmentDroneCommand(component5); bool flag = default(bool); ContentAddition.AddEntityState(DeathStateType, ref flag); CharacterDeathBehavior val3 = droneBody.GetComponent<CharacterDeathBehavior>(); if (!Object.op_Implicit((Object)(object)val3)) { val3 = droneBody.AddComponent<CharacterDeathBehavior>(); } val3.deathState = new SerializableEntityStateType(DeathStateType); AISkillDriver[] components = droneMaster.GetComponents<AISkillDriver>(); AISkillDriver[] array = components; foreach (AISkillDriver val4 in array) { if (Object.op_Implicit((Object)(object)val4)) { val4.aimType = (AimType)2; } } SetupBrokenObject(); iSpawnCard = Object.Instantiate<InteractableSpawnCard>(val); ((Object)iSpawnCard).name = "iscBroken" + name; ((SpawnCard)iSpawnCard).prefab = brokenObject; ((SpawnCard)iSpawnCard).directorCreditCost = DirectorCost; iSpawnCard.slightlyRandomizeOrientation = false; iSpawnCard.orientToFloor = true; directorCardHolder = new DirectorCardHolder { Card = new DirectorCard { spawnCard = (SpawnCard)(object)iSpawnCard, selectionWeight = spawnWeight, spawnDistance = (MonsterSpawnDistance)1, preventOverhead = false }, MonsterCategory = (MonsterCategory)0, InteractableCategory = (InteractableCategory)5 }; Setup(component4, component5, components); droneDef = CreateDroneDef(Load<DroneDef>(TierTemplateKey), displayPrefab, Load<DroneDef>(RoR2_Base_Drones.EquipmentDrone_asset)); if (spawnWeight > 0) { DirectorAPI.InteractableActions += OnInteractableActions; } } protected virtual void SetupConfig() { } protected abstract void Setup(CharacterBody body, SkillLocator locator, AISkillDriver[] skillDrivers); private void OnInteractableActions(DccsPool interactablesDccsPool, StageInfo stage) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)interactablesDccsPool) || NoDroneStages.Contains(((StageInfo)(ref stage)).ToInternalStageName()) || !Stages.Any((Stage s) => ((StageInfo)(ref stage)).CheckStage(s, Array.Empty<string>()))) { return; } string droneCategoryName = directorCardHolder.GetCategoryName(); Helpers.ForEachPoolEntryInDccsPool(interactablesDccsPool, (Action<PoolEntry>)delegate(PoolEntry poolEntry) { if (Object.op_Implicit((Object)(object)poolEntry.dccs) && poolEntry.dccs.categories.Any((Category category) => category.name.IndexOf(droneCategoryName, StringComparison.InvariantCultureIgnoreCase) >= 0)) { DirectorAPI.AddCard(poolEntry.dccs, directorCardHolder); } }); } private static void CopyStats(CharacterBody from, CharacterBody to) { to.baseMaxHealth = from.baseMaxHealth; to.levelMaxHealth = from.levelMaxHealth; to.baseRegen = from.baseRegen; to.levelRegen = from.levelRegen; to.baseArmor = from.baseArmor; to.levelArmor = from.levelArmor; to.baseDamage = from.baseDamage; to.levelDamage = from.levelDamage; to.baseMoveSpeed = from.baseMoveSpeed; to.baseAcceleration = from.baseAcceleration; } private void SetupBrokenObject() { //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) PurchaseInteraction component = brokenObject.GetComponent<PurchaseInteraction>(); component.cost = PurchaseCost; component.Networkcost = PurchaseCost; component.contextToken = TokenPrefix + "_CONTEXT"; component.displayNameToken = TokenPrefix + "_INTERACTABLE_NAME"; GenericDisplayNameProvider component2 = brokenObject.GetComponent<GenericDisplayNameProvider>(); if (Object.op_Implicit((Object)(object)component2)) { component2.displayToken = TokenPrefix + "_NAME"; } GameObject val = CreateCleanModel(((Component)Main.bundle.LoadAsset<GameObject>(BundleBrokenName).transform.Find(BundleBrokenModelPath)).gameObject, "mdl" + name + "Broken"); MeshRenderer highlightRenderer = val.GetComponentsInChildren<MeshRenderer>(true).OrderByDescending(BoundsVolume).First(); GameObject[] interactableParts = (from collider in val.GetComponentsInChildren<Collider>(true) select ((Component)collider).gameObject).ToArray(); ReplaceBrokenModel(val, (Renderer)(object)highlightRenderer, interactableParts); Transform val2 = FindChildRecursive(val.transform, "Damage Point"); if (Object.op_Implicit((Object)(object)val2)) { val2.localPosition = Vector3.zero; val2.localRotation = Quaternion.identity; val2.localScale = Vector3.one; } } private static float BoundsVolume(MeshRenderer renderer) { //IL_0028: 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_0030: 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_0040: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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) MeshFilter component = ((Component)renderer).GetComponent<MeshFilter>(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.sharedMesh)) { return 0f; } Bounds bounds = component.sharedMesh.bounds; Vector3 val = Vector3.Scale(((Bounds)(ref bounds)).size, ((Component)renderer).transform.lossyScale); return val.x * val.y * val.z; } private static GameObject CreateCleanModel(GameObject source, string modelName) { GameObject val = PrefabAPI.InstantiateClone(source, modelName, false); CharacterModel[] componentsInChildren = val.GetComponentsInChildren<CharacterModel>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } HurtBox[] componentsInChildren2 = val.GetComponentsInChildren<HurtBox>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren2[i]); } HurtBoxGroup[] componentsInChildren3 = val.GetComponentsInChildren<HurtBoxGroup>(true); for (int i = 0; i < componentsInChildren3.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren3[i]); } EntityLocator[] componentsInChildren4 = val.GetComponentsInChildren<EntityLocator>(true); for (int i = 0; i < componentsInChildren4.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren4[i]); } return val; } private static void ReplaceModel(GameObject clonedObject, GameObject replacementModel) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) ModelLocator val = clonedObject.GetComponent<ModelLocator>(); if (!Object.op_Implicit((Object)(object)val)) { val = clonedObject.AddComponent<ModelLocator>(); } Transform val2; if (Object.op_Implicit((Object)(object)(val2 = clonedObject.transform.Find("ModelBase")))) { Object.DestroyImmediate((Object)(object)((Component)val2).gameObject); } if (Object.op_Implicit((Object)(object)(val2 = clonedObject.transform.Find("Model Base")))) { Object.DestroyImmediate((Object)(object)((Component)val2).gameObject); } GameObject val3 = new GameObject("ModelBase"); val3.transform.SetParent(clonedObject.transform, false); replacementModel.transform.SetParent(val3.transform, false); replacementModel.transform.localPosition = Vector3.zero; replacementModel.transform.localRotation = Quaternion.identity; val.modelTransform = replacementModel.transform; val.modelBaseTransform = val3.transform; } private static void InitializeDroneModel(GameObject model, CharacterBody body) { //IL_0129: Unknown result type (might be due to invalid IL or missing references) CharacterModel obj = model.AddComponent<CharacterModel>(); obj.body = body; obj.autoPopulateLightInfos = true; obj.invisibilityCount = 0; obj.temporaryOverlays = new List<TemporaryOverlayInstance>(); obj.baseRendererInfos = (from renderer in model.GetComponentsInChildren<Renderer>(true) where renderer is MeshRenderer || renderer is SkinnedMeshRenderer select renderer).Select((Func<Renderer, RendererInfo>)((Renderer renderer) => new RendererInfo { renderer = renderer, defaultMaterial = renderer.sharedMaterial, defaultShadowCastingMode = renderer.shadowCastingMode, ignoreOverlays = false, hideOnDeath = false })).ToArray(); if (!Object.op_Implicit((Object)(object)model.GetComponent<ChildLocator>())) { model.AddComponent<ChildLocator>(); } Collider val = ((IEnumerable<Collider>)model.GetComponentsInChildren<Collider>(true)).FirstOrDefault((Func<Collider, bool>)((Collider collider) => !Object.op_Implicit((Object)(object)((Component)collider).GetComponent<HitBox>()))); if (!Object.op_Implicit((Object)(object)val)) { Log.Warning(((Object)body).name + ": No collider found on the model. The drone cannot be hit.", "D:\\Games\\LostItems\\moredronesrevive\\MoreDrones\\Drones\\DroneBase.cs", "InitializeDroneModel", 253); return; } HurtBoxGroup val2 = model.AddComponent<HurtBoxGroup>(); HurtBox val3 = ((Component)val).gameObject.AddComponent<HurtBox>(); ((Component)val3).gameObject.layer = LayerIndex.entityPrecise.intVal; val3.healthComponent = ((Component)body).GetComponent<HealthComponent>(); val3.isBullseye = true; val3.damageModifier = (DamageModifier)0; val3.hurtBoxGroup = val2; val3.indexInGroup = 0; val2.hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val3 }; val2.mainHurtBox = val3; val2.bullseyeCount = 1; } private GameObject CreatePickupDisplay(GameObject model) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) GameObject val = PrefabAPI.InstantiateClone(model, ((Object)model).name + "Display", false); Collider[] componentsInChildren = val.GetComponentsInChildren<Collider>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } HitBox[] componentsInChildren2 = val.GetComponentsInChildren<HitBox>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren2[i]); } HitBoxGroup[] componentsInChildren3 = val.GetComponentsInChildren<HitBoxGroup>(true); for (int i = 0; i < componentsInChildren3.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren3[i]); } GameObject val2 = new GameObject("Pickup" + name); val2.transform.SetParent(val.transform.parent, false); val.transform.SetParent(val2.transform, false); Bounds localModelBounds = GetLocalModelBounds(val2.transform); Mesh sharedMesh = new Mesh { name = "Pickup" + name + "Bounds", bounds = localModelBounds }; SkinnedMeshRenderer obj = val2.AddComponent<SkinnedMeshRenderer>(); obj.sharedMesh = sharedMesh; ((Renderer)obj).sharedMaterials = (Material[])(object)new Material[0]; obj.rootBone = null; obj.updateWhenOffscreen = false; ((Renderer)obj).localBounds = localModelBounds; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; return val2; } private static Bounds GetLocalModelBounds(Transform root) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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) Matrix4x4 worldToRoot = root.worldToLocalMatrix; bool hasBounds = false; Bounds result = default(Bounds); MeshRenderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<MeshRenderer>(true); foreach (MeshRenderer val in componentsInChildren) { MeshFilter component = ((Component)val).GetComponent<MeshFilter>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.sharedMesh)) { Encapsulate(((Component)val).transform, component.sharedMesh.bounds); } } SkinnedMeshRenderer[] componentsInChildren2 = ((Component)root).GetComponentsInChildren<SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer val2 in componentsInChildren2) { if (Object.op_Implicit((Object)(object)val2.sharedMesh)) { Encapsulate(Object.op_Implicit((Object)(object)val2.rootBone) ? val2.rootBone : ((Component)val2).transform, ((Renderer)val2).localBounds); } } if (!hasBounds) { result = new Bounds(Vector3.zero, Vector3.one); } return result; void Encapsulate(Transform space, Bounds localBounds) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_0053: 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_0085: 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_0091: 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) Matrix4x4 val3 = worldToRoot * space.localToWorldMatrix; Vector3 min = ((Bounds)(ref localBounds)).min; Vector3 max = ((Bounds)(ref localBounds)).max; for (int j = 0; j < 8; j++) { Vector3 val4 = ((Matrix4x4)(ref val3)).MultiplyPoint3x4(new Vector3(((j & 1) == 0) ? min.x : max.x, ((j & 2) == 0) ? min.y : max.y, ((j & 4) == 0) ? min.z : max.z)); if (hasBounds) { ((Bounds)(ref result)).Encapsulate(val4); } else { result = new Bounds(val4, Vector3.zero); hasBounds = true; } } } } private void ReplaceBrokenModel(GameObject customBrokenModel, Renderer highlightRenderer, GameObject[] interactableParts) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) Transform val = FindChildRecursive(brokenObject.transform, "BrokenDroneVFX"); if (Object.op_Implicit((Object)(object)val)) { val.SetParent(brokenObject.transform, false); } ReplaceModel(brokenObject, customBrokenModel); Highlight val2 = brokenObject.GetComponent<Highlight>(); if (!Object.op_Implicit((Object)(object)val2)) { val2 = brokenObject.AddComponent<Highlight>(); val2.highlightColor = (HighlightColor)0; val2.strength = 1f; } val2.targetRenderer = highlightRenderer; customBrokenModel.AddComponent<EntityLocator>().entity = brokenObject; foreach (GameObject val3 in interactableParts) { if (Object.op_Implicit((Object)(object)val3) && !Object.op_Implicit((Object)(object)val3.GetComponent<EntityLocator>())) { val3.AddComponent<EntityLocator>().entity = brokenObject; } } if (Object.op_Implicit((Object)(object)val)) { val.SetParent(customBrokenModel.transform, false); Transform val4 = FindChildRecursive(val, "Small Sparks, Mesh"); ParticleSystem val5 = (Object.op_Implicit((Object)(object)val4) ? ((Component)val4).GetComponent<ParticleSystem>() : null); if (Object.op_Implicit((Object)(object)val5)) { MeshRenderer val6 = (MeshRenderer)(object)((highlightRenderer is MeshRenderer) ? highlightRenderer : null); if (val6 != null) { ShapeModule shape = val5.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)13; ((ShapeModule)(ref shape)).meshShapeType = (ParticleSystemMeshShapeType)1; ((ShapeModule)(ref shape)).meshRenderer = val6; } } } else { Log.Warning(name + ": The broken drone effects were not found. The broken drone will not have sparks.", "D:\\Games\\LostItems\\moredronesrevive\\MoreDrones\\Drones\\DroneBase.cs", "ReplaceBrokenModel", 358); } } private static Transform FindChildRecursive(Transform root, string childName) { if (!Object.op_Implicit((Object)(object)root)) { return null; } Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if (((Object)val).name == childName) { return val; } } return null; } private void UseEquipmentDroneCommand(SkillLocator locator) { //IL_00c8: 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) DroneCommandReceiver component = droneBody.GetComponent<DroneCommandReceiver>(); GameObject val = Load<GameObject>(RoR2_Base_Drones.EquipmentDroneBody_prefab); DroneCommandReceiver val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<DroneCommandReceiver>() : null); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.commandSkill) || !Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)val2.commandSkill)) { Log.Warning(name + ": The drone command components were not found. The drone keeps the Gunner Drone command.", "D:\\Games\\LostItems\\moredronesrevive\\MoreDrones\\Drones\\DroneBase.cs", "UseEquipmentDroneCommand", 379); return; } if ((Object)(object)component.commandSkill == (Object)(object)locator.primary) { Log.Warning(name + ": The drone command shares the primary skill slot. The drone keeps its primary as the command.", "D:\\Games\\LostItems\\moredronesrevive\\MoreDrones\\Drones\\DroneBase.cs", "UseEquipmentDroneCommand", 384); return; } component.commandSkill._skillFamily = val2.commandSkill.skillFamily; component.targetType = val2.targetType; component.targetDistance = val2.targetDistance; } protected static void ReplacePrimarySkill(SkillLocator locator, SkillDef skillDef) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_004c: 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) ContentAddition.AddSkillDef(skillDef); SkillFamily val = Object.Instantiate<SkillFamily>(locator.primary.skillFamily); Variant[] array = new Variant[1]; Variant val2 = new Variant { skillDef = skillDef, unlockableDef = null }; ((Variant)(ref val2)).viewableNode = new Node("", false, (Node)null); array[0] = val2; val.variants = (Variant[])(object)array; locator.primary._skillFamily = val; ContentAddition.AddSkillFamily(val); } private DroneDef CreateDroneDef(DroneDef tierTemplate, GameObject displayPrefab, DroneDef commandTemplate) { DroneDef val = (Object.op_Implicit((Object)(object)tierTemplate) ? Object.Instantiate<DroneDef>(tierTemplate) : ScriptableObject.CreateInstance<DroneDef>()); ((Object)val).name = name; val.bodyPrefab = droneBody; val.displayPrefab = displayPrefab; val.droneBrokenSpawnCard = (SpawnCard)(object)iSpawnCard; val.remoteOpBody = null; val.remoteOpCost = 0; val.requiredExpansion = null; val.iconSprite = CreateSprite(droneBody.GetComponent<CharacterBody>().portraitIcon); val.iconSpriteReference = null; val.nameToken = TokenPrefix + "_NAME"; val.pickupToken = TokenPrefix + "_PICKUP"; val.descriptionToken = TokenPrefix + "_DESCRIPTION"; val.skillDescriptionToken = TokenPrefix + "_SKILL_DESCRIPTION"; if (Object.op_Implicit((Object)(object)commandTemplate)) { val.droneTechCommandToken = commandTemplate.droneTechCommandToken; } if (Object.op_Implicit((Object)(object)tierTemplate)) { val.desiredSortPosition = tierTemplate.desiredSortPosition + 0.5f; } if (!ContentAddition.AddDroneDef(val)) { Log.Warning(name + ": Failed to add the DroneDef.", "D:\\Games\\LostItems\\moredronesrevive\\MoreDrones\\Drones\\DroneBase.cs", "CreateDroneDef", 430); } LinkBrokenObjectToDroneDef(val); return val; } private void LinkBrokenObjectToDroneDef(DroneDef linkedDroneDef) { DroneAvailability component = brokenObject.GetComponent<DroneAvailability>(); if (Object.op_Implicit((Object)(object)component)) { component.droneDef = linkedDroneDef; } GenericInspectInfoProvider component2 = brokenObject.GetComponent<GenericInspectInfoProvider>(); SummonMasterBehavior component3 = brokenObject.GetComponent<SummonMasterBehavior>(); InspectDef val = null; if (Object.op_Implicit((Object)(object)component2) && Object.op_Implicit((Object)(object)component2.InspectInfo)) { val = component2.InspectInfo; } else if (Object.op_Implicit((Object)(object)component3) && Object.op_Implicit((Object)(object)component3.inspectDef)) { val = component3.inspectDef; } if (!Object.op_Implicit((Object)(object)val)) { return; } InspectDef newInspectDef = Object.Instantiate<InspectDef>(val); ((Object)newInspectDef).name = name + "BrokenInspectDef"; if (newInspectDef.Info != null) { newInspectDef.Info.Visual = linkedDroneDef.iconSprite; newInspectDef.Info.VisualReference = null; newInspectDef.Info.TitleToken = linkedDroneDef.nameToken; newInspectDef.Info.DescriptionToken = linkedDroneDef.descriptionToken; RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate { //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_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) newInspectDef.Info.TitleColor = Color32.op_Implicit(ColorCatalog.GetColor(linkedDroneDef.color)); }); } if (Object.op_Implicit((Object)(object)component2)) { component2.InspectInfo = newInspectDef; } if (Object.op_Implicit((Object)(object)component3)) { component3.inspectDef = newInspectDef; } } private static Sprite CreateSprite(Texture icon) { //IL_0025: 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) Texture2D val = (Texture2D)(object)((icon is Texture2D) ? icon : null); if (val == null) { return null; } return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } protected 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) T val = Addressables.LoadAssetAsync<T>((object)key).WaitForCompletion(); if (val == null) { Log.Error("Failed to load the addressable asset " + key + ".", "D:\\Games\\LostItems\\moredronesrevive\\MoreDrones\\Drones\\DroneBase.cs", "Load", 473); } return val; } } public abstract class DroneDeathState : DeathState { public const float CostMultiplierPerUpgrade = 0.2f; private bool spawnInteractable; private bool interactableSpawned; private int upgradeCount; protected abstract DroneBase Drone { get; } public override void OnEnter() { CopyVanillaDeathEffects(); GenericCharacterDeath.hardCutoffDuration = (GenericCharacterDeath.maxFallDuration = (GenericCharacterDeath.bodyPreservationDuration = (base.deathDuration = 12f))); base.destroyOnImpact = true; spawnInteractable = Drone.canBeRepurchased; if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.inventory)) { upgradeCount = ((EntityState)this).characterBody.inventory.GetItemCountEffective(Items.DroneUpgradeHidden); if (Util.HasAnyItemWithTag(((EntityState)this).characterBody.inventory, (ItemTag)43)) { spawnInteractable = false; } if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody.master) && ((EntityState)this).characterBody.master.IsExtraLifePendingServer()) { spawnInteractable = false; } } ((DeathState)this).OnEnter(); } public override void OnImpactServer(Vector3 contactPoint) { //IL_0039: 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_0040: 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_0046: 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_004d: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Invalid comparison between Unknown and I4 if (!NetworkServer.active || interactableSpawned || !spawnInteractable) { return; } InteractableSpawnCard iSpawnCard = Drone.iSpawnCard; if (!Object.op_Implicit((Object)(object)iSpawnCard) || !Object.op_Implicit((Object)(object)DirectorCore.instance)) { return; } DirectorPlacementRule val = new DirectorPlacementRule { placementMode = (PlacementMode)0, position = contactPoint }; GameObject val2 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest((SpawnCard)(object)iSpawnCard, val, new Xoroshiro128Plus(0uL))); if (Object.op_Implicit((Object)(object)val2)) { interactableSpawned = true; PurchaseInteraction component = val2.GetComponent<PurchaseInteraction>(); if (Object.op_Implicit((Object)(object)component) && (int)component.costType == 1) { float num = 1f + (float)upgradeCount * 0.2f; component.Networkcost = Mathf.RoundToInt((float)Run.instance.GetDifficultyScaledCost(component.cost) * base.costCoefficient * num); } SummonMasterBehavior component2 = val2.GetComponent<SummonMasterBehavior>(); if (Object.op_Implicit((Object)(object)component2)) { component2.NetworkdroneUpgradeCount = upgradeCount; } } } private void CopyVanillaDeathEffects() { EntityState obj = EntityStateCatalog.InstantiateState(typeof(DeathState)); DeathState val = (DeathState)(object)((obj is DeathState) ? obj : null); if (val != null) { base.initialExplosionEffect = val.initialExplosionEffect; base.deathExplosionEffect = val.deathExplosionEffect; base.initialSoundString = val.initialSoundString; base.deathSoundString = val.deathSoundString; base.deathEffectRadius = val.deathEffectRadius; base.forceAmount = val.forceAmount; base.costCoefficient = val.costCoefficient; } } } public class SeekerDrone : DroneBase { public static SeekerDrone instance { get; private set; } public float contactDamageCoefficient { get; private set; } = 5f; public float dashCooldown { get; private set; } = 3f; public override string ConfigName => "Seeker Drone"; public override string TokenPrefix => "MOREDRONES_SEEKER"; public override string BundleBodyName => "ShredderDrone.prefab"; public override string BundleBrokenName => "BrokenShredderDrone.prefab"; public override string BundleBrokenModelPath => "Model Base/Shredder (1)"; public override int PurchaseCost => 60; public override int DirectorCost => 15; public override Type DeathStateType => typeof(SeekerDeathState); public override string TierTemplateKey => RoR2_Base_Drones.MissileDrone_asset; public override Stage[] Stages { get { Stage[] array = new Stage[5]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); return (Stage[])(object)array; } } public override Dictionary<string, string> Tokens => new Dictionary<string, string> { { "MOREDRONES_SEEKER_NAME", "Seeker Drone" }, { "MOREDRONES_SEEKER_INTERACTABLE_NAME", "Broken Seeker Drone" }, { "MOREDRONES_SEEKER_CONTEXT", "Repair Seeker Drone" }, { "MOREDRONES_SEEKER_PICKUP", "Dashes into enemies with its drill." }, { "MOREDRONES_SEEKER_DESCRIPTION", $"Dashes into enemies every <style=cIsUtility>{dashCooldown} seconds</style>, drilling anything it touches for <style=cIsDamage>{contactDamageCoefficient * 100f:0.##}% damage per second</style>." }, { "MOREDRONES_SEEKER_SKILL_DESCRIPTION", $"Seek: Dash into an enemy. Deals <style=cIsDamage>{contactDamageCoefficient * 100f:0.##}% damage per second</style> on contact." } }; public SeekerDrone() { instance = this; } protected override void SetupConfig() { contactDamageCoefficient = config.Bind<float>(base.configCategory, "Contact Damage Coefficient", contactDamageCoefficient, "Damage per second dealt to enemies touching the drill. 5 is 500%.").Value; dashCooldown = config.Bind<float>(base.configCategory, "Dash Cooldown", dashCooldown, "Seconds between dashes.").Value; } protected override void Setup(CharacterBody body, SkillLocator locator, AISkillDriver[] skillDrivers) { //IL_0002: 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_003e: 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_0109: Unknown result type (might be due to invalid IL or missing references) bool flag = default(bool); ContentAddition.AddEntityState<Charge>(ref flag); SkillDef val = Object.Instantiate<SkillDef>(DroneBase.Load<SkillDef>(RoR2_Base_Drones.Drone1BodyGun_asset)); val.skillName = "MoreDronesSeekerDash"; val.activationStateMachineName = "Weapon"; val.activationState = new SerializableEntityStateType(typeof(Charge)); val.baseRechargeInterval = dashCooldown; val.baseMaxStock = 1; val.rechargeStock = 1; val.beginSkillCooldownOnSkillEnd = false; val.fullRestockOnAssign = true; DroneBase.ReplacePrimarySkill(locator, val); HitBoxGroup componentInChildren = ((Component)base.droneBody.GetComponent<ModelLocator>().modelTransform).GetComponentInChildren<HitBoxGroup>(true); if (Object.op_Implicit((Object)(object)componentInChildren)) { ContactDamage obj = base.droneBody.AddComponent<ContactDamage>(); obj.damagePerSecondCoefficient = contactDamageCoefficient; obj.damageInterval = 0.25f; obj.pushForcePerSecond = 0f; obj.hitBoxGroup = componentInChildren; } else { Log.Warning(base.name + ": The drill hitbox was not found. The drone will not deal contact damage.", "D:\\Games\\LostItems\\moredronesrevive\\MoreDrones\\Drones\\SeekerDrone.cs", "Setup", 76); } foreach (AISkillDriver val2 in skillDrivers) { if (Object.op_Implicit((Object)(object)val2) && (int)val2.skillSlot == 0) { val2.movementType = (MovementType)1; if (val2.customName == "ChaseFarEnemies") { val2.maxDistance = 60f; } } } } } public class SeekerDeathState : DroneDeathState { protected override DroneBase Drone => SeekerDrone.instance; } } namespace MoreDrones.Components { public class BoosterDroneWard : MonoBehaviour { private GameObject ward; private Transform target; private HealthComponent healthComponent; public void Start() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) healthComponent = ((Component)this).GetComponent<HealthComponent>(); ModelLocator component = ((Component)this).GetComponent<ModelLocator>(); ChildLocator val = ((Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.modelTransform)) ? ((Component)component.modelTransform).GetComponent<ChildLocator>() : null); target = (Object.op_Implicit((Object)(object)val) ? val.FindChild("Bulb") : null); if (!Object.op_Implicit((Object)(object)target)) { target = ((Component)this).transform; } ward = Object.Instantiate<GameObject>(BoosterDrone.instance.wardPrefab, target.position, Quaternion.identity); TeamComponent component2 = ((Component)this).GetComponent<TeamComponent>(); TeamFilter component3 = ward.GetComponent<TeamFilter>(); if (Object.op_Implicit((Object)(object)component3) && Object.op_Implicit((Object)(object)component2)) { component3.teamIndex = component2.teamIndex; } } public void Update() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)ward)) { if (Object.op_Implicit((Object)(object)healthComponent) && !healthComponent.alive) { Object.Destroy((Object)(object)ward); } else if (Object.op_Implicit((Object)(object)target)) { ward.transform.position = target.position; } } } public void OnDestroy() { if (Object.op_Implicit((Object)(object)ward)) { Object.Destroy((Object)(object)ward); } } } }