Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of AbominationSensor v1.0.0
BepInEx/plugins/AbominationSensor/AbominationSensor.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Microsoft.CodeAnalysis; using Splatform; using UnityEngine; 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("AbominationSensor")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AbominationSensor")] [assembly: AssemblyTitle("AbominationSensor")] [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 AbominationSensor { internal static class Appearance { internal static void SensorRelic(GameObject prefab) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true); Material val = null; Renderer[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { Material[] sharedMaterials = array[i].sharedMaterials; foreach (Material val2 in sharedMaterials) { if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.shader)) { val = val2; break; } } } if (!Object.op_Implicit((Object)(object)val)) { throw new InvalidOperationException("Sensor model material unavailable."); } RelicModel relicModel = RelicModel.Read(typeof(Appearance).Assembly.GetManifestResourceStream("AbominationSensor.SensorModel.bin")); GameObject val3 = new GameObject("RootBoundAbominationHeart"); val3.transform.SetParent(prefab.transform.Find("attach") ?? prefab.transform, false); Color val4 = default(Color); for (int k = 0; k < relicModel.palette.Length; k++) { List<Vector3> list = new List<Vector3>(); List<int> list2 = new List<int>(); RelicPart[] parts = relicModel.parts; foreach (RelicPart relicPart in parts) { if (relicPart.material == k) { int count = list.Count; for (int l = 0; l < relicPart.vertices.Length; l += 3) { list.Add(new Vector3(relicPart.vertices[l], relicPart.vertices[l + 1], relicPart.vertices[l + 2])); } int[] triangles = relicPart.triangles; foreach (int num in triangles) { list2.Add(count + num); } } } if (list.Count != 0) { RelicMaterial relicMaterial = relicModel.palette[k]; ((Color)(ref val4))..ctor(relicMaterial.color[0], relicMaterial.color[1], relicMaterial.color[2]); Material val5 = ControllerMaterial(val, val4); if (relicMaterial.emission > 0f && val5.HasProperty("_EmissionColor")) { val5.EnableKeyword("_EMISSION"); val5.SetColor("_EmissionColor", val4 * relicMaterial.emission); } AddMesh(val3.transform, relicMaterial.name, list, list2, val5); } } array = componentsInChildren; for (int i = 0; i < array.Length; i++) { array[i].enabled = false; } } internal static Texture2D LoadTexture(string name) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_006a: Expected O, but got Unknown using Stream stream = typeof(Appearance).Assembly.GetManifestResourceStream("AbominationSensor." + name); using MemoryStream memoryStream = new MemoryStream(); if (stream == null) { throw new InvalidOperationException("Missing sensor asset: " + name); } stream.CopyTo(memoryStream); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if (!ImageConversion.LoadImage(val, memoryStream.ToArray())) { throw new InvalidOperationException("Invalid sensor asset: " + name); } return val; } private static Material ControllerMaterial(Material source, Color color) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) Material val = Object.Instantiate<Material>(source); if (val.HasProperty("_MainTex")) { val.SetTexture("_MainTex", (Texture)(object)Texture2D.whiteTexture); } if (val.HasProperty("_Color")) { val.SetColor("_Color", color); } if (val.HasProperty("_BumpMap")) { val.SetTexture("_BumpMap", (Texture)null); } if (val.HasProperty("_EmissionMap")) { val.SetTexture("_EmissionMap", (Texture)(object)Texture2D.whiteTexture); } if (val.HasProperty("_EmissionColor")) { val.SetColor("_EmissionColor", Color.black); } val.DisableKeyword("_EMISSION"); return val; } internal static void RubberRoll(GameObject prefab) { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Expected O, but got Unknown //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Expected O, but got Unknown //IL_0206: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true); Material val = null; Renderer[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { Material[] sharedMaterials = array[i].sharedMaterials; foreach (Material val2 in sharedMaterials) { if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.shader)) { val = val2; break; } } } if (!Object.op_Implicit((Object)(object)val)) { throw new InvalidOperationException("No loaded material on Rubber's source prefab."); } Material val3 = Object.Instantiate<Material>(val); if (val3.HasProperty("_MainTex")) { val3.SetTexture("_MainTex", (Texture)(object)Texture2D.whiteTexture); } if (val3.HasProperty("_Color")) { val3.SetColor("_Color", new Color(0.045f, 0.045f, 0.05f)); } if (val3.HasProperty("_EmissionColor")) { val3.SetColor("_EmissionColor", Color.black); } if (val3.HasProperty("_EmissionMap")) { val3.SetTexture("_EmissionMap", (Texture)(object)Texture2D.blackTexture); } if (val3.HasProperty("_BumpMap")) { val3.SetTexture("_BumpMap", (Texture)null); } if (val3.HasProperty("_Glossiness")) { val3.SetFloat("_Glossiness", 0.3f); } val3.DisableKeyword("_EMISSION"); Transform val4 = prefab.transform.Find("attach") ?? prefab.transform; GameObject val5 = new GameObject("RubberRoll"); val5.transform.SetParent(val4, false); val5.transform.localRotation = Quaternion.Euler(0f, 0f, 75f); Mesh val6 = new Mesh(); List<Vector3> list = new List<Vector3>(); List<int> list2 = new List<int>(); for (int k = 0; k < 4; k++) { for (int l = 0; l <= 48; l++) { float num = (float)l * MathF.PI * 2f / 48f; float num2 = ((k < 2) ? 0.055f : 0.043f); list.Add(new Vector3(Mathf.Cos(num) * num2, (k % 2 == 0) ? (-0.16f) : 0.16f, Mathf.Sin(num) * num2)); } } for (int m = 0; m < 48; m++) { Quad(list2, m, m + 1, 49 + m + 1, 49 + m); int num3 = 98; Quad(list2, num3 + m, num3 + 48 + 1 + m, num3 + 48 + 1 + m + 1, num3 + m + 1); Quad(list2, m, num3 + m, num3 + m + 1, m + 1); Quad(list2, 49 + m, 49 + m + 1, num3 + 48 + 1 + m + 1, num3 + 48 + 1 + m); } val6.SetVertices(list); val6.SetTriangles(list2, 0); val6.RecalculateNormals(); val6.RecalculateBounds(); val5.AddComponent<MeshFilter>().sharedMesh = val6; ((Renderer)val5.AddComponent<MeshRenderer>()).sharedMaterial = val3; AddRollDetails(val5.transform, val3); array = componentsInChildren; for (int i = 0; i < array.Length; i++) { array[i].enabled = false; } } private static void AddRollDetails(Transform parent, Material rubber) { //IL_0145: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) List<Vector3> list = new List<Vector3>(); List<int> list2 = new List<int>(); for (int i = 0; i < 2; i++) { int count = list.Count; for (int j = 0; j <= 240; j++) { float num = (float)j / 240f * MathF.PI * 8f; float num2 = 0.006f + 0.047f * (float)j / 240f; float num3 = ((i == 0) ? (-0.162f) : 0.162f); list.Add(new Vector3(Mathf.Cos(num) * (num2 - 0.0015f), num3, Mathf.Sin(num) * (num2 - 0.0015f))); list.Add(new Vector3(Mathf.Cos(num) * (num2 + 0.0015f), num3, Mathf.Sin(num) * (num2 + 0.0015f))); if (j > 0) { int num4 = count + (j - 1) * 2; int num5 = num4 + 1; int num6 = num4 + 3; int num7 = num4 + 2; Quad(list2, num4, num5, num6, num7); Quad(list2, num7, num6, num5, num4); } } } Material val = Object.Instantiate<Material>(rubber); if (val.HasProperty("_Color")) { val.SetColor("_Color", new Color(0.11f, 0.11f, 0.12f)); } AddMesh(parent, "RolledEdges", list, list2, val); list = new List<Vector3>(); list2 = new List<int>(); for (int k = 0; k <= 48; k++) { for (int l = 0; l <= 8; l++) { float num8 = (float)k * MathF.PI * 2f / 48f; float num9 = (float)l * MathF.PI * 2f / 8f; float num10 = 0.057f + 0.0025f * Mathf.Cos(num9); list.Add(new Vector3(Mathf.Cos(num8) * num10, 0.0025f * Mathf.Sin(num9), Mathf.Sin(num8) * num10)); if (k < 48 && l < 8) { int num11 = k * 9 + l; Quad(list2, num11, num11 + 1, num11 + 8 + 2, num11 + 8 + 1); Quad(list2, num11 + 8 + 1, num11 + 8 + 2, num11 + 1, num11); } } } Material val2 = Object.Instantiate<Material>(rubber); if (val2.HasProperty("_Color")) { val2.SetColor("_Color", new Color(0.23f, 0.23f, 0.24f)); } AddMesh(parent, "BindingCord", list, list2, val2); } private static void AddMesh(Transform parent, string name, List<Vector3> vertices, List<int> triangles, Material material) { //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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); Mesh val2 = new Mesh(); val2.SetVertices(vertices); val2.SetTriangles(triangles, 0); val2.RecalculateNormals(); val2.RecalculateBounds(); val.AddComponent<MeshFilter>().sharedMesh = val2; ((Renderer)val.AddComponent<MeshRenderer>()).sharedMaterial = material; } private static void Quad(List<int> t, int a, int b, int c, int d) { t.Add(a); t.Add(c); t.Add(b); t.Add(a); t.Add(d); t.Add(c); } } [BepInPlugin("joshu.abominationsensor", "AbominationSensor", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { public const string Guid = "joshu.abominationsensor"; public const string Sensor = "AS_AbominationSensor"; private ConfigEntry<float> radius; private ConfigEntry<float> cooldown; private ConfigEntry<float> duration; private ConfigEntry<float> volume; private float nextCheck; private readonly List<PinData> pins = new List<PinData>(); private Minimap pinMap; private Player scanPlayer; private float nextUse; private float expires; private float markerStarted; private Sprite dot; private AudioClip ping; private Material pulseMaterial; private void Awake() { radius = Setting("ScanRadius", 100f, 1f, 128f, "Horizontal scan radius in metres (maximum 128). Only dormant creatures currently loaded by your client can be detected. Raising this does not extend game loading or spawning distance."); cooldown = Setting("DetectionCooldownSeconds", 30f, 1f, 300f, "Delay between automatic detection pulses while equipped. Replaces the old manual-use CooldownSeconds setting."); duration = Setting("MarkerSeconds", 15f, 1f, 300f, "How long flashing scan-result markers remain."); volume = Setting("RadarVolume", 0.65f, 0f, 1f, "Radar sound volume; 0 mutes it."); PrefabManager.OnVanillaPrefabsAvailable += Register; } private ConfigEntry<float> Setting(string key, float value, float min, float max, string description) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown return ((BaseUnityPlugin)this).Config.Bind<float>("Sensor", key, value, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>(min, max), Array.Empty<object>())); } private static float Valid(ConfigEntry<float> entry, float fallback) { if (!float.IsNaN(entry.Value) && !float.IsInfinity(entry.Value)) { return entry.Value; } return fallback; } private void Register() { //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Expected O, but got Unknown //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Expected O, but got Unknown //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Expected O, but got Unknown //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Expected O, but got Unknown //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Expected O, but got Unknown //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Expected O, but got Unknown //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //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) //IL_014a: Unknown result type (might be due to invalid IL or missing references) PrefabManager.OnVanillaPrefabsAvailable -= Register; ItemConfig val; if (!Chainloader.PluginInfos.ContainsKey("joshu.swampcapes")) { val = new ItemConfig(); val.Name = "Rubber"; val.Description = "A waterproof roll of black rubber, cured from guck and coal."; val.CraftingStation = "piece_workbench"; val.MinStationLevel = 1; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Guck", 2, 0, true), new RequirementConfig("Coal", 5, 0, true) }; CustomItem val2 = new CustomItem("SC_Rubber", "Resin", val); val2.ItemDrop.m_itemData.m_shared.m_maxStackSize = 50; val2.ItemDrop.m_itemData.m_shared.m_weight = 0.5f; using (Stream stream = ((object)this).GetType().Assembly.GetManifestResourceStream("AbominationSensor.RubberIcon.png")) { using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); Texture2D val3 = new Texture2D(2, 2); ImageConversion.LoadImage(val3, memoryStream.ToArray()); val2.ItemDrop.m_itemData.m_shared.m_icons = (Sprite[])(object)new Sprite[1] { Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), Vector2.one * 0.5f) }; } if (!ItemManager.Instance.AddItem(val2)) { throw new InvalidOperationException("Rubber registration failed."); } try { Appearance.RubberRoll(val2.ItemPrefab); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Rubber appearance failed; the item remains registered. " + ex)); } } val = new ItemConfig(); val.Name = "Abomination Sensor"; val.Description = "Built from the dying heart of an Abomination, it senses the vibrations of their roots and points you the way"; val.CraftingStation = "forge"; val.MinStationLevel = 1; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("SC_Rubber", 10, 0, true), new RequirementConfig("Iron", 10, 0, true), new RequirementConfig("TrophyAbomination", 1, 0, true) }; CustomItem val4 = new CustomItem("AS_AbominationSensor", "Wishbone", val); SharedData shared = val4.ItemDrop.m_itemData.m_shared; shared.m_itemType = (ItemType)18; shared.m_equipStatusEffect = null; shared.m_setStatusEffect = null; shared.m_maxStackSize = 1; shared.m_maxQuality = 1; shared.m_useDurability = false; shared.m_weight = 1f; try { shared.m_icons = (Sprite[])(object)new Sprite[1] { MakeIcon(small: false) }; } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogError((object)("Sensor artwork failed; keeping the fallback icon. " + ex2)); } StatusEffect val5 = ScriptableObject.CreateInstance<StatusEffect>(); ((Object)val5).name = "AS_SensorEquipped"; val5.m_name = "Abomination Sensor"; val5.m_icon = shared.m_icons[0]; val5.m_tooltip = "Monitoring for dormant Abominations."; val5.m_ttl = 0f; if (!ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(val5, false))) { throw new InvalidOperationException("Sensor equipment status registration failed."); } shared.m_equipStatusEffect = val5; if (!ItemManager.Instance.AddItem(val4)) { throw new InvalidOperationException("Sensor registration failed."); } try { Appearance.SensorRelic(val4.ItemPrefab); } catch (Exception ex3) { ((BaseUnityPlugin)this).Logger.LogError((object)("Sensor model failed; the item and recipe remain registered with the fallback appearance. " + ex3)); } dot = MakeIcon(small: true); ping = MakePing(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Abomination Sensor registered with Rubber, Iron and Abomination Trophy forge recipe."); } private static Sprite MakeIcon(bool small) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_014f: 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_015e: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) if (!small) { Texture2D val = Appearance.LoadTexture("SensorIcon.png"); return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), Vector2.one * 0.5f); } Texture2D val2 = new Texture2D(64, 64, (TextureFormat)4, false); for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { Vector2 val3 = new Vector2((float)j + 0.5f - 32f, (float)i + 0.5f - 32f) / 32f; float num = Mathf.Atan2(val3.y, val3.x); float num2 = 0.68f + 0.012f * Mathf.Sin(num * 3f + 0.6f) + 0.008f * Mathf.Sin(num * 5f - 1.2f); float num3 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01((num2 - ((Vector2)(ref val3)).magnitude) / 0.28f)); val2.SetPixel(j, i, new Color(1f, 0.04f, 0.02f, num3)); } } val2.Apply(); return Sprite.Create(val2, new Rect(0f, 0f, 64f, 64f), Vector2.one * 0.5f); } private static AudioClip MakePing() { float[] array = new float[3969]; for (int i = 0; i < array.Length; i++) { float num = (float)i / 22050f; float num2 = Mathf.Min(Mathf.Clamp01(num / 0.008f), Mathf.Clamp01((0.18f - num) / 0.018f)); float num3 = MathF.PI * 2300f * num; array[i] = 0.45f * (Mathf.Sin(num3) + 0.12f * Mathf.Sin(num3 * 3f)) * num2; } AudioClip obj = AudioClip.Create("AbominationSensorBeep", array.Length, 1, 22050, false); obj.SetData(array, 0); return obj; } private void Scan(Player player) { //IL_0025: 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_017e: 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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Expected O, but got Unknown if (((Character)player).IsDead() || ((Character)player).InCutscene() || ((Character)player).IsTeleporting()) { return; } List<Vector3> list = new List<Vector3>(); Vector3 position = ((Component)player).transform.position; float num = Valid(radius, 100f); foreach (Character allCharacter in Character.GetAllCharacters()) { if (!Object.op_Implicit((Object)(object)allCharacter) || allCharacter.IsDead()) { continue; } MonsterAI component = ((Component)allCharacter).GetComponent<MonsterAI>(); if (!Object.op_Implicit((Object)(object)component) || !((BaseAI)component).IsSleeping()) { continue; } ZNetView component2 = ((Component)allCharacter).GetComponent<ZNetView>(); if (Object.op_Implicit((Object)(object)component2) && component2.GetZDO() != null && component2.GetZDO().GetPrefab() == StringExtensionMethods.GetStableHashCode("Abomination")) { Vector3 val = ((Component)allCharacter).transform.position - position; val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude > num * num)) { list.Add(((Component)allCharacter).transform.position); } } } if (list.Count == 0) { return; } ClearPins(); nextUse = Time.time + Valid(cooldown, 30f); expires = Time.time + Valid(duration, 15f); markerStarted = Time.time; pinMap = Minimap.instance; foreach (Vector3 item in list) { if (!Object.op_Implicit((Object)(object)pinMap)) { break; } PinData val2 = pinMap.AddPin(item, (PinType)3, "", false, false, 0L, default(PlatformUserID)); val2.m_icon = dot; pins.Add(val2); } ((Character)player).Message((MessageType)2, "Abomination found", 0, (Sprite)null, false); ((MonoBehaviour)this).StartCoroutine(Pulse(player, num)); if (Object.op_Implicit((Object)(object)ping) && Valid(volume, 0.65f) > 0f) { GameObject val3 = new GameObject("Abomination Sensor Radar"); AudioSource val4 = val3.AddComponent<AudioSource>(); val4.clip = ping; val4.volume = Valid(volume, 0.65f); val4.spatialBlend = 0f; val4.bypassReverbZones = true; val4.bypassEffects = true; val4.dopplerLevel = 0f; if (AudioListener.pause) { val4.ignoreListenerPause = false; } val4.Play(); Object.Destroy((Object)val3, 2f); } } private IEnumerator Pulse(Player player, float range) { if (!Object.op_Implicit((Object)(object)pulseMaterial)) { ParticleSystemRenderer[] componentsInChildren = ((Component)player).GetComponentsInChildren<ParticleSystemRenderer>(true); foreach (ParticleSystemRenderer val in componentsInChildren) { if (Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial)) { pulseMaterial = new Material(((Renderer)val).sharedMaterial); break; } } if (!Object.op_Implicit((Object)(object)pulseMaterial)) { Shader val2 = Shader.Find("Sprites/Default"); if (Object.op_Implicit((Object)(object)val2)) { pulseMaterial = new Material(val2); } } } if (Object.op_Implicit((Object)(object)pulseMaterial) && pulseMaterial.HasProperty("_MainTex")) { pulseMaterial.SetTexture("_MainTex", (Texture)(object)Texture2D.whiteTexture); } if (!Object.op_Implicit((Object)(object)pulseMaterial)) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"No pulse material available."); yield break; } GameObject go = new GameObject("Sensor Pulse"); LineRenderer line = go.AddComponent<LineRenderer>(); ((Renderer)line).sharedMaterial = pulseMaterial; line.useWorldSpace = true; line.loop = true; line.positionCount = 128; line.widthMultiplier = 0.25f; ((Renderer)line).shadowCastingMode = (ShadowCastingMode)0; try { Color val3 = default(Color); float num3 = default(float); for (float t = 0f; t < 2.5f; t += Time.deltaTime) { if (!Object.op_Implicit((Object)(object)player)) { break; } float num = t / 2.5f; ((Color)(ref val3))..ctor(0.2f, 1f, 0.45f, 1f - num); line.startColor = val3; line.endColor = val3; Vector3 val4 = ((Component)player).transform.position + Vector3.up * 0.3f; for (int j = 0; j < 128; j++) { float num2 = (float)j * MathF.PI * 2f / 128f; Vector3 val5 = val4 + new Vector3(Mathf.Cos(num2), 0f, Mathf.Sin(num2)) * Mathf.Lerp(1f, range, num); if (Heightmap.GetHeight(val5, ref num3)) { val5.y = Mathf.Max(val5.y, num3 + 0.2f); } line.SetPosition(j, val5); } yield return null; } } finally { if (Object.op_Implicit((Object)(object)go)) { Object.Destroy((Object)(object)go); } } } private void LateUpdate() { //IL_014e: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)(object)scanPlayer) { ClearPins(); scanPlayer = localPlayer; nextUse = 0f; nextCheck = 0f; } if (!Object.op_Implicit((Object)(object)localPlayer) || ((Character)localPlayer).IsDead() || !Equipped(localPlayer)) { ClearPins(); return; } if (pins.Count > 0 && (!Object.op_Implicit((Object)(object)pinMap) || (Object)(object)pinMap != (Object)(object)Minimap.instance || Time.time >= expires)) { ClearPins(); } if (Time.time >= nextCheck && Time.time >= nextUse) { nextCheck = Time.time + 0.5f; Scan(localPlayer); } float num = (0.5f - 0.5f * Mathf.Cos((Time.time - markerStarted) * MathF.PI)) * Mathf.Clamp01((expires - Time.time) / 0.5f); foreach (PinData pin in pins) { if (Object.op_Implicit((Object)(object)pin.m_iconElement)) { pin.m_iconElement.sprite = dot; ((Graphic)pin.m_iconElement).color = new Color(1f, 1f, 1f, num); } } } private static bool Equipped(Player player) { foreach (ItemData allItem in ((Humanoid)player).GetInventory().GetAllItems()) { if (allItem.m_equipped && Object.op_Implicit((Object)(object)allItem.m_dropPrefab) && ((Object)allItem.m_dropPrefab).name == "AS_AbominationSensor") { return true; } } return false; } private void ClearPins() { if (Object.op_Implicit((Object)(object)pinMap)) { foreach (PinData pin in pins) { pinMap.RemovePin(pin); } } pins.Clear(); pinMap = null; } private void OnDestroy() { PrefabManager.OnVanillaPrefabsAvailable -= Register; ClearPins(); ((MonoBehaviour)this).StopAllCoroutines(); if (Object.op_Implicit((Object)(object)ping)) { Object.Destroy((Object)(object)ping); } if (Object.op_Implicit((Object)(object)pulseMaterial)) { Object.Destroy((Object)(object)pulseMaterial); } } } internal sealed class RelicModel { internal RelicMaterial[] palette; internal RelicPart[] parts; internal static RelicModel Read(Stream stream) { if (stream == null) { throw new InvalidDataException("Sensor model asset is missing."); } using BinaryReader binaryReader = new BinaryReader(stream); if (binaryReader.ReadInt32() != 827478849) { throw new InvalidDataException("Unsupported sensor mesh format."); } RelicModel relicModel = new RelicModel(); relicModel.palette = new RelicMaterial[Count(binaryReader, 32)]; for (int i = 0; i < relicModel.palette.Length; i++) { RelicMaterial relicMaterial = new RelicMaterial { name = binaryReader.ReadString(), color = new float[3] }; for (int j = 0; j < 3; j++) { relicMaterial.color[j] = binaryReader.ReadSingle(); } relicMaterial.emission = binaryReader.ReadSingle(); relicModel.palette[i] = relicMaterial; } relicModel.parts = new RelicPart[Count(binaryReader, 512)]; for (int k = 0; k < relicModel.parts.Length; k++) { RelicPart relicPart = new RelicPart { name = binaryReader.ReadString(), material = binaryReader.ReadInt32() }; if (relicPart.material < 0 || relicPart.material >= relicModel.palette.Length) { throw new InvalidDataException("Invalid material index."); } relicPart.vertices = new float[Count(binaryReader, 600000)]; if (relicPart.vertices.Length % 3 != 0) { throw new InvalidDataException("Invalid vertex count."); } for (int l = 0; l < relicPart.vertices.Length; l++) { float num = binaryReader.ReadSingle(); if (float.IsNaN(num) || float.IsInfinity(num)) { throw new InvalidDataException("Invalid vertex coordinate."); } relicPart.vertices[l] = num; } relicPart.triangles = new int[Count(binaryReader, 1000000)]; if (relicPart.triangles.Length % 3 != 0) { throw new InvalidDataException("Invalid triangle count."); } for (int m = 0; m < relicPart.triangles.Length; m++) { int num2 = binaryReader.ReadInt32(); if (num2 < 0 || num2 >= relicPart.vertices.Length / 3) { throw new InvalidDataException("Invalid triangle index."); } relicPart.triangles[m] = num2; } relicModel.parts[k] = relicPart; } if (binaryReader.BaseStream.Position != binaryReader.BaseStream.Length) { throw new InvalidDataException("Unexpected mesh data."); } return relicModel; } private static int Count(BinaryReader reader, int maximum) { int num = reader.ReadInt32(); if (num <= 0 || num > maximum) { throw new InvalidDataException("Invalid sensor mesh length."); } return num; } } internal sealed class RelicMaterial { internal string name; internal float[] color; internal float emission; } internal sealed class RelicPart { internal string name; internal int material; internal float[] vertices; internal int[] triangles; } }