Decompiled source of HelldiverTree v0.29.8
HelldiverTree.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Burst2Flame; using Burst2Flame.Observable; using Cysharp.Threading.Tasks; using HarmonyLib; using HexMapTools; using Microsoft.CodeAnalysis; using ModNet; using StolenRealmModAPI; using TMPro; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("HelldiverTree")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+39bd95f1d9f94a3c7903de2f5b29f41bd1e93438")] [assembly: AssemblyProduct("HelldiverTree")] [assembly: AssemblyTitle("HelldiverTree")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 HelldiverTree { internal static class ArmorModel { private const string ModelName = "B01Armor"; internal const string PartPrefix = "HD_B01_"; private const string BodyRootName = "Modular_Characters"; private const string HelmetBone = "Head"; private const string EyebrowsSuffix = "_Eyebrows"; private static GameObject _model; private static bool _tried; private static bool _logged; private static GameObject Model() { if ((Object)(object)_model != (Object)null || _tried) { return _model; } _tried = true; AssetBundle val = EruptorModel.Bundle(); _model = (((Object)(object)val != (Object)null) ? val.LoadAsset<GameObject>("B01Armor") : null); if ((Object)(object)val != (Object)null && (Object)(object)_model == (Object)null) { Plugin.ModLog.LogWarning((object)("No 'B01Armor' in " + ((Object)val).name + ": the B-01 Tactical Armor shows its under-suit only.")); } return _model; } internal static ItemInfo ShownArmor(Character character) { if (character == null) { return null; } ObservableList<Item> equippedItems = character.EquippedItems; if (equippedItems == null) { return null; } Item? obj = ((IEnumerable<Item>)equippedItems).FirstOrDefault((Func<Item, bool>)((Item i) => (Object)(object)((i != null) ? i.ItemInfo : null) != (Object)null && (int)i.ItemInfo.ItemType == 3)); if (obj == null) { return null; } return obj.CurrentVisualItemInfo; } internal static void Apply(Character character, ItemInfo shown) { PlayerMovement val = ((character == null) ? null : character.PlayerMovement); if (!((Object)(object)val == (Object)null)) { Animator val2 = (((Object)(object)val.AnimManager != (Object)null && (Object)(object)val.AnimManager.Anim != (Object)null) ? val.AnimManager.Anim : ((Component)val).GetComponentInChildren<Animator>(true)); Dress(((Object)(object)val2 != (Object)null) ? ((Component)val2).transform : ((Component)val).transform, HelldiverArmor.Is(shown), !character.HelmHidden, HeadParents(val).ToList(), character.CharacterName); } } internal static void ApplyRig(GameObject rig, Character character) { if (!((Object)(object)rig == (Object)null) && character != null) { Animator componentInChildren = rig.GetComponentInChildren<Animator>(true); HashSet<string> names = new HashSet<string>(((Object)(object)character.PlayerMovement != (Object)null) ? (from t in HeadParents(character.PlayerMovement) select ((Object)t).name) : Enumerable.Empty<string>()); List<Transform> headParents = (from t in rig.GetComponentsInChildren<Transform>(true) where names.Contains(((Object)t).name) select t).ToList(); Dress(((Object)(object)componentInChildren != (Object)null) ? ((Component)componentInChildren).transform : rig.transform, HelldiverArmor.Is(ShownArmor(character)), !character.HelmHidden, headParents, character.CharacterName + " (preview)"); } } private static IEnumerable<Transform> HeadParents(PlayerMovement pm) { return from t in ((IEnumerable<Transform>)(object)new Transform[2] { pm.hairParent, pm.facialHairParent }).Concat(pm.headParents ?? new List<Transform>()).Concat(pm.helmParents ?? new List<Transform>()) where (Object)(object)t != (Object)null select t; } private static void Dress(Transform root, bool wear, bool helmet, List<Transform> headParents, string who) { //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Expected O, but got Unknown //IL_026a: 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_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) foreach (GameObject item in (from t in ((Component)root).GetComponentsInChildren<Transform>(true) where ((Object)t).name.StartsWith("HD_B01_") select ((Component)t).gameObject).ToList()) { Object.DestroyImmediate((Object)(object)item); } PlateVisibility plateVisibility = ((Component)root).GetComponent<PlateVisibility>(); if (!wear) { if ((Object)(object)plateVisibility != (Object)null) { Object.DestroyImmediate((Object)(object)plateVisibility); } return; } GameObject val = Model(); if ((Object)(object)val == (Object)null) { return; } Transform val2 = root.Find("Modular_Characters") ?? ((IEnumerable<Transform>)((Component)root).GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "Modular_Characters")) ?? root; Dictionary<string, (Transform, Matrix4x4)> dictionary = BindPose(root, val2); if (dictionary.Count == 0) { Plugin.ModLog.LogWarning((object)(who + ": no skinned body under '" + ((Object)root).name + "': B-01 Tactical Armor plates not shown.")); return; } List<(Vector3, Vector3)> list = new List<(Vector3, Vector3)>(); foreach (Transform item2 in val.transform) { Transform val3 = item2; if (dictionary.TryGetValue(BoneName(val3), out var value)) { list.Add((val3.localPosition, Vector4.op_Implicit(((Matrix4x4)(ref value.Item2)).GetColumn(3)))); } } float worst; float num = Fit(list, out worst); if (num < 0.25f || num > 4f) { num = 1f; } List<Renderer> list2 = new List<Renderer>(); List<string> list3 = new List<string>(); bool flag = false; foreach (Transform item3 in val.transform) { Transform val4 = item3; bool flag2 = BoneName(val4) == "Head"; if (flag2 && !helmet) { continue; } if (!dictionary.TryGetValue(BoneName(val4), out var value2)) { list3.Add(((Object)val4).name); continue; } flag = flag || flag2; GameObject val5 = Object.Instantiate<GameObject>(((Component)val4).gameObject, value2.Item1, false); ((Object)val5).name = "HD_B01_" + ((Object)val4).name; val5.transform.localPosition = Vector3.zero; val5.transform.localRotation = Quaternion.Inverse(((Matrix4x4)(ref value2.Item2)).rotation) * val4.localRotation; val5.transform.localScale = val4.localScale * (num / ((Matrix4x4)(ref value2.Item2)).lossyScale.x); int layer = ((Component)value2.Item1).gameObject.layer; Transform[] componentsInChildren = val5.GetComponentsInChildren<Transform>(true); for (int num2 = 0; num2 < componentsInChildren.Length; num2++) { ((Component)componentsInChildren[num2]).gameObject.layer = layer; } Collider[] componentsInChildren2 = val5.GetComponentsInChildren<Collider>(true); for (int num2 = 0; num2 < componentsInChildren2.Length; num2++) { Object.DestroyImmediate((Object)(object)componentsInChildren2[num2]); } list2.AddRange(val5.GetComponentsInChildren<Renderer>(true)); } List<Renderer> hidden = (flag ? headParents.Concat(from t in ((Component)val2).GetComponentsInChildren<Transform>(true) where ((Object)t).name.EndsWith("_Eyebrows", StringComparison.Ordinal) select t).SelectMany((Transform p) => ((Component)p).GetComponentsInChildren<SkinnedMeshRenderer>(true)).Distinct() .Cast<Renderer>() .ToList() : new List<Renderer>()); if ((Object)(object)plateVisibility == (Object)null) { plateVisibility = ((Component)root).gameObject.AddComponent<PlateVisibility>(); } plateVisibility.Init(val2, list2, hidden); if (list3.Count > 0 || worst > 0.02f || !_logged) { _logged = true; Plugin.ModLog.LogInfo((object)(string.Format("{0}: {1} plates on ({2} renderers, scale {3:F3}, worst pivot ", who, "B-01 Tactical Armor", list2.Count, num) + string.Format("{0:F1} cm off its bone{1}).", worst * 100f, (list3.Count > 0) ? (", no bone for " + string.Join(", ", list3)) : ""))); } } private static string BoneName(Transform part) { return ((Object)part).name.Split(new string[1] { "__" }, StringSplitOptions.None)[0]; } private static Dictionary<string, (Transform bone, Matrix4x4 rootFromBone)> BindPose(Transform root, Transform bodyRoot) { //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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) Dictionary<string, (Transform, Matrix4x4)> dictionary = new Dictionary<string, (Transform, Matrix4x4)>(); Matrix4x4 worldToLocalMatrix = root.worldToLocalMatrix; SkinnedMeshRenderer[] componentsInChildren = ((Component)bodyRoot).GetComponentsInChildren<SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer val in componentsInChildren) { Mesh sharedMesh = val.sharedMesh; Transform[] bones = val.bones; if ((Object)(object)sharedMesh == (Object)null || bones == null) { continue; } Matrix4x4[] bindposes = sharedMesh.bindposes; if (bindposes.Length != bones.Length) { continue; } Matrix4x4 val2 = worldToLocalMatrix * ((Component)val).transform.localToWorldMatrix; for (int j = 0; j < bones.Length; j++) { if ((Object)(object)bones[j] != (Object)null && !dictionary.ContainsKey(((Object)bones[j]).name)) { dictionary[((Object)bones[j]).name] = (bones[j], val2 * ((Matrix4x4)(ref bindposes[j])).inverse); } } } return dictionary; } private static float Fit(List<(Vector3 model, Vector3 rig)> pairs, out float worst) { //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_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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) worst = 0f; if (pairs.Count < 2) { return 1f; } Vector3 val = Vector3.zero; Vector3 val2 = Vector3.zero; foreach (var pair in pairs) { val += pair.model; val2 += pair.rig; } val /= (float)pairs.Count; val2 /= (float)pairs.Count; float num = 0f; float num2 = 0f; Vector3 val3; foreach (var pair2 in pairs) { float num3 = num; val3 = pair2.model - val; num = num3 + ((Vector3)(ref val3)).magnitude; float num4 = num2; val3 = pair2.rig - val2; num2 = num4 + ((Vector3)(ref val3)).magnitude; } float num5 = ((num > 1E-05f) ? (num2 / num) : 1f); foreach (var pair3 in pairs) { float num6 = worst; val3 = pair3.rig - val2 - num5 * (pair3.model - val); worst = Mathf.Max(num6, ((Vector3)(ref val3)).magnitude); } return num5; } } [DefaultExecutionOrder(20000)] internal class PlateVisibility : MonoBehaviour { private readonly List<Renderer> _body = new List<Renderer>(); private List<Renderer> _plates = new List<Renderer>(); private List<Renderer> _hidden = new List<Renderer>(); private Transform _bodyRoot; private bool _shown = true; private float _nextRescan; internal void Init(Transform bodyRoot, List<Renderer> plates, List<Renderer> hidden) { Show(_hidden); _bodyRoot = bodyRoot; _plates = plates; _hidden = hidden; _shown = true; _nextRescan = 0f; Hide(); } private void Hide() { foreach (Renderer item in _hidden) { if ((Object)(object)item != (Object)null) { item.forceRenderingOff = true; } } } private static void Show(List<Renderer> renderers) { foreach (Renderer renderer in renderers) { if ((Object)(object)renderer != (Object)null) { renderer.forceRenderingOff = false; } } } private void OnDestroy() { Show(_hidden); } private void LateUpdate() { Hide(); if ((Object)(object)_bodyRoot == (Object)null) { return; } if (Time.unscaledTime >= _nextRescan) { _body.Clear(); SkinnedMeshRenderer[] componentsInChildren = ((Component)_bodyRoot).GetComponentsInChildren<SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer item in componentsInChildren) { _body.Add((Renderer)(object)item); } _nextRescan = Time.unscaledTime + 1f; } bool flag = false; foreach (Renderer item2 in _body) { if ((Object)(object)item2 != (Object)null && item2.enabled && !item2.forceRenderingOff && ((Component)item2).gameObject.activeInHierarchy) { flag = true; break; } } if (flag == _shown) { return; } _shown = flag; foreach (Renderer plate in _plates) { if ((Object)(object)plate != (Object)null) { plate.enabled = flag; } } } } [HarmonyPatch(typeof(Character), "EquipArmorVisually")] internal static class Character_EquipArmorVisually_Patch { private static void Postfix(Character __instance, ItemInfo itemInfo) { try { ArmorModel.Apply(__instance, itemInfo); } catch (Exception arg) { Plugin.ModLog.LogError((object)string.Format("{0} visual failed: {1}", "B-01 Tactical Armor", arg)); } } } [HarmonyPatch] internal static class Character_EquipHelmVisually_Patch { private static IEnumerable<MethodBase> TargetMethods() { return new MethodInfo[2] { AccessTools.Method(typeof(Character), "EquipHelmVisually", (Type[])null, (Type[])null), AccessTools.Method(typeof(Character), "HelmHiddenDidSet", (Type[])null, (Type[])null) }; } private static void Postfix(Character __instance) { try { ItemInfo val = ArmorModel.ShownArmor(__instance); if (HelldiverArmor.Is(val)) { ArmorModel.Apply(__instance, val); } } catch (Exception arg) { Plugin.ModLog.LogError((object)string.Format("{0} helmet failed: {1}", "B-01 Tactical Armor", arg)); } } } [HarmonyPatch(typeof(CharacterIconMaker), "SyncCharacter")] internal static class CharacterIconMaker_SyncCharacter_Patch { private static void Postfix(CharacterIconMaker __instance, Character character, ModelType modelType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) try { ArmorModel.ApplyRig(((int)modelType == 0) ? __instance.characterPortraitModelForInventory : __instance.characterPortraitModelForIcons, character); } catch (Exception arg) { Plugin.ModLog.LogError((object)string.Format("{0} preview failed: {1}", "B-01 Tactical Armor", arg)); } } } internal static class Barrage380 { internal const float HexWidth = 1.47f; private static Transform _holder; internal static readonly Color ZoneRed = new Color(1f, 0.16f, 0.1f); private static Mesh _ring; private static Mesh _disc; private static Shader _sprites; internal static Transform Holder { get { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_holder != (Object)null) { return _holder; } GameObject val = new GameObject("HelldiverTree.Barrage380"); val.SetActive(false); Object.DontDestroyOnLoad((Object)val); ((Object)val).hideFlags = (HideFlags)61; _holder = val.transform; return _holder; } } internal static Mesh Ring => _ring ?? (_ring = Annulus("HD_380Ring", 0.86f, 64)); internal static Mesh Disc => _disc ?? (_disc = Annulus("HD_380Disc", 0f, 48)); internal static void Dress(ActionInfo zone, ActionInfo tick, int zoneRadius, int shellRadius) { DressBarrage(zone, tick, zoneRadius, shellRadius, light: false, "Orbital 380mm HE Barrage", "380mm"); } internal static void DressBarrage(ActionInfo zone, ActionInfo tick, int zoneRadius, int shellRadius, bool light, string skill, string tag) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) try { DressZone(zone, skill, tag, zoneRadius, ZoneRed, !light); GameObject val = TickPrefab(tick, "HD_" + tag + " Shell", tag); if (!((Object)(object)val == (Object)null)) { ShellStrike shellStrike = val.AddComponent<ShellStrike>(); shellStrike.BlastRadius = shellRadius; shellStrike.Light = light; TickVisual(tick, val, "HD_" + skill + " Shell", ShellRun.Spec(light).ImpactAt); } } catch (Exception arg) { Plugin.ModLog.LogWarning((object)$"{tag}: custom look failed, keeping the vanilla one: {arg}"); } } internal static void DressZone(ActionInfo zone, string skill, string tag, int radius, Color tint, bool inner) { //IL_0040: 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) GameObject val = zone.GroundEffectPrefabOnOrigin ?? zone.GroundEffect; if ((Object)(object)val != (Object)null) { GameObject val2 = Silenced(val, "HD_" + tag + " Target Zone"); BarrageMarker barrageMarker = val2.AddComponent<BarrageMarker>(); barrageMarker.Radius = radius; barrageMarker.Tint = tint; barrageMarker.Inner = inner; zone.GroundEffectPrefabOnOrigin = val2; if ((Object)(object)zone.GroundEffect != (Object)null) { zone.GroundEffect = Silenced(zone.GroundEffect, "HD_" + tag + " Zone Hex"); } } else { Plugin.ModLog.LogWarning((object)(tag + ": Thunder Storm has no ground visual (game update?): the zone has no marker.")); } SkillBook.Quiet(zone, skill); zone.ActionVisualSetOverrides = Array.Empty<ActionVisualSetOverride>(); } internal static GameObject TickPrefab(ActionInfo tick, string name, string tag) { ActionVisualSet actionVisualSet = tick.ActionVisualSet; GameObject val = ((IEnumerable<ActionVisual>)(object)new ActionVisual[3] { actionVisualSet?.endEffectTarget, actionVisualSet?.applyEffect, actionVisualSet?.endEffectSource }).Select((ActionVisual v) => v?.effect).FirstOrDefault((Func<GameObject, bool>)((GameObject e) => (Object)(object)e != (Object)null)) ?? SentryModel.Boom; if ((Object)(object)val == (Object)null) { Plugin.ModLog.LogWarning((object)(tag + ": no effect to build on: the tick keeps Thunder Storm's look.")); return null; } return Silenced(val, name); } internal static void TickVisual(ActionInfo tick, GameObject prefab, string name, float delay) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) ActionVisualSet actionVisualSet = tick.ActionVisualSet; ActionVisualSet val = (((Object)(object)actionVisualSet != (Object)null) ? Object.Instantiate<ActionVisualSet>(actionVisualSet) : ScriptableObject.CreateInstance<ActionVisualSet>()); ((Object)val).name = name; ((Object)val).hideFlags = (HideFlags)32; val.preCastEffect = new ActionVisual(); val.startCastEffect = new ActionVisual(); val.projectileEffect = new ActionVisual(); val.applyEffect = new ActionVisual(); val.endEffectSource = new ActionVisual(); val.endEffectTarget = new ActionVisual { effect = prefab, spawnPos = (VisualEffectPosition)1 }; val.endEffectDelay = 0f; val.applyEffectDelay = Expr.Use(delay.ToString(CultureInfo.InvariantCulture)); val.shakeIntensity = (ShakeIntensity)0; tick.ActionVisualSet = val; tick.ActionVisualSetOverrides = Array.Empty<ActionVisualSetOverride>(); } internal static GameObject Silenced(GameObject template, string name, bool keepSound = false) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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) GameObject val = Object.Instantiate<GameObject>(template, Holder); ((Object)val).name = name; ParticleSystem[] componentsInChildren = val.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem obj in componentsInChildren) { EmissionModule emission = obj.emission; ((EmissionModule)(ref emission)).enabled = false; MainModule main = obj.main; ((MainModule)(ref main)).playOnAwake = false; } Renderer[] componentsInChildren2 = val.GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { componentsInChildren2[i].enabled = false; } TrailRenderer[] componentsInChildren3 = val.GetComponentsInChildren<TrailRenderer>(true); for (int i = 0; i < componentsInChildren3.Length; i++) { componentsInChildren3[i].emitting = false; } Light[] componentsInChildren4 = val.GetComponentsInChildren<Light>(true); for (int i = 0; i < componentsInChildren4.Length; i++) { ((Behaviour)componentsInChildren4[i]).enabled = false; } if (!keepSound) { Mute(val); } return val; } internal static void Mute(GameObject copy) { AudioSource[] componentsInChildren = copy.GetComponentsInChildren<AudioSource>(true); foreach (AudioSource obj in componentsInChildren) { obj.playOnAwake = false; obj.clip = null; } MonoBehaviour[] componentsInChildren2 = copy.GetComponentsInChildren<MonoBehaviour>(true); foreach (MonoBehaviour val in componentsInChildren2) { if ((Object)(object)val != (Object)null && ((object)val).GetType().Name == "PolygonSoundSpawn") { Object.DestroyImmediate((Object)(object)val); } } } internal static float GroundY(Vector3 p, float fallback) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) HexCellManager instance = HexCellManager.instance; HexCell val = (((Object)(object)instance != (Object)null) ? instance.GetHexCellFromPos(p) : null); if (!((Object)(object)val != (Object)null)) { return fallback; } return ((Component)val).transform.position.y; } private static Mesh Annulus(string name, float inner, int sides) { //IL_0043: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown List<Vector3> list = new List<Vector3>(); List<Vector2> list2 = new List<Vector2>(); List<int> list3 = new List<int>(); for (int i = 0; i <= sides; i++) { float num = (float)i * 2f * MathF.PI / (float)sides; float num2 = Mathf.Cos(num); float num3 = Mathf.Sin(num); list.Add(new Vector3(num2, 0f, num3)); list.Add(new Vector3(num2 * inner, 0f, num3 * inner)); list2.Add(new Vector2(0.5f + 0.5f * num2, 0.5f + 0.5f * num3)); list2.Add(new Vector2(0.5f + 0.5f * num2 * inner, 0.5f + 0.5f * num3 * inner)); if (i == sides) { break; } int num4 = i * 2; list3.AddRange(new int[6] { num4, num4 + 1, num4 + 2, num4 + 2, num4 + 1, num4 + 3 }); } Mesh val = new Mesh { name = name, hideFlags = (HideFlags)32 }; val.SetVertices(list); val.SetUVs(0, list2); val.SetTriangles(list3, 0); val.RecalculateNormals(); val.RecalculateBounds(); return val; } internal static Material Glow(string name, Color color, Texture texture = null, int queue = 3050) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_sprites == (Object)null) { _sprites = Shader.Find("Sprites/Default"); } Material val = new Material(_sprites) { name = "HD_380" + name, renderQueue = queue }; if ((Object)(object)texture != (Object)null) { val.mainTexture = texture; } val.color = color; return val; } internal static Transform Piece(Transform parent, string name, Mesh mesh, Material mat, Vector3 at, Vector3 scale, Quaternion? rot = null) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name) { layer = ((Component)parent).gameObject.layer }; val.transform.SetParent(parent, false); val.transform.localPosition = at; val.transform.localRotation = (Quaternion)(((??)rot) ?? Quaternion.identity); val.transform.localScale = scale; val.AddComponent<MeshFilter>().sharedMesh = mesh; MeshRenderer obj = val.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterial = mat; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)obj).receiveShadows = false; return val.transform; } internal static Light PointLight(Transform parent, Vector3 at, Color color, float range, float intensity) { //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) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Light"); val.transform.SetParent(parent, false); val.transform.localPosition = at; Light obj = val.AddComponent<Light>(); obj.type = (LightType)2; obj.color = color; obj.range = range; obj.intensity = intensity; obj.shadows = (LightShadows)0; return obj; } } internal sealed class Puffs { private sealed class Puff { public Transform T; public MeshRenderer R; public Color C; public Vector3 From; public Vector3 Drift; public float Born; public float Life; public float Size; public float Spin; public float Angle; public float Alpha; } private static Material _shared; private static MaterialPropertyBlock _block; private static readonly int ColorId = Shader.PropertyToID("_Color"); private static readonly int TexId = Shader.PropertyToID("_MainTex"); private readonly Transform _parent; private readonly List<Puff> _list = new List<Puff>(); private float _t; private static Material Shared { get { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_shared != (Object)null) { return _shared; } _shared = Barrage380.Glow("Smoke", Color.white, (Texture)(object)HellpodDrop.SmokeTex); ((Object)_shared).hideFlags = (HideFlags)32; return _shared; } } internal Puffs(Transform parent) { _parent = parent; } internal void Add(Vector3 from, Vector3 drift, float size, float life, float alpha, Color color) { //IL_0015: 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_0043: 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_004b: 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_0052: 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) Transform val = Barrage380.Piece(_parent, "Smoke", HellpodDrop.Quad, Shared, from, Vector3.one); Puff puff = new Puff { T = val, R = ((Component)val).GetComponent<MeshRenderer>(), C = color, From = from, Drift = drift, Born = _t, Life = life, Size = size, Alpha = alpha, Spin = Random.Range(-40f, 40f), Angle = Random.Range(0f, 360f) }; _list.Add(puff); Step(puff, Camera.main); } internal void Update(float t) { _t = t; if (_list.Count == 0) { return; } Camera main = Camera.main; for (int num = _list.Count - 1; num >= 0; num--) { if (!Step(_list[num], main)) { _list.RemoveAt(num); } } } private bool Step(Puff p, Camera cam) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0187: 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_0154: Expected O, but got Unknown if ((Object)(object)p.T == (Object)null) { return false; } float num = _t - p.Born; float num2 = Mathf.Clamp01(num / p.Life); if (num2 >= 1f) { Object.Destroy((Object)(object)((Component)p.T).gameObject); return false; } float num3 = (1f - Mathf.Exp((0f - num) * 2.5f)) / 2.5f; p.T.localPosition = p.From + new Vector3(p.Drift.x * num3, p.Drift.y * num, p.Drift.z * num3); p.T.localScale = Vector3.one * p.Size * (0.5f + 1.6f * Mathf.Sqrt(num2)); p.Angle += p.Spin * Time.deltaTime; if ((Object)(object)cam != (Object)null) { p.T.rotation = ((Component)cam).transform.rotation * Quaternion.Euler(0f, 0f, p.Angle); } float num4 = Mathf.Clamp01(num / 0.12f) * (1f - num2) * (1f - num2); if (_block == null) { _block = new MaterialPropertyBlock(); } _block.SetColor(ColorId, new Color(p.C.r, p.C.g, p.C.b, p.Alpha * num4)); _block.SetTexture(TexId, (Texture)(object)HellpodDrop.SmokeTex); ((Renderer)p.R).SetPropertyBlock(_block); return true; } internal void Clear() { foreach (Puff item in _list) { if ((Object)(object)item.T != (Object)null) { Object.Destroy((Object)(object)((Component)item.T).gameObject); } } _list.Clear(); } } internal class BarrageMarker : MonoBehaviour { public int Radius = 6; public Color Tint = new Color(1f, 0.16f, 0.1f); public bool Inner = true; private const int OuterDashes = 56; private const int InnerDashes = 28; private const int ScanPeriod = 2; private const float FadeIn = 0.5f; private Transform _fx; private Transform _beam; private Transform _beaconLamp; private Transform _scan; private Transform[] _outer; private Transform[] _inner; private Transform[] _chevrons; private Light _lamp; private Material _bright; private Material _dim; private Material _wash; private Material _scanMat; private Material _beamMat; private float _t; private float _r; private bool _placed; private void OnEnable() { _t = 0f; _placed = false; } private void OnDisable() { if ((Object)(object)_fx != (Object)null) { ((Component)_fx).gameObject.SetActive(false); } } private void OnDestroy() { if ((Object)(object)_fx != (Object)null) { Object.Destroy((Object)(object)((Component)_fx).gameObject); } Material[] array = (Material[])(object)new Material[5] { _bright, _dim, _wash, _scanMat, _beamMat }; foreach (Material val in array) { if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } } } private void Update() { //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_014d: 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) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0260: 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_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) if (!_placed) { Place(); Sfx.Play("beacon"); Sfx.Say("vo_orbital"); } if (!((Object)(object)_fx == (Object)null)) { _t += Time.deltaTime; float num = Mathf.Clamp01(_t / 0.5f); Chase(_outer, _t * 0.25f, 9); if (_inner != null) { Chase(_inner, (0f - _t) * 0.35f, 5); } float num2 = 0.35f * Mathf.Sin(_t * 4f); Vector3 val = default(Vector3); for (int i = 0; i < _chevrons.Length; i++) { float num3 = (45f + 90f * (float)i) * (MathF.PI / 180f); ((Vector3)(ref val))..ctor(Mathf.Cos(num3), 0f, Mathf.Sin(num3)); Vector3 val2 = _fx.position + val * (_r - 0.9f - num2); _chevrons[i].position = new Vector3(val2.x, Barrage380.GroundY(val2, _fx.position.y) + 0.07f, val2.z); } float num4 = Mathf.Repeat(_t, 2f) / 2f; _scan.localScale = new Vector3(_r * num4, 1f, _r * num4); _scanMat.color = Shade(1f, 0.45f * (1f - num4) * num); bool flag = Mathf.Repeat(_t, 0.8f) < 0.4f; _beaconLamp.localScale = Vector3.one * (flag ? 0.16f : 0.1f); _lamp.intensity = (flag ? 3f : 1.2f) * num; float num5 = 0.07f * (1f + 0.25f * Mathf.Sin(_t * 23f)); _beam.localScale = new Vector3(num5, 30f, num5); _bright.color = Shade(1f, 0.95f * num); _dim.color = Shade(0.75f, 0.4f * num); _wash.color = Shade(1f, 0.07f * num); _beamMat.color = Shade(1f, 0.45f * num); } } private Color Shade(float k, float alpha) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) return new Color(Tint.r * k, Tint.g * k, Tint.b * k, alpha); } private void Chase(Transform[] dashes, float phase, int lit) { int num = dashes.Length; int num2 = (int)(Mathf.Repeat(phase, 1f) * (float)num); for (int i = 0; i < num; i++) { int num3 = (num2 - i + num) % num; ((Renderer)((Component)dashes[i]).GetComponent<MeshRenderer>()).sharedMaterial = ((num3 < lit) ? _bright : _dim); } } private void Place() { //IL_0051: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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) _placed = true; _r = ((float)Radius + 0.5f) * 1.47f; if ((Object)(object)_fx == (Object)null) { Build(); } ((Component)_fx).gameObject.SetActive(true); _fx.position = ((Component)this).transform.position; _fx.rotation = Quaternion.identity; float y = _fx.position.y; Lay(_outer, _r, y); if (_inner != null) { Lay(_inner, _r * 0.5f, y); } Material wash = _wash; Material bright = _bright; Color val = (_dim.color = Color.clear); Color color = (bright.color = val); wash.color = color; } private void Lay(Transform[] dashes, float radius, float y0) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < dashes.Length; i++) { float num = (float)i * 2f * MathF.PI / (float)dashes.Length; Vector3 val = _fx.position + new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)) * radius; dashes[i].position = new Vector3(val.x, Barrage380.GroundY(val, y0) + 0.06f, val.z); dashes[i].rotation = Quaternion.Euler(0f, (0f - num) * 57.29578f, 0f); } } private void Build() { //IL_0006: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) _fx = new GameObject("HD_380Marker").transform; ((Component)_fx).gameObject.layer = ((Component)this).gameObject.layer; _bright = Barrage380.Glow("Bright", Color.clear); _dim = Barrage380.Glow("Dim", Color.clear); _wash = Barrage380.Glow("Wash", Color.clear, null, 3010); _scanMat = Barrage380.Glow("Scan", Color.clear); _beamMat = Barrage380.Glow("Beam", Color.clear); float num = ((float)Radius + 0.5f) * 1.47f; _outer = Dashes("Outer", 56, num, 0.55f, 0.13f); if (Inner) { _inner = Dashes("Inner", 28, num * 0.5f, 0.45f, 0.08f); } _chevrons = (Transform[])(object)new Transform[4]; for (int i = 0; i < 4; i++) { Transform transform = new GameObject("Chevron" + i).transform; transform.SetParent(_fx, false); ((Component)transform).gameObject.layer = ((Component)this).gameObject.layer; float num2 = 90f - (45f + 90f * (float)i); transform.rotation = Quaternion.Euler(0f, num2 + 180f, 0f); Barrage380.Piece(transform, "L", SentryModel.Cube, _bright, new Vector3(-0.22f, 0f, 0.15f), new Vector3(0.1f, 0.03f, 0.62f), Quaternion.Euler(0f, 35f, 0f)); Barrage380.Piece(transform, "R", SentryModel.Cube, _bright, new Vector3(0.22f, 0f, 0.15f), new Vector3(0.1f, 0.03f, 0.62f), Quaternion.Euler(0f, -35f, 0f)); _chevrons[i] = transform; } Barrage380.Piece(_fx, "Wash", Barrage380.Disc, _wash, new Vector3(0f, 0.05f, 0f), new Vector3(num, 1f, num)); _scan = Barrage380.Piece(_fx, "Scan", Barrage380.Ring, _scanMat, new Vector3(0f, 0.08f, 0f), Vector3.one); Barrage380.Piece(_fx, "Stake", SentryModel.Prism(8), SentryModel.Dark, new Vector3(0f, 0.15f, 0f), new Vector3(0.16f, 0.3f, 0.16f)); Barrage380.Piece(_fx, "Collar", SentryModel.Prism(8), SentryModel.Trim, new Vector3(0f, 0.27f, 0f), new Vector3(0.19f, 0.04f, 0.19f)); _beaconLamp = Barrage380.Piece(_fx, "Lamp", SentryModel.Sphere, _bright, new Vector3(0f, 0.36f, 0f), Vector3.one * 0.12f); _beam = Barrage380.Piece(_fx, "Beam", SentryModel.Prism(8), _beamMat, new Vector3(0f, 15.3f, 0f), new Vector3(0.07f, 30f, 0.07f)); _lamp = Barrage380.PointLight(_fx, new Vector3(0f, 0.6f, 0f), Tint, 5f, 0f); } private Transform[] Dashes(string name, int n, float radius, float fill, float width) { //IL_0039: 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) Transform[] array = (Transform[])(object)new Transform[n]; float num = MathF.PI * 2f * radius / (float)n * fill; for (int i = 0; i < n; i++) { array[i] = Barrage380.Piece(_fx, name + i, SentryModel.Cube, _dim, Vector3.zero, new Vector3(width, 0.03f, num)); } return array; } } internal class ShellStrike : MonoBehaviour { public int BlastRadius = 3; public bool Light; private bool _pending; private void OnEnable() { _pending = true; } private void LateUpdate() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (_pending) { _pending = false; new GameObject("HD_380Shell").AddComponent<ShellRun>().Begin(((Component)this).transform.position, BlastRadius, Light, ((Component)this).gameObject.layer); } } } internal class ShellRun : MonoBehaviour { internal sealed class Caliber { public float ImpactAt; public float Size; public float Trail; public float Life; public float Flash; public float Throw; public int Reticle; public int Dust; public int Column; public int Rocks; public ShakeIntensity Shake; } private static readonly Caliber Heavy = new Caliber { ImpactAt = 1.1f, Size = 1f, Trail = 18f, Life = 9f, Flash = 10f, Throw = 1.4f, Reticle = 24, Dust = 16, Column = 10, Rocks = 12, Shake = (ShakeIntensity)3 }; private static readonly Caliber Small = new Caliber { ImpactAt = 0.7f, Size = 0.55f, Trail = 14f, Life = 6f, Flash = 6f, Throw = 1f, Reticle = 14, Dust = 8, Column = 4, Rocks = 5, Shake = (ShakeIntensity)2 }; private const float Drop = 32f; private const float ScorchFade = 2.5f; private static Material _streakMat; private static Material _hotMat; private Caliber _c; private Vector3 _at; private Vector3 _from; private float _blast; private float _t; private bool _hit; private Transform _shell; private Transform _trail; private Transform _reticle; private Transform _core; private Transform _fireball; private Transform _wave; private Transform _scorch; private Transform[] _reticleDashes; private Light _shellLight; private Light _flash; private Material _reticleMat; private Material _fireMat; private Material _waveMat; private Material _scorchMat; private Puffs _smoke; private static Material Streak => _streakMat ?? (_streakMat = SentryModel.Mat("380Streak", new Color(1f, 0.6f, 0.3f), 0f, 0f, new Color(1f, 0.55f, 0.2f) * 1.6f)); private static Material Hot => _hotMat ?? (_hotMat = SentryModel.Mat("380Hot", new Color(1f, 0.9f, 0.7f), 0f, 0f, new Color(1f, 0.75f, 0.4f) * 4f)); internal static Caliber Spec(bool light) { if (!light) { return Heavy; } return Small; } internal void Begin(Vector3 at, int blastRadius, bool light, int layer) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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) _c = Spec(light); _at = at; _blast = ((float)blastRadius + 0.5f) * 1.47f; ((Component)this).gameObject.layer = layer; ((Component)this).transform.position = at; _from = StartPoint(at); _smoke = new Puffs(((Component)this).transform); Build(); Sfx.EndAt("orbital_whistle", _c.ImpactAt, light ? 0.6f : 1f, light ? 1.15f : 1f); } internal static Vector3 StartPoint(Vector3 at, float lean = 12f) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return at + Vector3.up * 32f; } Vector3 val = Quaternion.AngleAxis(Random.Range(0f - lean, lean), ((Component)main).transform.forward) * ((Component)main).transform.up; float num = Vector3.Dot(at - ((Component)main).transform.position, ((Component)main).transform.forward); float y = main.WorldToViewportPoint(at).y; if (num <= 0.1f || y < -0.5f || y > 1.5f) { return at + val * 32f; } float num2 = (main.orthographic ? (2f * main.orthographicSize) : (2f * num * Mathf.Tan(main.fieldOfView * 0.5f * (MathF.PI / 180f)))); float num3 = Mathf.Clamp((1.08f - y) * num2, 3f, 32f); return at + val * num3; } private void Build() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) _reticle = new GameObject("Reticle").transform; _reticle.SetParent(((Component)this).transform, false); _reticle.localPosition = new Vector3(0f, 0.07f, 0f); _reticleMat = Barrage380.Glow("Reticle", new Color(1f, 0.15f, 0.08f, 0f)); _reticleDashes = (Transform[])(object)new Transform[_c.Reticle]; for (int i = 0; i < _reticleDashes.Length; i++) { float num = (float)i * 2f * MathF.PI / (float)_reticleDashes.Length; _reticleDashes[i] = Barrage380.Piece(_reticle, "Dash" + i, SentryModel.Cube, _reticleMat, new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)), new Vector3(0.12f, 0.03f, 0.5f), Quaternion.Euler(0f, (0f - num) * 57.29578f, 0f)); } Barrage380.Piece(_reticle, "Dot", Barrage380.Disc, _reticleMat, Vector3.zero, new Vector3(0.3f, 1f, 0.3f)); _shell = new GameObject("Shell").transform; _shell.SetParent(((Component)this).transform, false); _shell.localScale = Vector3.one * _c.Size; Barrage380.Piece(_shell, "Body", SentryModel.Prism(12), SentryModel.Armor, new Vector3(0f, 0.9f, 0f), new Vector3(0.42f, 1.5f, 0.42f)); Barrage380.Piece(_shell, "Band", SentryModel.Prism(12), SentryModel.Trim, new Vector3(0f, 0.35f, 0f), new Vector3(0.45f, 0.08f, 0.45f)); Barrage380.Piece(_shell, "Band2", SentryModel.Prism(12), SentryModel.Steel, new Vector3(0f, 1.5f, 0f), new Vector3(0.45f, 0.06f, 0.45f)); Barrage380.Piece(_shell, "Nose", SentryModel.Sphere, Hot, new Vector3(0f, 0.05f, 0f), new Vector3(0.4f, 0.75f, 0.4f)); _trail = Barrage380.Piece(_shell, "Trail", SentryModel.Prism(8), Streak, new Vector3(0f, 1.65f + _c.Trail * 0.5f, 0f), new Vector3(0.2f, _c.Trail, 0.2f)); _shellLight = Barrage380.PointLight(_shell, Vector3.zero, new Color(1f, 0.6f, 0.3f), 9f * _c.Size, 4f); Transform shell = _shell; Vector3 down = Vector3.down; Vector3 val = _at - _from; shell.rotation = Quaternion.FromToRotation(down, ((Vector3)(ref val)).normalized); _shell.position = _from; Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); for (int j = 0; j < componentsInChildren.Length; j++) { ((Component)componentsInChildren[j]).gameObject.layer = ((Component)this).gameObject.layer; } } private void Update() { //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) _t += Time.deltaTime; if (!_hit) { float num = Mathf.Clamp01(_t / _c.ImpactAt); _shell.position = Vector3.LerpUnclamped(_from, _at, Mathf.Pow(num, 1.25f)); float num2 = Mathf.Lerp(_c.Trail * 0.22f, _c.Trail, num); _trail.localScale = new Vector3(0.2f, num2, 0.2f); _trail.localPosition = new Vector3(0f, 1.65f + num2 * 0.5f, 0f); float num3 = 1.35f - 0.35f * num; for (int i = 0; i < _reticleDashes.Length; i++) { float num4 = (float)i * 2f * MathF.PI / (float)_reticleDashes.Length; Vector3 val = _at + new Vector3(Mathf.Cos(num4), 0f, Mathf.Sin(num4)) * _blast * num3; _reticleDashes[i].position = new Vector3(val.x, Barrage380.GroundY(val, _at.y) + 0.07f, val.z); } bool flag = Mathf.Repeat(_t, 0.16f) < 0.1f; _reticleMat.color = new Color(1f, 0.15f, 0.08f, Mathf.Clamp01(_t / 0.15f) * (flag ? 0.95f : 0.45f)); if (_t >= _c.ImpactAt) { Impact(); } } else { float num5 = _t - _c.ImpactAt; float num6 = Mathf.Clamp01(num5 / 0.18f); float num7 = Mathf.Clamp01((num5 - 0.18f) / 0.7f); float num8 = _blast * 0.75f * Mathf.Sqrt(num6) * (1f - 0.5f * num7); _fireball.localScale = Vector3.one * Mathf.Max(0.01f, num8); _fireball.localPosition = new Vector3(0f, 0.4f + 2.2f * num7, 0f); _fireMat.color = new Color(1f, 0.5f, 0.15f, 0.75f * (1f - num7)); _core.localScale = Vector3.one * Mathf.Max(0f, num8 * 0.55f * (1f - Mathf.Clamp01(num5 / 0.35f))); _core.localPosition = _fireball.localPosition; float num9 = Mathf.Clamp01(num5 / 0.4f); _wave.localScale = new Vector3(0.5f + _blast * 1.15f * num9, 1f, 0.5f + _blast * 1.15f * num9); _waveMat.color = new Color(1f, 0.85f, 0.65f, 0.7f * (1f - num9)); ((Component)_wave).gameObject.SetActive(num9 < 1f); _flash.intensity = Mathf.MoveTowards(_flash.intensity, 0f, Time.deltaTime * 16f); float num10 = Mathf.Clamp01((_c.Life - _t) / 2.5f); _scorchMat.color = new Color(0.05f, 0.04f, 0.035f, 0.8f * num10); } _smoke.Update(_t); if (_t >= _c.Life) { Object.Destroy((Object)(object)((Component)this).gameObject); } } private void Impact() { //IL_004f: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: 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_0348: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_05ba: Unknown result type (might be due to invalid IL or missing references) //IL_056c: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_0590: Unknown result type (might be due to invalid IL or missing references) _hit = true; Object.Destroy((Object)(object)((Component)_shell).gameObject); Object.Destroy((Object)(object)((Component)_reticle).gameObject); Object.Destroy((Object)(object)_reticleMat); float y = _at.y; CameraController instance = CameraController.instance; if (instance != null) { instance.Shake(_c.Shake); } bool flag = _c == Small; Hellbomb.GameBoom(_at, Sfx.Play("orbital_impact", flag ? 0.65f : 1f, 0f, flag ? 1.15f : 1f)); _flash = Barrage380.PointLight(((Component)this).transform, new Vector3(0f, 1.5f, 0f), new Color(1f, 0.7f, 0.4f), _blast * 2.2f, _c.Flash); _fireMat = Barrage380.Glow("Fireball", new Color(1f, 0.5f, 0.15f, 0.75f), (Texture)(object)HellpodDrop.SmokeTex); _fireball = Barrage380.Piece(((Component)this).transform, "Fireball", SentryModel.Sphere, _fireMat, new Vector3(0f, 0.4f, 0f), Vector3.one * 0.01f); _core = Barrage380.Piece(((Component)this).transform, "Core", SentryModel.Sphere, Hot, new Vector3(0f, 0.4f, 0f), Vector3.zero); _waveMat = Barrage380.Glow("Wave", new Color(1f, 0.85f, 0.65f, 0.7f)); _wave = Barrage380.Piece(((Component)this).transform, "Wave", Barrage380.Ring, _waveMat, new Vector3(0f, 0.12f, 0f), Vector3.one * 0.5f); _scorchMat = Barrage380.Glow("Scorch", new Color(0.05f, 0.04f, 0.035f, 0.8f), (Texture)(object)HellpodDrop.SmokeTex, 3005); _scorch = Barrage380.Piece(((Component)this).transform, "Scorch", Barrage380.Disc, _scorchMat, new Vector3(0f, 0.04f, 0f), new Vector3(_blast * 0.55f, 1f, _blast * 0.55f), Quaternion.Euler(0f, Random.Range(0f, 360f), 0f)); float num = Mathf.Sqrt(_c.Size); Vector3 val = default(Vector3); for (int i = 0; i < _c.Dust; i++) { float num2 = ((float)i + Random.value * 0.6f) * MathF.PI * 2f / (float)_c.Dust; ((Vector3)(ref val))..ctor(Mathf.Cos(num2), 0f, Mathf.Sin(num2)); _smoke.Add(val * 0.6f + Vector3.up * 0.25f, (val * Random.Range(3f, 4.5f) + Vector3.up * Random.Range(0.2f, 0.5f)) * num, Random.Range(1.4f, 2f) * num, Random.Range(1.8f, 2.6f) * num, 0.85f, new Color(0.55f, 0.5f, 0.44f)); } for (int j = 0; j < _c.Column; j++) { _smoke.Add(new Vector3(Random.Range(-0.6f, 0.6f), 0.6f + 0.45f * (float)j, Random.Range(-0.6f, 0.6f)) * num, new Vector3(Random.Range(-0.3f, 0.3f), Random.Range(1.2f, 2.2f), Random.Range(-0.3f, 0.3f)) * num, (Random.Range(1.4f, 2.1f) + 0.12f * (float)j) * num, Random.Range(3f, 4.2f) * num, 0.8f, new Color(0.22f, 0.2f, 0.19f)); } Transform transform = new GameObject("Rubble").transform; transform.SetParent(((Component)this).transform, false); for (int k = 0; k < _c.Rocks; k++) { float num3 = Random.value * MathF.PI * 2f; float num4 = Random.Range(0.1f, 0.6f); Barrage380.Piece(transform, "Rock" + k, (k % 3 == 0) ? SentryModel.Prism(6) : SentryModel.Cube, (k % 2 == 0) ? SentryModel.Dark : SentryModel.Armor, new Vector3(Mathf.Cos(num3) * num4, 0.2f, Mathf.Sin(num3) * num4), Vector3.one * Random.Range(0.12f, 0.32f) * num, Random.rotation); } Scrap.Scatter(transform, _at, y, _c.Throw); Object.Destroy((Object)(object)((Component)transform).gameObject); } private void OnDestroy() { _smoke?.Clear(); Material[] array = (Material[])(object)new Material[4] { _reticleMat, _fireMat, _waveMat, _scorchMat }; foreach (Material val in array) { if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } } } } internal static class Barrages { internal sealed class Plan { public int Shells; public int Spread; public int Turns; public float Interval; public bool EnemyOnly; public bool TickOnPlace; } private sealed class Runner : MonoBehaviour { } internal static readonly Dictionary<ActionInfo, Plan> Plans = new Dictionary<ActionInfo, Plan>(); private static readonly Dictionary<(Character, int, int), int> TurnsLeft = new Dictionary<(Character, int, int), int>(); private static int _placing; private static bool _firing; private static Runner _runner; private static Runner Run { get { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_runner != (Object)null) { return _runner; } GameObject val = new GameObject("HelldiverTree.Barrages"); Object.DontDestroyOnLoad((Object)val); ((Object)val).hideFlags = (HideFlags)61; _runner = val.AddComponent<Runner>(); return _runner; } } internal static void BeginPlacing() { _placing++; } internal static void EndPlacing() { _placing = Math.Max(0, _placing - 1); } internal static bool OnPerform(Character caster, ActionInfo action, HexCell origin) { if (_firing || (Object)(object)action == (Object)null || !Plans.TryGetValue(action, out var value)) { return true; } if (caster == null || (Object)(object)origin == (Object)null) { return true; } (Character, int, int) key = (caster, ((HexCoordinates)(ref origin.Coordinates)).X, ((HexCoordinates)(ref origin.Coordinates)).Y); if (_placing > 0) { if (TurnsLeft.Count > 64) { TurnsLeft.Clear(); } TurnsLeft[key] = value.Turns; if (!value.TickOnPlace) { return false; } } if (TurnsLeft.TryGetValue(key, out var value2)) { if (value2 <= 0) { return false; } TurnsLeft[key] = value2 - 1; } List<HexCell> list = Pick(caster, origin, value); if (list.Count > 0) { ((MonoBehaviour)Run).StartCoroutine(Fire(caster, action, list, value.Interval)); } return false; } private static List<HexCell> Pick(Character caster, HexCell origin, Plan plan) { HexCellManager instance = HexCellManager.instance; if ((Object)(object)instance == (Object)null || instance.cells == null) { return new List<HexCell>(); } return (from _ in instance.cells.GetCells() where (Object)(object)_ != (Object)null && _.IsValid && _.Distance(origin) <= plan.Spread where !plan.EnemyOnly || (_.Player != null && !_.Player.IsDead && caster.IsEnemy(_.Player, false)) orderby Random.value select _).Take(plan.Shells).ToList(); } private static IEnumerator Fire(Character caster, ActionInfo action, List<HexCell> hexes, float interval) { for (int i = 0; i < hexes.Count; i++) { if (i > 0) { yield return (object)new WaitForSeconds(interval); } if (caster == null || (Object)(object)hexes[i] == (Object)null || (Object)(object)caster.Cell == (Object)null) { break; } _firing = true; try { caster.PerformAction(action, hexes[i], (ActionDetail?)null, true, true, false, false, true, (Item)null, 0f, -1); } catch (Exception ex) { Plugin.ModLog.LogWarning((object)$"Barrage: shell {i + 1} on {((HexCoordinates)(ref hexes[i].Coordinates)).X},{((HexCoordinates)(ref hexes[i].Coordinates)).Y} failed: {ex}"); } finally { _firing = false; } } } } [HarmonyPatch(typeof(Character), "PerformAction", new Type[] { typeof(ActionInfo), typeof(HexCell), typeof(ActionDetail?), typeof(bool), typeof(bool), typeof(bool), typeof(bool), typeof(bool), typeof(Item), typeof(float), typeof(int) })] internal static class Character_PerformAction_Barrage_Patch { private static bool Prefix(Character __instance, ActionInfo actionInfo, HexCell targetedCell) { return Barrages.OnPerform(__instance, actionInfo, targetedCell); } } [HarmonyPatch] internal static class GameLogic_AddGroundEffect_Patch { private static IEnumerable<MethodBase> TargetMethods() { return (from m in AccessTools.GetDeclaredMethods(typeof(GameLogic)) where m.Name == "AddGroundEffect" select m).ToList(); } private static void Prefix() { Barrages.BeginPlacing(); } private static Exception Finalizer(Exception __exception) { Barrages.EndPlacing(); return __exception; } } internal static class Eagle500 { internal const float ImpactAt = 1.8f; internal const float Fall = 0.8f; internal const float Release = MathF.PI * 113f / 355f; internal static void Dress(ActionInfo strike, int radius) { try { EagleStrike.Dress(strike, EagleRunKind.Bomb500, radius, 1.8f, "Eagle500", "HD_500kg Strike", "HD_Eagle 500kg Bomb"); } catch (Exception arg) { Plugin.ModLog.LogWarning((object)$"Eagle500: custom look failed, keeping the vanilla one: {arg}"); } } } internal class Eagle500Run : EagleRun { private const float Speed = 14f; private const float Lead = 0.3f; private const float Over = 1.3f; private const float Life = 14f; private const float ScorchFade = 4f; private const float DiveFrom = 8f; private const float Level = 5.5f; private const float Climb = 5f; private const float JetGone = 3.2f; private const float ScreenLift = 2.5f; private const float ScreenTop = 0.72f; private const float MinLift = 0.4f; private const float MaxPull = 16f; private const float Tilt = 8f; private const float EmbersFor = 7f; private const int Dashes = 28; private static readonly float[] BoomAt = new float[3] { 0f, 0.12f, 0.26f }; private Vector3 _at; private Vector3 _dir; private Vector3 _from; private Vector3 _last; private Vector3 _pull; private Vector3 _side; private float _r; private float _t; private bool _dropped; private bool _hit; private bool _secondShake; private int _booms; private EagleJet _eagle; private StratagemBeacon _beacon; private Transform _bomb; private Transform _streak; private Transform _reticle; private Transform _core; private Transform _fire; private Transform _flashDisc; private Transform _wave; private Transform _dust; private Transform _embers; private Transform _scorch; private Transform _ash; private Transform[] _dashes; private Light _flash; private Material _reticleMat; private Material _streakMat; private Material _coreMat; private Material _fireMat; private Material _flashMat; private Material _waveMat; private Material _dustMat; private Material _emberMat; private Material _scorchMat; private Material _ashMat; private Puffs _smoke; private static float ImpactAt => 1.8f; internal override void Begin(Vector3 at, int radius, int layer) { //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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) _at = at; _r = ((float)radius + 0.5f) * 1.47f; ((Component)this).gameObject.layer = layer; ((Component)this).transform.position = at; _dir = FlightLine(_at); _pull = TowardCamera(_at, 5.95f); _smoke = new Puffs(((Component)this).transform); _beacon = new StratagemBeacon(((Component)this).transform, "500kg"); Sfx.Say("vo_eagle"); Sfx.Play("eagle_flyby"); Sfx.EndAt("bomb500_fall", 1.8f); EagleRun.Pilot(1.8f); BuildReticle(); _eagle = new EagleJet(((Component)this).transform, _at, _r); _bomb = BombModel(_eagle.Root); Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Component)componentsInChildren[i]).gameObject.layer = layer; } Step(); } private float Ground(Vector3 p) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return Barrage380.GroundY(p, _at.y); } private static Vector3 TowardCamera(Vector3 at, float height) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_006d: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; if ((Object)(object)main == (Object)null || !main.orthographic) { return Vector3.zero; } Vector3 val = -((Component)main).transform.forward; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { return Vector3.zero; } ((Vector3)(ref val)).Normalize(); Vector3 up = ((Component)main).transform.up; float num = Vector3.Dot(Vector3.up, up); float num2 = Vector3.Dot(val, up); float y = main.WorldToViewportPoint(at).y; if (num2 > -0.05f || y < -0.5f || y > 1.5f) { return Vector3.zero; } float num3 = Mathf.Clamp((0.72f - y) * 2f * main.orthographicSize, 0.4f, 2.5f); return val * Mathf.Clamp((num3 - height * num) / num2, 0f, 16f); } private static Vector3 FlightLine(Vector3 at) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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) Camera main = Camera.main; Vector3 val = (((Object)(object)main != (Object)null) ? ((Component)main).transform.right : Vector3.right); val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.right; } val = Quaternion.Euler(0f, Random.Range(-8f, 8f), 0f) * ((Vector3)(ref val)).normalized; if (!((((Object)(object)main != (Object)null) ? main.WorldToViewportPoint(at).x : Random.value) >= 0.5f)) { return -val; } return val; } private Vector3 JetAt(float t) { //IL_0040: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01(1f - t / (MathF.PI * 113f / 355f)); float num2 = Mathf.Max(0f, t - MathF.PI * 113f / 355f); float num3 = 5.5f + 2.5f * num * num + 5f * num2 * num2; return _at + _pull + _dir * (14f * (t - 1.3f)) + Vector3.up * num3; } private void BuildReticle() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00d0: Unknown result type (might be due to invalid IL or missing references) _reticle = new GameObject("Reticle").transform; _reticle.SetParent(((Component)this).transform, false); _reticleMat = Barrage380.Glow("500kgReticle", new Color(1f, 0.15f, 0.08f, 0f)); _dashes = (Transform[])(object)new Transform[28]; for (int i = 0; i < 28; i++) { float num = (float)i * 2f * MathF.PI / 28f; _dashes[i] = Barrage380.Piece(_reticle, "Dash" + i, SentryModel.Cube, _reticleMat, Vector3.zero, new Vector3(0.14f, 0.03f, 0.6f), Quaternion.Euler(0f, (0f - num) * 57.29578f, 0f)); } } private static Transform BombModel(Transform jet) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0173: 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_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: 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_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) Transform transform = new GameObject("Bomb").transform; transform.SetParent(jet, false); transform.localPosition = new Vector3(0f, -0.64f, 0.1f); Quaternion along = EagleJet.Along; Barrage380.Piece(transform, "Body", SentryModel.Prism(12), SentryModel.Armor, Vector3.zero, new Vector3(0.5f, 1.15f, 0.5f), along); Barrage380.Piece(transform, "Nose", SentryModel.Sphere, SentryModel.Trim, new Vector3(0f, 0f, 0.56f), new Vector3(0.5f, 0.5f, 0.8f)); Barrage380.Piece(transform, "Fuze", SentryModel.Sphere, SentryModel.Steel, new Vector3(0f, 0f, 0.95f), Vector3.one * 0.1f); Barrage380.Piece(transform, "Tail", SentryModel.Prism(12), SentryModel.Dark, new Vector3(0f, 0f, -0.75f), new Vector3(0.34f, 0.38f, 0.34f), along); Barrage380.Piece(transform, "BandFront", SentryModel.Prism(12), SentryModel.Trim, new Vector3(0f, 0f, 0.3f), new Vector3(0.52f, 0.07f, 0.52f), along); Barrage380.Piece(transform, "BandBack", SentryModel.Prism(12), SentryModel.Trim, new Vector3(0f, 0f, -0.3f), new Vector3(0.52f, 0.07f, 0.52f), along); for (int i = 0; i < 4; i++) { Quaternion val = Quaternion.Euler(0f, 0f, 45f + 90f * (float)i); Barrage380.Piece(transform, "Fin" + i, SentryModel.Cube, SentryModel.Armor, val * new Vector3(0f, 0.27f, 0f) + new Vector3(0f, 0f, -0.88f), new Vector3(0.035f, 0.3f, 0.36f), val); Barrage380.Piece(transform, "FinTip" + i, SentryModel.Cube, SentryModel.Trim, val * new Vector3(0f, 0.43f, 0f) + new Vector3(0f, 0f, -0.92f), new Vector3(0.04f, 0.04f, 0.3f), val); } return transform; } private void Update() { if (EagleRun.BattleLeft) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } _t += Time.deltaTime; Step(); } private void Step() { if (_beacon != null && !_beacon.Update(_t, 1f - Mathf.Clamp01((_t - ImpactAt) / 0.4f))) { _beacon = null; } UpdateJet(); if (!_hit) { UpdateReticle(); UpdateBomb(); if (_t >= ImpactAt) { Impact(); } } else { Blast(_t - ImpactAt); } _smoke.Update(_t); if (_t >= 14f) { Object.Destroy((Object)(object)((Component)this).gameObject); } } private void UpdateJet() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0099: Unknown result type (might be due to invalid IL or missing references) if (_eagle != null) { if (_t >= 3.2f) { _eagle.Dispose(); _eagle = null; return; } Vector3 val = JetAt(_t); Vector3 velocity = (JetAt(_t + 0.02f) - val) / 0.02f; float bank = 18f * Mathf.Clamp01((_t - MathF.PI * 113f / 355f) / 0.5f); _eagle.Pose(val, velocity, bank, _t, (3.2f - _t) / 0.6f, Ground(val)); } } private void UpdateReticle() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01(_t / ImpactAt); float num2 = 1.3f - 0.3f * num; float num3 = 25f * _t; for (int i = 0; i < _dashes.Length; i++) { float num4 = (float)i * 2f * MathF.PI / (float)_dashes.Length + num3 * (MathF.PI / 180f); Vector3 val = _at + new Vector3(Mathf.Cos(num4), 0f, Mathf.Sin(num4)) * _r * num2; _dashes[i].position = new Vector3(val.x, Ground(val) + 0.07f, val.z); _dashes[i].rotation = Quaternion.Euler(0f, (0f - num4) * 57.29578f, 0f); } float num5 = Mathf.Lerp(0.35f, 0.1f, num); bool flag = Mathf.Repeat(_t, num5) < num5 * 0.6f; _reticleMat.color = new Color(1f, 0.15f, 0.08f, Mathf.Clamp01(_t / 0.15f) * (flag ? 0.95f : 0.4f)); } private void UpdateBomb() { //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_bomb == (Object)null) { return; } if (!_dropped) { if (_t < MathF.PI * 113f / 355f || _eagle == null) { return; } _dropped = true; _bomb.SetParent(((Component)this).transform, true); _from = (_last = _bomb.position); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(_at.x - _from.x, 0f, _at.z - _from.z); _side = Vector3.Cross(Vector3.up, (((Vector3)(ref val)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref val)).normalized : _dir); _streakMat = Barrage380.Glow("500kgStreak", new Color(1f, 1f, 1f, 0f)); _streak = Barrage380.Piece(_bomb, "Streak", SentryModel.Prism(6), _streakMat, Vector3.zero, Vector3.one * 0.01f, EagleJet.Along); } float num = Mathf.Clamp01((_t - MathF.PI * 113f / 355f) / 0.8f