Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of TempDrones v1.0.0
plugins/TempDrones.dll
Decompiled a day agousing System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Globalization; 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 Microsoft.CodeAnalysis; using On.RoR2; using On.RoR2.UI; using RiskOfOptions; using RiskOfOptions.Options; using RoR2; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.Networking; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("TempDrones")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+eda26cb08b1550479e299b32e2f4bc095e582d9c")] [assembly: AssemblyProduct("TempDrones")] [assembly: AssemblyTitle("TempDrones")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace AdjustedDrones { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("AdoptedFatty.TempDrones", "TempDrones", "1.0.0")] public class AdjustedDrones : BaseUnityPlugin { private sealed class UnityColorTypeConverter : TypeConverter { public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType); } public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return destinationType == typeof(string) || base.CanConvertTo(context, destinationType); } public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) if (value is string text) { string text2 = text.Trim(); if (text2.Length == 0) { return Color.white; } string text3 = (text2.StartsWith("#", StringComparison.Ordinal) ? text2 : ("#" + text2)); Color val = default(Color); if (ColorUtility.TryParseHtmlString(text3, ref val)) { return val; } string[] array = text2.Split(','); int num = array.Length; bool flag = (uint)(num - 3) <= 1u; if (flag && float.TryParse(array[0], out var result) && float.TryParse(array[1], out var result2) && float.TryParse(array[2], out var result3)) { float result4 = 1f; if (array.Length == 4) { float.TryParse(array[3], out result4); } return (object)new Color(result, result2, result3, result4); } } return base.ConvertFrom(context, culture, value); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { //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_0034: Unknown result type (might be due to invalid IL or missing references) if (destinationType == typeof(string) && value is Color val) { return "#" + ColorUtility.ToHtmlStringRGBA(val); } return base.ConvertTo(context, culture, value, destinationType); } } [CompilerGenerated] private sealed class <ApplyRunGatedSystems>d__32 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public AdjustedDrones <>4__this; private float <startTime>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ApplyRunGatedSystems>d__32(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; } else { <>1__state = -1; CaptureOriginalDroneCostsIfNeeded(); SetGlobalDroneCosts(active: false); if (DisableWhenOperator == null || !DisableWhenOperator.Value) { goto IL_008f; } <startTime>5__1 = Time.unscaledTime; } if (Time.unscaledTime - <startTime>5__1 < 5f && !IsOperatorPlayerPresent()) { <>2__current = null; <>1__state = 1; return true; } goto IL_008f; IL_008f: if (IsModActiveNow()) { SetGlobalDroneCosts(active: true); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <InitializePerDroneConfigsWhenReady>d__24 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public AdjustedDrones <>4__this; private float <startTime>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <InitializePerDroneConfigsWhenReady>d__24(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <startTime>5__1 = Time.unscaledTime; break; case 1: <>1__state = -1; break; } if (DroneCatalog.droneCount <= 0 && Time.unscaledTime - <startTime>5__1 < 10f) { <>2__current = null; <>1__state = 1; return true; } <>4__this.InitializePerDroneConfigs(); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public const string PluginAuthor = "AdoptedFatty"; public const string PluginName = "TempDrones"; public const string PluginGUID = "AdoptedFatty.TempDrones"; public const string PluginVersion = "1.0.0"; internal static ConfigEntry<bool> ModEnabled; internal static ConfigEntry<bool> DisableWhenOperator; internal static ConfigEntry<string> TimerExemptDrones; internal static ConfigEntry<bool> DisableDroneAggro; internal static ConfigEntry<Color> TimerColor; internal static ConfigEntry<float> DifficultyExponent; internal static ConfigEntry<float> DifficultyCoefficientMultiplier; internal static ConfigEntry<float> RepairCostMultiplier; internal static ConfigEntry<float> DroneBaseCostMultiplier; internal static readonly Dictionary<(DroneUptimeRarityTier tier, DroneUptimeTierClass tierClass), ConfigEntry<float>> DurationSeconds = new Dictionary<(DroneUptimeRarityTier, DroneUptimeTierClass), ConfigEntry<float>>(); internal static readonly Dictionary<DroneIndex, ConfigEntry<float>> PerDroneDurationSeconds = new Dictionary<DroneIndex, ConfigEntry<float>>(); private static readonly HashSet<ConfigEntryBase> riskOfOptionsRegisteredEntries = new HashSet<ConfigEntryBase>(); private static readonly Dictionary<PurchaseInteraction, int> originalDroneCosts = new Dictionary<PurchaseInteraction, int>(); private static string cachedTimerExemptValue; private static HashSet<string> cachedTimerExemptTokens; internal static AdjustedDrones Instance { get; private set; } private void Awake() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown Instance = this; Log.Init(((BaseUnityPlugin)this).Logger); TryRegisterColorTomlConverter(); BindConfig(); RegisterRiskOfOptionsOptions(); if (!ModEnabled.Value) { Log.Info("AdjustedDrones is disabled via config (General.Enabled=false). Restart required to apply."); return; } CaptureOriginalDroneCostsIfNeeded(); ((MonoBehaviour)this).StartCoroutine(InitializePerDroneConfigsWhenReady()); CharacterBody.onBodyStartGlobal += OnBodyStartGlobal; BullseyeSearch.GetResults += new hook_GetResults(BullseyeSearch_GetResults); AllyCardController.Awake += new hook_Awake(AllyCardController_Awake); Run.onRunStartGlobal += Run_onRunStartGlobal; } [IteratorStateMachine(typeof(<InitializePerDroneConfigsWhenReady>d__24))] private IEnumerator InitializePerDroneConfigsWhenReady() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <InitializePerDroneConfigsWhenReady>d__24(0) { <>4__this = this }; } private void Run_onRunStartGlobal(Run run) { InitializePerDroneConfigs(); ((MonoBehaviour)this).StartCoroutine(ApplyRunGatedSystems()); } private void OnDestroy() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown CharacterBody.onBodyStartGlobal -= OnBodyStartGlobal; BullseyeSearch.GetResults -= new hook_GetResults(BullseyeSearch_GetResults); AllyCardController.Awake -= new hook_Awake(AllyCardController_Awake); Run.onRunStartGlobal -= Run_onRunStartGlobal; } private void BindConfig() { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) ModEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable/disable the AdjustedDrones mod. Requires restart."); DisableWhenOperator = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DisableWhenOperator", false, "If true, this mod is disabled when at least one player is Operator/DroneTech (body name contains 'Operator' or 'DroneTech')."); TimerExemptDrones = ((BaseUnityPlugin)this).Config.Bind<string>("General", "TimerExemptDrones", string.Join("\n", "Drone_11_DroneBomberBodySeconds", "Drone_14_DTGunnerDroneBodySeconds", "Drone_15_DTHaulerDroneBodySeconds", "Drone_16_DTHealingDroneBodySeconds", "Drone_9_DroneCommanderBodySecons"), "List of drone body names (or per-drone config keys like 'Drone_11_DroneBomberBodySeconds') that should NEVER auto-break from the timer. One entry per line."); TimerColor = ((BaseUnityPlugin)this).Config.Bind<Color>("General", "TimerColor", new Color(0.3f, 0.6f, 1f, 1f), "Drone timer UI color."); DisableDroneAggro = ((BaseUnityPlugin)this).Config.Bind<bool>("Aggro", "DisableDroneAggro", true, "If true, enemies will not target player-owned drones/turrets (they won't draw aggro)."); DifficultyExponent = ((BaseUnityPlugin)this).Config.Bind<float>("Scaling", "DifficultyCoefficientExponent", 1f, "Effective duration = baseDuration / ((difficultyCoefficient * multiplier) ^ exponent). Uses Run.difficultyCoefficient only. Updates dynamically as the run difficulty ramps. Set to 0 to disable scaling."); DifficultyCoefficientMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Scaling", "DifficultyCoefficientMultiplier", 1f, "Multiplier applied to Run.difficultyCoefficient before exponentiation. 1 = unchanged."); RepairCostMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Repair", "RepairCostMultiplier", 0.5f, "Multiplier applied to the base repair cost of broken drone interactables 0.5 = half price."); DroneBaseCostMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Repair", "DroneBaseCostMultiplier", 0.5f, "Multiplier applied to the base purchase cost of drone purchase interactables (non-broken). 0.5 = half price."); BindDuration(DroneUptimeRarityTier.White, DroneUptimeTierClass.Utility, 240f); BindDuration(DroneUptimeRarityTier.White, DroneUptimeTierClass.Combat, 180f); BindDuration(DroneUptimeRarityTier.Green, DroneUptimeTierClass.Utility, 180f); BindDuration(DroneUptimeRarityTier.Green, DroneUptimeTierClass.Combat, 135f); BindDuration(DroneUptimeRarityTier.Red, DroneUptimeTierClass.Utility, 120f); BindDuration(DroneUptimeRarityTier.Red, DroneUptimeTierClass.Combat, 90f); } private void InitializePerDroneConfigs() { for (int i = 0; i < DroneCatalog.droneCount; i++) { DroneDef droneDef = DroneCatalog.GetDroneDef((DroneIndex)i); if ((Object)(object)droneDef != (Object)null) { EnsurePerDroneEntry(droneDef); } } } private void ApplyGlobalDroneCostMultipliers() { SetGlobalDroneCosts(active: true); } internal static bool IsModActiveNow() { if (ModEnabled == null || !ModEnabled.Value) { return false; } if (DisableWhenOperator != null && DisableWhenOperator.Value && IsOperatorPlayerPresent()) { return false; } return true; } private static bool IsOperatorPlayerPresent() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) try { ReadOnlyCollection<PlayerCharacterMasterController> instances = PlayerCharacterMasterController.instances; if (instances == null) { return false; } foreach (PlayerCharacterMasterController item in instances) { if (!Object.op_Implicit((Object)(object)item)) { continue; } CharacterMaster master = item.master; CharacterBody val = (Object.op_Implicit((Object)(object)master) ? master.GetBody() : null); if (Object.op_Implicit((Object)(object)val)) { string text = BodyCatalog.GetBodyName(val.bodyIndex); if (string.IsNullOrWhiteSpace(text)) { text = ((Object)val).name; } if (!string.IsNullOrWhiteSpace(text) && (text.IndexOf("Operator", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("DroneTech", StringComparison.OrdinalIgnoreCase) >= 0)) { return true; } } } } catch { } return false; } [IteratorStateMachine(typeof(<ApplyRunGatedSystems>d__32))] private IEnumerator ApplyRunGatedSystems() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ApplyRunGatedSystems>d__32(0) { <>4__this = this }; } private static void CaptureOriginalDroneCostsIfNeeded() { try { InteractableSpawnCard[] array = Resources.LoadAll<InteractableSpawnCard>("SpawnCards/InteractableSpawnCard"); if (array == null || array.Length == 0) { return; } InteractableSpawnCard[] array2 = array; foreach (InteractableSpawnCard val in array2) { if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((SpawnCard)val).prefab)) { PurchaseInteraction component = ((SpawnCard)val).prefab.GetComponent<PurchaseInteraction>(); if (Object.op_Implicit((Object)(object)component) && component.isDrone && !originalDroneCosts.ContainsKey(component)) { originalDroneCosts[component] = component.cost; } } } } catch { } } private static void SetGlobalDroneCosts(bool active) { try { InteractableSpawnCard[] array = Resources.LoadAll<InteractableSpawnCard>("SpawnCards/InteractableSpawnCard"); if (array == null || array.Length == 0) { return; } float num = (active ? Mathf.Max(0f, DroneBaseCostMultiplier.Value) : 1f); float num2 = (active ? Mathf.Max(0f, RepairCostMultiplier.Value) : 1f); InteractableSpawnCard[] array2 = array; foreach (InteractableSpawnCard val in array2) { if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)((SpawnCard)val).prefab)) { continue; } PurchaseInteraction component = ((SpawnCard)val).prefab.GetComponent<PurchaseInteraction>(); if (Object.op_Implicit((Object)(object)component) && component.isDrone) { if (!originalDroneCosts.TryGetValue(component, out var value)) { value = component.cost; originalDroneCosts[component] = value; } float num3 = ((!string.IsNullOrEmpty(((Object)val).name) && ((Object)val).name.StartsWith("iscBroken", StringComparison.OrdinalIgnoreCase)) ? num2 : num); component.cost = Mathf.Max(0, Mathf.RoundToInt((float)value * num3)); } } } catch (Exception data) { Log.Error(data); } } private void BindDuration(DroneUptimeRarityTier tier, DroneUptimeTierClass tierClass, float defaultSeconds) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown ConfigEntry<float> val = ((BaseUnityPlugin)this).Config.Bind<float>($"Duration.{tier}", $"{tierClass}Seconds", defaultSeconds, new ConfigDescription("Base active duration in seconds before the drone/turret breaks and requires repair. Set to 0 for infinite duration (no timer UI).", (AcceptableValueBase)null, Array.Empty<object>())); DurationSeconds[(tier, tierClass)] = val; RegisterRiskOfOptionsUnlimitedFloat(val); } internal ConfigEntry<float> EnsurePerDroneEntry(DroneDef droneDef) { //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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_002b: 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_0088: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) DroneIndex val = (DroneIndex)((!Object.op_Implicit((Object)(object)droneDef)) ? (-1) : ((int)droneDef.droneIndex)); if ((int)val == -1) { return null; } if (PerDroneDurationSeconds.TryGetValue(val, out var value)) { return value; } string safeDroneConfigKeyName = GetSafeDroneConfigKeyName(droneDef); string droneDisplayNameForConfig = GetDroneDisplayNameForConfig(droneDef); ConfigEntry<float> val2 = ((BaseUnityPlugin)this).Config.Bind<float>("Overrides.PerDrone", safeDroneConfigKeyName + "Seconds", -1f, new ConfigDescription("Per-drone duration override for '" + droneDisplayNameForConfig + "' in seconds. Set to -1 to use the tier/class duration. Set to 0 for infinite duration (no timer UI).", (AcceptableValueBase)null, Array.Empty<object>())); PerDroneDurationSeconds[val] = val2; RegisterRiskOfOptionsUnlimitedFloat(val2); return val2; } private void RegisterRiskOfOptionsOptions() { try { RegisterRiskOfOptionsCheckbox(ModEnabled); RegisterRiskOfOptionsCheckbox(DisableWhenOperator); RegisterRiskOfOptionsStringInput(TimerExemptDrones); RegisterRiskOfOptionsColorPicker(TimerColor); RegisterRiskOfOptionsCheckbox(DisableDroneAggro); RegisterRiskOfOptionsUnlimitedFloat(DifficultyExponent); RegisterRiskOfOptionsUnlimitedFloat(DifficultyCoefficientMultiplier); RegisterRiskOfOptionsUnlimitedFloat(RepairCostMultiplier); RegisterRiskOfOptionsUnlimitedFloat(DroneBaseCostMultiplier); ModSettingsManager.SetModDescription("Adjust drone uptime/duration scaling and drone costs. Includes per-drone overrides."); } catch (Exception data) { Log.Error(data); } } private static void RegisterRiskOfOptionsUnlimitedFloat(ConfigEntry<float> entry) { if (entry != null && !riskOfOptionsRegisteredEntries.Contains((ConfigEntryBase)(object)entry)) { if (!TryAddRiskOfOptionsOptionByTypeName("RiskOfOptions.Options.FloatFieldOption", entry) && !TryAddRiskOfOptionsOptionByTypeName("RiskOfOptions.Options.FloatInputFieldOption", entry) && !TryAddRiskOfOptionsOptionByTypeName("RiskOfOptions.Options.InputFieldOption", entry)) { Log.Warning("RiskOfOptions float field option not found; skipping menu option for '" + ((ConfigEntryBase)entry).Definition.Section + "." + ((ConfigEntryBase)entry).Definition.Key + "' to avoid imposing an upper limit."); } else { riskOfOptionsRegisteredEntries.Add((ConfigEntryBase)(object)entry); } } } private static bool TryAddRiskOfOptionsOptionByTypeName(string fullTypeName, object ctorArg) { try { Assembly assembly = typeof(ModSettingsManager).Assembly; Type type = assembly.GetType(fullTypeName, throwOnError: false); if (type == null) { return false; } object obj = Activator.CreateInstance(type, ctorArg); if (obj == null) { return false; } MethodInfo methodInfo = typeof(ModSettingsManager).GetMethods(BindingFlags.Static | BindingFlags.Public).FirstOrDefault((MethodInfo m) => m.Name == "AddOption" && m.GetParameters().Length == 1); if (methodInfo == null) { return false; } methodInfo.Invoke(null, new object[1] { obj }); return true; } catch { return false; } } private static void RegisterRiskOfOptionsCheckbox(ConfigEntry<bool> entry) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown if (entry != null && !riskOfOptionsRegisteredEntries.Contains((ConfigEntryBase)(object)entry)) { ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(entry)); riskOfOptionsRegisteredEntries.Add((ConfigEntryBase)(object)entry); } } private static void RegisterRiskOfOptionsStringInput(ConfigEntry<string> entry) { if (entry != null && !riskOfOptionsRegisteredEntries.Contains((ConfigEntryBase)(object)entry) && (TryAddRiskOfOptionsOptionByTypeName("RiskOfOptions.Options.StringInputFieldOption", entry) || TryAddRiskOfOptionsOptionByTypeName("RiskOfOptions.Options.InputFieldOption", entry))) { riskOfOptionsRegisteredEntries.Add((ConfigEntryBase)(object)entry); } } internal static bool IsDroneExemptFromTimer(DroneDef droneDef) { if (!Object.op_Implicit((Object)(object)droneDef)) { return false; } string text = TimerExemptDrones?.Value ?? string.Empty; if (!string.Equals(text, cachedTimerExemptValue, StringComparison.Ordinal)) { cachedTimerExemptValue = text; cachedTimerExemptTokens = ParseTimerExemptTokens(text); } if (cachedTimerExemptTokens == null || cachedTimerExemptTokens.Count == 0) { return false; } string s = (Object.op_Implicit((Object)(object)droneDef.bodyPrefab) ? ((Object)droneDef.bodyPrefab).name : string.Empty); string safeDroneConfigKeyName = GetSafeDroneConfigKeyName(droneDef); return cachedTimerExemptTokens.Contains(NormalizeToken(s)) || cachedTimerExemptTokens.Contains(NormalizeToken(safeDroneConfigKeyName)) || cachedTimerExemptTokens.Contains(NormalizeToken(safeDroneConfigKeyName + "Seconds")); } private static HashSet<string> ParseTimerExemptTokens(string raw) { HashSet<string> hashSet = new HashSet<string>(StringComparer.Ordinal); if (string.IsNullOrWhiteSpace(raw)) { return hashSet; } string[] array = raw.Split(new char[2] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); string[] array2 = array; foreach (string s in array2) { string text = NormalizeToken(s); if (text.Length == 0) { continue; } text = StripSuffix(text, "seconds"); text = StripSuffix(text, "secons"); hashSet.Add(text); if (!text.StartsWith("drone_", StringComparison.Ordinal)) { continue; } int num = text.IndexOf('_', "drone_".Length); if (num >= 0 && num + 1 < text.Length) { string text2 = text.Substring(num + 1); if (text2.Length > 0) { hashSet.Add(text2); } } } return hashSet; } private static string NormalizeToken(string s) { if (string.IsNullOrWhiteSpace(s)) { return string.Empty; } return s.Trim().ToLowerInvariant(); } private static string StripSuffix(string s, string suffix) { if (s != null && suffix != null && s.EndsWith(suffix, StringComparison.Ordinal)) { return s.Substring(0, s.Length - suffix.Length); } return s; } private static void RegisterRiskOfOptionsColorPicker(ConfigEntry<Color> entry) { if (entry != null && !riskOfOptionsRegisteredEntries.Contains((ConfigEntryBase)(object)entry) && (TryAddRiskOfOptionsOptionByTypeName("RiskOfOptions.Options.ColorOption", entry) || TryAddRiskOfOptionsOptionByTypeName("RiskOfOptions.Options.ColorPickerOption", entry) || TryAddRiskOfOptionsOptionByHeuristic(entry))) { riskOfOptionsRegisteredEntries.Add((ConfigEntryBase)(object)entry); } } private static bool TryAddRiskOfOptionsOptionByHeuristic(object entry) { try { Assembly assembly = typeof(ModSettingsManager).Assembly; Type entryType = entry.GetType(); Type[] array = (from t in assembly.GetTypes() where t != null && string.Equals(t.Namespace, "RiskOfOptions.Options", StringComparison.Ordinal) && t.Name.IndexOf("Color", StringComparison.OrdinalIgnoreCase) >= 0 select t).ToArray(); Type[] array2 = array; foreach (Type type in array2) { ConstructorInfo constructorInfo = type.GetConstructors(BindingFlags.Instance | BindingFlags.Public).FirstOrDefault(delegate(ConstructorInfo c) { ParameterInfo[] parameters = c.GetParameters(); return parameters.Length == 1 && parameters[0].ParameterType.IsAssignableFrom(entryType); }); if (constructorInfo == null) { continue; } object obj = constructorInfo.Invoke(new object[1] { entry }); if (obj != null) { MethodInfo methodInfo = typeof(ModSettingsManager).GetMethods(BindingFlags.Static | BindingFlags.Public).FirstOrDefault((MethodInfo m) => m.Name == "AddOption" && m.GetParameters().Length == 1); if (methodInfo == null) { return false; } methodInfo.Invoke(null, new object[1] { obj }); return true; } } } catch { } return false; } private static void TryRegisterColorTomlConverter() { try { Type typeFromHandle = typeof(TomlTypeConverter); MethodInfo methodInfo = typeFromHandle.GetMethods(BindingFlags.Static | BindingFlags.Public).FirstOrDefault((MethodInfo m) => m.Name == "AddConverter" && m.GetParameters().Length == 2); if (!(methodInfo == null)) { methodInfo.Invoke(null, new object[2] { typeof(Color), new UnityColorTypeConverter() }); } } catch { } } private static string GetDroneDisplayNameForConfig(DroneDef droneDef) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected I4, but got Unknown if (!Object.op_Implicit((Object)(object)droneDef)) { return "Unknown Drone"; } if (!string.IsNullOrWhiteSpace(droneDef.nameToken)) { string @string = Language.GetString(droneDef.nameToken); if (!string.IsNullOrWhiteSpace(@string)) { return @string; } return droneDef.nameToken; } if (Object.op_Implicit((Object)(object)droneDef.bodyPrefab)) { return ((Object)droneDef.bodyPrefab).name; } return $"Drone {(int)droneDef.droneIndex}"; } private static string GetSafeDroneConfigKeyName(DroneDef droneDef) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected I4, but got Unknown string arg = "UnknownBody"; if (Object.op_Implicit((Object)(object)droneDef) && Object.op_Implicit((Object)(object)droneDef.bodyPrefab)) { arg = ((Object)droneDef.bodyPrefab).name; } return $"Drone_{(int)droneDef.droneIndex}_{arg}"; } private void OnBodyStartGlobal(CharacterBody body) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 //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) //IL_00b9: 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_00bc: Invalid comparison between Unknown and I4 //IL_00eb: Unknown result type (might be due to invalid IL or missing references) try { if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.teamComponent) || (int)body.teamComponent.teamIndex != 1 || !Object.op_Implicit((Object)(object)body.master) || !Object.op_Implicit((Object)(object)body.master.minionOwnership) || !Object.op_Implicit((Object)(object)body.master.minionOwnership.ownerMaster) || !Object.op_Implicit((Object)(object)body.master.minionOwnership.ownerMaster.playerCharacterMasterController)) { return; } DroneIndex droneIndexFromBodyIndex = DroneCatalog.GetDroneIndexFromBodyIndex(body.bodyIndex); if ((int)droneIndexFromBodyIndex != -1) { DroneUptimeTimer droneUptimeTimer = ((Component)body).GetComponent<DroneUptimeTimer>(); if (!Object.op_Implicit((Object)(object)droneUptimeTimer)) { droneUptimeTimer = ((Component)body).gameObject.AddComponent<DroneUptimeTimer>(); } DroneDef droneDef = DroneCatalog.GetDroneDef(droneIndexFromBodyIndex); EnsurePerDroneEntry(droneDef); droneUptimeTimer.Configure(droneDef); } } catch (Exception data) { Log.Error(data); } } private IEnumerable<HurtBox> BullseyeSearch_GetResults(orig_GetResults orig, BullseyeSearch self) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Invalid comparison between Unknown and I4 IEnumerable<HurtBox> enumerable = orig.Invoke(self); if (!IsModActiveNow() || !DisableDroneAggro.Value) { return enumerable; } if (self == null || (Object)(object)self.viewer == (Object)null || (Object)(object)self.viewer.teamComponent == (Object)null) { return enumerable; } if ((int)self.viewer.teamComponent.teamIndex == 1) { return enumerable; } if (!(enumerable is HurtBox[] array) || array.Length == 0) { return enumerable; } return array.Where((HurtBox hb) => !ShouldIgnoreAsTarget(hb)).ToArray(); } private static bool ShouldIgnoreAsTarget(HurtBox hb) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //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_0067: Invalid comparison between Unknown and I4 if (!Object.op_Implicit((Object)(object)hb) || (int)hb.teamIndex != 1) { return false; } HealthComponent healthComponent = hb.healthComponent; if (!Object.op_Implicit((Object)(object)healthComponent) || !Object.op_Implicit((Object)(object)healthComponent.body)) { return false; } CharacterBody body = healthComponent.body; if ((int)DroneCatalog.GetDroneIndexFromBodyIndex(body.bodyIndex) == -1) { return false; } CharacterMaster master = body.master; if (!Object.op_Implicit((Object)(object)master) || Object.op_Implicit((Object)(object)master.playerCharacterMasterController)) { return false; } if (!Object.op_Implicit((Object)(object)master.minionOwnership) || !Object.op_Implicit((Object)(object)master.minionOwnership.ownerMaster)) { return false; } return Object.op_Implicit((Object)(object)master.minionOwnership.ownerMaster.playerCharacterMasterController); } private void AllyCardController_Awake(orig_Awake orig, AllyCardController self) { orig.Invoke(self); if (Object.op_Implicit((Object)(object)self) && IsModActiveNow() && !Object.op_Implicit((Object)(object)((Component)self).GetComponent<DroneUptimeAllyCardOverlay>())) { ((Component)self).gameObject.AddComponent<DroneUptimeAllyCardOverlay>(); } } } internal enum DroneUptimeTierClass { Utility, Combat } internal enum DroneUptimeRarityTier { White, Green, Red } internal static class DroneUptimeDuration { public static float ComputeBaseDurationSeconds(DroneDef droneDef) { //IL_002a: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected I4, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Invalid comparison between Unknown and I4 if (AdjustedDrones.IsDroneExemptFromTimer(droneDef)) { return 0f; } DroneUptimeRarityTier item = DroneUptimeRarityTier.Green; if (Object.op_Implicit((Object)(object)droneDef)) { ItemTier tier = droneDef.tier; if (1 == 0) { } DroneUptimeRarityTier droneUptimeRarityTier = (int)tier switch { 0 => DroneUptimeRarityTier.White, 1 => DroneUptimeRarityTier.Green, 2 => DroneUptimeRarityTier.Red, _ => DroneUptimeRarityTier.Green, }; if (1 == 0) { } item = droneUptimeRarityTier; } if (!AdjustedDrones.IsModActiveNow()) { return 0f; } DroneUptimeTierClass item2 = DroneUptimeTierClass.Utility; if (Object.op_Implicit((Object)(object)droneDef) && (int)droneDef.droneType == 1) { item2 = DroneUptimeTierClass.Combat; } if (Object.op_Implicit((Object)(object)droneDef)) { AdjustedDrones instance = AdjustedDrones.Instance; ConfigEntry<float> val = (Object.op_Implicit((Object)(object)instance) ? instance.EnsurePerDroneEntry(droneDef) : null); if (val != null && val.Value >= 0f) { return Mathf.Max(0f, val.Value); } } float result = 180f; if (AdjustedDrones.DurationSeconds.TryGetValue((item, item2), out var value)) { result = Mathf.Max(0f, value.Value); } return result; } public static float GetScaledDurationSeconds(float baseSeconds) { float num = 1f; if (Object.op_Implicit((Object)(object)Run.instance)) { num = Mathf.Max(1f, Run.instance.difficultyCoefficient); } float num2 = Mathf.Max(0f, AdjustedDrones.DifficultyCoefficientMultiplier.Value); num = Mathf.Max(1f, num * num2); float num3 = Mathf.Max(0f, AdjustedDrones.DifficultyExponent.Value); float num4 = ((num3 <= 0f) ? 1f : Mathf.Pow(num, num3)); return (num4 <= 0f) ? baseSeconds : (baseSeconds / num4); } } internal sealed class DroneUptimeTimer : MonoBehaviour { private float baseDuration; private HealthComponent health; private bool configured; private bool broke; public float duration => DroneUptimeDuration.GetScaledDurationSeconds(baseDuration); public float age { get; private set; } public DroneDef droneDef { get; private set; } public float remaining => Mathf.Max(0f, duration - age); public float remainingFraction => (duration > 0f) ? Mathf.Clamp01(remaining / duration) : 0f; public void Configure(DroneDef def) { droneDef = def; baseDuration = DroneUptimeDuration.ComputeBaseDurationSeconds(def); age = 0f; configured = true; broke = false; } private void Start() { ((Component)this).TryGetComponent<HealthComponent>(ref health); } private void Update() { if (!AdjustedDrones.IsModActiveNow() || !configured) { return; } float num = duration; if (num <= 0f) { return; } age += Time.deltaTime; if (!broke && age >= num) { broke = true; if (NetworkServer.active) { BreakToRepair(); } } } [Server] private void BreakToRepair() { if (Object.op_Implicit((Object)(object)health) && Object.op_Implicit((Object)(object)health.body)) { CharacterBody body = health.body; DroneDef val = droneDef; if (IsMegaDrone(body, val)) { DroneUptimeRepairSpawner.SpawnBrokenAndRemove(body, val); } else if (Object.op_Implicit((Object)(object)body.master)) { body.master.TrueKill(); } } } private static bool IsMegaDrone(CharacterBody body, DroneDef droneDef) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body)) { return false; } string bodyName = BodyCatalog.GetBodyName(body.bodyIndex); if (!string.IsNullOrEmpty(bodyName) && bodyName.Contains("MegaDrone")) { return true; } if (((Object)body).name.Contains("MegaDrone")) { return true; } return false; } } internal sealed class DroneUptimeAllyCardOverlay : MonoBehaviour { private AllyCardController allyCard; private RectTransform portraitRect; private GameObject timerRoot; private GameObject tempItemIndicatorInstance; private Image timerImage; private TextMeshProUGUI fallbackText; private static bool triedLoadTempItemIndicator; private static GameObject cachedTempItemIndicatorPrefab; private void Awake() { allyCard = ((Component)this).GetComponent<AllyCardController>(); TryBuildUi(); } private void TryBuildUi() { //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0223: 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) //IL_02d3: Expected O, but got Unknown //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Expected O, but got Unknown //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0341: 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_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Invalid comparison between Unknown and I4 if (!Object.op_Implicit((Object)(object)allyCard) || !Object.op_Implicit((Object)(object)allyCard.portraitIconImage)) { return; } portraitRect = ((Component)allyCard.portraitIconImage).GetComponent<RectTransform>(); if (!Object.op_Implicit((Object)(object)portraitRect)) { return; } if (!triedLoadTempItemIndicator) { triedLoadTempItemIndicator = true; try { GameObject hiddenPickupDisplayPrefab = PickupCatalog.GetHiddenPickupDisplayPrefab(); PickupDisplay val = (Object.op_Implicit((Object)(object)hiddenPickupDisplayPrefab) ? hiddenPickupDisplayPrefab.GetComponentInChildren<PickupDisplay>(true) : null); cachedTempItemIndicatorPrefab = (Object.op_Implicit((Object)(object)val) ? val.temporaryItemIndicator : null); } catch { cachedTempItemIndicatorPrefab = null; } } if (!Object.op_Implicit((Object)(object)timerRoot)) { timerRoot = new GameObject("DroneUptimeTimer", new Type[1] { typeof(RectTransform) }); timerRoot.transform.SetParent((Transform)(object)portraitRect, false); timerRoot.transform.SetAsLastSibling(); RectTransform val2 = (RectTransform)timerRoot.transform; val2.anchorMin = new Vector2(0f, 0f); val2.anchorMax = new Vector2(0f, 0f); val2.pivot = new Vector2(0f, 0f); val2.anchoredPosition = new Vector2(0f, 0f); val2.sizeDelta = new Vector2(18f, 18f); } if (!Object.op_Implicit((Object)(object)tempItemIndicatorInstance) && Object.op_Implicit((Object)(object)cachedTempItemIndicatorPrefab)) { tempItemIndicatorInstance = Object.Instantiate<GameObject>(cachedTempItemIndicatorPrefab, timerRoot.transform, false); ((Object)tempItemIndicatorInstance).name = "TempItemIndicator"; tempItemIndicatorInstance.transform.localPosition = Vector3.zero; tempItemIndicatorInstance.transform.localRotation = Quaternion.identity; tempItemIndicatorInstance.transform.localScale = Vector3.one; Image[] componentsInChildren = tempItemIndicatorInstance.GetComponentsInChildren<Image>(true); Image[] array = componentsInChildren; foreach (Image val3 in array) { if (Object.op_Implicit((Object)(object)val3) && (int)val3.type == 3) { timerImage = val3; break; } } ApplyTimerColorIfConfigured(); } if (!Object.op_Implicit((Object)(object)timerImage) && !Object.op_Implicit((Object)(object)fallbackText)) { GameObject val4 = new GameObject("FallbackTimerText", new Type[1] { typeof(RectTransform) }); val4.transform.SetParent(timerRoot.transform, false); RectTransform val5 = (RectTransform)val4.transform; val5.anchorMin = new Vector2(0f, 0f); val5.anchorMax = new Vector2(1f, 1f); val5.pivot = new Vector2(0.5f, 0.5f); val5.anchoredPosition = Vector2.zero; val5.sizeDelta = Vector2.zero; fallbackText = val4.AddComponent<TextMeshProUGUI>(); ((TMP_Text)fallbackText).fontSize = 12f; ((Graphic)fallbackText).color = new Color(0.3f, 0.6f, 1f, 1f); ((TMP_Text)fallbackText).alignment = (TextAlignmentOptions)514; ((TMP_Text)fallbackText).enableWordWrapping = false; ((Graphic)fallbackText).raycastTarget = false; ApplyTimerColorIfConfigured(); } } private void ApplyTimerColorIfConfigured() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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) ConfigEntry<Color> timerColor = AdjustedDrones.TimerColor; if (timerColor != null) { Color value = timerColor.Value; if (Object.op_Implicit((Object)(object)timerImage)) { ((Graphic)timerImage).color = value; } if (Object.op_Implicit((Object)(object)fallbackText)) { ((Graphic)fallbackText).color = value; } } } private void LateUpdate() { //IL_016d: 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_0178: Invalid comparison between Unknown and I4 if (!Object.op_Implicit((Object)(object)timerImage) && !Object.op_Implicit((Object)(object)fallbackText)) { TryBuildUi(); } ApplyTimerColorIfConfigured(); if (!Object.op_Implicit((Object)(object)allyCard)) { return; } CharacterMaster sourceMaster = allyCard.sourceMaster; CharacterBody val = (Object.op_Implicit((Object)(object)sourceMaster) ? sourceMaster.GetBody() : null); if (!Object.op_Implicit((Object)(object)val)) { if (Object.op_Implicit((Object)(object)tempItemIndicatorInstance)) { tempItemIndicatorInstance.SetActive(false); } if (Object.op_Implicit((Object)(object)fallbackText)) { ((Behaviour)fallbackText).enabled = false; } return; } DroneUptimeTimer component = ((Component)val).GetComponent<DroneUptimeTimer>(); if (!Object.op_Implicit((Object)(object)component)) { if (Object.op_Implicit((Object)(object)tempItemIndicatorInstance)) { tempItemIndicatorInstance.SetActive(false); } if (Object.op_Implicit((Object)(object)fallbackText)) { ((Behaviour)fallbackText).enabled = false; } } else if (component.duration <= 0f) { if (Object.op_Implicit((Object)(object)tempItemIndicatorInstance)) { tempItemIndicatorInstance.SetActive(false); } if (Object.op_Implicit((Object)(object)fallbackText)) { ((Behaviour)fallbackText).enabled = false; } } else if ((int)DroneCatalog.GetDroneIndexFromBodyIndex(val.bodyIndex) == -1) { if (Object.op_Implicit((Object)(object)tempItemIndicatorInstance)) { tempItemIndicatorInstance.SetActive(false); } if (Object.op_Implicit((Object)(object)fallbackText)) { ((Behaviour)fallbackText).enabled = false; } } else if (Object.op_Implicit((Object)(object)timerImage)) { if (Object.op_Implicit((Object)(object)tempItemIndicatorInstance)) { tempItemIndicatorInstance.SetActive(true); } timerImage.fillAmount = component.remainingFraction; if (Object.op_Implicit((Object)(object)fallbackText)) { ((Behaviour)fallbackText).enabled = false; } } else if (Object.op_Implicit((Object)(object)fallbackText)) { ((Behaviour)fallbackText).enabled = true; float remaining = component.remaining; int num = Mathf.FloorToInt(remaining / 60f); int num2 = Mathf.FloorToInt(remaining % 60f); ((TMP_Text)fallbackText).text = $"{num}:{num2:00}"; } } } internal static class DroneUptimeRepairSpawner { [Server] public static void SpawnBrokenAndRemove(CharacterBody droneBody, DroneDef droneDef) { //IL_004f: 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_005f: 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) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_00b7: 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_00be: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Invalid comparison between Unknown and I4 if (!NetworkServer.active || !Object.op_Implicit((Object)(object)droneBody)) { return; } SpawnCard brokenDroneSpawnCard = GetBrokenDroneSpawnCard(droneBody, droneDef); if ((Object)(object)brokenDroneSpawnCard != (Object)null && Object.op_Implicit((Object)(object)DirectorCore.instance)) { Vector3 position = FindGround(droneBody.corePosition, droneBody.radius) + Vector3.up * 0.25f; DirectorPlacementRule val = new DirectorPlacementRule { placementMode = (PlacementMode)0, position = position }; Xoroshiro128Plus val2 = (((Object)(object)Run.instance != (Object)null) ? new Xoroshiro128Plus(Run.instance.seed + (ulong)Run.instance.fixedTime) : new Xoroshiro128Plus(0uL)); GameObject val3 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(brokenDroneSpawnCard, val, val2)); if (Object.op_Implicit((Object)(object)val3)) { PurchaseInteraction component = val3.GetComponent<PurchaseInteraction>(); if (Object.op_Implicit((Object)(object)component) && (int)component.costType == 1 && Object.op_Implicit((Object)(object)Run.instance)) { component.Networkcost = Mathf.RoundToInt((float)Run.instance.GetDifficultyScaledCost(component.cost)); } } } CharacterMaster master = droneBody.master; if (Object.op_Implicit((Object)(object)master)) { master.TrueKill(); } else { NetworkServer.Destroy(((Component)droneBody).gameObject); } } private static SpawnCard GetBrokenDroneSpawnCard(CharacterBody droneBody, DroneDef droneDef) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)droneDef) && Object.op_Implicit((Object)(object)droneDef.droneBrokenSpawnCard)) { return droneDef.droneBrokenSpawnCard; } string text = BodyCatalog.GetBodyName(droneBody.bodyIndex); if (string.IsNullOrWhiteSpace(text)) { text = ((Object)droneBody).name; } text = text.Replace("Body", ""); string text2 = "iscBroken" + text; return LegacyResourcesAPI.Load<SpawnCard>("SpawnCards/InteractableSpawnCard/" + text2); } private static Vector3 FindGround(Vector3 origin, float radius) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_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_008a: 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_0081: 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_008f: Unknown result type (might be due to invalid IL or missing references) Vector3 val = origin + Vector3.up * 200f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, 1200f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val2)).point; } float num = Mathf.Max(0.25f, radius); if (Physics.SphereCast(val, num, Vector3.down, ref val2, 1200f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val2)).point; } return origin; } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } }